mcard-js 2.1.34 → 2.1.36
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 +35 -2
- package/dist/CardCollection-WGCKKUOD.js +9 -0
- package/dist/LambdaRuntime-WNYDBTS6.js +16 -0
- package/dist/Loader-RT4NI6AT.js +11 -0
- package/dist/MCard-JOW6RBSO.js +8 -0
- package/dist/NetworkRuntime-2H7AQITA.js +1571 -0
- package/dist/chunk-5BIDGXA6.js +987 -0
- package/dist/chunk-5HXLTWYN.js +296 -0
- package/dist/chunk-ARPIBGRP.js +1236 -0
- package/dist/chunk-OFHDMLNM.js +355 -0
- package/dist/chunk-X42F7DE3.js +373 -0
- package/dist/chunk-XC7Y4I7L.js +290 -0
- package/dist/chunk-Z4BRNTO5.js +2313 -0
- package/dist/index.browser.cjs +162 -86
- package/dist/index.browser.d.cts +3 -1
- package/dist/index.browser.d.ts +3 -1
- package/dist/index.browser.js +4 -4
- package/dist/index.cjs +367 -269
- package/dist/index.d.cts +194 -3
- package/dist/index.d.ts +194 -3
- package/dist/index.js +11 -11
- package/dist/storage/SqliteNodeEngine.cjs +174 -88
- package/dist/storage/SqliteNodeEngine.js +2 -2
- package/dist/storage/SqliteWasmEngine.cjs +162 -86
- package/dist/storage/SqliteWasmEngine.js +2 -2
- package/package.json +7 -4
- package/schema/README.md +0 -277
- package/schema/mcard_schema.sql +0 -125
- package/schema/mcard_vector_schema.sql +0 -283
package/README.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Full-featured TypeScript implementation of MCard content-addressable storage, supporting both browser and Node.js environments.
|
|
4
4
|
|
|
5
|
-
[-brightgreen)](./tests)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
7
7
|
[](https://nodejs.org/)
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
11
|
- **Content Addressing**: SHA-256 via Web Crypto API (browser) or Node.js crypto
|
|
12
|
-
- **
|
|
12
|
+
- **5 Interchangeable Storage Engines**: `IndexedDBEngine` (browser), `SqliteNodeEngine` (Node.js/better-sqlite3), `SqliteWasmEngine` (browser/sql.js), `DuckDBNodeEngine` (Node.js/@duckdb/node-api), `DuckDBWasmEngine` (browser/@duckdb/duckdb-wasm)
|
|
13
13
|
- **UTF-8 Handles**: International support (文檔, مستند, ドキュメント, документ)
|
|
14
14
|
- **Monadic API**: Maybe, Either, IO monads for functional composition
|
|
15
15
|
- **PTR Runtime**: Polynomial Type Runtime with polyglot execution (JS, Python, Rust, C, WASM, Lean)
|
|
@@ -99,6 +99,39 @@ const count = db.countSync();
|
|
|
99
99
|
db.close();
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
+
### DuckDB (Node.js — Alternative OLAP Engine)
|
|
103
|
+
```typescript
|
|
104
|
+
import { DuckDBNodeEngine } from './storage/DuckDBNodeEngine';
|
|
105
|
+
|
|
106
|
+
// Async factory — in-memory or file-backed
|
|
107
|
+
const db = await DuckDBNodeEngine.create(':memory:');
|
|
108
|
+
// or: await DuckDBNodeEngine.create('./mcard.duckdb');
|
|
109
|
+
|
|
110
|
+
// Same StorageEngine interface as SQLite
|
|
111
|
+
const card = await MCard.create('Hello from DuckDB!');
|
|
112
|
+
await db.add(card);
|
|
113
|
+
|
|
114
|
+
const retrieved = await db.get(card.hash);
|
|
115
|
+
console.log(retrieved?.getContentAsText());
|
|
116
|
+
|
|
117
|
+
await db.close();
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### DuckDB WASM (Browser — In-Browser OLAP)
|
|
121
|
+
```typescript
|
|
122
|
+
import { DuckDBWasmEngine } from './storage/DuckDBWasmEngine';
|
|
123
|
+
|
|
124
|
+
// Runs DuckDB entirely in WebAssembly via Web Worker
|
|
125
|
+
const db = new DuckDBWasmEngine();
|
|
126
|
+
await db.init(); // Downloads WASM bundle from CDN
|
|
127
|
+
|
|
128
|
+
// Same StorageEngine interface
|
|
129
|
+
const card = await MCard.create('Hello from DuckDB WASM!');
|
|
130
|
+
await db.add(card);
|
|
131
|
+
|
|
132
|
+
await db.close();
|
|
133
|
+
```
|
|
134
|
+
|
|
102
135
|
## Database Schema
|
|
103
136
|
|
|
104
137
|
The SQLite backend uses schemas matching the Python implementation for full interoperability.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LambdaRuntime,
|
|
3
|
+
parseLambdaExpression
|
|
4
|
+
} from "./chunk-Z4BRNTO5.js";
|
|
5
|
+
import "./chunk-MPMRBT5R.js";
|
|
6
|
+
import "./chunk-2KADE3SE.js";
|
|
7
|
+
import "./chunk-X42F7DE3.js";
|
|
8
|
+
import "./chunk-WTNVQ5WS.js";
|
|
9
|
+
import "./chunk-5HXLTWYN.js";
|
|
10
|
+
import "./chunk-5BIDGXA6.js";
|
|
11
|
+
import "./chunk-7NKII2JA.js";
|
|
12
|
+
import "./chunk-MLKGABMK.js";
|
|
13
|
+
export {
|
|
14
|
+
LambdaRuntime,
|
|
15
|
+
parseLambdaExpression
|
|
16
|
+
};
|