@contextos/core 0.2.0 → 0.2.1

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 (2) hide show
  1. package/dist/index.js +17 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -993,9 +993,23 @@ var DependencyGraph = class {
993
993
  * Deserialize graph from JSON
994
994
  */
995
995
  fromJSON(data) {
996
- this.nodes = new Map(data.nodes);
997
- this.edges = data.edges;
998
- this.lastUpdated = data.lastUpdated;
996
+ if (!data) {
997
+ this.nodes = /* @__PURE__ */ new Map();
998
+ this.edges = [];
999
+ this.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
1000
+ return;
1001
+ }
1002
+ if (data.nodes instanceof Map) {
1003
+ this.nodes = data.nodes;
1004
+ } else if (Array.isArray(data.nodes)) {
1005
+ this.nodes = new Map(data.nodes);
1006
+ } else if (data.nodes && typeof data.nodes === "object") {
1007
+ this.nodes = new Map(Object.entries(data.nodes));
1008
+ } else {
1009
+ this.nodes = /* @__PURE__ */ new Map();
1010
+ }
1011
+ this.edges = Array.isArray(data.edges) ? data.edges : [];
1012
+ this.lastUpdated = data.lastUpdated || (/* @__PURE__ */ new Date()).toISOString();
999
1013
  }
1000
1014
  /**
1001
1015
  * Get graph statistics
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contextos/core",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Core engine for ContextOS - context management, parsing, and ranking",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",