@wxn0brp/db-storage-accdb 0.0.0-stage → 0.120.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/LICENSE +21 -0
- package/README.md +66 -2
- package/package.json +48 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 wxn0brP
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,67 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @wxn0brp/db-storage-accdb
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A simple ACCDB (Microsoft Access) storage adapter for the **ValtheraDB** database library. It uses the `odbc` package to connect natively to your `.accdb` or `.mdb` files.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i github:wxn0brP/db-storage-accdb#dist
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### ODBC Driver Prerequisites
|
|
12
|
+
|
|
13
|
+
To connect to your database, you must have the **Microsoft Access Database Engine** installed on your system. If you're on Windows, you can quickly install the driver via `winget`:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
winget install Microsoft.AccessDatabaseEngine.2016
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Ensure you have the proper MS Access ODBC driver installed on your machine (`Microsoft Access Driver (*.mdb, *.accdb)`).
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { ValtheraClass } from "@wxn0brp/db-core";
|
|
25
|
+
import { createAccDBValthera, makeConnect } from "@wxn0brp/db-storage-accdb";
|
|
26
|
+
|
|
27
|
+
// 1. Establish connection to your Access database
|
|
28
|
+
const conn = await makeConnect('path/to/your/database.accdb');
|
|
29
|
+
|
|
30
|
+
// 2. Wrap it with the Valthera storage adapter
|
|
31
|
+
const db = createAccDBValthera(conn, {
|
|
32
|
+
Users: "id" // define the primary key (default: "_id")
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// 3. Get collection (table) instances
|
|
36
|
+
const User = db.c("Users");
|
|
37
|
+
|
|
38
|
+
// Add entry
|
|
39
|
+
await User.add({ name: "John Doe", age: 30 });
|
|
40
|
+
|
|
41
|
+
// Find entries
|
|
42
|
+
const users = await User.find({ name: "John Doe" });
|
|
43
|
+
console.log(users);
|
|
44
|
+
|
|
45
|
+
// Update entry
|
|
46
|
+
await User.updateOne({ name: "John Doe" }, { age: 31 });
|
|
47
|
+
|
|
48
|
+
// Remove entry
|
|
49
|
+
await User.remove({ name: "John Doe" });
|
|
50
|
+
|
|
51
|
+
// Ensure connection is closed after your app finishes
|
|
52
|
+
await db.close();
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Why? Idk
|
|
56
|
+
|
|
57
|
+
**Q: Why did I made this?**
|
|
58
|
+
|
|
59
|
+
A: Idk.
|
|
60
|
+
|
|
61
|
+
**Q: But seriously, why?**
|
|
62
|
+
|
|
63
|
+
A: It started off as a joke. Somehow, it ended up actually working properly. So if you ever find yourself needing to connect to a Microsoft Access 2007 database in a modern web stack (for whatever absurd reason), here you go.
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@wxn0brp/db-storage-accdb",
|
|
3
|
+
"version": "0.120.1",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"description": "A pure ACCDB storage adapter for the ValtheraDB database library",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/wxn0brP/ValtheraDB-storage-accdb.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/wxn0brP/ValtheraDB-storage-accdb",
|
|
12
|
+
"author": "wxn0brP",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"valthera",
|
|
17
|
+
"valtheradb",
|
|
18
|
+
"vdb-adapter",
|
|
19
|
+
"accdb"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc && tsc-alias"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/bun": "*",
|
|
26
|
+
"@wxn0brp/biome": "*",
|
|
27
|
+
"tsc-alias": "^1",
|
|
28
|
+
"typescript": "^7"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@wxn0brp/db-core": "^0.13.0-alpha.0",
|
|
32
|
+
"odbc": "^2.6.0"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
],
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"import": "./dist/index.js",
|
|
41
|
+
"default": "./dist/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./*": {
|
|
44
|
+
"types": "./dist/*.d.ts",
|
|
45
|
+
"import": "./dist/*.js",
|
|
46
|
+
"default": "./dist/*.js"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|