@rest-hooks/endpoint
Advanced tools
Comparing version 3.4.1 to 3.5.0
@@ -402,3 +402,2 @@ 'use strict'; | ||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
/** | ||
@@ -419,11 +418,2 @@ * Represents data that should be deduped by specifying a primary key. | ||
/** Returns the globally unique identifier for the static Entity */ | ||
static get key() { | ||
/* istanbul ignore next */ | ||
if (process.env.NODE_ENV !== 'production' && (this.name === '' || this.name === 'Entity' || this.name === '_temp')) throw new Error('Entity classes without a name must define `static get key()`'); | ||
return this.name; | ||
} | ||
/** Defines indexes to enable lookup by */ | ||
/** | ||
@@ -473,4 +463,2 @@ * A unique identifier for each Entity | ||
* @param [props] Plain Object of properties to assign. | ||
* @param [parent] When normalizing, the object which included the record | ||
* @param [key] When normalizing, the key where this record was found | ||
*/ | ||
@@ -488,2 +476,15 @@ static fromJS( | ||
/** Factory method to convert from Plain JS Objects. | ||
* | ||
* @param [props] Plain Object of properties to assign. | ||
*/ | ||
static createIfValid( | ||
// TODO: this should only accept members that are not functions | ||
props) { | ||
if (this.validate(props)) { | ||
return undefined; | ||
} | ||
return this.fromJS(props); | ||
} | ||
/** Do any transformations when first receiving input */ | ||
@@ -668,2 +669,3 @@ static process(input, parent, key) { | ||
} | ||
// TODO(breaking): Remove fromJS and setLocal call once old versions are no longer supported | ||
if (isImmutable(input)) { | ||
@@ -675,11 +677,18 @@ if (this.validate(input.toJS())) return [undefined, false, true]; | ||
const [denormEntity, found, deleted] = denormalizeImmutable(this.schema, input, unvisit); | ||
return [this.fromJS(denormEntity.toObject()), found, deleted]; | ||
return [this.fromJS(denormEntity.toObject()), true, deleted]; | ||
} | ||
if (this.validate(input)) { | ||
return [undefined, false, true]; | ||
let entityCopy; | ||
// new path | ||
if (input instanceof this) { | ||
entityCopy = input; | ||
// TODO(breaking): Remove fromJS and setLocal call once old versions are no longer supported | ||
} else { | ||
if (this.validate(input)) { | ||
return [undefined, false, true]; | ||
} | ||
entityCopy = this.fromJS(input); | ||
// Need to set this first so that if it is referenced further within the | ||
// denormalization the reference will already exist. | ||
unvisit.setLocal == null ? void 0 : unvisit.setLocal(entityCopy); | ||
} | ||
const entityCopy = this.fromJS(input); | ||
// Need to set this first so that if it is referenced further within the | ||
// denormalization the reference will already exist. | ||
unvisit.setLocal == null ? void 0 : unvisit.setLocal(entityCopy); | ||
let deleted = false; | ||
@@ -690,8 +699,8 @@ | ||
const schema = this.schema[key]; | ||
const nextInput = Object.hasOwn(input, key) ? input[key] : undefined; | ||
const nextInput = input[key]; | ||
const [value,, deletedItem] = unvisit(nextInput, schema); | ||
if (deletedItem && !(Object.hasOwn(input, key) && !this.defaults[key])) { | ||
if (deletedItem && !!this.defaults[key]) { | ||
deleted = true; | ||
} | ||
if (Object.hasOwn(input, key) && input[key] !== value) { | ||
if (input[key] !== value) { | ||
this.set(entityCopy, key, value); | ||
@@ -712,2 +721,4 @@ } | ||
} | ||
/* istanbul ignore next */ | ||
} | ||
@@ -717,2 +728,27 @@ | ||
Entity.schema = {}; | ||
(() => { | ||
const get = /* istanbul ignore if */ | ||
Entity.name !== 'Entity' ? /* istanbul ignore next */function () { | ||
if (!this.__keyErr) { | ||
console.error('Rest Hooks Error: https://resthooks.io/errors/dklj'); | ||
this.__keyErr = true; | ||
} | ||
return this.name; | ||
} : function () { | ||
/* istanbul ignore next */ | ||
if (process.env.NODE_ENV !== 'production' && (this.name === '' || this.name === 'Entity' || this.name === '_temp')) throw new Error('Entity classes without a name must define `static key`\nSee: https://resthooks.io/rest/api/Entity#key'); | ||
return this.name; | ||
}; | ||
Object.defineProperty(Entity, 'key', { | ||
get, | ||
// this allows assignment in strict-mode | ||
set(value) { | ||
Object.defineProperty(this, 'key', { | ||
value, | ||
writable: true, | ||
enumerable: true | ||
}); | ||
} | ||
}); | ||
})(); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -838,3 +874,15 @@ const superFrom = Entity.fromJS; | ||
} | ||
/* istanbul ignore next */ | ||
} | ||
(() => { | ||
/* istanbul ignore if */ | ||
if (Endpoint.name !== 'Endpoint') { | ||
Endpoint.prototype.key = function (...args) { | ||
console.error('Rest Hooks Error: https://resthooks.io/errors/osid'); | ||
return `${this.name} ${JSON.stringify(args)}`; | ||
}; | ||
} | ||
})(); | ||
const ExtendableEndpoint = Endpoint; | ||
@@ -841,0 +889,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).restHookEndpoint={})}(this,(function(e){"use strict";function t(e){return!("function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function s(e,t,s){let i=!0,n=!1;return[Object.keys(e).reduce(((t,r)=>{const c=`${r}`,[o,a,h]=s(t.get(c),e[c]);return a||(i=!1),h&&(n=!0),t.has(c)?t.set(c,o):t}),t),i,n]}class i{constructor(e,t){this.schema=void 0,t&&(this._schemaAttribute="string"==typeof t?e=>e[t]:t),this.define(e)}get isSingleSchema(){return!this._schemaAttribute}define(e){this.schema=e}getSchemaAttribute(e,t,s){return!this.isSingleSchema&&this._schemaAttribute(e,t,s)}inferSchema(e,t,s){if(this.isSingleSchema)return this.schema;const i=this.getSchemaAttribute(e,t,s);return this.schema[i]}normalizeValue(e,t,s,i,n,r){const c=this.inferSchema(e,t,s);if(!c)return e;const o=i(e,t,s,c,n,r);return this.isSingleSchema||null==o?o:{id:o,schema:this.getSchemaAttribute(e,t,s)}}denormalizeValue(e,s){const i=!this.isSingleSchema&&(t(e)?e.get("schema"):e.schema);if(!this.isSingleSchema&&!i)return[e,!0,!1];return s((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[i])}}const n=([e,,t])=>void 0!==e&&!t;class r extends i{normalize(e,t,s,i,n,r){const c=(e=>Array.isArray(e)?e:Object.keys(e).map((t=>e[t])))(e);return c.map(((e,c)=>this.normalizeValue(e,t,s,i,n,r))).filter((e=>null!=e))}denormalize(e,t){return[e.map?e.map((e=>this.denormalizeValue(e,t))).filter(n).map((([e])=>e)):e,!0,!1]}infer(e,t,s,i){}toJSON(){return[this.schema]}}const c=Symbol("ENTITY WAS DELETED");var o=Object.freeze({__proto__:null,Union:class extends i{constructor(e,t){if(!t)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');super(e,t)}normalize(e,t,s,i,n,r){return this.normalizeValue(e,t,s,i,n,r)}denormalize(e,t){return this.denormalizeValue(e,t)}infer(e,t,s,i){if(!e[0])return;const n=this.getSchemaAttribute(e[0],void 0,""),r=this.schema[n];return void 0!==r?{id:s(r,e,t,i),schema:n}:void 0}},Values:class extends i{normalize(e,t,s,i,n,r){return Object.keys(e).reduce(((t,s,c)=>{const o=e[s];return null!=o?Object.assign({},t,{[s]:this.normalizeValue(o,e,s,i,n,r)}):t}),{})}denormalize(e,t){let s=!0,i=!1;return[Object.keys(e).reduce(((n,r)=>{const c=e[r],[o,a,h]=this.denormalizeValue(c,t);return a||(s=!1),h&&(i=!0),!a||h?n:Object.assign({},n,{[r]:o})}),{}),s,i]}infer(e,t,s){}},Array:r,All:class extends r{constructor(e,t){super(e,t)}normalize(e,t,s,i,n,r){super.normalize(e,t,s,i,n,r)}infer(e,t,s,i){if(this.isSingleSchema){const e=i[this.schema.key];if(void 0===e)return;return Object.values(e).map((e=>e&&this.schema.pk(e)))}let n=!1;const r=Object.values(this.schema).flatMap((e=>Object.hasOwn(i,e.key)&&i[e.key]?(n=!0,Object.values(i[e.key]).map((t=>({id:t&&e.pk(t),schema:this.getSchemaAttribute(t,void 0,void 0)})))):[]));if(n)return r}},Object:class{constructor(e){this.schema=void 0,this.define(e)}define(e){this.schema=Object.keys(e).reduce(((t,s)=>{const i=e[s];return Object.assign({},t,{[s]:i})}),this.schema||{})}normalize(...e){return((e,t,s,i,n,r,c)=>{const o=Object.assign({},t);return Object.keys(e).forEach((s=>{const i=e[s],a=n(t[s],t,s,i,r,c);null==a?delete o[s]:o[s]=a})),o})(this.schema,...e)}denormalize(...e){return((e,i,n)=>{if(t(i))return s(e,i,n);const r=Object.assign({},i);let c=!0,o=!1;return Object.keys(e).forEach((t=>{const[s,i,a]=n(r[t],e[t]);void 0!==r[t]&&(r[t]=s),a&&(o=!0),i||(c=!1)})),[r,c,o]})(this.schema,...e)}infer(e,t,s,i){return function(e,t,s,i,n){const r={};for(const c of Object.keys(e))r[c]=i(e[c],t,s,n);return r}(this.schema,e,t,s,i)}},Delete:class{constructor(e){this._entity=e}get key(){return this._entity.key}normalize(e,t,s,i,n,r){const o=this._entity.process(e,t,s),a=this._entity.pk(o,t,s);return n(this,c,a),a}infer(e,t,s){}denormalize(e,t){return t(e,this._entity)}_denormalizeNullable(){return[]}_normalizeNullable(){return[]}merge(e,t){return t}useIncoming(e,t,s,i){return e.date<=t.date}}});class a{static toJSON(){return{name:this.name,schema:this.schema,key:this.key}}static get key(){return this.name}static pk(e,t,s){return this.prototype.pk.call(e,t,s)}static useIncoming(e,t,s,i){return e.fetchedAt<=t.fetchedAt}static merge(e,t){return Object.assign({},e,t)}static mergeWithStore(e,t,s,i){return!e||this.useIncoming(e,t,s,i)?typeof i!=typeof s?i:this.merge(s,i):s}static fromJS(e={}){const t=new this(e);return Object.assign(t,e),t}static process(e,t,s){return Object.assign({},e)}static normalize(e,t,s,i,n,r){const c=this.process(e,t,s),o=this.pk(c,t,s);if(void 0===o||""===o)return;const a=this.key;if(a in r||(r[a]={}),o in r[a]||(r[a][o]=[]),r[a][o].some((t=>t===e)))return o;const h=this.validate(c);if(h){const e=new Error(h);throw e.status=400,e}return r[a][o].push(e),Object.keys(this.schema).forEach((e=>{if(Object.hasOwn(c,e)){const t=this.schema[e];c[e]=i(c[e],c,e,t,n,r)}})),n(this,c,o),o}static validate(e){}static infer(e,t,s){if(!e[0])return;if(["string","number"].includes(typeof e[0]))return`${e[0]}`;const i=this.pk(e[0],void 0,"");if(void 0!==i&&""!==i)return i;const n=function(e,t){return t?t.find((t=>Object.hasOwn(e,t))):void 0}(e[0],this.indexes);if(n&&t[this.key]){return t[this.key][n][e[0][n]]}}static expiresAt(e,t){return e.expiresAt}static denormalize(e,i){if("symbol"==typeof e)return[void 0,!0,!0];if(t(e)){if(this.validate(e.toJS()))return[void 0,!1,!0];null==i.setLocal||i.setLocal(e);const[t,n,r]=s(this.schema,e,i);return[this.fromJS(t.toObject()),n,r]}if(this.validate(e))return[void 0,!1,!0];const n=this.fromJS(e);null==i.setLocal||i.setLocal(n);let r=!1;return Object.keys(this.schema).forEach((t=>{const s=this.schema[t],c=Object.hasOwn(e,t)?e[t]:void 0,[o,,a]=i(c,s);!a||Object.hasOwn(e,t)&&!this.defaults[t]||(r=!0),Object.hasOwn(e,t)&&e[t]!==o&&this.set(n,t,o)})),[n,!0,r]}static get defaults(){return Object.hasOwn(this,"__defaults")||(this.__defaults=new this),this.__defaults}static set(e,t,s){e[t]=s}}function h(e,t){e.type=e.sideEffect?"mutate":"read",e.options=Object.assign({},t),delete e.options.key,delete e.options.schema,delete e.options.sideEffect,delete e.options.fetch,delete e.options.getFetchKey,delete e.options.options,0===Object.keys(e.options).length&&delete e.options,void 0===e.schema&&(e.schema=null)}a.schema={};let u=!1;try{Function()}catch(e){u=!0,console.error("Content Security Policy: The previous CSP log can be safely ignored - @rest-hooks/endpoint will use setPrototypeOf instead")}class l extends Function{constructor(e,t){let s;return u?(s=(...e)=>s.fetch(...e),Object.setPrototypeOf(s,new.target.prototype)):(super("return arguments.callee.fetch.apply(arguments.callee, arguments)"),s=this),s.getFetchKey=e=>s.key(e),e&&(s.fetch=e),t&&"name"in t?(s.__name=t.name,delete t.name):e&&(s.__name=e.name),Object.assign(s,t),Object.defineProperty(s,"name",{get:function(){return this.__name}}),h(s,t),s}key(...e){return`${this.name} ${JSON.stringify(e)}`}bind(e,...t){const s=this.fetch,i=this.key;return this.extend({fetch(){return s.apply(null!=e?e:this,t)},key(){return i.apply(this,t)}})}extend(e){class t extends this.constructor{}Object.assign(t.prototype,this);const s=new t(e.fetch,e);return h(s,Object.assign({},this.options,e)),s}}const m=l;class d extends Error{}Object.hasOwn=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},e.AbortOptimistic=d,e.DELETED=c,e.Endpoint=l,e.Entity=a,e.ExtendableEndpoint=m,e.Index=class{constructor(e,t){this.getFetchKey=e=>this.key(e),this.schema=e,t&&(this.key=t)}key(e){return JSON.stringify(e)}},e.Query=class{constructor(e,t){this.sideEffect=void 0,this.schema=this.createQuerySchema(e),t?this.process=t:this.process||(this.process=e=>e)}key(...e){return`QUERY ${JSON.stringify(e)}`}createQuerySchema(e){const t=Object.create(e);return t.denormalize=({args:t,input:s},i)=>{if(void 0===s)return[void 0,!1,!0];const[n,r,c]=e.denormalize(s,i);return[r?this.process(n,...t):void 0,r,c]},t.infer=(t,s,i,n)=>({args:t,input:i(e,t,s,n)}),t}},e.schema=o,e.validateRequired=function(e,t){let s="";if(Object.keys(t).some((t=>!Object.hasOwn(e,t)&&(s=t,!0))))return`Missing key ${s}`},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).restHookEndpoint={})}(this,(function(e){"use strict";function t(e){return!("function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function s(e,t,s){let i=!0,r=!1;return[Object.keys(e).reduce(((t,n)=>{const o=`${n}`,[c,a,h]=s(t.get(o),e[o]);return a||(i=!1),h&&(r=!0),t.has(o)?t.set(o,c):t}),t),i,r]}class i{constructor(e,t){this.schema=void 0,t&&(this._schemaAttribute="string"==typeof t?e=>e[t]:t),this.define(e)}get isSingleSchema(){return!this._schemaAttribute}define(e){this.schema=e}getSchemaAttribute(e,t,s){return!this.isSingleSchema&&this._schemaAttribute(e,t,s)}inferSchema(e,t,s){if(this.isSingleSchema)return this.schema;const i=this.getSchemaAttribute(e,t,s);return this.schema[i]}normalizeValue(e,t,s,i,r,n){const o=this.inferSchema(e,t,s);if(!o)return e;const c=i(e,t,s,o,r,n);return this.isSingleSchema||null==c?c:{id:c,schema:this.getSchemaAttribute(e,t,s)}}denormalizeValue(e,s){const i=!this.isSingleSchema&&(t(e)?e.get("schema"):e.schema);if(!this.isSingleSchema&&!i)return[e,!0,!1];return s((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[i])}}const r=([e,,t])=>void 0!==e&&!t;class n extends i{normalize(e,t,s,i,r,n){const o=(e=>Array.isArray(e)?e:Object.keys(e).map((t=>e[t])))(e);return o.map(((e,o)=>this.normalizeValue(e,t,s,i,r,n))).filter((e=>null!=e))}denormalize(e,t){return[e.map?e.map((e=>this.denormalizeValue(e,t))).filter(r).map((([e])=>e)):e,!0,!1]}infer(e,t,s,i){}toJSON(){return[this.schema]}}const o=Symbol("ENTITY WAS DELETED");var c=Object.freeze({__proto__:null,Union:class extends i{constructor(e,t){if(!t)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');super(e,t)}normalize(e,t,s,i,r,n){return this.normalizeValue(e,t,s,i,r,n)}denormalize(e,t){return this.denormalizeValue(e,t)}infer(e,t,s,i){if(!e[0])return;const r=this.getSchemaAttribute(e[0],void 0,""),n=this.schema[r];return void 0!==n?{id:s(n,e,t,i),schema:r}:void 0}},Values:class extends i{normalize(e,t,s,i,r,n){return Object.keys(e).reduce(((t,s,o)=>{const c=e[s];return null!=c?Object.assign({},t,{[s]:this.normalizeValue(c,e,s,i,r,n)}):t}),{})}denormalize(e,t){let s=!0,i=!1;return[Object.keys(e).reduce(((r,n)=>{const o=e[n],[c,a,h]=this.denormalizeValue(o,t);return a||(s=!1),h&&(i=!0),!a||h?r:Object.assign({},r,{[n]:c})}),{}),s,i]}infer(e,t,s){}},Array:n,All:class extends n{constructor(e,t){super(e,t)}normalize(e,t,s,i,r,n){super.normalize(e,t,s,i,r,n)}infer(e,t,s,i){if(this.isSingleSchema){const e=i[this.schema.key];if(void 0===e)return;return Object.values(e).map((e=>e&&this.schema.pk(e)))}let r=!1;const n=Object.values(this.schema).flatMap((e=>Object.hasOwn(i,e.key)&&i[e.key]?(r=!0,Object.values(i[e.key]).map((t=>({id:t&&e.pk(t),schema:this.getSchemaAttribute(t,void 0,void 0)})))):[]));if(r)return n}},Object:class{constructor(e){this.schema=void 0,this.define(e)}define(e){this.schema=Object.keys(e).reduce(((t,s)=>{const i=e[s];return Object.assign({},t,{[s]:i})}),this.schema||{})}normalize(...e){return((e,t,s,i,r,n,o)=>{const c=Object.assign({},t);return Object.keys(e).forEach((s=>{const i=e[s],a=r(t[s],t,s,i,n,o);null==a?delete c[s]:c[s]=a})),c})(this.schema,...e)}denormalize(...e){return((e,i,r)=>{if(t(i))return s(e,i,r);const n=Object.assign({},i);let o=!0,c=!1;return Object.keys(e).forEach((t=>{const[s,i,a]=r(n[t],e[t]);void 0!==n[t]&&(n[t]=s),a&&(c=!0),i||(o=!1)})),[n,o,c]})(this.schema,...e)}infer(e,t,s,i){return function(e,t,s,i,r){const n={};for(const o of Object.keys(e))n[o]=i(e[o],t,s,r);return n}(this.schema,e,t,s,i)}},Delete:class{constructor(e){this._entity=e}get key(){return this._entity.key}normalize(e,t,s,i,r,n){const c=this._entity.process(e,t,s),a=this._entity.pk(c,t,s);return r(this,o,a),a}infer(e,t,s){}denormalize(e,t){return t(e,this._entity)}_denormalizeNullable(){return[]}_normalizeNullable(){return[]}merge(e,t){return t}useIncoming(e,t,s,i){return e.date<=t.date}}});class a{static toJSON(){return{name:this.name,schema:this.schema,key:this.key}}static pk(e,t,s){return this.prototype.pk.call(e,t,s)}static useIncoming(e,t,s,i){return e.fetchedAt<=t.fetchedAt}static merge(e,t){return Object.assign({},e,t)}static mergeWithStore(e,t,s,i){return!e||this.useIncoming(e,t,s,i)?typeof i!=typeof s?i:this.merge(s,i):s}static fromJS(e={}){const t=new this(e);return Object.assign(t,e),t}static createIfValid(e){if(!this.validate(e))return this.fromJS(e)}static process(e,t,s){return Object.assign({},e)}static normalize(e,t,s,i,r,n){const o=this.process(e,t,s),c=this.pk(o,t,s);if(void 0===c||""===c)return;const a=this.key;if(a in n||(n[a]={}),c in n[a]||(n[a][c]=[]),n[a][c].some((t=>t===e)))return c;const h=this.validate(o);if(h){const e=new Error(h);throw e.status=400,e}return n[a][c].push(e),Object.keys(this.schema).forEach((e=>{if(Object.hasOwn(o,e)){const t=this.schema[e];o[e]=i(o[e],o,e,t,r,n)}})),r(this,o,c),c}static validate(e){}static infer(e,t,s){if(!e[0])return;if(["string","number"].includes(typeof e[0]))return`${e[0]}`;const i=this.pk(e[0],void 0,"");if(void 0!==i&&""!==i)return i;const r=function(e,t){return t?t.find((t=>Object.hasOwn(e,t))):void 0}(e[0],this.indexes);if(r&&t[this.key]){return t[this.key][r][e[0][r]]}}static expiresAt(e,t){return e.expiresAt}static denormalize(e,i){if("symbol"==typeof e)return[void 0,!0,!0];if(t(e)){if(this.validate(e.toJS()))return[void 0,!1,!0];null==i.setLocal||i.setLocal(e);const[t,r,n]=s(this.schema,e,i);return[this.fromJS(t.toObject()),!0,n]}let r;if(e instanceof this)r=e;else{if(this.validate(e))return[void 0,!1,!0];r=this.fromJS(e),null==i.setLocal||i.setLocal(r)}let n=!1;return Object.keys(this.schema).forEach((t=>{const s=this.schema[t],o=e[t],[c,,a]=i(o,s);a&&this.defaults[t]&&(n=!0),e[t]!==c&&this.set(r,t,c)})),[r,!0,n]}static get defaults(){return Object.hasOwn(this,"__defaults")||(this.__defaults=new this),this.__defaults}static set(e,t,s){e[t]=s}}function h(e,t){e.type=e.sideEffect?"mutate":"read",e.options=Object.assign({},t),delete e.options.key,delete e.options.schema,delete e.options.sideEffect,delete e.options.fetch,delete e.options.getFetchKey,delete e.options.options,0===Object.keys(e.options).length&&delete e.options,void 0===e.schema&&(e.schema=null)}a.schema={},(()=>{const e="Entity"!==a.name?function(){return this.__keyErr||(console.error("Rest Hooks Error: https://resthooks.io/errors/dklj"),this.__keyErr=!0),this.name}:function(){return this.name};Object.defineProperty(a,"key",{get:e,set(e){Object.defineProperty(this,"key",{value:e,writable:!0,enumerable:!0})}})})();let u=!1;try{Function()}catch(e){u=!0,console.error("Content Security Policy: The previous CSP log can be safely ignored - @rest-hooks/endpoint will use setPrototypeOf instead")}class l extends Function{constructor(e,t){let s;return u?(s=(...e)=>s.fetch(...e),Object.setPrototypeOf(s,new.target.prototype)):(super("return arguments.callee.fetch.apply(arguments.callee, arguments)"),s=this),s.getFetchKey=e=>s.key(e),e&&(s.fetch=e),t&&"name"in t?(s.__name=t.name,delete t.name):e&&(s.__name=e.name),Object.assign(s,t),Object.defineProperty(s,"name",{get:function(){return this.__name}}),h(s,t),s}key(...e){return`${this.name} ${JSON.stringify(e)}`}bind(e,...t){const s=this.fetch,i=this.key;return this.extend({fetch(){return s.apply(null!=e?e:this,t)},key(){return i.apply(this,t)}})}extend(e){class t extends this.constructor{}Object.assign(t.prototype,this);const s=new t(e.fetch,e);return h(s,Object.assign({},this.options,e)),s}}"Endpoint"!==l.name&&(l.prototype.key=function(...e){return console.error("Rest Hooks Error: https://resthooks.io/errors/osid"),`${this.name} ${JSON.stringify(e)}`});const m=l;class d extends Error{}Object.hasOwn=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},e.AbortOptimistic=d,e.DELETED=o,e.Endpoint=l,e.Entity=a,e.ExtendableEndpoint=m,e.Index=class{constructor(e,t){this.getFetchKey=e=>this.key(e),this.schema=e,t&&(this.key=t)}key(e){return JSON.stringify(e)}},e.Query=class{constructor(e,t){this.sideEffect=void 0,this.schema=this.createQuerySchema(e),t?this.process=t:this.process||(this.process=e=>e)}key(...e){return`QUERY ${JSON.stringify(e)}`}createQuerySchema(e){const t=Object.create(e);return t.denormalize=({args:t,input:s},i)=>{if(void 0===s)return[void 0,!1,!0];const[r,n,o]=e.denormalize(s,i);return[n?this.process(r,...t):void 0,n,o]},t.infer=(t,s,i,r)=>({args:t,input:i(e,t,s,r)}),t}},e.schema=c,e.validateRequired=function(e,t){let s="";if(Object.keys(t).some((t=>!Object.hasOwn(e,t)&&(s=t,!0))))return`Missing key ${s}`},Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -89,4 +89,15 @@ function runCompat(endpoint, options) { | ||
} | ||
/* istanbul ignore next */ | ||
} | ||
(() => { | ||
/* istanbul ignore if */ | ||
if (Endpoint.name !== 'Endpoint') { | ||
Endpoint.prototype.key = function (...args) { | ||
console.error('Rest Hooks Error: https://resthooks.io/errors/osid'); | ||
return `${this.name} ${JSON.stringify(args)}`; | ||
}; | ||
} | ||
})(); | ||
export const ExtendableEndpoint = Endpoint; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJydW5Db21wYXQiLCJlbmRwb2ludCIsIm9wdGlvbnMiLCJ0eXBlIiwic2lkZUVmZmVjdCIsImtleSIsInNjaGVtYSIsImZldGNoIiwiZ2V0RmV0Y2hLZXkiLCJPYmplY3QiLCJrZXlzIiwibGVuZ3RoIiwidW5kZWZpbmVkIiwiQ1NQIiwiRnVuY3Rpb24iLCJlIiwiY29uc29sZSIsImVycm9yIiwiRW5kcG9pbnQiLCJjb25zdHJ1Y3RvciIsImZldGNoRnVuY3Rpb24iLCJzZWxmIiwiYXJncyIsInNldFByb3RvdHlwZU9mIiwibmV3IiwidGFyZ2V0IiwicHJvdG90eXBlIiwicGFyYW1zIiwiX19uYW1lIiwibmFtZSIsImFzc2lnbiIsImRlZmluZVByb3BlcnR5IiwiZ2V0IiwiSlNPTiIsInN0cmluZ2lmeSIsImJpbmQiLCJ0aGlzQXJnIiwiZmV0Y2hGdW5jIiwia2V5RnVuYyIsImV4dGVuZCIsImFwcGx5IiwiRSIsImluc3RhbmNlIiwiRXh0ZW5kYWJsZUVuZHBvaW50Il0sIn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tCLEdBQUd6QixRQUFRIn0= |
export * from './SnapshotInterface.js'; | ||
export {}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vc3JjL2ludGVyZmFjZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBBYnN0cmFjdEluc3RhbmNlVHlwZSwgRGVub3JtYWxpemUsIEVudGl0eU1hcCB9IGZyb20gJy4vbm9ybWFsLmpzJztcbmltcG9ydCB0eXBlIHsgRW5kcG9pbnRFeHRyYU9wdGlvbnMsIEZldGNoRnVuY3Rpb24gfSBmcm9tICcuL3R5cGVzLmpzJztcblxuZXhwb3J0ICogZnJvbSAnLi9TbmFwc2hvdEludGVyZmFjZS5qcyc7XG5cbmV4cG9ydCB0eXBlIFNjaGVtYSA9XG4gIHwgbnVsbFxuICB8IHN0cmluZ1xuICB8IHsgW0s6IHN0cmluZ106IGFueSB9XG4gIHwgU2NoZW1hW11cbiAgfCBTY2hlbWFTaW1wbGVcbiAgfCBTZXJpYWxpemFibGU7XG5cbmV4cG9ydCB0eXBlIFNlcmlhbGl6YWJsZTxcbiAgVCBleHRlbmRzIHsgdG9KU09OKCk6IHN0cmluZyB9ID0geyB0b0pTT04oKTogc3RyaW5nIH0sXG4+ID0ge1xuICBwcm90b3R5cGU6IFQ7XG59O1xuXG5leHBvcnQgaW50ZXJmYWNlIFNjaGVtYVNpbXBsZTxUID0gYW55PiB7XG4gIG5vcm1hbGl6ZShcbiAgICBpbnB1dDogYW55LFxuICAgIHBhcmVudDogYW55LFxuICAgIGtleTogYW55LFxuICAgIHZpc2l0OiAoLi4uYXJnczogYW55KSA9PiBhbnksXG4gICAgYWRkRW50aXR5OiAoLi4uYXJnczogYW55KSA9PiBhbnksXG4gICAgdmlzaXRlZEVudGl0aWVzOiBSZWNvcmQ8c3RyaW5nLCBhbnk+LFxuICApOiBhbnk7XG4gIGRlbm9ybWFsaXplK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Xhwb3J0IHR5cGUgUmVhZEVuZHBvaW50PFxuICBGIGV4dGVuZHMgRmV0Y2hGdW5jdGlvbiA9IEZldGNoRnVuY3Rpb24sXG4gIFMgZXh0ZW5kcyBTY2hlbWEgfCB1bmRlZmluZWQgPSBTY2hlbWEgfCB1bmRlZmluZWQsXG4+ID0gRW5kcG9pbnRJbnRlcmZhY2U8RiwgUywgdW5kZWZpbmVkPjtcbiJdLCJtYXBwaW5ncyI6IkFBR0EsY0FBYyx3QkFBd0I7QUFBQyJ9 |
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
import { isImmutable, denormalizeImmutable } from './ImmutableUtils.js'; | ||
/** | ||
@@ -20,11 +19,2 @@ * Represents data that should be deduped by specifying a primary key. | ||
/** Returns the globally unique identifier for the static Entity */ | ||
static get key() { | ||
/* istanbul ignore next */ | ||
if (process.env.NODE_ENV !== 'production' && (this.name === '' || this.name === 'Entity' || this.name === '_temp')) throw new Error('Entity classes without a name must define `static get key()`'); | ||
return this.name; | ||
} | ||
/** Defines indexes to enable lookup by */ | ||
/** | ||
@@ -71,4 +61,2 @@ * A unique identifier for each Entity | ||
* @param [props] Plain Object of properties to assign. | ||
* @param [parent] When normalizing, the object which included the record | ||
* @param [key] When normalizing, the key where this record was found | ||
*/ | ||
@@ -86,2 +74,15 @@ static fromJS( | ||
/** Factory method to convert from Plain JS Objects. | ||
* | ||
* @param [props] Plain Object of properties to assign. | ||
*/ | ||
static createIfValid( | ||
// TODO: this should only accept members that are not functions | ||
props) { | ||
if (this.validate(props)) { | ||
return undefined; | ||
} | ||
return this.fromJS(props); | ||
} | ||
/** Do any transformations when first receiving input */ | ||
@@ -264,2 +265,3 @@ static process(input, parent, key) { | ||
} | ||
// TODO(breaking): Remove fromJS and setLocal call once old versions are no longer supported | ||
if (isImmutable(input)) { | ||
@@ -271,11 +273,18 @@ if (this.validate(input.toJS())) return [undefined, false, true]; | ||
const [denormEntity, found, deleted] = denormalizeImmutable(this.schema, input, unvisit); | ||
return [this.fromJS(denormEntity.toObject()), found, deleted]; | ||
return [this.fromJS(denormEntity.toObject()), true, deleted]; | ||
} | ||
if (this.validate(input)) { | ||
return [undefined, false, true]; | ||
let entityCopy; | ||
// new path | ||
if (input instanceof this) { | ||
entityCopy = input; | ||
// TODO(breaking): Remove fromJS and setLocal call once old versions are no longer supported | ||
} else { | ||
if (this.validate(input)) { | ||
return [undefined, false, true]; | ||
} | ||
entityCopy = this.fromJS(input); | ||
// Need to set this first so that if it is referenced further within the | ||
// denormalization the reference will already exist. | ||
unvisit.setLocal == null ? void 0 : unvisit.setLocal(entityCopy); | ||
} | ||
const entityCopy = this.fromJS(input); | ||
// Need to set this first so that if it is referenced further within the | ||
// denormalization the reference will already exist. | ||
unvisit.setLocal == null ? void 0 : unvisit.setLocal(entityCopy); | ||
let deleted = false; | ||
@@ -286,8 +295,8 @@ | ||
const schema = this.schema[key]; | ||
const nextInput = Object.hasOwn(input, key) ? input[key] : undefined; | ||
const nextInput = input[key]; | ||
const [value,, deletedItem] = unvisit(nextInput, schema); | ||
if (deletedItem && !(Object.hasOwn(input, key) && !this.defaults[key])) { | ||
if (deletedItem && !!this.defaults[key]) { | ||
deleted = true; | ||
} | ||
if (Object.hasOwn(input, key) && input[key] !== value) { | ||
if (input[key] !== value) { | ||
this.set(entityCopy, key, value); | ||
@@ -308,2 +317,4 @@ } | ||
} | ||
/* istanbul ignore next */ | ||
} | ||
@@ -313,2 +324,27 @@ | ||
Entity.schema = {}; | ||
(() => { | ||
const get = /* istanbul ignore if */ | ||
Entity.name !== 'Entity' ? /* istanbul ignore next */function () { | ||
if (!this.__keyErr) { | ||
console.error('Rest Hooks Error: https://resthooks.io/errors/dklj'); | ||
this.__keyErr = true; | ||
} | ||
return this.name; | ||
} : function () { | ||
/* istanbul ignore next */ | ||
if (process.env.NODE_ENV !== 'production' && (this.name === '' || this.name === 'Entity' || this.name === '_temp')) throw new Error('Entity classes without a name must define `static key`\nSee: https://resthooks.io/rest/api/Entity#key'); | ||
return this.name; | ||
}; | ||
Object.defineProperty(Entity, 'key', { | ||
get, | ||
// this allows assignment in strict-mode | ||
set(value) { | ||
Object.defineProperty(this, 'key', { | ||
value, | ||
writable: true, | ||
enumerable: true | ||
}); | ||
} | ||
}); | ||
})(); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -327,2 +363,2 @@ const superFrom = Entity.fromJS; | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsImRlbm9ybWFsaXplSW1tdXRhYmxlIiwiRW50aXR5IiwidG9KU09OIiwibmFtZSIsInNjaGVtYSIsImtleSIsInByb2Nlc3MiLCJlbnYiLCJOT0RFX0VOViIsIkVycm9yIiwicGsiLCJ2YWx1ZSIsInBhcmVudCIsInByb3RvdHlwZSIsImNhbGwiLCJ1c2VJbmNvbWluZyIsImV4aXN0aW5nTWV0YSIsImluY29taW5nTWV0YSIsImV4aXN0aW5nIiwiaW5jb21pbmciLCJmZXRjaGVkQXQiLCJtZXJnZSIsIm1lcmdlV2l0aFN0b3JlIiwiZnJvbUpTIiwicHJvcHMiLCJpbnN0YW5jZSIsIk9iamVjdCIsImFzc2lnbiIsImlucHV0IiwiYXV0b21hdGljVmFsaWRhdGlvbiIsIkFycmF5IiwiaXNBcnJheSIsImVycm9yTWVzc2FnZSIsIkpTT04iLCJzdHJpbmdpZnkiLCJzbGljZSIsImVycm9yIiwic3RhdHVzIiwiY29uc29sZSIsIndhcm4iLCJub3JtYWxpemUiLCJ2aXNpdCIsImFkZEVudGl0eSIsInZpc2l0ZWRFbnRpdGllcyIsInByb2Nlc3NlZEVudGl0eSIsImlkIiwidW5kZWZpbmVkIiwiZW50aXR5VHlwZSIsInNvbWUiLCJlbnRpdHkiLCJ2YWxpZGF0ZSIsInB1c2giLCJrZXlzIiwiZm9yRWFjaCIsImhhc093biIsImtleXNPZlJlY29yZCIsIlNldCIsImRlZmF1bHRzIiwia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J19fZGVmYXVsdHMnKSlcbiAgICAgIHRoaXMuX19kZWZhdWx0cyA9IG5ldyAodGhpcyBhcyBhbnkpKCk7XG4gICAgcmV0dXJuIHRoaXMuX19kZWZhdWx0cztcbiAgfVxuXG4gIC8qKiBVc2VkIGJ5IGRlbm9ybWFsaXplIHRvIHNldCBuZXN0ZWQgbWVtYmVycyAqL1xuICBwcm90ZWN0ZWQgc3RhdGljIHNldChlbnRpdHk6IGFueSwga2V5OiBzdHJpbmcsIHZhbHVlOiBhbnkpIHtcbiAgICBlbnRpdHlba2V5XSA9IHZhbHVlO1xuICB9XG5cbiAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgc3RhdGljIHtcbiAgICBjb25zdCBnZXQgPVxuICAgICAgLyogaXN0YW5idWwgaWdub3JlIGlmICovXG4gICAgICB0aGlzLm5hbWUgIT09ICdFbnRpdHknXG4gICAgICAgID8gLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi8gZnVuY3Rpb24gKHRoaXM6IHtcbiAgICAgICAgICAgIG5hbWU6IHN0cmluZztcbiAgICAgICAgICAgIF9fa2V5RXJyPzogYm9vbGVhbjtcbiAgICAgICAgICB9KTogc3RyaW5nIHtcbiAgICAgICAgICAgIGlmICghdGhpcy5fX2tleUVycikge1xuICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKFxuICAgICAgICAgICAgICAgICdSZXN0IEhvb2tzIEVycm9yOiBodHRwczovL3Jlc3Rob29rcy5pby9lcnJvcnMvZGtsaicsXG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgIHRoaXMuX19rZXlFcnIgPSB0cnVlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRoaXMubmFtZTtcbiAgICAgICAgICB9XG4gICAgICAgIDogZnVuY3Rpb24gKHRoaXM6IHsgbmFtZTogc3RyaW5nIH0pOiBzdHJpbmcge1xuICAgICAgICAgICAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICAgcHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09ICdwcm9kdWN0aW9uJyAmJlxuICAgICAgICAgICAgICAodGhpcy5uYW1lID09PSAnJyB8fFxuICAgICAgICAgICAgICAgIHRoaXMubmFtZSA9PT0gJ0VudGl0eScgfHxcbiAgICAgICAgICAgICAgICB0aGlzLm5hbWUgPT09ICdfdGVtcCcpXG4gICAgICAgICAgICApXG4gICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcbiAgICAgICAgICAgICAgICAnRW50aXR5IGNsYXNzZXMgd2l0aG91dCBhIG5hbWUgbXVzdCBkZWZpbmUgYHN0YXRpYyBrZXlgXFxuU2VlOiBodHRwczovL3Jlc3Rob29rcy5pby9yZXN0L2FwaS9FbnRpdHkja2V5JyxcbiAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLm5hbWU7XG4gICAgICAgICAgfTtcblxuICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCAna2V5Jywge1xuICAgICAgZ2V0LFxuICAgICAgLy8gdGhpcyBhbGxvd3MgYXNzaWdubWVudCBpbiBzdHJpY3QtbW9kZVxuICAgICAgc2V0KHZhbHVlOiBzdHJpbmcpIHtcbiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsICdrZXknLCB7XG4gICAgICAgICAgdmFsdWUsXG4gICAgICAgICAgd3JpdGFibGU6IHRydWUsXG4gICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSxcbiAgICAgICAgfSk7XG4gICAgICB9LFxuICAgIH0pO1xuICB9XG59XG5cbi8qIGlzdGFuYnVsIGlnbm9yZSBlbHNlICovXG5pZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09ICdwcm9kdWN0aW9uJykge1xuICBjb25zdCBzdXBlckZyb20gPSBFbnRpdHkuZnJvbUpTO1xuICAvLyBmb3IgdGhvc2Ugbm90IHVzaW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DZDtJQUN6QixJQUFLLElBQUksQ0FBU1gsU0FBUyxDQUFDSCxFQUFFLEtBQUtvQixTQUFTLEVBQzFDLE1BQU0sSUFBSWEsS0FBSyxDQUFDLG9DQUFvQyxDQUFDO0lBQ3ZELE9BQU84RCxTQUFTLENBQUMzRixJQUFJLENBQUMsSUFBSSxFQUFFVSxLQUFLLENBQUM7RUFDcEMsQ0FBQztBQUNIO0FBRUEsU0FBUzZELGVBQWUsQ0FDdEJxQixNQUF3QixFQUN4QnhCLE9BQXVCLEVBQ3ZCO0VBQ0EsSUFBSSxDQUFDQSxPQUFPLEVBQUUsT0FBT3BELFNBQVM7RUFDOUIsT0FBT29ELE9BQU8sQ0FBQ3lCLElBQUksQ0FBQ0MsS0FBSyxJQUFJbEYsTUFBTSxDQUFDaUMsTUFBTSxDQUFDK0MsTUFBTSxFQUFFRSxLQUFLLENBQUMsQ0FBQztBQUM1RCJ9 |
@@ -94,4 +94,15 @@ function runCompat(endpoint, options) { | ||
} | ||
/* istanbul ignore next */ | ||
} | ||
(() => { | ||
/* istanbul ignore if */ | ||
if (Endpoint.name !== 'Endpoint') { | ||
Endpoint.prototype.key = function (...args) { | ||
console.error('Rest Hooks Error: https://resthooks.io/errors/osid'); | ||
return `${this.name} ${JSON.stringify(args)}`; | ||
}; | ||
} | ||
})(); | ||
export const ExtendableEndpoint = Endpoint; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJydW5Db21wYXQiLCJlbmRwb2ludCIsIm9wdGlvbnMiLCJ0eXBlIiwic2lkZUVmZmVjdCIsImtleSIsInNjaGVtYSIsImZldGNoIiwiZ2V0RmV0Y2hLZXkiLCJPYmplY3QiLCJrZXlzIiwibGVuZ3RoIiwidW5kZWZpbmVkIiwiQ1NQIiwiRnVuY3Rpb24iLCJlIiwiY29uc29sZSIsImVycm9yIiwiRW5kcG9pbnQiLCJjb25zdHJ1Y3RvciIsImZldGNoRnVuY3Rpb24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JHO0VBQ0EsSUF0RWlCeEIsUUFBUSxDQXNFaEJXLElBQUksS0FBSyxVQUFVLEVBQUU7SUF0RWJYLFFBQVEsQ0F1RWxCUSxTQUFTLENBQUNyQixHQUFHLEdBQUcsVUFBVSxHQUFHaUIsSUFBSSxFQUFFO01BQ3RDTixPQUFPLENBQUNDLEtBQUssQ0FBQyxvREFBb0QsQ0FBQztNQUNuRSxPQUFRLEdBQUUsSUFBSSxDQUFDWSxJQUFLLElBQUdJLElBQUksQ0FBQ0MsU0FBUyxDQUFDWixJQUFJLENBQUUsRUFBQztJQUMvQyxDQUFDO0VBQ0g7QUFBQztBQUdMLE9BQU8sTUFBTXFCLGtCQUFrQixHQUFHekIsUUFBUSJ9 |
@@ -23,2 +23,3 @@ import type { EndpointExtraOptions, FetchFunction } from './types.js'; | ||
export interface EntityInterface<T = any> extends SchemaSimple { | ||
createIfValid?(props: any): any; | ||
pk(params: any, parent?: any, key?: string): string | undefined; | ||
@@ -28,2 +29,3 @@ readonly key: string; | ||
expiresAt?(meta: any, input: any): number; | ||
mergeWithStore?(existingMeta: any, incomingMeta: any, existing: any, incoming: any): any; | ||
useIncoming?(existingMeta: any, incomingMeta: any, existing: any, incoming: any): boolean; | ||
@@ -30,0 +32,0 @@ indexes?: any; |
export * from './SnapshotInterface.js'; | ||
export {}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vc3JjL2ludGVyZmFjZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBBYnN0cmFjdEluc3RhbmNlVHlwZSwgRGVub3JtYWxpemUsIEVudGl0eU1hcCB9IGZyb20gJy4vbm9ybWFsLmpzJztcbmltcG9ydCB0eXBlIHsgRW5kcG9pbnRFeHRyYU9wdGlvbnMsIEZldGNoRnVuY3Rpb24gfSBmcm9tICcuL3R5cGVzLmpzJztcblxuZXhwb3J0ICogZnJvbSAnLi9Tb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cnVlIHwgdW5kZWZpbmVkID0gdHJ1ZSB8IHVuZGVmaW5lZCxcbj4gZXh0ZW5kcyBFbmRwb2ludEV4dHJhT3B0aW9uczxGPiB7XG4gICguLi5hcmdzOiBQYXJhbWV0ZXJzPEY+KTogUmV0dXJuVHlwZTxGPjtcbiAga2V5KC4uLmFyZ3M6IFBhcmFtZXRlcnM8Rj4pOiBzdHJpbmc7XG4gIHJlYWRvbmx5IHNpZGVFZmZlY3Q/OiBNO1xuICByZWFkb25seSBzY2hlbWE/OiBTO1xufVxuXG4vKiogVG8gY2hhbmdlIHZhbHVlcyBvbiB0aGUgc2VydmVyICovXG5leHBvcnQgaW50ZXJmYWNlIE11dGF0ZUVuZHBvaW50PFxuICBGIGV4dGVuZHMgRmV0Y2hGdW5jdGlvbiA9IEZldGNoRnVuY3Rpb24sXG4gIFMgZXh0ZW5kcyBTY2hlbWEgfCB1bmRlZmluZWQgPSBTY2hlbWEgfCB1bmRlZmluZWQsXG4+IGV4dGVuZHMgRW5kcG9pbnRJbnRlcmZhY2U8RiwgUywgdHJ1ZT4ge1xuICBzaWRlRWZmZWN0OiB0cnVlO1xufVxuXG4vKiogRm9yIHJldHJpZXZhbCByZXF1ZXN0cyAqL1xuZXhwb3J0IHR5cGUgUmVhZEVuZHBvaW50PFxuICBGIGV4dGVuZHMgRmV0Y2hGdW5jdGlvbiA9IEZldGNoRnVuY3Rpb24sXG4gIFMgZXh0ZW5kcyBTY2hlbWEgfCB1bmRlZmluZWQgPSBTY2hlbWEgfCB1bmRlZmluZWQsXG4+ID0gRW5kcG9pbnRJbnRlcmZhY2U8RiwgUywgdW5kZWZpbmVkPjtcbiJdLCJtYXBwaW5ncyI6IkFBR0EsY0FBYyx3QkFBd0I7QUFBQyJ9 |
@@ -27,3 +27,3 @@ import type { Schema, NormalizedIndex, UnvisitFunction } from '../interface.js'; | ||
/** Returns the globally unique identifier for the static Entity */ | ||
static get key(): string; | ||
static key: string; | ||
/** Defines indexes to enable lookup by */ | ||
@@ -69,6 +69,9 @@ static indexes?: readonly string[]; | ||
* @param [props] Plain Object of properties to assign. | ||
* @param [parent] When normalizing, the object which included the record | ||
* @param [key] When normalizing, the key where this record was found | ||
*/ | ||
static fromJS<T extends typeof Entity>(this: T, props?: Partial<AbstractInstanceType<T>>): AbstractInstanceType<T>; | ||
/** Factory method to convert from Plain JS Objects. | ||
* | ||
* @param [props] Plain Object of properties to assign. | ||
*/ | ||
static createIfValid<T extends typeof Entity>(this: T, props: Partial<AbstractInstanceType<T>>): AbstractInstanceType<T> | undefined; | ||
/** Do any transformations when first receiving input */ | ||
@@ -75,0 +78,0 @@ static process(input: any, parent: any, key: string | undefined): any; |
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
import { isImmutable, denormalizeImmutable } from './ImmutableUtils.js'; | ||
/** | ||
@@ -20,11 +19,2 @@ * Represents data that should be deduped by specifying a primary key. | ||
/** Returns the globally unique identifier for the static Entity */ | ||
static get key() { | ||
/* istanbul ignore next */ | ||
if (process.env.NODE_ENV !== 'production' && (this.name === '' || this.name === 'Entity' || this.name === '_temp')) throw new Error('Entity classes without a name must define `static get key()`'); | ||
return this.name; | ||
} | ||
/** Defines indexes to enable lookup by */ | ||
/** | ||
@@ -74,4 +64,2 @@ * A unique identifier for each Entity | ||
* @param [props] Plain Object of properties to assign. | ||
* @param [parent] When normalizing, the object which included the record | ||
* @param [key] When normalizing, the key where this record was found | ||
*/ | ||
@@ -89,2 +77,15 @@ static fromJS( | ||
/** Factory method to convert from Plain JS Objects. | ||
* | ||
* @param [props] Plain Object of properties to assign. | ||
*/ | ||
static createIfValid( | ||
// TODO: this should only accept members that are not functions | ||
props) { | ||
if (this.validate(props)) { | ||
return undefined; | ||
} | ||
return this.fromJS(props); | ||
} | ||
/** Do any transformations when first receiving input */ | ||
@@ -269,2 +270,3 @@ static process(input, parent, key) { | ||
} | ||
// TODO(breaking): Remove fromJS and setLocal call once old versions are no longer supported | ||
if (isImmutable(input)) { | ||
@@ -276,11 +278,18 @@ if (this.validate(input.toJS())) return [undefined, false, true]; | ||
const [denormEntity, found, deleted] = denormalizeImmutable(this.schema, input, unvisit); | ||
return [this.fromJS(denormEntity.toObject()), found, deleted]; | ||
return [this.fromJS(denormEntity.toObject()), true, deleted]; | ||
} | ||
if (this.validate(input)) { | ||
return [undefined, false, true]; | ||
let entityCopy; | ||
// new path | ||
if (input instanceof this) { | ||
entityCopy = input; | ||
// TODO(breaking): Remove fromJS and setLocal call once old versions are no longer supported | ||
} else { | ||
if (this.validate(input)) { | ||
return [undefined, false, true]; | ||
} | ||
entityCopy = this.fromJS(input); | ||
// Need to set this first so that if it is referenced further within the | ||
// denormalization the reference will already exist. | ||
unvisit.setLocal == null ? void 0 : unvisit.setLocal(entityCopy); | ||
} | ||
const entityCopy = this.fromJS(input); | ||
// Need to set this first so that if it is referenced further within the | ||
// denormalization the reference will already exist. | ||
unvisit.setLocal == null ? void 0 : unvisit.setLocal(entityCopy); | ||
let deleted = false; | ||
@@ -291,8 +300,8 @@ | ||
const schema = this.schema[key]; | ||
const nextInput = Object.hasOwn(input, key) ? input[key] : undefined; | ||
const nextInput = input[key]; | ||
const [value,, deletedItem] = unvisit(nextInput, schema); | ||
if (deletedItem && !(Object.hasOwn(input, key) && !this.defaults[key])) { | ||
if (deletedItem && !!this.defaults[key]) { | ||
deleted = true; | ||
} | ||
if (Object.hasOwn(input, key) && input[key] !== value) { | ||
if (input[key] !== value) { | ||
this.set(entityCopy, key, value); | ||
@@ -313,2 +322,4 @@ } | ||
} | ||
/* istanbul ignore next */ | ||
} | ||
@@ -318,2 +329,27 @@ | ||
Entity.schema = {}; | ||
(() => { | ||
const get = /* istanbul ignore if */ | ||
Entity.name !== 'Entity' ? /* istanbul ignore next */function () { | ||
if (!this.__keyErr) { | ||
console.error('Rest Hooks Error: https://resthooks.io/errors/dklj'); | ||
this.__keyErr = true; | ||
} | ||
return this.name; | ||
} : function () { | ||
/* istanbul ignore next */ | ||
if (process.env.NODE_ENV !== 'production' && (this.name === '' || this.name === 'Entity' || this.name === '_temp')) throw new Error('Entity classes without a name must define `static key`\nSee: https://resthooks.io/rest/api/Entity#key'); | ||
return this.name; | ||
}; | ||
Object.defineProperty(Entity, 'key', { | ||
get, | ||
// this allows assignment in strict-mode | ||
set(value) { | ||
Object.defineProperty(this, 'key', { | ||
value, | ||
writable: true, | ||
enumerable: true | ||
}); | ||
} | ||
}); | ||
})(); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -332,2 +368,2 @@ const superFrom = Entity.fromJS; | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsImRlbm9ybWFsaXplSW1tdXRhYmxlIiwiRW50aXR5IiwidG9KU09OIiwibmFtZSIsInNjaGVtYSIsImtleSIsInByb2Nlc3MiLCJlbnYiLCJOT0RFX0VOViIsIkVycm9yIiwicGsiLCJ2YWx1ZSIsInBhcmVudCIsInByb3RvdHlwZSIsImNhbGwiLCJ1c2VJbmNvbWluZyIsImV4aXN0aW5nTWV0YSIsImluY29taW5nTWV0YSIsImV4aXN0aW5nIiwiaW5jb21pbmciLCJmZXRjaGVkQXQiLCJtZXJnZSIsIm1lcmdlV2l0aFN0b3JlIiwiZnJvbUpTIiwicHJvcHMiLCJpbnN0YW5jZSIsIk9iamVjdCIsImFzc2lnbiIsImlucHV0IiwiYXV0b21hdGljVmFsaWRhdGlvbiIsIkFycmF5IiwiaXNBcnJheSIsImVycm9yTWVzc2FnZSIsIkpTT04iLCJzdHJpbmdpZnkiLCJzbGljZSIsImVycm9yIiwic3RhdHVzIiwiY29uc29sZSIsIndhcm4iLCJub3JtYWxpemUiLCJ2aXNpdCIsImFkZEVudGl0eSIsInZpc2l0ZWRFbnRpdGllcyIsInByb2Nlc3NlZEVudGl0eSIsImlkIiwidW5kZWZpbmVkIiwiZW50aXR5VHlwZSIsInNvbWUiLCJlbnRpdHkiLCJ2YWxpZGF0ZSIsIn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FBQzBDLE1BQU0sRUFBRUUsS0FBSyxDQUFDLENBQUM7QUFDNUQifQ== | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsImRlbm9ybWFsaXplSW1tdXRhYmxlIiwiRW50aXR5IiwidG9KU09OIiwibmFtZSIsInNjaGVtYSIsImtleSIsInBrIiwidmFsdWUiLCJwYXJlbnQiLCJwcm90b3R5cGUiLCJjYWxsIiwidXNlSW5jb21pbmciLCJleGlzdGluZ01ldGEiLCJpbmNvbWluZ01ldGEiLCJleGlzdGluZyIsImluY29taW5nIiwiZmV0Y2hlZEF0IiwibWVyZ2UiLCJtZXJnZVdpdGhTdG9yZSIsImZyb21KUyIsInByb3BzIiwiaW5zdGFuY2UiLCJPYmplY3QiLCJhc3NpZ24iLCJjcmVhdGVJZlZhbGlkIiwidmFsaWRhdGUiLCJ1bmRlZmluZWQiLCJwcm9jZXNzIiwiaW5wdXQiLCJlbnYiLCJOT0RFX0VOViIsImF1dG9tYXRpY1ZhbGlkYXRpb24iLCJBcnJheSIsImlzQXJyYXkiLCJlcnJvck1lc3NhZ2UiLCJKU09OIiwic3RyaW5naWZ5Iiwic2xpY2UiLCJlcnJvciIsIkVycm9yIiwic3RhdHVzIiwiY29uc29sZSIsIndhcm4iLCJub3JtYWxpemUiLCJ2aXNpdCIsImFkZEVudGl0eSIsInZpc2l0ZWRFbnRpdGllcyIsInByb2Nlc3NlZEVudGl0eSIsImlkIiwiZW50aXR5VHlwZSIsInNvbWUiLCJlbnRpdHkiLCJwdXNoIiwia2V5cyIsImZvckVhY2giLCJoYXNPd24iLCJrZXlzT2ZSZWNvcmQiLCJTZXQiLCJkZWZhdWx0cyIsImtleXNPZlByb3BzIiwiZm91bmQiLCJtaXNzaW5nIiwidW5leHBlY3RlZCIsImtleU9mUHJvcHMiLCJoYXMiLCJrZXlPZlJlY29yZCIsImluY2x1ZGVzIiwic2l6ZSIsInRv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QWxsIGluc3RhbmNlIGRlZmF1bHRzIHNldCAqL1xuICBwcm90ZWN0ZWQgc3RhdGljIGdldCBkZWZhdWx0cygpIHtcbiAgICBpZiAoIU9iamVjdC5oYXNPd24odGhpcywgJ19fZGVmYXVsdHMnKSlcbiAgICAgIHRoaXMuX19kZWZhdWx0cyA9IG5ldyAodGhpcyBhcyBhbnkpKCk7XG4gICAgcmV0dXJuIHRoaXMuX19kZWZhdWx0cztcbiAgfVxuXG4gIC8qKiBVc2VkIGJ5IGRlbm9ybWFsaXplIHRvIHNldCBuZXN0ZWQgbWVtYmVycyAqL1xuICBwcm90ZWN0ZWQgc3RhdGljIHNldChlbnRpdHk6IGFueSwga2V5OiBzdHJpbmcsIHZhbHVlOiBhbnkpIHtcbiAgICBlbnRpdHlba2V5XSA9IHZhbHVlO1xuICB9XG5cbiAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgc3RhdGljIHtcbiAgICBjb25zdCBnZXQgPVxuICAgICAgLyogaXN0YW5idWwgaWdub3JlIGlmICovXG4gICAgICB0aGlzLm5hbWUgIT09ICdFbnRpdHknXG4gICAgICAgID8gLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi8gZnVuY3Rpb24gKHRoaXM6IHtcbiAgICAgICAgICAgIG5hbWU6IHN0cmluZztcbiAgICAgICAgICAgIF9fa2V5RXJyPzogYm9vbGVhbjtcbiAgICAgICAgICB9KTogc3RyaW5nIHtcbiAgICAgICAgICAgIGlmICghdGhpcy5fX2tleUVycikge1xuICAgICAgICAgICAgICBjb25zb2xlLmVycm9yKFxuICAgICAgICAgICAgICAgICdSZXN0IEhvb2tzIEVycm9yOiBodHRwczovL3Jlc3Rob29rcy5pby9lcnJvcnMvZGtsaicsXG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgIHRoaXMuX19rZXlFcnIgPSB0cnVlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRoaXMubmFtZTtcbiAgICAgICAgICB9XG4gICAgICAgIDogZnVuY3Rpb24gKHRoaXM6IHsgbmFtZTogc3RyaW5nIH0pOiBzdHJpbmcge1xuICAgICAgICAgICAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICAgcHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09ICdwcm9kdWN0aW9uJyAmJlxuICAgICAgICAgICAgICAodGhpcy5uYW1lID09PSAnJyB8fFxuICAgICAgICAgICAgICAgIHRoaXMubmFtZSA9PT0gJ0VudGl0eScgfHxcbiAgICAgICAgICAgICAgICB0aGlzLm5hbWUgPT09ICdfdGVtcCcpXG4gICAgICAgICAgICApXG4gICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcbiAgICAgICAgICAgICAgICAnRW50aXR5IGNsYXNzZXMgd2l0aG91dCBhIG5hbWUgbXVzdCBkZWZpbmUgYHN0YXRpYyBrZXlgXFxuU2VlOiBodHRwczovL3Jlc3Rob29rcy5pby9yZXN0L2FwaS9FbnRpdHkja2V5JyxcbiAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLm5hbWU7XG4gICAgICAgICAgfTtcblxuICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCAna2V5Jywge1xuICAgICAgZ2V0LFxuICAgICAgLy8gdGhpcyBhbGxvd3MgYXNzaWdubWVudCBpbiBzdHJpY3QtbW9kZVxuICAgICAgc2V0KHZhbHVlOiBzdHJpbmcpIHtcbiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsICdrZXknLCB7XG4gICAgICAgICAgdmFsdWUsXG4gICAgICAgICAgd3JpdGFibGU6IHRydWUsXG4gICAgICAgICAgZW51bWVyYWJsZTogdHJ1ZSxcbiAgICAgICAgfSk7XG4gICAgICB9LFxuICAgIH0pO1xuICB9XG59XG5cbi8qIGlzdGFuYnVsIGlnbm9yZSBlbHNlICovXG5pZiAocHJvY2Vz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VksRUFBRTtFQUN6QyxNQUFNdUUsU0FBUyxHQUFHcEcsTUFBTSxDQUFDa0IsTUFBTTtFQUMvQjtFQUNBO0VBQ0FsQixNQUFNLENBQUNrQixNQUFNLEdBQUcsU0FBU0EsTUFBTSxDQUU3QkMsS0FBdUMsRUFDZDtJQUN6QixJQUFLLElBQUksQ0FBU1gsU0FBUyxDQUFDSCxFQUFFLEtBQUtvQixTQUFTLEVBQzFDLE1BQU0sSUFBSWEsS0FBSyxDQUFDLG9DQUFvQyxDQUFDO0lBQ3ZELE9BQU84RCxTQUFTLENBQUMzRixJQUFJLENBQUMsSUFBSSxFQUFFVSxLQUFLLENBQUM7RUFDcEMsQ0FBQztBQUNIO0FBRUEsU0FBUzZELGVBQWUsQ0FDdEJxQixNQUF3QixFQUN4QnhCLE9BQXVCLEVBQ3ZCO0VBQ0EsSUFBSSxDQUFDQSxPQUFPLEVBQUUsT0FBT3BELFNBQVM7RUFDOUIsT0FBT29ELE9BQU8sQ0FBQ3lCLElBQUksQ0FBQ0MsS0FBSyxJQUFJbEYsTUFBTSxDQUFDaUMsTUFBTSxDQUFDK0MsTUFBTSxFQUFFRSxLQUFLLENBQUMsQ0FBQztBQUM1RCJ9 |
{ | ||
"name": "@rest-hooks/endpoint", | ||
"version": "3.4.1", | ||
"version": "3.5.0", | ||
"description": "Declarative Network Interface Definitions", | ||
@@ -53,4 +53,4 @@ "sideEffects": false, | ||
"scripts": { | ||
"build:lib": "NODE_ENV=production BROWSERSLIST_ENV='2020' babel --root-mode upward src --out-dir lib --source-maps inline --extensions '.ts,.tsx,.js' --ignore '**/__tests__/**' --ignore '**/*.d.ts'", | ||
"build:legacy:lib": "NODE_ENV=production BROWSERSLIST_ENV='2018' babel --root-mode upward src --out-dir legacy --source-maps inline --extensions '.ts,.tsx,.js' --ignore '**/__tests__/**' --ignore '**/*.d.ts'", | ||
"build:lib": "NODE_ENV=production BROWSERSLIST_ENV='2020' babel --root-mode upward src --out-dir lib --extensions '.ts,.tsx,.js' --ignore '**/__tests__/**' --ignore '**/*.d.ts'", | ||
"build:legacy:lib": "NODE_ENV=production BROWSERSLIST_ENV='2018' babel --root-mode upward src --out-dir legacy --extensions '.ts,.tsx,.js' --ignore '**/__tests__/**' --ignore '**/*.d.ts'", | ||
"build:js:node": "BROWSERSLIST_ENV=node12 rollup -c", | ||
@@ -119,5 +119,5 @@ "build:js:browser": "BROWSERSLIST_ENV=legacy rollup -c", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"typescript": "4.9.4" | ||
"typescript": "4.9.5" | ||
}, | ||
"gitHead": "45b40604ea463629e63808964090c4f2a175172c" | ||
"gitHead": "26fbbe5cf048e85986b06f35f04d1409c24b6a71" | ||
} |
@@ -99,3 +99,14 @@ function runCompat(endpoint, options) { | ||
} | ||
/* istanbul ignore next */ | ||
static { | ||
/* istanbul ignore if */ | ||
if (this.name !== 'Endpoint') { | ||
this.prototype.key = function (...args) { | ||
console.error('Rest Hooks Error: https://resthooks.io/errors/osid'); | ||
return `${this.name} ${JSON.stringify(args)}`; | ||
}; | ||
} | ||
} | ||
} | ||
export const ExtendableEndpoint = Endpoint; |
@@ -51,2 +51,3 @@ import { AbstractInstanceType, Denormalize, EntityMap } from './normal.js'; | ||
export interface EntityInterface<T = any> extends SchemaSimple { | ||
createIfValid?(props: any): any; | ||
pk(params: any, parent?: any, key?: string): string | undefined; | ||
@@ -56,2 +57,9 @@ readonly key: string; | ||
expiresAt?(meta: any, input: any): number; | ||
mergeWithStore?( | ||
existingMeta: any, | ||
incomingMeta: any, | ||
existing: any, | ||
incoming: any, | ||
): any; | ||
// TODO(breaking): deprecate this | ||
useIncoming?( | ||
@@ -58,0 +66,0 @@ existingMeta: any, |
@@ -730,7 +730,9 @@ // eslint-env jest | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
const de1 = denormalize('1', Menu, entities); | ||
expect(de1).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toEqual(de1); | ||
expect(denormalize('2', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toMatchSnapshot(); | ||
const de2 = denormalize('2', Menu, entities); | ||
expect(de2).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toEqual(de2); | ||
}); | ||
@@ -1132,3 +1134,3 @@ | ||
[WithOptional.key]: { | ||
abc: WithOptional.fromJS({ | ||
abc: { | ||
id: 'abc', | ||
@@ -1138,6 +1140,6 @@ // this is typed because we're actually sending wrong data to it | ||
nextPage: 'blob', | ||
}), | ||
}, | ||
}, | ||
[ArticleEntity.key]: { | ||
['5']: ArticleEntity.fromJS({ id: '5' }), | ||
['5']: { id: '5' }, | ||
}, | ||
@@ -1187,3 +1189,3 @@ }); | ||
[WithOptional.key]: { | ||
abc: WithOptional.fromJS({ | ||
abc: { | ||
id: 'abc', | ||
@@ -1193,3 +1195,3 @@ // this is typed because we're actually sending wrong data to it | ||
nextPage: 'blob', | ||
}), | ||
}, | ||
}, | ||
@@ -1196,0 +1198,0 @@ [ArticleEntity.key]: { |
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
import { isImmutable, denormalizeImmutable } from './ImmutableUtils.js'; | ||
import type { Schema, NormalizedIndex, UnvisitFunction } from '../interface.js'; | ||
import { AbstractInstanceType } from '../normal.js'; | ||
import { isImmutable, denormalizeImmutable } from './ImmutableUtils.js'; | ||
@@ -32,13 +32,4 @@ /** | ||
/** Returns the globally unique identifier for the static Entity */ | ||
static get key(): string { | ||
/* istanbul ignore next */ | ||
if ( | ||
process.env.NODE_ENV !== 'production' && | ||
(this.name === '' || this.name === 'Entity' || this.name === '_temp') | ||
) | ||
throw new Error( | ||
'Entity classes without a name must define `static get key()`', | ||
); | ||
return this.name; | ||
} | ||
declare static key: string; | ||
// default implementation in class static block at bottom of definition | ||
@@ -124,4 +115,2 @@ /** Defines indexes to enable lookup by */ | ||
* @param [props] Plain Object of properties to assign. | ||
* @param [parent] When normalizing, the object which included the record | ||
* @param [key] When normalizing, the key where this record was found | ||
*/ | ||
@@ -141,2 +130,17 @@ static fromJS<T extends typeof Entity>( | ||
/** Factory method to convert from Plain JS Objects. | ||
* | ||
* @param [props] Plain Object of properties to assign. | ||
*/ | ||
static createIfValid<T extends typeof Entity>( | ||
this: T, | ||
// TODO: this should only accept members that are not functions | ||
props: Partial<AbstractInstanceType<T>>, | ||
): AbstractInstanceType<T> | undefined { | ||
if (this.validate(props)) { | ||
return undefined as any; | ||
} | ||
return this.fromJS(props); | ||
} | ||
/** Do any transformations when first receiving input */ | ||
@@ -379,2 +383,3 @@ static process(input: any, parent: any, key: string | undefined): any { | ||
} | ||
// TODO(breaking): Remove fromJS and setLocal call once old versions are no longer supported | ||
if (isImmutable(input)) { | ||
@@ -391,11 +396,18 @@ if (this.validate((input as any).toJS())) | ||
); | ||
return [this.fromJS(denormEntity.toObject()), found, deleted]; | ||
return [this.fromJS(denormEntity.toObject()) as any, true, deleted]; | ||
} | ||
if (this.validate(input)) { | ||
return [undefined as any, false, true]; | ||
let entityCopy: any; | ||
// new path | ||
if (input instanceof this) { | ||
entityCopy = input; | ||
// TODO(breaking): Remove fromJS and setLocal call once old versions are no longer supported | ||
} else { | ||
if (this.validate(input)) { | ||
return [undefined as any, false, true]; | ||
} | ||
entityCopy = this.fromJS(input); | ||
// Need to set this first so that if it is referenced further within the | ||
// denormalization the reference will already exist. | ||
unvisit.setLocal?.(entityCopy); | ||
} | ||
const entityCopy: any = this.fromJS(input); | ||
// Need to set this first so that if it is referenced further within the | ||
// denormalization the reference will already exist. | ||
unvisit.setLocal?.(entityCopy); | ||
@@ -407,11 +419,9 @@ let deleted = false; | ||
const schema = this.schema[key]; | ||
const nextInput = Object.hasOwn(input, key) | ||
? (input as any)[key] | ||
: undefined; | ||
const nextInput = (input as any)[key]; | ||
const [value, , deletedItem] = unvisit(nextInput, schema); | ||
if (deletedItem && !(Object.hasOwn(input, key) && !this.defaults[key])) { | ||
if (deletedItem && !!this.defaults[key]) { | ||
deleted = true; | ||
} | ||
if (Object.hasOwn(input, key) && (input as any)[key] !== value) { | ||
if ((input as any)[key] !== value) { | ||
this.set(entityCopy, key, value); | ||
@@ -436,2 +446,46 @@ } | ||
} | ||
/* istanbul ignore next */ | ||
static { | ||
const get = | ||
/* istanbul ignore if */ | ||
this.name !== 'Entity' | ||
? /* istanbul ignore next */ function (this: { | ||
name: string; | ||
__keyErr?: boolean; | ||
}): string { | ||
if (!this.__keyErr) { | ||
console.error( | ||
'Rest Hooks Error: https://resthooks.io/errors/dklj', | ||
); | ||
this.__keyErr = true; | ||
} | ||
return this.name; | ||
} | ||
: function (this: { name: string }): string { | ||
/* istanbul ignore next */ | ||
if ( | ||
process.env.NODE_ENV !== 'production' && | ||
(this.name === '' || | ||
this.name === 'Entity' || | ||
this.name === '_temp') | ||
) | ||
throw new Error( | ||
'Entity classes without a name must define `static key`\nSee: https://resthooks.io/rest/api/Entity#key', | ||
); | ||
return this.name; | ||
}; | ||
Object.defineProperty(this, 'key', { | ||
get, | ||
// this allows assignment in strict-mode | ||
set(value: string) { | ||
Object.defineProperty(this, 'key', { | ||
value, | ||
writable: true, | ||
enumerable: true, | ||
}); | ||
}, | ||
}); | ||
} | ||
} | ||
@@ -438,0 +492,0 @@ |
@@ -31,2 +31,3 @@ import { EndpointExtraOptions, FetchFunction } from './types.js'; | ||
export interface EntityInterface<T = any> extends SchemaSimple { | ||
createIfValid?(props: any): any; | ||
pk(params: any, parent?: any, key?: string): string | undefined; | ||
@@ -36,2 +37,3 @@ readonly key: string; | ||
expiresAt?(meta: any, input: any): number; | ||
mergeWithStore?(existingMeta: any, incomingMeta: any, existing: any, incoming: any): any; | ||
useIncoming?(existingMeta: any, incomingMeta: any, existing: any, incoming: any): boolean; | ||
@@ -38,0 +40,0 @@ indexes?: any; |
@@ -26,4 +26,4 @@ import { Schema, NormalizedIndex, UnvisitFunction } from '../interface.js'; | ||
abstract pk(parent?: any, key?: string): string | undefined; | ||
/*Returns the globally unique identifier for the static Entity */ | ||
static readonly key: string; | ||
/** Returns the globally unique identifier for the static Entity */ | ||
static key: string; | ||
/** Defines indexes to enable lookup by */ | ||
@@ -69,6 +69,9 @@ static indexes?: readonly string[]; | ||
* @param [props] Plain Object of properties to assign. | ||
* @param [parent] When normalizing, the object which included the record | ||
* @param [key] When normalizing, the key where this record was found | ||
*/ | ||
static fromJS<T extends typeof Entity>(this: T, props?: Partial<AbstractInstanceType<T>>): AbstractInstanceType<T>; | ||
/** Factory method to convert from Plain JS Objects. | ||
* | ||
* @param [props] Plain Object of properties to assign. | ||
*/ | ||
static createIfValid<T extends typeof Entity>(this: T, props: Partial<AbstractInstanceType<T>>): AbstractInstanceType<T> | undefined; | ||
/** Do any transformations when first receiving input */ | ||
@@ -75,0 +78,0 @@ static process(input: any, parent: any, key: string | undefined): any; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
795629
177
12113