mcard-js 2.1.39 → 2.1.41

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.
Files changed (40) hide show
  1. package/dist/AbstractSqlEngine-BSfp8S_Y.d.cts +451 -0
  2. package/dist/AbstractSqlEngine-BSfp8S_Y.d.ts +451 -0
  3. package/dist/CardCollection-MXTUJV4J.js +9 -0
  4. package/dist/EventProducer-AWD6YMZR.js +47 -0
  5. package/dist/Handle-3N4QOA3U.js +13 -0
  6. package/dist/IndexedDBEngine-2G5KCISA.js +11 -0
  7. package/dist/LLMRuntime-LBWUJ7ON.js +16 -0
  8. package/dist/LambdaRuntime-B6D6IQKZ.js +18 -0
  9. package/dist/Loader-3LSJXJQG.js +11 -0
  10. package/dist/MCard-H56VOJLR.js +8 -0
  11. package/dist/NetworkRuntime-IAFHPQSX.js +1570 -0
  12. package/dist/OllamaProvider-QPX2JXL2.js +8 -0
  13. package/dist/chunk-2R4ESMZB.js +110 -0
  14. package/dist/chunk-3EIBJPNF.js +17 -0
  15. package/dist/chunk-3LPY36OG.js +355 -0
  16. package/dist/chunk-3MMMJ7NH.js +1068 -0
  17. package/dist/chunk-42VF42KH.js +273 -0
  18. package/dist/chunk-4PDYHPR6.js +297 -0
  19. package/dist/chunk-ADV52544.js +95 -0
  20. package/dist/chunk-FIE4LAJG.js +215 -0
  21. package/dist/chunk-PNKVD2UK.js +26 -0
  22. package/dist/chunk-RSTKX7WM.js +907 -0
  23. package/dist/chunk-VXV35I5J.js +2315 -0
  24. package/dist/index.browser.cjs +375 -276
  25. package/dist/index.browser.d.cts +4 -4
  26. package/dist/index.browser.d.ts +4 -4
  27. package/dist/index.browser.js +18 -13
  28. package/dist/index.cjs +382 -453
  29. package/dist/index.d.cts +2 -2
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.js +26 -21
  32. package/dist/storage/SqliteNodeEngine.cjs +395 -270
  33. package/dist/storage/SqliteNodeEngine.d.cts +9 -94
  34. package/dist/storage/SqliteNodeEngine.d.ts +9 -94
  35. package/dist/storage/SqliteNodeEngine.js +6 -5
  36. package/dist/storage/SqliteWasmEngine.cjs +382 -252
  37. package/dist/storage/SqliteWasmEngine.d.cts +8 -29
  38. package/dist/storage/SqliteWasmEngine.d.ts +8 -29
  39. package/dist/storage/SqliteWasmEngine.js +6 -5
  40. package/package.json +1 -1
@@ -1,10 +1,13 @@
1
- import { S as StorageEngine, M as MCard, P as Page } from '../StorageAdapter-DdDUiIvH.cjs';
1
+ import { A as AbstractSqlEngine, M as MCard } from '../AbstractSqlEngine-BSfp8S_Y.cjs';
2
2
 
3
3
  /**
4
4
  * SqliteWasmEngine - SQLite WASM backend using sql.js
5
5
  *
6
6
  * Provides full SQL support with FTS5 and same schema as Python implementation.
7
7
  * Persistence via IndexedDB or OPFS.
8
+ *
9
+ * All card and handle operations are inherited from AbstractSqlEngine.
10
+ * Only the sql.js-specific primitives and init/export helpers are here.
8
11
  */
9
12
 
