diff --git a/packages/entity/index.js b/packages/entity/index.js index ac7b296..be688bc 100644 --- a/packages/entity/index.js +++ b/packages/entity/index.js @@ -105,17 +105,6 @@ export class Entity extends decorate(Resource) { return pristine; } - static loadOrInstance(json) { - if (json.uri) { - return Entity.read(json.uri).then((entityJSON) => { - return new Entity(entityJSON, json); - }); - } - else { - return Promise.resolve(new Entity(json)); - } - } - constructor(json, jsonext) { super(); this._hooks = {}; diff --git a/packages/resource/resource.js b/packages/resource/resource.js index 180ab17..8d04dde 100644 --- a/packages/resource/resource.js +++ b/packages/resource/resource.js @@ -31,6 +31,17 @@ export class Resource extends decorate(class {}) { }); } + static loadOrInstance(json) { + if (json.uri) { + return this.read(json.uri).then((readJson) => { + return new this(readJson, json); + }); + } + else { + return Promise.resolve(new this(json)); + } + } + static read(uri) { if (!this.readCache) { this.readCache = {};