mcard-js 1.0.0 → 2.0.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 +1 -1
- package/README.md +379 -68
- package/dist/hash/HashValidator.d.ts +14 -0
- package/dist/hash/HashValidator.d.ts.map +1 -0
- package/dist/hash/HashValidator.js +57 -0
- package/dist/hash/HashValidator.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -9
- package/dist/index.js.map +1 -1
- package/dist/model/CardCollection.d.ts +72 -0
- package/dist/model/CardCollection.d.ts.map +1 -0
- package/dist/model/CardCollection.js +152 -0
- package/dist/model/CardCollection.js.map +1 -0
- package/dist/model/EventProducer.d.ts +10 -0
- package/dist/model/EventProducer.d.ts.map +1 -0
- package/dist/model/EventProducer.js +46 -0
- package/dist/model/EventProducer.js.map +1 -0
- package/dist/model/GTime.d.ts +29 -0
- package/dist/model/GTime.d.ts.map +1 -0
- package/dist/model/GTime.js +49 -0
- package/dist/model/GTime.js.map +1 -0
- package/dist/model/Handle.d.ts +37 -0
- package/dist/model/Handle.d.ts.map +1 -0
- package/dist/model/Handle.js +90 -0
- package/dist/model/Handle.js.map +1 -0
- package/dist/model/MCard.d.ts +43 -0
- package/dist/model/MCard.d.ts.map +1 -0
- package/dist/model/MCard.js +76 -0
- package/dist/model/MCard.js.map +1 -0
- package/dist/model/constants.d.ts +45 -0
- package/dist/model/constants.d.ts.map +1 -0
- package/dist/model/constants.js +27 -0
- package/dist/model/constants.js.map +1 -0
- package/dist/model/detectors/ContentTypeInterpreter.d.ts +11 -0
- package/dist/model/detectors/ContentTypeInterpreter.d.ts.map +1 -0
- package/dist/model/detectors/ContentTypeInterpreter.js +51 -0
- package/dist/model/detectors/ContentTypeInterpreter.js.map +1 -0
- package/dist/monads/Either.d.ts +51 -0
- package/dist/monads/Either.d.ts.map +1 -0
- package/dist/monads/Either.js +82 -0
- package/dist/monads/Either.js.map +1 -0
- package/dist/monads/IO.d.ts +38 -0
- package/dist/monads/IO.d.ts.map +1 -0
- package/dist/monads/IO.js +66 -0
- package/dist/monads/IO.js.map +1 -0
- package/dist/monads/Maybe.d.ts +45 -0
- package/dist/monads/Maybe.d.ts.map +1 -0
- package/dist/monads/Maybe.js +73 -0
- package/dist/monads/Maybe.js.map +1 -0
- package/dist/monads/Reader.d.ts +29 -0
- package/dist/monads/Reader.d.ts.map +1 -0
- package/dist/monads/Reader.js +44 -0
- package/dist/monads/Reader.js.map +1 -0
- package/dist/monads/State.d.ts +33 -0
- package/dist/monads/State.d.ts.map +1 -0
- package/dist/monads/State.js +50 -0
- package/dist/monads/State.js.map +1 -0
- package/dist/monads/Writer.d.ts +29 -0
- package/dist/monads/Writer.d.ts.map +1 -0
- package/dist/monads/Writer.js +46 -0
- package/dist/monads/Writer.js.map +1 -0
- package/dist/ptr/LensProtocol.d.ts +84 -0
- package/dist/ptr/LensProtocol.d.ts.map +1 -0
- package/dist/ptr/LensProtocol.js +98 -0
- package/dist/ptr/LensProtocol.js.map +1 -0
- package/dist/ptr/SandboxWorker.d.ts +54 -0
- package/dist/ptr/SandboxWorker.d.ts.map +1 -0
- package/dist/ptr/SandboxWorker.js +172 -0
- package/dist/ptr/SandboxWorker.js.map +1 -0
- package/dist/ptr/common_types.d.ts +39 -0
- package/dist/ptr/common_types.d.ts.map +1 -0
- package/dist/ptr/common_types.js +12 -0
- package/dist/ptr/common_types.js.map +1 -0
- package/dist/ptr/llm/Config.d.ts +57 -0
- package/dist/ptr/llm/Config.d.ts.map +1 -0
- package/dist/ptr/llm/Config.js +167 -0
- package/dist/ptr/llm/Config.js.map +1 -0
- package/dist/ptr/llm/LLMRuntime.d.ts +20 -0
- package/dist/ptr/llm/LLMRuntime.d.ts.map +1 -0
- package/dist/ptr/llm/LLMRuntime.js +106 -0
- package/dist/ptr/llm/LLMRuntime.js.map +1 -0
- package/dist/ptr/llm/providers/LLMProvider.d.ts +43 -0
- package/dist/ptr/llm/providers/LLMProvider.d.ts.map +1 -0
- package/dist/ptr/llm/providers/LLMProvider.js +31 -0
- package/dist/ptr/llm/providers/LLMProvider.js.map +1 -0
- package/dist/ptr/llm/providers/OllamaProvider.d.ts +21 -0
- package/dist/ptr/llm/providers/OllamaProvider.d.ts.map +1 -0
- package/dist/ptr/llm/providers/OllamaProvider.js +158 -0
- package/dist/ptr/llm/providers/OllamaProvider.js.map +1 -0
- package/dist/ptr/node/CLMLoader.d.ts +63 -0
- package/dist/ptr/node/CLMLoader.d.ts.map +1 -0
- package/dist/ptr/node/CLMLoader.js +119 -0
- package/dist/ptr/node/CLMLoader.js.map +1 -0
- package/dist/ptr/node/CLMRunner.d.ts +45 -0
- package/dist/ptr/node/CLMRunner.d.ts.map +1 -0
- package/dist/ptr/node/CLMRunner.js +174 -0
- package/dist/ptr/node/CLMRunner.js.map +1 -0
- package/dist/ptr/node/RuntimeInterface.d.ts +4 -0
- package/dist/ptr/node/RuntimeInterface.d.ts.map +1 -0
- package/dist/ptr/node/RuntimeInterface.js +2 -0
- package/dist/ptr/node/RuntimeInterface.js.map +1 -0
- package/dist/ptr/node/Runtimes.d.ts +40 -0
- package/dist/ptr/node/Runtimes.d.ts.map +1 -0
- package/dist/ptr/node/Runtimes.js +471 -0
- package/dist/ptr/node/Runtimes.js.map +1 -0
- package/dist/ptr/node/cli.d.ts +3 -0
- package/dist/ptr/node/cli.d.ts.map +1 -0
- package/dist/ptr/node/cli.js +316 -0
- package/dist/ptr/node/cli.js.map +1 -0
- package/dist/storage/IndexedDBEngine.d.ts +30 -0
- package/dist/storage/IndexedDBEngine.d.ts.map +1 -0
- package/dist/storage/IndexedDBEngine.js +145 -0
- package/dist/storage/IndexedDBEngine.js.map +1 -0
- package/dist/storage/SqliteNodeEngine.d.ts +109 -0
- package/dist/storage/SqliteNodeEngine.d.ts.map +1 -0
- package/dist/storage/SqliteNodeEngine.js +315 -0
- package/dist/storage/SqliteNodeEngine.js.map +1 -0
- package/dist/storage/SqliteWasmEngine.d.ts +57 -0
- package/dist/storage/SqliteWasmEngine.d.ts.map +1 -0
- package/dist/storage/SqliteWasmEngine.js +139 -0
- package/dist/storage/SqliteWasmEngine.js.map +1 -0
- package/dist/storage/StorageAdapter.d.ts +33 -0
- package/dist/storage/StorageAdapter.d.ts.map +1 -0
- package/dist/storage/StorageAdapter.js +2 -0
- package/dist/storage/StorageAdapter.js.map +1 -0
- package/dist/storage/VectorStore.d.ts +179 -0
- package/dist/storage/VectorStore.d.ts.map +1 -0
- package/dist/storage/VectorStore.js +497 -0
- package/dist/storage/VectorStore.js.map +1 -0
- package/dist/storage/schema.d.ts +119 -0
- package/dist/storage/schema.d.ts.map +1 -0
- package/dist/storage/schema.js +261 -0
- package/dist/storage/schema.js.map +1 -0
- package/package.json +87 -71
- package/dist/__mocks__/better-sqlite3.js +0 -20
- package/dist/__mocks__/better-sqlite3.js.map +0 -1
- package/dist/config/config_constants.js +0 -188
- package/dist/config/config_constants.js.map +0 -1
- package/dist/config/env_parameters.js +0 -62
- package/dist/config/env_parameters.js.map +0 -1
- package/dist/content/model/content_type_detector.js +0 -89
- package/dist/content/model/content_type_detector.js.map +0 -1
- package/dist/core/card-collection.js +0 -279
- package/dist/core/card-collection.js.map +0 -1
- package/dist/core/event-producer.js +0 -132
- package/dist/core/event-producer.js.map +0 -1
- package/dist/core/g_time.js +0 -201
- package/dist/core/g_time.js.map +0 -1
- package/dist/core/hash/enums.js +0 -19
- package/dist/core/hash/enums.js.map +0 -1
- package/dist/core/hash/validator.js +0 -260
- package/dist/core/hash/validator.js.map +0 -1
- package/dist/core/mcard.js +0 -205
- package/dist/core/mcard.js.map +0 -1
- package/dist/engine/sqlite_engine.js +0 -723
- package/dist/engine/sqlite_engine.js.map +0 -1
- package/dist/middleware/mcardPersistenceMiddleware.js +0 -45
- package/dist/middleware/mcardPersistenceMiddleware.js.map +0 -1
- package/dist/models/database_schemas.js +0 -31
- package/dist/models/database_schemas.js.map +0 -1
- package/dist/services/logger.js +0 -80
- package/dist/services/logger.js.map +0 -1
- package/dist/services/mcardStorageService.js +0 -36
- package/dist/services/mcardStorageService.js.map +0 -1
- package/dist/utils/actionHelpers.js +0 -25
- package/dist/utils/actionHelpers.js.map +0 -1
- package/dist/utils/bufferContentHelper.js +0 -393
- package/dist/utils/bufferContentHelper.js.map +0 -1
- package/dist/utils/bufferPolyfill.js +0 -198
- package/dist/utils/bufferPolyfill.js.map +0 -1
- package/dist/utils/content-detection.js +0 -74
- package/dist/utils/content-detection.js.map +0 -1
- package/dist/utils/content-utils.js +0 -269
- package/dist/utils/content-utils.js.map +0 -1
- package/dist/utils/content_type_detector copy.js +0 -480
- package/dist/utils/content_type_detector copy.js.map +0 -1
- package/dist/utils/content_type_detector.js +0 -480
- package/dist/utils/content_type_detector.js.map +0 -1
- package/dist/utils/cryptoPolyfill.js +0 -166
- package/dist/utils/cryptoPolyfill.js.map +0 -1
- package/dist/utils/dotenv-browser.js +0 -35
- package/dist/utils/dotenv-browser.js.map +0 -1
- package/dist/utils/environmentDetector.js +0 -93
- package/dist/utils/environmentDetector.js.map +0 -1
- package/dist/utils/logWriter.js +0 -27
- package/dist/utils/logWriter.js.map +0 -1
- package/dist/utils/serviceWorkerManager.js +0 -118
- package/dist/utils/serviceWorkerManager.js.map +0 -1
- package/dist/utils/test-content-detection.js +0 -79
- package/dist/utils/test-content-detection.js.map +0 -1
- package/dist/utils/test-detection-fix.js +0 -121
- package/dist/utils/test-detection-fix.js.map +0 -1
- package/dist/utils/test-format-conversion.js +0 -170
- package/dist/utils/test-format-conversion.js.map +0 -1
- package/dist/utils/test-mov-viewer.js +0 -57
- package/dist/utils/test-mov-viewer.js.map +0 -1
- package/dist/utils/testDetection.js +0 -21
- package/dist/utils/testDetection.js.map +0 -1
- package/dist/utils/textEncoderPolyfill.js +0 -87
- package/dist/utils/textEncoderPolyfill.js.map +0 -1
- package/src/__mocks__/better-sqlite3.js +0 -14
- package/src/config/config_constants.js +0 -227
- package/src/config/env_parameters.js +0 -69
- package/src/content/model/content_type_detector.js +0 -87
- package/src/core/card-collection.js +0 -300
- package/src/core/event-producer.js +0 -160
- package/src/core/g_time.js +0 -215
- package/src/core/hash/enums.js +0 -13
- package/src/core/hash/validator.js +0 -271
- package/src/core/mcard.js +0 -203
- package/src/engine/sqlite_engine.js +0 -755
- package/src/index.js +0 -10
- package/src/middleware/mcardPersistenceMiddleware.js +0 -45
- package/src/models/database_schemas.js +0 -26
- package/src/services/logger.js +0 -74
- package/src/services/mcardStorageService.js +0 -34
- package/src/utils/actionHelpers.js +0 -13
- package/src/utils/bufferContentHelper.js +0 -436
- package/src/utils/bufferPolyfill.js +0 -202
- package/src/utils/cn.ts +0 -6
- package/src/utils/content-detection.js +0 -66
- package/src/utils/content-utils.js +0 -250
- package/src/utils/content_type_detector copy.js +0 -501
- package/src/utils/content_type_detector.js +0 -501
- package/src/utils/cryptoPolyfill.js +0 -180
- package/src/utils/dateUtils.ts +0 -18
- package/src/utils/dbInitializer.ts +0 -27
- package/src/utils/dotenv-browser.js +0 -29
- package/src/utils/environmentDetector.js +0 -92
- package/src/utils/logWriter.js +0 -20
- package/src/utils/serviceWorkerManager.js +0 -122
- package/src/utils/stateWatcher.ts +0 -78
- package/src/utils/storeAdapter copy.ts +0 -157
- package/src/utils/storeAdapter.ts +0 -157
- package/src/utils/test-content-detection.js +0 -71
- package/src/utils/test-detection-fix.js +0 -136
- package/src/utils/test-format-conversion.js +0 -165
- package/src/utils/test-mov-viewer.js +0 -59
- package/src/utils/testDetection.js +0 -16
- package/src/utils/textEncoderPolyfill.js +0 -88
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,117 +1,428 @@
|
|
|
1
|
-
# MCard
|
|
1
|
+
# MCard JavaScript / TypeScript
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Full-featured TypeScript implementation of MCard content-addressable storage, supporting both browser and Node.js environments.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](./tests)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](https://nodejs.org/)
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## Features
|
|
8
10
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
11
|
+
- **Content Addressing**: SHA-256 via Web Crypto API (browser) or Node.js crypto
|
|
12
|
+
- **Dual Storage**: IndexedDB (browser) + SQLite via better-sqlite3 (Node.js)
|
|
13
|
+
- **UTF-8 Handles**: International support (文檔, مستند, ドキュメント, документ)
|
|
14
|
+
- **Monadic API**: Maybe, Either, IO monads for functional composition
|
|
15
|
+
- **PTR Runtime**: Polynomial Type Runtime with polyglot execution (JS, Python, Rust, C, WASM, Lean)
|
|
16
|
+
- **LLM Integration**: Ollama provider for local LLM execution
|
|
17
|
+
- **Vector Search**: sqlite-vec extension for semantic similarity search
|
|
14
18
|
|
|
15
|
-
##
|
|
19
|
+
## Quick Start
|
|
16
20
|
|
|
17
|
-
###
|
|
21
|
+
### Browser (IndexedDB)
|
|
22
|
+
```typescript
|
|
23
|
+
import { MCard, IndexedDBEngine, CardCollection } from 'mcard-js';
|
|
18
24
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- **GTime**: Handles global timestamping with region-aware formatting
|
|
25
|
+
const db = new IndexedDBEngine();
|
|
26
|
+
await db.init();
|
|
22
27
|
|
|
23
|
-
|
|
28
|
+
const collection = new CardCollection(db);
|
|
29
|
+
const card = await MCard.create('Hello, 世界!');
|
|
30
|
+
await collection.addWithHandle(card, 'greeting');
|
|
24
31
|
|
|
25
|
-
|
|
32
|
+
// Monadic retrieval
|
|
33
|
+
const result = await collection.getByHandleM('greeting');
|
|
34
|
+
if (result.isJust) {
|
|
35
|
+
console.log(result.value.getContentAsText());
|
|
36
|
+
}
|
|
37
|
+
```
|
|
26
38
|
|
|
27
|
-
###
|
|
39
|
+
### Node.js (SQLite)
|
|
40
|
+
```typescript
|
|
41
|
+
import { MCard } from './model/MCard';
|
|
42
|
+
import { SqliteNodeEngine } from './storage/SqliteNodeEngine';
|
|
28
43
|
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
44
|
+
// File-based or in-memory database
|
|
45
|
+
const engine = new SqliteNodeEngine('./data/mcard.db');
|
|
46
|
+
// or: const engine = new SqliteNodeEngine(':memory:');
|
|
32
47
|
|
|
33
|
-
|
|
48
|
+
// Store a card
|
|
49
|
+
const card = await MCard.create('Hello from Node.js!');
|
|
50
|
+
await engine.save(card);
|
|
34
51
|
|
|
35
|
-
|
|
52
|
+
// Retrieve by hash
|
|
53
|
+
const retrieved = await engine.get(card.hash);
|
|
54
|
+
console.log(retrieved?.getContentAsText());
|
|
36
55
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
56
|
+
// Search
|
|
57
|
+
const results = engine.searchByString('Hello');
|
|
58
|
+
console.log(`Found ${results.totalItems} cards`);
|
|
40
59
|
|
|
41
|
-
|
|
60
|
+
// Clean up
|
|
61
|
+
engine.close();
|
|
62
|
+
```
|
|
42
63
|
|
|
43
|
-
|
|
64
|
+
## Storage Backends
|
|
44
65
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
66
|
+
### IndexedDB (Browser)
|
|
67
|
+
```typescript
|
|
68
|
+
const db = new IndexedDBEngine();
|
|
69
|
+
await db.init();
|
|
70
|
+
```
|
|
49
71
|
|
|
50
|
-
###
|
|
72
|
+
### SQLite WASM (Browser)
|
|
73
|
+
```typescript
|
|
74
|
+
const db = new SqliteWasmEngine();
|
|
75
|
+
await db.init();
|
|
76
|
+
const data = db.export(); // Persist to IndexedDB
|
|
77
|
+
```
|
|
51
78
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
79
|
+
### SQLite Node.js (Server)
|
|
80
|
+
```typescript
|
|
81
|
+
import { SqliteNodeEngine } from './storage/SqliteNodeEngine';
|
|
55
82
|
|
|
56
|
-
|
|
83
|
+
const db = new SqliteNodeEngine('./mcard.db');
|
|
57
84
|
|
|
58
|
-
|
|
85
|
+
// Synchronous API available for performance
|
|
86
|
+
db.saveSync(card);
|
|
87
|
+
const card = db.getSync(hash);
|
|
88
|
+
const count = db.countSync();
|
|
59
89
|
|
|
60
|
-
|
|
61
|
-
npm install @benkoo/mcard
|
|
90
|
+
db.close();
|
|
62
91
|
```
|
|
63
92
|
|
|
64
|
-
|
|
93
|
+
## Database Schema
|
|
65
94
|
|
|
66
|
-
|
|
67
|
-
|
|
95
|
+
The SQLite backend uses schemas matching the Python implementation for full interoperability.
|
|
96
|
+
Schemas are defined in `src/storage/schema.ts` and mirror `mcard/model/schema.py` and `mcard/rag/*/schema.py`.
|
|
68
97
|
|
|
69
|
-
|
|
70
|
-
const card = new MCard('Hello, World!');
|
|
98
|
+
### Core Storage (matches `mcard/model/schema.py`)
|
|
71
99
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
100
|
+
```sql
|
|
101
|
+
-- Content-addressable card storage
|
|
102
|
+
CREATE TABLE card (
|
|
103
|
+
hash TEXT PRIMARY KEY,
|
|
104
|
+
content BLOB NOT NULL,
|
|
105
|
+
g_time TEXT NOT NULL
|
|
106
|
+
);
|
|
75
107
|
|
|
76
|
-
|
|
77
|
-
|
|
108
|
+
-- Handle registry (UTF-8 string → hash mapping)
|
|
109
|
+
CREATE TABLE handle_registry (
|
|
110
|
+
handle TEXT PRIMARY KEY,
|
|
111
|
+
current_hash TEXT NOT NULL,
|
|
112
|
+
created_at TEXT NOT NULL,
|
|
113
|
+
updated_at TEXT NOT NULL,
|
|
114
|
+
FOREIGN KEY (current_hash) REFERENCES card(hash)
|
|
115
|
+
);
|
|
78
116
|
|
|
79
|
-
|
|
80
|
-
|
|
117
|
+
-- Handle version history
|
|
118
|
+
CREATE TABLE handle_history (
|
|
119
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
120
|
+
handle TEXT NOT NULL,
|
|
121
|
+
previous_hash TEXT NOT NULL,
|
|
122
|
+
changed_at TEXT NOT NULL,
|
|
123
|
+
FOREIGN KEY (handle) REFERENCES handle_registry(handle),
|
|
124
|
+
FOREIGN KEY (previous_hash) REFERENCES card(hash)
|
|
125
|
+
);
|
|
81
126
|
```
|
|
82
127
|
|
|
83
|
-
###
|
|
128
|
+
### Vector Storage (matches `mcard/rag/vector/schema.py`)
|
|
129
|
+
|
|
130
|
+
```sql
|
|
131
|
+
-- Vector metadata
|
|
132
|
+
CREATE TABLE mcard_vector_metadata (
|
|
133
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
134
|
+
hash TEXT NOT NULL,
|
|
135
|
+
model_name TEXT NOT NULL,
|
|
136
|
+
dimensions INTEGER NOT NULL,
|
|
137
|
+
chunk_index INTEGER DEFAULT 0,
|
|
138
|
+
chunk_total INTEGER DEFAULT 1,
|
|
139
|
+
chunk_text TEXT,
|
|
140
|
+
created_at TEXT NOT NULL,
|
|
141
|
+
UNIQUE(hash, chunk_index)
|
|
142
|
+
);
|
|
84
143
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
144
|
+
-- Fallback embeddings (when sqlite-vec unavailable)
|
|
145
|
+
CREATE TABLE mcard_embeddings (
|
|
146
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
147
|
+
metadata_id INTEGER NOT NULL REFERENCES mcard_vector_metadata(id),
|
|
148
|
+
embedding BLOB NOT NULL,
|
|
149
|
+
UNIQUE(metadata_id)
|
|
150
|
+
);
|
|
90
151
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
152
|
+
-- FTS5 for hybrid search
|
|
153
|
+
CREATE VIRTUAL TABLE mcard_fts USING fts5(
|
|
154
|
+
hash, content, tokenize='porter unicode61'
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
-- sqlite-vec virtual table (when extension available)
|
|
158
|
+
CREATE VIRTUAL TABLE mcard_vec USING vec0(
|
|
159
|
+
metadata_id INTEGER PRIMARY KEY,
|
|
160
|
+
embedding float[768]
|
|
96
161
|
);
|
|
97
162
|
```
|
|
98
163
|
|
|
99
|
-
|
|
164
|
+
### Graph Storage (matches `mcard/rag/graph/schema.py`)
|
|
165
|
+
|
|
166
|
+
```sql
|
|
167
|
+
-- Knowledge graph entities
|
|
168
|
+
CREATE TABLE graph_entities (
|
|
169
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
170
|
+
name TEXT NOT NULL,
|
|
171
|
+
type TEXT NOT NULL,
|
|
172
|
+
description TEXT,
|
|
173
|
+
source_hash TEXT NOT NULL,
|
|
174
|
+
embedding BLOB,
|
|
175
|
+
created_at TEXT NOT NULL,
|
|
176
|
+
UNIQUE(name, type, source_hash)
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
-- Knowledge graph relationships
|
|
180
|
+
CREATE TABLE graph_relationships (
|
|
181
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
182
|
+
source_entity_id INTEGER NOT NULL,
|
|
183
|
+
target_entity_id INTEGER NOT NULL,
|
|
184
|
+
relationship TEXT NOT NULL,
|
|
185
|
+
description TEXT,
|
|
186
|
+
weight REAL DEFAULT 1.0,
|
|
187
|
+
source_hash TEXT NOT NULL,
|
|
188
|
+
created_at TEXT NOT NULL
|
|
189
|
+
);
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Monads
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
import { Maybe, Either, IO } from 'mcard-js';
|
|
196
|
+
|
|
197
|
+
// Maybe - optional values
|
|
198
|
+
Maybe.just(5).bind(x => Maybe.just(x * 2)); // Just(10)
|
|
199
|
+
Maybe.nothing().map(x => x * 2); // Nothing
|
|
200
|
+
|
|
201
|
+
// Either - error handling
|
|
202
|
+
Either.right(5).map(x => x * 2); // Right(10)
|
|
203
|
+
Either.left('error').map(x => x * 2); // Left('error')
|
|
204
|
+
|
|
205
|
+
// IO - deferred side effects
|
|
206
|
+
const io = IO.of(() => fetch('/api'));
|
|
207
|
+
await io.run();
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## PTR (Polynomial Type Runtime)
|
|
211
|
+
|
|
212
|
+
### CLM Execution
|
|
213
|
+
```typescript
|
|
214
|
+
import { CLMRunner } from './ptr/node/CLMRunner';
|
|
215
|
+
import { CLMLoader } from './ptr/node/CLMLoader';
|
|
216
|
+
|
|
217
|
+
const runner = new CLMRunner();
|
|
218
|
+
const loader = new CLMLoader();
|
|
219
|
+
|
|
220
|
+
// Load and execute a CLM specification
|
|
221
|
+
const clm = loader.load('chapters/chapter_01_arithmetic/addition.yaml');
|
|
222
|
+
const result = await runner.executeCLM(clm, './chapters/chapter_01_arithmetic', { a: 10, b: 20 });
|
|
223
|
+
|
|
224
|
+
console.log(result.result); // 30
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Recursive CLM (Meta-Execution)
|
|
228
|
+
```typescript
|
|
229
|
+
// CLM files can reference other CLM files as their runtime
|
|
230
|
+
// runtime: meta.clm → loads and executes meta.clm with original context
|
|
231
|
+
|
|
232
|
+
const clm = {
|
|
233
|
+
chapter: { title: 'Orchestrator' },
|
|
234
|
+
clm: {
|
|
235
|
+
concrete: { runtime: 'meta.clm' } // Recursive execution
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
const result = await runner.executeCLM(clm, chapterDir, input);
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Polyglot Runtimes
|
|
243
|
+
```typescript
|
|
244
|
+
import { RuntimeFactory } from './ptr/node/Runtimes';
|
|
245
|
+
|
|
246
|
+
// Available runtimes
|
|
247
|
+
const jsRuntime = RuntimeFactory.getRuntime('javascript');
|
|
248
|
+
const pyRuntime = RuntimeFactory.getRuntime('python');
|
|
249
|
+
const rustRuntime = RuntimeFactory.getRuntime('rust');
|
|
250
|
+
const cRuntime = RuntimeFactory.getRuntime('c');
|
|
251
|
+
const wasmRuntime = RuntimeFactory.getRuntime('wasm');
|
|
252
|
+
const leanRuntime = RuntimeFactory.getRuntime('lean');
|
|
253
|
+
const llmRuntime = RuntimeFactory.getRuntime('llm');
|
|
254
|
+
const loaderRuntime = RuntimeFactory.getRuntime('loader');
|
|
255
|
+
|
|
256
|
+
// Check availability
|
|
257
|
+
const available = RuntimeFactory.getAvailableRuntimes();
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### File Loader Runtime
|
|
261
|
+
|
|
262
|
+
The `LoaderRuntime` provides high-performance directory loading using native Node.js APIs:
|
|
263
|
+
|
|
264
|
+
```typescript
|
|
265
|
+
// CLM files can use operation: loader for built-in file loading
|
|
266
|
+
// Example CLM:
|
|
267
|
+
// concrete:
|
|
268
|
+
// runtime: python
|
|
269
|
+
// operation: loader
|
|
270
|
+
// balanced:
|
|
271
|
+
// input_arguments:
|
|
272
|
+
// source_dir: "path/to/files"
|
|
273
|
+
// recursive: true
|
|
274
|
+
|
|
275
|
+
// Features:
|
|
276
|
+
// - Recursive/flat directory traversal
|
|
277
|
+
// - SHA-256 content hashing
|
|
278
|
+
// - MIME type detection (extension + magic bytes)
|
|
279
|
+
// - Problematic file filtering (>50MB, binary garbage)
|
|
280
|
+
// - ~5000 files/sec performance
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### LLM Runtime (Ollama)
|
|
284
|
+
```typescript
|
|
285
|
+
import { LLMRuntime } from './ptr/node/llm/LLMRuntime';
|
|
286
|
+
import { OllamaProvider } from './ptr/node/llm/providers/OllamaProvider';
|
|
100
287
|
|
|
101
|
-
|
|
288
|
+
const provider = new OllamaProvider({ model: 'gemma3:latest' });
|
|
289
|
+
const runtime = new LLMRuntime(provider);
|
|
102
290
|
|
|
103
|
-
|
|
291
|
+
const result = await runtime.execute('prompt', { question: 'What is 2+2?' }, config, dir);
|
|
292
|
+
```
|
|
104
293
|
|
|
294
|
+
### Node.js CLI
|
|
105
295
|
```bash
|
|
106
|
-
|
|
296
|
+
# Run a CLM file
|
|
297
|
+
npx tsx src/ptr/node/cli.ts run chapters/chapter_01_arithmetic/addition.yaml
|
|
298
|
+
|
|
299
|
+
# Check runtime status
|
|
300
|
+
npx tsx src/ptr/node/cli.ts status
|
|
301
|
+
|
|
302
|
+
# List available CLM files
|
|
303
|
+
npx tsx src/ptr/node/cli.ts list
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Vector Search (sqlite-vec)
|
|
307
|
+
|
|
308
|
+
The `MCardVectorStore` provides semantic search using the sqlite-vec extension:
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
import { MCardVectorStore } from './storage/VectorStore';
|
|
312
|
+
|
|
313
|
+
// Initialize vector store
|
|
314
|
+
const store = new MCardVectorStore('./vectors.db', {
|
|
315
|
+
embeddingModel: 'nomic-embed-text',
|
|
316
|
+
dimensions: 768,
|
|
317
|
+
ollamaBaseUrl: 'http://localhost:11434'
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
// Index content
|
|
321
|
+
await store.index('abc123...', 'MCard provides content-addressable storage...');
|
|
322
|
+
|
|
323
|
+
// Search similar content
|
|
324
|
+
const results = await store.search('What is MCard?', 5);
|
|
325
|
+
for (const result of results) {
|
|
326
|
+
console.log(`${result.hash}: ${result.score}`);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Hybrid search (vector + FTS)
|
|
330
|
+
const hybridResults = await store.hybridSearch('content storage', 5, 0.7);
|
|
331
|
+
|
|
332
|
+
// Check if sqlite-vec is available
|
|
333
|
+
console.log('Has vec extension:', store.hasVectorExtension());
|
|
334
|
+
|
|
335
|
+
store.close();
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Features
|
|
339
|
+
- **sqlite-vec extension**: Native KNN search with vec0 virtual tables
|
|
340
|
+
- **Fallback mode**: Brute-force cosine similarity when extension unavailable
|
|
341
|
+
- **Chunking**: Automatic text splitting with overlap
|
|
342
|
+
- **Hybrid search**: Combined vector + FTS5 full-text search
|
|
343
|
+
- **Ollama integration**: Embedding generation via local LLM
|
|
344
|
+
|
|
345
|
+
## Recent Bug Fixes (December 2025)
|
|
346
|
+
|
|
347
|
+
### SQLite Foreign Key Constraint Fix
|
|
348
|
+
|
|
349
|
+
**Problem**: `clearSync()` was deleting tables in wrong order, causing `SQLITE_CONSTRAINT_FOREIGNKEY` errors.
|
|
350
|
+
|
|
351
|
+
**Solution**: Delete child tables before parent tables:
|
|
352
|
+
```typescript
|
|
353
|
+
clearSync(): void {
|
|
354
|
+
// FK-safe order: children first, then parents
|
|
355
|
+
this.db.exec('DELETE FROM handle_history'); // ✓ Child
|
|
356
|
+
this.db.exec('DELETE FROM handle_registry'); // ✓ Child
|
|
357
|
+
this.db.exec('DELETE FROM card'); // ✓ Parent
|
|
358
|
+
}
|
|
107
359
|
```
|
|
108
360
|
|
|
109
|
-
|
|
361
|
+
**Impact**: All 117 tests pass ✅
|
|
362
|
+
|
|
363
|
+
### CLMRunner Recursive Runtime Fix
|
|
364
|
+
|
|
365
|
+
**Problem**: Test mocks for recursive runtime execution weren't wiring correctly due to Vitest module path resolution.
|
|
366
|
+
|
|
367
|
+
**Solution**: Verified `executeRecursive()` implementation correctly calls `this.loader.load()` for meta CLM files.
|
|
368
|
+
|
|
369
|
+
**Impact**: Both CLMRunner tests pass ✅
|
|
370
|
+
|
|
371
|
+
## Development
|
|
110
372
|
|
|
111
373
|
```bash
|
|
374
|
+
# Install dependencies
|
|
375
|
+
npm install
|
|
376
|
+
|
|
377
|
+
# Run tests (Vitest)
|
|
378
|
+
npm test
|
|
379
|
+
|
|
380
|
+
# Run tests in watch mode
|
|
381
|
+
npm run test:watch
|
|
382
|
+
|
|
383
|
+
# Type checking
|
|
384
|
+
npx tsc --noEmit
|
|
385
|
+
|
|
386
|
+
# Build
|
|
112
387
|
npm run build
|
|
113
388
|
```
|
|
114
389
|
|
|
390
|
+
## Project Structure
|
|
391
|
+
|
|
392
|
+
```
|
|
393
|
+
mcard-js/
|
|
394
|
+
├── src/
|
|
395
|
+
│ ├── model/
|
|
396
|
+
│ │ ├── MCard.ts # Core MCard implementation
|
|
397
|
+
│ │ ├── Handle.ts # Handle validation & normalization
|
|
398
|
+
│ │ └── GTime.ts # Global time ordering
|
|
399
|
+
│ ├── storage/
|
|
400
|
+
│ │ ├── StorageAdapter.ts # Storage interface
|
|
401
|
+
│ │ ├── SqliteNodeEngine.ts # Node.js SQLite (better-sqlite3)
|
|
402
|
+
│ │ ├── IndexedDBEngine.ts # Browser IndexedDB
|
|
403
|
+
│ │ └── SqliteWasmEngine.ts # Browser SQLite (sql.js)
|
|
404
|
+
│ ├── ptr/
|
|
405
|
+
│ │ └── node/
|
|
406
|
+
│ │ ├── CLMLoader.ts # YAML CLM parser
|
|
407
|
+
│ │ ├── CLMRunner.ts # CLM execution engine
|
|
408
|
+
│ │ ├── Runtimes.ts # Polyglot runtime factory
|
|
409
|
+
│ │ ├── cli.ts # Node.js CLI
|
|
410
|
+
│ │ └── llm/ # LLM runtime (Ollama)
|
|
411
|
+
│ ├── hash/
|
|
412
|
+
│ │ └── HashValidator.ts # SHA-256 validation
|
|
413
|
+
│ └── monads/
|
|
414
|
+
│ └── Monads.ts # Maybe, Either, IO
|
|
415
|
+
├── tests/
|
|
416
|
+
│ ├── storage/
|
|
417
|
+
│ │ └── SqliteNodeEngine.test.ts
|
|
418
|
+
│ ├── ptr/
|
|
419
|
+
│ │ ├── CLMLoader.test.ts
|
|
420
|
+
│ │ └── CLMRunner.test.ts
|
|
421
|
+
│ └── ...
|
|
422
|
+
└── package.json
|
|
423
|
+
```
|
|
424
|
+
|
|
115
425
|
## License
|
|
116
426
|
|
|
117
|
-
MIT
|
|
427
|
+
MIT
|
|
428
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HashValidator - Computes SHA-256 hashes using Web Crypto API
|
|
3
|
+
*/
|
|
4
|
+
export declare class HashValidator {
|
|
5
|
+
/**
|
|
6
|
+
* Compute hash of content using specified algorithm
|
|
7
|
+
*/
|
|
8
|
+
static computeHash(content: Uint8Array | string, algorithm?: string): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Validate that content matches expected hash
|
|
11
|
+
*/
|
|
12
|
+
static validate(content: Uint8Array | string, expectedHash: string): Promise<boolean>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=HashValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HashValidator.d.ts","sourceRoot":"","sources":["../../src/hash/HashValidator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,aAAa;IACtB;;OAEG;WACU,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,EAAE,SAAS,GAAE,MAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IA4BrG;;OAEG;WACU,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAI9F"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HashValidator - Computes SHA-256 hashes using Web Crypto API
|
|
3
|
+
*/
|
|
4
|
+
export class HashValidator {
|
|
5
|
+
/**
|
|
6
|
+
* Compute hash of content using specified algorithm
|
|
7
|
+
*/
|
|
8
|
+
static async computeHash(content, algorithm = 'sha256') {
|
|
9
|
+
const data = typeof content === 'string'
|
|
10
|
+
? new TextEncoder().encode(content)
|
|
11
|
+
: content;
|
|
12
|
+
let algoName = 'SHA-256';
|
|
13
|
+
switch (algorithm.toLowerCase()) {
|
|
14
|
+
case 'sha1':
|
|
15
|
+
algoName = 'SHA-1';
|
|
16
|
+
break;
|
|
17
|
+
case 'sha-1':
|
|
18
|
+
algoName = 'SHA-1';
|
|
19
|
+
break;
|
|
20
|
+
case 'sha256':
|
|
21
|
+
algoName = 'SHA-256';
|
|
22
|
+
break;
|
|
23
|
+
case 'sha-256':
|
|
24
|
+
algoName = 'SHA-256';
|
|
25
|
+
break;
|
|
26
|
+
case 'sha384':
|
|
27
|
+
algoName = 'SHA-384';
|
|
28
|
+
break;
|
|
29
|
+
case 'sha-384':
|
|
30
|
+
algoName = 'SHA-384';
|
|
31
|
+
break;
|
|
32
|
+
case 'sha512':
|
|
33
|
+
algoName = 'SHA-512';
|
|
34
|
+
break;
|
|
35
|
+
case 'sha-512':
|
|
36
|
+
algoName = 'SHA-512';
|
|
37
|
+
break;
|
|
38
|
+
default:
|
|
39
|
+
console.warn(`Algorithm ${algorithm} not natively supported or mapped, defaulting to SHA-256`);
|
|
40
|
+
algoName = 'SHA-256';
|
|
41
|
+
}
|
|
42
|
+
// Create a copy to ensure we have a standard ArrayBuffer (not SharedArrayBuffer)
|
|
43
|
+
const buffer = new Uint8Array(data).buffer;
|
|
44
|
+
const hashBuffer = await crypto.subtle.digest(algoName, buffer);
|
|
45
|
+
return Array.from(new Uint8Array(hashBuffer))
|
|
46
|
+
.map(b => b.toString(16).padStart(2, '0'))
|
|
47
|
+
.join('');
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Validate that content matches expected hash
|
|
51
|
+
*/
|
|
52
|
+
static async validate(content, expectedHash) {
|
|
53
|
+
const computedHash = await this.computeHash(content);
|
|
54
|
+
return computedHash === expectedHash;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=HashValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HashValidator.js","sourceRoot":"","sources":["../../src/hash/HashValidator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,aAAa;IACtB;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,OAA4B,EAAE,YAAoB,QAAQ;QAC/E,MAAM,IAAI,GAAG,OAAO,OAAO,KAAK,QAAQ;YACpC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;YACnC,CAAC,CAAC,OAAO,CAAC;QAEd,IAAI,QAAQ,GAAG,SAAS,CAAC;QACzB,QAAQ,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC;YAC9B,KAAK,MAAM;gBAAE,QAAQ,GAAG,OAAO,CAAC;gBAAC,MAAM;YACvC,KAAK,OAAO;gBAAE,QAAQ,GAAG,OAAO,CAAC;gBAAC,MAAM;YACxC,KAAK,QAAQ;gBAAE,QAAQ,GAAG,SAAS,CAAC;gBAAC,MAAM;YAC3C,KAAK,SAAS;gBAAE,QAAQ,GAAG,SAAS,CAAC;gBAAC,MAAM;YAC5C,KAAK,QAAQ;gBAAE,QAAQ,GAAG,SAAS,CAAC;gBAAC,MAAM;YAC3C,KAAK,SAAS;gBAAE,QAAQ,GAAG,SAAS,CAAC;gBAAC,MAAM;YAC5C,KAAK,QAAQ;gBAAE,QAAQ,GAAG,SAAS,CAAC;gBAAC,MAAM;YAC3C,KAAK,SAAS;gBAAE,QAAQ,GAAG,SAAS,CAAC;gBAAC,MAAM;YAC5C;gBACI,OAAO,CAAC,IAAI,CAAC,aAAa,SAAS,0DAA0D,CAAC,CAAC;gBAC/F,QAAQ,GAAG,SAAS,CAAC;QAC7B,CAAC;QAED,iFAAiF;QACjF,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,MAAqB,CAAC;QAC1D,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAChE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;aACxC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;aACzC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,OAA4B,EAAE,YAAoB;QACpE,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACrD,OAAO,YAAY,KAAK,YAAY,CAAC;IACzC,CAAC;CACJ"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { MCard } from './model/MCard';
|
|
2
|
+
export { GTime } from './model/GTime';
|
|
3
|
+
export { ContentHandle, validateHandle, HandleValidationError } from './model/Handle';
|
|
4
|
+
export { CardCollection } from './model/CardCollection';
|
|
5
|
+
export { ContentTypeInterpreter } from './model/detectors/ContentTypeInterpreter';
|
|
6
|
+
export { EVENT_CONSTANTS, ALGORITHM_HIERARCHY } from './model/constants';
|
|
7
|
+
export { StorageEngine, Page } from './storage/StorageAdapter';
|
|
8
|
+
export { IndexedDBEngine } from './storage/IndexedDBEngine';
|
|
9
|
+
export { SqliteWasmEngine } from './storage/SqliteWasmEngine';
|
|
10
|
+
export { SqliteNodeEngine } from './storage/SqliteNodeEngine';
|
|
11
|
+
export { HashValidator } from './hash/HashValidator';
|
|
12
|
+
export { Maybe } from './monads/Maybe';
|
|
13
|
+
export { Either } from './monads/Either';
|
|
14
|
+
export { IO } from './monads/IO';
|
|
15
|
+
export { Reader } from './monads/Reader';
|
|
16
|
+
export { Writer } from './monads/Writer';
|
|
17
|
+
export { State } from './monads/State';
|
|
18
|
+
export { LensProtocol, JsonRpcRequest, JsonRpcResponse, ErrorCodes } from './ptr/LensProtocol';
|
|
19
|
+
export { SandboxWorker } from './ptr/SandboxWorker';
|
|
20
|
+
export * from './ptr/common_types';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGzE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
1
|
+
// MCard JavaScript Library
|
|
2
|
+
// Content-addressable storage for browsers
|
|
3
|
+
// Core model
|
|
4
|
+
export { MCard } from './model/MCard';
|
|
5
|
+
export { GTime } from './model/GTime';
|
|
6
|
+
export { ContentHandle, validateHandle, HandleValidationError } from './model/Handle';
|
|
7
|
+
export { CardCollection } from './model/CardCollection';
|
|
8
|
+
export { ContentTypeInterpreter } from './model/detectors/ContentTypeInterpreter';
|
|
9
|
+
export { EVENT_CONSTANTS, ALGORITHM_HIERARCHY } from './model/constants';
|
|
10
|
+
export { IndexedDBEngine } from './storage/IndexedDBEngine';
|
|
11
|
+
export { SqliteWasmEngine } from './storage/SqliteWasmEngine';
|
|
12
|
+
export { SqliteNodeEngine } from './storage/SqliteNodeEngine';
|
|
13
|
+
// Hash
|
|
14
|
+
export { HashValidator } from './hash/HashValidator';
|
|
15
|
+
// Monads
|
|
16
|
+
export { Maybe } from './monads/Maybe';
|
|
17
|
+
export { Either } from './monads/Either';
|
|
18
|
+
export { IO } from './monads/IO';
|
|
19
|
+
export { Reader } from './monads/Reader';
|
|
20
|
+
export { Writer } from './monads/Writer';
|
|
21
|
+
export { State } from './monads/State';
|
|
22
|
+
// PTR (Polynomial Type Runtime)
|
|
23
|
+
export { LensProtocol, ErrorCodes } from './ptr/LensProtocol';
|
|
24
|
+
export { SandboxWorker } from './ptr/SandboxWorker';
|
|
25
|
+
export * from './ptr/common_types';
|
|
10
26
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,2CAA2C;AAE3C,aAAa;AACb,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIzE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO;AACP,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,SAAS;AACT,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,gCAAgC;AAChC,OAAO,EAAE,YAAY,EAAmC,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,cAAc,oBAAoB,CAAC"}
|