10
13
  type SqlJsDatabase = {
@@ -19,7 +22,7 @@ type SqlJsDatabase = {
19
22
  /**
20
23
  * SqliteWasmEngine - Full SQL support via sql.js
21
24
  */
22
- declare class SqliteWasmEngine implements StorageEngine {
25
+ declare class SqliteWasmEngine extends AbstractSqlEngine {
23
26
  private db;
24
27
  private SQL;
25
28
  /**
@@ -29,45 +32,21 @@ declare class SqliteWasmEngine implements StorageEngine {
29
32
  */
30
33
  init(wasmUrl?: string, existingData?: Uint8Array): Promise<void>;
31
34
  private ensureDb;
35
+ protected queryRows(sql: string, ...params: unknown[]): Promise<Record<string, unknown>[]>;
36
+ protected execSql(sql: string, ...params: unknown[]): Promise<number>;
37
+ protected rowToCard(row: Record<string, unknown>): MCard;
32
38
  /**
33
39
  * Export database as Uint8Array (for persistence)
34
40
  */
35
41
  export(): Uint8Array;
36
42
  /**
37
43
  * Get raw sql.js Database for use with VectorStore adapter.
38
- *
39
- * Example:
40
- * const vecStore = createWasmVectorStore(engine.getRawDb());
41
44
  */
42
45
  getRawDb(): SqlJsDatabase;
43
- add(card: MCard): Promise<string>;
44
- get(hash: string): Promise<MCard | null>;
45
- delete(hash: string): Promise<void>;
46
- getPage(pageNumber: number, pageSize: number): Promise<Page<MCard>>;
47
- count(): Promise<number>;
48
- searchByHash(hashPrefix: string): Promise<MCard[]>;
49
- search(query: string, pageNumber: number, pageSize: number): Promise<Page<MCard>>;
50
- getAll(): Promise<MCard[]>;
51
- clear(): Promise<void>;
52
- registerHandle(handle: string, hash: string): Promise<void>;
53
- resolveHandle(handle: string): Promise<string | null>;
54
- getByHandle(handle: string): Promise<MCard | null>;
55
- updateHandle(handle: string, newHash: string): Promise<string>;
56
- getHandleHistory(handle: string): Promise<{
57
- previousHash: string;
58
- changedAt: string;
59
- }[]>;
60
46
  pruneHandleHistory(handle: string, options?: {
61
47
  olderThan?: string;
62
48
  deleteAll?: boolean;
63
49
  }): Promise<number>;
64
- getAllHandles(): Promise<{
65
- handle: string;
66
- hash: string;
67
- }[]>;
68
- removeHandle(handle: string): Promise<void>;
69
- renameHandle(oldHandle: string, newHandle: string): Promise<void>;
70
- deleteHistoryEntry(handle: string, previousHash: string): Promise<void>;
71
50
  }
72
51
 
73
52
  export { SqliteWasmEngine };
@@ -1,10 +1,13 @@
1
- import { S as StorageEngine, M as MCard, P as Page } from '../StorageAdapter-DdDUiIvH.js';
1
+ import { A as AbstractSqlEngine, M as MCard } from '../AbstractSqlEngine-BSfp8S_Y.js';
2
2
 
3
3
  /**
4
4
  * SqliteWasmEngine - SQLite WASM backend using sql.js
5
5
  *
6
6
  * Provides full SQL support with FTS5 and same schema as Python implementation.
7
7
  * Persistence via IndexedDB or OPFS.
8
+ *
9
+ * All card and handle operations are inherited from AbstractSqlEngine.
10
+ * Only the sql.js-specific primitives and init/export helpers are here.
8
11
  */
9
12
 
10
13
  type SqlJsDatabase = {
@@ -19,7 +22,7 @@ type SqlJsDatabase = {
19
22
  /**
20
23
  * SqliteWasmEngine - Full SQL support via sql.js
21
24
  */
22
- declare class SqliteWasmEngine implements StorageEngine {
25
+ declare class SqliteWasmEngine extends AbstractSqlEngine {
23
26
  private db;
24
27
  private SQL;
25
28
  /**
@@ -29,45 +32,21 @@ declare class SqliteWasmEngine implements StorageEngine {
29
32
  */
30
33
  init(wasmUrl?: string, existingData?: Uint8Array): Promise<void>;
31
34
  private ensureDb;
35
+ protected queryRows(sql: string, ...params: unknown[]): Promise<Record<string, unknown>[]>;
36
+ protected execSql(sql: string, ...params: unknown[]): Promise<number>;
37
+ protected rowToCard(row: Record<string, unknown>): MCard;
32
38
  /**
33
39
  * Export database as Uint8Array (for persistence)
34
40
  */
35
41
  export(): Uint8Array;
36
42
  /**
37
43
  * Get raw sql.js Database for use with VectorStore adapter.
38
- *
39
- * Example:
40
- * const vecStore = createWasmVectorStore(engine.getRawDb());
41
44
  */
42
45
  getRawDb(): SqlJsDatabase;
43
- add(card: MCard): Promise<string>;
44
- get(hash: string): Promise<MCard | null>;
45
- delete(hash: string): Promise<void>;
46
- getPage(pageNumber: number, pageSize: number): Promise<Page<MCard>>;
47
- count(): Promise<number>;
48
- searchByHash(hashPrefix: string): Promise<MCard[]>;
49
- search(query: string, pageNumber: number, pageSize: number): Promise<Page<MCard>>;
50
- getAll(): Promise<MCard[]>;
51
- clear(): Promise<void>;
52
- registerHandle(handle: string, hash: string): Promise<void>;
53
- resolveHandle(handle: string): Promise<string | null>;
54
- getByHandle(handle: string): Promise<MCard | null>;
55
- updateHandle(handle: string, newHash: string): Promise<string>;
56
- getHandleHistory(handle: string): Promise<{
57
- previousHash: string;
58
- changedAt: string;
59
- }[]>;
60
46
  pruneHandleHistory(handle: string, options?: {
61
47
  olderThan?: string;
62
48
  deleteAll?: boolean;
63
49
  }): Promise<number>;
64
- getAllHandles(): Promise<{
65
- handle: string;
66
- hash: string;
67
- }[]>;
68
- removeHandle(handle: string): Promise<void>;
69
- renameHandle(oldHandle: string, newHandle: string): Promise<void>;
70
- deleteHistoryEntry(handle: string, previousHash: string): Promise<void>;
71
50
  }
72
51
 
73
52
  export { SqliteWasmEngine };
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  SqliteWasmEngine
3
- } from "../chunk-437JTYVP.js";
4
- import "../chunk-DWXNZ5AJ.js";
5
- import "../chunk-NZ6OQ7UT.js";
6
- import "../chunk-WVFWNVT2.js";
3
+ } from "../chunk-2R4ESMZB.js";
4
+ import "../chunk-RSTKX7WM.js";
5
+ import "../chunk-3EIBJPNF.js";
6
+ import "../chunk-ADV52544.js";
7
+ import "../chunk-3MMMJ7NH.js";
7
8
  import "../chunk-7NKII2JA.js";
8
- import "../chunk-MLKGABMK.js";
9
+ import "../chunk-PNKVD2UK.js";
9
10
  export {
10
11
  SqliteWasmEngine
11
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcard-js",
3
- "version": "2.1.39",
3
+ "version": "2.1.41",
4
4
  "description": "MCard - Content-addressable storage with cryptographic hashing, handle resolution, and vector search for Node.js and browsers",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",