@kubun/protocol 0.5.2 → 0.5.3

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.
@@ -1 +1 @@
1
- import{verifyCluster as e}from"./cluster.js";export class GraphModel{static fromClusters(r){let s={};for(let t of r.clusters.map(e))Object.assign(s,t);return new GraphModel({aliases:r.aliases,record:s})}#e;#r;constructor(e){this.#e=e.aliases??Object.entries(e.record).reduce((e,[r,s])=>(null==e[s.name]?e[s.name]=r:console.warn(`Duplicate model name ${s.name} in GraphModel record, ignoring model ID ${r} in aliases`),e),{}),this.#r=e.record}get aliases(){return this.#e}get record(){return this.#r}getAlias(e){for(let[r,s]of Object.entries(this.#e))if(s===e)return r;return null}getModel(e){let r=this.#e[e]??e;return this.#r[r]??null}toJSON(){return{aliases:this.#e,record:this.#r}}}
1
+ import{verifyCluster as e}from"./cluster.js";export class GraphModel{static fromClusters(s){let r={};for(let a of s.clusters.map(e))Object.assign(r,a);return new GraphModel({aliases:s.aliases,record:r})}#e;#s;constructor(e){null!=e.aliases&&0!==Object.keys(e.aliases).length?this.#e=e.aliases:this.#e=Object.entries(e.record).reduce((e,[s,r])=>(null==e[r.name]?e[r.name]=s:console.warn(`Duplicate model name ${r.name} in GraphModel record, ignoring model ID ${s} in aliases`),e),{}),this.#s=e.record}get aliases(){return this.#e}get record(){return this.#s}getAlias(e){for(let[s,r]of Object.entries(this.#e))if(r===e)return s;return null}getModel(e){let s=this.#e[e]??e;return this.#s[s]??null}toJSON(){return{aliases:this.#e,record:this.#s}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubun/protocol",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "license": "see LICENSE.md",
5
5
  "keywords": [],
6
6
  "type": "module",
@@ -19,8 +19,8 @@
19
19
  "@enkaku/protocol": "^0.13.0",
20
20
  "@enkaku/schema": "^0.13.0",
21
21
  "change-case": "^5.4.4",
22
- "@kubun/logger": "^0.5.0",
23
- "@kubun/id": "^0.5.0"
22
+ "@kubun/id": "^0.5.0",
23
+ "@kubun/logger": "^0.5.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "json-schema-typed": "^8.0.2"