@taladb/node 0.1.0
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 +94 -0
- package/package.json +48 -0
- package/taladb-node.darwin-arm64.node +0 -0
- package/taladb-node.linux-x64-gnu.node +0 -0
- package/taladb-node.win32-x64-msvc.node +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 thinkgrid-labs
|
|
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
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# @taladb/node
|
|
2
|
+
|
|
3
|
+
Node.js native module for TalaDB — high-performance local-first storage via a napi-rs Rust binding.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@taladb/node)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
> **Note:** Most users should install [`taladb`](https://www.npmjs.com/package/taladb) instead, which auto-selects this package when running in Node.js.
|
|
9
|
+
|
|
10
|
+
## What it provides
|
|
11
|
+
|
|
12
|
+
- TalaDB's Rust core exposed via [napi-rs](https://napi.rs/) — zero marshalling overhead
|
|
13
|
+
- Synchronous hot-path methods + `async` variants for non-blocking server use
|
|
14
|
+
- Pre-built binaries for `linux-x64`, `linux-arm64`, `darwin-x64`, `darwin-arm64`, `win32-x64`
|
|
15
|
+
- No `node-gyp` required — binaries ship with the package
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
18
|
+
|
|
19
|
+
- Node.js 18+
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add taladb @taladb/node
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
Use through the unified [`taladb`](https://www.npmjs.com/package/taladb) package:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { openDB } from 'taladb';
|
|
33
|
+
|
|
34
|
+
const db = await openDB('./myapp.db');
|
|
35
|
+
const users = db.collection('users');
|
|
36
|
+
|
|
37
|
+
await users.createIndex('email');
|
|
38
|
+
await users.insert({ name: 'Alice', email: 'alice@example.com', role: 'admin' });
|
|
39
|
+
|
|
40
|
+
const alice = await users.findOne({ email: 'alice@example.com' });
|
|
41
|
+
const admins = await users.find({ role: 'admin' });
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### CommonJS
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
const { openDB } = require('taladb');
|
|
48
|
+
|
|
49
|
+
async function main() {
|
|
50
|
+
const db = await openDB('./myapp.db');
|
|
51
|
+
const col = db.collection('items');
|
|
52
|
+
|
|
53
|
+
await col.insert({ name: 'Widget', price: 9.99 });
|
|
54
|
+
const results = await col.find({ price: { $lt: 20 } });
|
|
55
|
+
console.log(results);
|
|
56
|
+
|
|
57
|
+
await db.close();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
main();
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Direct usage (advanced)
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
const { TalaDBNode } = require('@taladb/node');
|
|
67
|
+
|
|
68
|
+
const db = TalaDBNode.open('./myapp.db');
|
|
69
|
+
const col = db.collection('items');
|
|
70
|
+
|
|
71
|
+
// Synchronous (no await)
|
|
72
|
+
const id = col.insert({ x: 1 });
|
|
73
|
+
const docs = col.find(null);
|
|
74
|
+
|
|
75
|
+
db.close();
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Building from source
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Install napi-rs CLI
|
|
82
|
+
pnpm add -g @napi-rs/cli
|
|
83
|
+
|
|
84
|
+
# Build for current platform
|
|
85
|
+
pnpm --filter @taladb/node build
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Full Documentation
|
|
89
|
+
|
|
90
|
+
**[https://thinkgrid-labs.github.io/taladb/guide/node](https://thinkgrid-labs.github.io/taladb/guide/node)**
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
MIT © [ThinkGrid Labs](https://github.com/thinkgrid-labs)
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@taladb/node",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TalaDB Node.js native module (napi-rs)",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"index.js",
|
|
9
|
+
"index.d.ts",
|
|
10
|
+
"*.node"
|
|
11
|
+
],
|
|
12
|
+
"napi": {
|
|
13
|
+
"name": "taladb-node",
|
|
14
|
+
"triples": {
|
|
15
|
+
"defaults": false,
|
|
16
|
+
"additional": [
|
|
17
|
+
"x86_64-unknown-linux-gnu",
|
|
18
|
+
"aarch64-apple-darwin",
|
|
19
|
+
"x86_64-pc-windows-msvc"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/thinkgrid-labs/taladb.git",
|
|
26
|
+
"directory": "packages/taladb-node"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://thinkgrid-labs.github.io/taladb/guide/node",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/thinkgrid-labs/taladb/issues"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18"
|
|
34
|
+
},
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@napi-rs/cli": "^2.18.0",
|
|
38
|
+
"jest": "^29.0.0",
|
|
39
|
+
"@types/jest": "^29.0.0",
|
|
40
|
+
"ts-jest": "^29.0.0",
|
|
41
|
+
"typescript": "^5.9.3"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "napi build --platform --release --js index.js --dts index.d.ts",
|
|
45
|
+
"build:debug": "napi build --platform --js index.js --dts index.d.ts",
|
|
46
|
+
"test": "jest"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|