mcard-js 2.1.47 → 2.1.49

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 (52) hide show
  1. package/dist/AbstractSqlEngine-DKka6XjT.d.cts +451 -0
  2. package/dist/AbstractSqlEngine-DKka6XjT.d.ts +451 -0
  3. package/dist/CardCollection-TYC67XOH.js +10 -0
  4. package/dist/CardCollection-ZQ3G3Q3A.js +10 -0
  5. package/dist/EventProducer-VFDOM5W2.js +47 -0
  6. package/dist/IndexedDBEngine-5CEFZDOG.js +12 -0
  7. package/dist/IndexedDBEngine-BWXAB46W.js +12 -0
  8. package/dist/LLMRuntime-PH3MOQ2Y.js +17 -0
  9. package/dist/LambdaRuntime-DMEBYJIN.js +19 -0
  10. package/dist/LambdaRuntime-YH74FHIW.js +19 -0
  11. package/dist/Loader-OBPDJNFH.js +12 -0
  12. package/dist/Loader-WZXYG4GE.js +12 -0
  13. package/dist/MCard-RHTWJPHJ.js +8 -0
  14. package/dist/NetworkRuntime-KBQURQ6A.js +1598 -0
  15. package/dist/NetworkRuntime-S4DZCGVN.js +1598 -0
  16. package/dist/OllamaProvider-SPGO5Z5E.js +9 -0
  17. package/dist/chunk-3FFEA2XK.js +149 -0
  18. package/dist/chunk-7AXRV7NS.js +112 -0
  19. package/dist/chunk-AAO4GDBI.js +2360 -0
  20. package/dist/chunk-ASW6AOA7.js +140 -0
  21. package/dist/chunk-BJJZWPIF.js +112 -0
  22. package/dist/chunk-GGQCF7ZK.js +170 -0
  23. package/dist/chunk-HIVVDGE5.js +497 -0
  24. package/dist/chunk-HWBEGVEN.js +364 -0
  25. package/dist/chunk-ISY5LYLF.js +217 -0
  26. package/dist/chunk-KVZYFZJ5.js +427 -0
  27. package/dist/chunk-NGTY4P6A.js +275 -0
  28. package/dist/chunk-OAHWTOEB.js +275 -0
  29. package/dist/chunk-OUW2SUGM.js +368 -0
  30. package/dist/chunk-QKH3N62B.js +2360 -0
  31. package/dist/chunk-QPVEUPMU.js +299 -0
  32. package/dist/chunk-RZENJZGX.js +299 -0
  33. package/dist/chunk-VYDZR4ZD.js +364 -0
  34. package/dist/chunk-XJZOEM5F.js +903 -0
  35. package/dist/chunk-Z7EFXSTO.js +217 -0
  36. package/dist/index.browser.cjs +58 -20
  37. package/dist/index.browser.d.cts +34 -17
  38. package/dist/index.browser.d.ts +34 -17
  39. package/dist/index.browser.js +12 -8
  40. package/dist/index.cjs +644 -167
  41. package/dist/index.d.cts +725 -5
  42. package/dist/index.d.ts +725 -5
  43. package/dist/index.js +536 -95
  44. package/dist/storage/SqliteNodeEngine.cjs +28 -20
  45. package/dist/storage/SqliteNodeEngine.d.cts +1 -1
  46. package/dist/storage/SqliteNodeEngine.d.ts +1 -1
  47. package/dist/storage/SqliteNodeEngine.js +5 -5
  48. package/dist/storage/SqliteWasmEngine.cjs +28 -20
  49. package/dist/storage/SqliteWasmEngine.d.cts +1 -1
  50. package/dist/storage/SqliteWasmEngine.d.ts +1 -1
  51. package/dist/storage/SqliteWasmEngine.js +5 -5
  52. package/package.json +3 -1
