@remix-run/data-table-mysql 0.2.0 → 0.3.1
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 +0 -15
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/adapter.d.ts +3 -9
- package/dist/lib/adapter.d.ts.map +1 -1
- package/dist/lib/adapter.js +8 -8
- package/package.json +8 -5
- package/src/index.ts +0 -1
- package/src/lib/adapter.ts +8 -19
package/README.md
CHANGED
|
@@ -48,21 +48,6 @@ Import any driver-specific types you need directly from `mysql2/promise`.
|
|
|
48
48
|
|
|
49
49
|
## Advanced Usage
|
|
50
50
|
|
|
51
|
-
### Capability Overrides For Testing
|
|
52
|
-
|
|
53
|
-
Capability overrides are mainly for tests where you want to force or disable specific behavior
|
|
54
|
-
checks. In production, keep defaults so adapter behavior matches MySQL behavior.
|
|
55
|
-
|
|
56
|
-
```ts
|
|
57
|
-
import { createMysqlDatabaseAdapter } from 'remix/data-table-mysql'
|
|
58
|
-
|
|
59
|
-
let adapter = createMysqlDatabaseAdapter(pool, {
|
|
60
|
-
capabilities: {
|
|
61
|
-
upsert: false,
|
|
62
|
-
},
|
|
63
|
-
})
|
|
64
|
-
```
|
|
65
|
-
|
|
66
51
|
### `returning` On MySQL
|
|
67
52
|
|
|
68
53
|
MySQL does not natively support SQL `RETURNING`. In this adapter, using `returning` on write
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA"}
|
package/dist/lib/adapter.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DataManipulationRequest, DataMigrationRequest, DataMigrationResult, DataMigrationOperation, DataManipulationResult, DataManipulationOperation, DatabaseAdapter, SqlStatement, TableRef, TransactionOptions, TransactionToken } from '@remix-run/data-table';
|
|
2
2
|
import type { Connection as MysqlConnection, Pool as MysqlPool, PoolConnection as MysqlPoolConnection } from 'mysql2/promise';
|
|
3
|
-
/**
|
|
4
|
-
* Mysql adapter configuration.
|
|
5
|
-
*/
|
|
6
|
-
export type MysqlDatabaseAdapterOptions = {
|
|
7
|
-
capabilities?: AdapterCapabilityOverrides;
|
|
8
|
-
};
|
|
9
3
|
type MysqlTransactionConnection = MysqlConnection | MysqlPoolConnection;
|
|
10
4
|
type MysqlQueryable = MysqlPool | MysqlTransactionConnection;
|
|
11
5
|
/**
|
|
@@ -27,7 +21,7 @@ export declare class MysqlDatabaseAdapter implements DatabaseAdapter {
|
|
|
27
21
|
transactionalDdl: boolean;
|
|
28
22
|
migrationLock: boolean;
|
|
29
23
|
};
|
|
30
|
-
constructor(client: MysqlQueryable
|
|
24
|
+
constructor(client: MysqlQueryable);
|
|
31
25
|
/**
|
|
32
26
|
* Compiles a data or migration operation to mysql SQL statements.
|
|
33
27
|
* @param operation Operation to compile.
|
|
@@ -127,6 +121,6 @@ export declare class MysqlDatabaseAdapter implements DatabaseAdapter {
|
|
|
127
121
|
* let db = createDatabase(adapter)
|
|
128
122
|
* ```
|
|
129
123
|
*/
|
|
130
|
-
export declare function createMysqlDatabaseAdapter(client: MysqlQueryable
|
|
124
|
+
export declare function createMysqlDatabaseAdapter(client: MysqlQueryable): MysqlDatabaseAdapter;
|
|
131
125
|
export {};
|
|
132
126
|
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/lib/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sour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CAAC,gBAAgB,CAAC,CAgC9E;IAED;;;;OAIG;IACG,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB9D;IAED;;;;OAIG;IACG,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBhE;IAED;;;;;OAKG;IACG,eAAe,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG1E;IAED;;;;;OAKG;IACG,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG9E;IAED;;;;;OAKG;IACG,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG3E;IAED;;;OAGG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1C;IAED;;;OAGG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1C;CAmBF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,cAAc,GAAG,oBAAoB,CAEvF"}
|
package/dist/lib/adapter.js
CHANGED
|
@@ -16,14 +16,14 @@ export class MysqlDatabaseAdapter {
|
|
|
16
16
|
#client;
|
|
17
17
|
#transactions = new Map();
|
|
18
18
|
#transactionCounter = 0;
|
|
19
|
-
constructor(client
|
|
19
|
+
constructor(client) {
|
|
20
20
|
this.#client = client;
|
|
21
21
|
this.capabilities = {
|
|
22
|
-
returning:
|
|
23
|
-
savepoints:
|
|
24
|
-
upsert:
|
|
25
|
-
transactionalDdl:
|
|
26
|
-
migrationLock:
|
|
22
|
+
returning: false,
|
|
23
|
+
savepoints: true,
|
|
24
|
+
upsert: true,
|
|
25
|
+
transactionalDdl: false,
|
|
26
|
+
migrationLock: true,
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
@@ -266,8 +266,8 @@ export class MysqlDatabaseAdapter {
|
|
|
266
266
|
* let db = createDatabase(adapter)
|
|
267
267
|
* ```
|
|
268
268
|
*/
|
|
269
|
-
export function createMysqlDatabaseAdapter(client
|
|
270
|
-
return new MysqlDatabaseAdapter(client
|
|
269
|
+
export function createMysqlDatabaseAdapter(client) {
|
|
270
|
+
return new MysqlDatabaseAdapter(client);
|
|
271
271
|
}
|
|
272
272
|
function isMysqlPool(client) {
|
|
273
273
|
return 'getConnection' in client && typeof client.getConnection === 'function';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remix-run/data-table-mysql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "MySQL adapter for remix/data-table",
|
|
5
5
|
"author": "Michael Jackson <mjijackson@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,10 +30,12 @@
|
|
|
30
30
|
"@types/node": "^24.6.0",
|
|
31
31
|
"@typescript/native-preview": "7.0.0-dev.20251125.1",
|
|
32
32
|
"mysql2": "^3.15.3",
|
|
33
|
-
"@remix-run/
|
|
33
|
+
"@remix-run/assert": "0.2.0",
|
|
34
|
+
"@remix-run/data-table": "0.2.1",
|
|
35
|
+
"@remix-run/test": "0.3.0"
|
|
34
36
|
},
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"@remix-run/data-table": "^0.2.
|
|
38
|
+
"@remix-run/data-table": "^0.2.1"
|
|
37
39
|
},
|
|
38
40
|
"peerDependencies": {
|
|
39
41
|
"mysql2": "^3.15.3"
|
|
@@ -53,8 +55,9 @@
|
|
|
53
55
|
"scripts": {
|
|
54
56
|
"build": "tsgo -p tsconfig.build.json",
|
|
55
57
|
"clean": "git clean -fdX",
|
|
56
|
-
"test": "
|
|
57
|
-
"test:
|
|
58
|
+
"test": "remix-test",
|
|
59
|
+
"test:bun": "bun x --bun remix-test",
|
|
60
|
+
"test:coverage": "remix-test --coverage",
|
|
58
61
|
"typecheck": "tsgo --noEmit"
|
|
59
62
|
}
|
|
60
63
|
}
|
package/src/index.ts
CHANGED
package/src/lib/adapter.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
AdapterCapabilityOverrides,
|
|
3
2
|
DataManipulationRequest,
|
|
4
3
|
DataMigrationRequest,
|
|
5
4
|
DataMigrationResult,
|
|
@@ -29,13 +28,6 @@ import type {
|
|
|
29
28
|
|
|
30
29
|
import { compileMysqlOperation } from './sql-compiler.ts'
|
|
31
30
|
|
|
32
|
-
/**
|
|
33
|
-
* Mysql adapter configuration.
|
|
34
|
-
*/
|
|
35
|
-
export type MysqlDatabaseAdapterOptions = {
|
|
36
|
-
capabilities?: AdapterCapabilityOverrides
|
|
37
|
-
}
|
|
38
|
-
|
|
39
31
|
type TransactionState = {
|
|
40
32
|
connection: MysqlTransactionConnection
|
|
41
33
|
releaseOnClose: boolean
|
|
@@ -67,14 +59,14 @@ export class MysqlDatabaseAdapter implements DatabaseAdapter {
|
|
|
67
59
|
#transactions = new Map<string, TransactionState>()
|
|
68
60
|
#transactionCounter = 0
|
|
69
61
|
|
|
70
|
-
constructor(client: MysqlQueryable
|
|
62
|
+
constructor(client: MysqlQueryable) {
|
|
71
63
|
this.#client = client
|
|
72
64
|
this.capabilities = {
|
|
73
|
-
returning:
|
|
74
|
-
savepoints:
|
|
75
|
-
upsert:
|
|
76
|
-
transactionalDdl:
|
|
77
|
-
migrationLock:
|
|
65
|
+
returning: false,
|
|
66
|
+
savepoints: true,
|
|
67
|
+
upsert: true,
|
|
68
|
+
transactionalDdl: false,
|
|
69
|
+
migrationLock: true,
|
|
78
70
|
}
|
|
79
71
|
}
|
|
80
72
|
|
|
@@ -365,11 +357,8 @@ export class MysqlDatabaseAdapter implements DatabaseAdapter {
|
|
|
365
357
|
* let db = createDatabase(adapter)
|
|
366
358
|
* ```
|
|
367
359
|
*/
|
|
368
|
-
export function createMysqlDatabaseAdapter(
|
|
369
|
-
client
|
|
370
|
-
options?: MysqlDatabaseAdapterOptions,
|
|
371
|
-
): MysqlDatabaseAdapter {
|
|
372
|
-
return new MysqlDatabaseAdapter(client, options)
|
|
360
|
+
export function createMysqlDatabaseAdapter(client: MysqlQueryable): MysqlDatabaseAdapter {
|
|
361
|
+
return new MysqlDatabaseAdapter(client)
|
|
373
362
|
}
|
|
374
363
|
|
|
375
364
|
function isMysqlPool(client: MysqlQueryable): client is MysqlPool {
|