@@ -177,13 +177,13 @@ var GTime = class {
177
177
  static DEFAULT_ALGORITHM = "sha256";
178
178
  /**
179
179
  * Generate a GTime stamp for the current moment
180
- * Format: HASH_ALGO|TIMESTAMP|REGION_CODE
180
+ * Format: ALGORITHM|TIMESTAMP|LOCALE_OR_DID
181
+ * Representing the mathematical coordinate (a,b,c) for an event signature.
181
182
  */
182
- static stampNow(hashAlgorithm = this.DEFAULT_ALGORITHM) {
183
+ static stampNow(hashAlgorithm = this.DEFAULT_ALGORITHM, localeOrDID = "UTC") {
183
184
  const algo = hashAlgorithm.toLowerCase();
184
185
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
185
- const region = "UTC";
186
- return `${algo}|${timestamp}|${region}`;
186
+ return `${algo}|${timestamp}|${localeOrDID}`;
187
187
  }
188
188
  /**
189
189
  * Parse a GTime string
@@ -196,26 +196,28 @@ var GTime = class {
196
196
  return {
197
197
  algorithm: parts[0],
198
198
  timestamp: new Date(parts[1]),
199
- region: parts[2]
199
+ localeOrDID: parts[2]
200
200
  };
201
201
  }
202
- /**
203
- * Get the hash algorithm from a GTime string
204
- */
205
- static getHashAlgorithm(gtime) {
202
+ /** Extract coordinate a: Algorithm */
203
+ static getAlgorithm(gtime) {
206
204
  return this.parse(gtime).algorithm;
207
205
  }
208
- /**
209
- * Get the timestamp from a GTime string
210
- */
206
+ /** Alias for backward compatibility */
207
+ static getHashAlgorithm(gtime) {
208
+ return this.getAlgorithm(gtime);
209
+ }
210
+ /** Extract coordinate b: Timestamp */
211
211
  static getTimestamp(gtime) {
212
212
  return this.parse(gtime).timestamp;
213
213
  }
214
- /**
215
- * Get the region code from a GTime string
216
- */
214
+ /** Extract coordinate c: Locale or DID */
215
+ static getLocaleOrDID(gtime) {
216
+ return this.parse(gtime).localeOrDID;
217
+ }
218
+ /** Alias for backward compatibility */
217
219
  static getRegionCode(gtime) {
218
- return this.parse(gtime).region;
220
+ return this.getLocaleOrDID(gtime);
219
221
  }
220
222
  /**
221
223
  * Check if the provided hash function is valid.
@@ -228,11 +230,11 @@ var GTime = class {
228
230
  return VALID_HASH_ALGORITHMS.includes(hashFunction.toLowerCase());
229
231
  }
230
232
  /**
231
- * Check if the provided region code is valid.
232
- * Matches Python's GTime.is_valid_region_code()
233
+ * Check if the provided locale/region code is valid.
234
+ * Maintains backward compatibility by checking for strings.
233
235
  */
234
236
  static isValidRegionCode(regionCode) {
235
- return Boolean(regionCode && regionCode === regionCode.toUpperCase());
237
+ return Boolean(regionCode && typeof regionCode === "string");
236
238
  }
237
239
  /**
238
240
  * Check if the provided timestamp is in ISO format.
@@ -643,6 +645,8 @@ var app_config_default = {
643
645
  default_ws_host: "127.0.0.1",
644
646
  default_ws_port: 5321,
645
647
  default_api_port: 5320,
648
+ default_python_api_port: 28302,
649
+ default_js_api_port: 28303,
646
650
  default_server_host: "0.0.0.0",
647
651
  cors_origins: [
648
652
  "http://localhost:3000",
@@ -672,7 +676,8 @@ var app_config_default = {
672
676
  default_server_memory_db: "servermemory.db",
673
677
  default_mcard_db: "mcard.db",
674
678
  default_server_log_db: "server_log.db",
675
- default_push_subscriptions_file: "subscriptions.json"
679
+ default_push_subscriptions_file: "subscriptions.json",
680
+ default_vcard_db_path: "data/vcard.db"
676
681
  },
677
682
  services: {
678
683
  default_ollama_base_url: "http://localhost:11434",
@@ -724,6 +729,9 @@ var SQLITE_BUSY_TIMEOUT_MS = 5e3;
724
729
  var DEFAULT_IDENTITY_PROVIDER = String(identity.provider ?? "sqlite");
725
730
  var DEFAULT_IDENTITY_SPACE_PATH = String(identity.space_path ?? "./data/IDENTITY_SPACE.db");
726
731
  var DEFAULT_API_PORT = Number(network.default_api_port ?? 5320);
732
+ var DEFAULT_PYTHON_API_PORT = Number(network.default_python_api_port ?? 28302);
733
+ var DEFAULT_JS_API_PORT = Number(network.default_js_api_port ?? 28303);
734
+ var DEFAULT_VCARD_DB_PATH = String(app_config_default.storage?.default_vcard_db_path ?? "./data/vcard.db");
727
735
  var DEFAULT_WS_PORT = Number(network.default_ws_port ?? 5321);
728
736
  var DEFAULT_WS_HOST = String(network.default_ws_host ?? "127.0.0.1");
729
737
  var DEFAULT_SERVER_HOST = String(network.default_server_host ?? "0.0.0.0");
@@ -1,4 +1,4 @@
1
- import { A as AbstractSqlEngine, M as MCard, P as Page } from '../AbstractSqlEngine-BSfp8S_Y.cjs';
1
+ import { A as AbstractSqlEngine, M as MCard, P as Page } from '../AbstractSqlEngine-DKka6XjT.cjs';
2
2
 
3
3
  /**
4
4
  * SqliteNodeEngine - Native SQLite backend for Node.js using better-sqlite3
@@ -1,4 +1,4 @@
1
- import { A as AbstractSqlEngine, M as MCard, P as Page } from '../AbstractSqlEngine-BSfp8S_Y.js';
1
+ import { A as AbstractSqlEngine, M as MCard, P as Page } from '../AbstractSqlEngine-DKka6XjT.js';
2
2
 
3
3
  /**
4
4
  * SqliteNodeEngine - Native SQLite backend for Node.js using better-sqlite3
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  SqliteNodeEngine
3
- } from "../chunk-AOTXYFW2.js";
4
- import "../chunk-FPW33LMV.js";
3
+ } from "../chunk-Z7EFXSTO.js";
4
+ import "../chunk-HIVVDGE5.js";
5
5
  import "../chunk-3EIBJPNF.js";
6
6
  import "../chunk-ADV52544.js";
7
- import "../chunk-J3IDWMDN.js";
8
- import "../chunk-2NFGZ6PA.js";
9
- import "../chunk-7NKII2JA.js";
7
+ import "../chunk-3FFEA2XK.js";
8
+ import "../chunk-GGQCF7ZK.js";
9
+ import "../chunk-ASW6AOA7.js";
10
10
  import "../chunk-PNKVD2UK.js";
11
11
  export {
12
12
  SqliteNodeEngine
@@ -177,13 +177,13 @@ var GTime = class {
177
177
  static DEFAULT_ALGORITHM = "sha256";
178
178
  /**
179
179
  * Generate a GTime stamp for the current moment
180
- * Format: HASH_ALGO|TIMESTAMP|REGION_CODE
180
+ * Format: ALGORITHM|TIMESTAMP|LOCALE_OR_DID
181
+ * Representing the mathematical coordinate (a,b,c) for an event signature.
181
182
  */
182
- static stampNow(hashAlgorithm = this.DEFAULT_ALGORITHM) {
183
+ static stampNow(hashAlgorithm = this.DEFAULT_ALGORITHM, localeOrDID = "UTC") {
183
184
  const algo = hashAlgorithm.toLowerCase();
184
185
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
185
- const region = "UTC";
186
- return `${algo}|${timestamp}|${region}`;
186
+ return `${algo}|${timestamp}|${localeOrDID}`;
187
187
  }
188
188
  /**
189
189
  * Parse a GTime string
@@ -196,26 +196,28 @@ var GTime = class {
196
196
  return {
197
197
  algorithm: parts[0],
198
198
  timestamp: new Date(parts[1]),
199
- region: parts[2]
199
+ localeOrDID: parts[2]
200
200
  };
201
201
  }
202
- /**
203
- * Get the hash algorithm from a GTime string
204
- */
205
- static getHashAlgorithm(gtime) {
202
+ /** Extract coordinate a: Algorithm */
203
+ static getAlgorithm(gtime) {
206
204
  return this.parse(gtime).algorithm;
207
205
  }
208
- /**
209
- * Get the timestamp from a GTime string
210
- */
206
+ /** Alias for backward compatibility */
207
+ static getHashAlgorithm(gtime) {
208
+ return this.getAlgorithm(gtime);
209
+ }
210
+ /** Extract coordinate b: Timestamp */
211
211
  static getTimestamp(gtime) {
212
212
  return this.parse(gtime).timestamp;
213
213
  }
214
- /**
215
- * Get the region code from a GTime string
216
- */
214
+ /** Extract coordinate c: Locale or DID */
215
+ static getLocaleOrDID(gtime) {
216
+ return this.parse(gtime).localeOrDID;
217
+ }
218
+ /** Alias for backward compatibility */
217
219
  static getRegionCode(gtime) {
218
- return this.parse(gtime).region;
220
+ return this.getLocaleOrDID(gtime);
219
221
  }
220
222
  /**
221
223
  * Check if the provided hash function is valid.
@@ -228,11 +230,11 @@ var GTime = class {
228
230
  return VALID_HASH_ALGORITHMS.includes(hashFunction.toLowerCase());
229
231
  }
230
232
  /**
231
- * Check if the provided region code is valid.
232
- * Matches Python's GTime.is_valid_region_code()
233
+ * Check if the provided locale/region code is valid.
234
+ * Maintains backward compatibility by checking for strings.
233
235
  */
234
236
  static isValidRegionCode(regionCode) {
235
- return Boolean(regionCode && regionCode === regionCode.toUpperCase());
237
+ return Boolean(regionCode && typeof regionCode === "string");
236
238
  }
237
239
  /**
238
240
  * Check if the provided timestamp is in ISO format.
@@ -644,6 +646,8 @@ var app_config_default = {
644
646
  default_ws_host: "127.0.0.1",
645
647
  default_ws_port: 5321,
646
648
  default_api_port: 5320,
649
+ default_python_api_port: 28302,
650
+ default_js_api_port: 28303,
647
651
  default_server_host: "0.0.0.0",
648
652
  cors_origins: [
649
653
  "http://localhost:3000",
@@ -673,7 +677,8 @@ var app_config_default = {
673
677
  default_server_memory_db: "servermemory.db",
674
678
  default_mcard_db: "mcard.db",
675
679
  default_server_log_db: "server_log.db",
676
- default_push_subscriptions_file: "subscriptions.json"
680
+ default_push_subscriptions_file: "subscriptions.json",
681
+ default_vcard_db_path: "data/vcard.db"
677
682
  },
678
683
  services: {
679
684
  default_ollama_base_url: "http://localhost:11434",
@@ -724,6 +729,9 @@ var DEFAULT_MAX_PROBLEM_BYTES = 2 * 1024 * 1024;
724
729
  var DEFAULT_IDENTITY_PROVIDER = String(identity.provider ?? "sqlite");
725
730
  var DEFAULT_IDENTITY_SPACE_PATH = String(identity.space_path ?? "./data/IDENTITY_SPACE.db");
726
731
  var DEFAULT_API_PORT = Number(network.default_api_port ?? 5320);
732
+ var DEFAULT_PYTHON_API_PORT = Number(network.default_python_api_port ?? 28302);
733
+ var DEFAULT_JS_API_PORT = Number(network.default_js_api_port ?? 28303);
734
+ var DEFAULT_VCARD_DB_PATH = String(app_config_default.storage?.default_vcard_db_path ?? "./data/vcard.db");
727
735
  var DEFAULT_WS_PORT = Number(network.default_ws_port ?? 5321);
728
736
  var DEFAULT_WS_HOST = String(network.default_ws_host ?? "127.0.0.1");
729
737
  var DEFAULT_SERVER_HOST = String(network.default_server_host ?? "0.0.0.0");
@@ -1,4 +1,4 @@
1
- import { A as AbstractSqlEngine, M as MCard } from '../AbstractSqlEngine-BSfp8S_Y.cjs';
1
+ import { A as AbstractSqlEngine, M as MCard } from '../AbstractSqlEngine-DKka6XjT.cjs';
2
2
 
3
3
  /**
4
4
  * SqliteWasmEngine - SQLite WASM backend using sql.js
@@ -1,4 +1,4 @@
1
- import { A as AbstractSqlEngine, M as MCard } from '../AbstractSqlEngine-BSfp8S_Y.js';
1
+ import { A as AbstractSqlEngine, M as MCard } from '../AbstractSqlEngine-DKka6XjT.js';
2
2
 
3
3
  /**
4
4
  * SqliteWasmEngine - SQLite WASM backend using sql.js
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  SqliteWasmEngine
3
- } from "../chunk-UFSXA5QB.js";
4
- import "../chunk-FPW33LMV.js";
3
+ } from "../chunk-7AXRV7NS.js";
4
+ import "../chunk-HIVVDGE5.js";
5
5
  import "../chunk-3EIBJPNF.js";
6
6
  import "../chunk-ADV52544.js";
7
- import "../chunk-J3IDWMDN.js";
8
- import "../chunk-2NFGZ6PA.js";
9
- import "../chunk-7NKII2JA.js";
7
+ import "../chunk-3FFEA2XK.js";
8
+ import "../chunk-GGQCF7ZK.js";
9
+ import "../chunk-ASW6AOA7.js";
10
10
  import "../chunk-PNKVD2UK.js";
11
11
  export {
12
12
  SqliteWasmEngine
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcard-js",
3
- "version": "2.1.47",
3
+ "version": "2.1.49",
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",
@@ -53,8 +53,10 @@
53
53
  "@grafana/faro-web-sdk": "^2.0.2",
54
54
  "@grafana/faro-web-tracing": "^2.0.2",
55
55
  "@mlc-ai/web-llm": "^0.2.46",
56
+ "@types/multicast-dns": "^7.2.4",
56
57
  "idb": "^7.1.1",
57
58
  "mcard-wasm": "file:../mcard-wasm/pkg",
59
+ "multicast-dns": "^7.2.5",
58
60
  "sql.js": "^1.13.0",
59
61
  "ws": "^8.19.0",
60
62
  "yaml": "^2.8.2"