New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rest-hooks/endpoint

Package Overview
Dependencies
Maintainers
2
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rest-hooks/endpoint - npm Package Compare versions

Comparing version 3.3.0 to 3.4.0

18

dist/index.js

@@ -402,2 +402,3 @@ 'use strict';

/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/**

@@ -451,2 +452,19 @@ * Represents data that should be deduped by specifying a primary key.

/** Run when an existing entity is found in the store */
static mergeWithStore(existingMeta, incomingMeta, existing, incoming) {
const useIncoming =
// we may have in store but not in meta; so this existance check is still important
!existingMeta || this.useIncoming(existingMeta, incomingMeta, existing, incoming);
if (useIncoming) {
// distinct types are not mergeable, so just replace
if (typeof incoming !== typeof existing) {
return incoming;
} else {
return this.merge(existing, incoming);
}
} else {
return existing;
}
}
/** Factory method to convert from Plain JS Objects.

@@ -453,0 +471,0 @@ *

2

dist/index.umd.min.js

@@ -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 n=!0,i=!1;return[Object.keys(e).reduce(((t,r)=>{const c=`${r}`,[o,a,h]=s(t.get(c),e[c]);return a||(n=!1),h&&(i=!0),t.has(c)?t.set(c,o):t}),t),n,i]}class n{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 n=this.getSchemaAttribute(e,t,s);return this.schema[n]}normalizeValue(e,t,s,n,i,r){const c=this.inferSchema(e,t,s);if(!c)return e;const o=n(e,t,s,c,i,r);return this.isSingleSchema||null==o?o:{id:o,schema:this.getSchemaAttribute(e,t,s)}}denormalizeValue(e,s){const n=!this.isSingleSchema&&(t(e)?e.get("schema"):e.schema);if(!this.isSingleSchema&&!n)return[e,!0,!1];return s((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[n])}}const i=([e,,t])=>void 0!==e&&!t;class r extends n{normalize(e,t,s,n,i,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,n,i,r))).filter((e=>null!=e))}denormalize(e,t){return[e.map?e.map((e=>this.denormalizeValue(e,t))).filter(i).map((([e])=>e)):e,!0,!1]}infer(e,t,s,n){}toJSON(){return[this.schema]}}const c=Symbol("ENTITY WAS DELETED");var o=Object.freeze({__proto__:null,Union:class extends n{constructor(e,t){if(!t)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');super(e,t)}normalize(e,t,s,n,i,r){return this.normalizeValue(e,t,s,n,i,r)}denormalize(e,t){return this.denormalizeValue(e,t)}infer(e,t,s,n){if(!e[0])return;const i=this.getSchemaAttribute(e[0],void 0,""),r=this.schema[i];return void 0!==r?{id:s(r,e,t,n),schema:i}:void 0}},Values:class extends n{normalize(e,t,s,n,i,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,n,i,r)}):t}),{})}denormalize(e,t){let s=!0,n=!1;return[Object.keys(e).reduce(((i,r)=>{const c=e[r],[o,a,h]=this.denormalizeValue(c,t);return a||(s=!1),h&&(n=!0),!a||h?i:Object.assign({},i,{[r]:o})}),{}),s,n]}infer(e,t,s){}},Array:r,All:class extends r{constructor(e,t){super(e,t)}normalize(e,t,s,n,i,r){super.normalize(e,t,s,n,i,r)}infer(e,t,s,n){if(this.isSingleSchema){const e=n[this.schema.key];if(void 0===e)return;return Object.values(e).map((e=>e&&this.schema.pk(e)))}let i=!1;const r=Object.values(this.schema).flatMap((e=>Object.hasOwn(n,e.key)&&n[e.key]?(i=!0,Object.values(n[e.key]).map((t=>({id:t&&e.pk(t),schema:this.getSchemaAttribute(t,void 0,void 0)})))):[]));if(i)return r}},Object:class{constructor(e){this.schema=void 0,this.define(e)}define(e){this.schema=Object.keys(e).reduce(((t,s)=>{const n=e[s];return Object.assign({},t,{[s]:n})}),this.schema||{})}normalize(...e){return((e,t,s,n,i,r,c)=>{const o=Object.assign({},t);return Object.keys(e).forEach((s=>{const n=e[s],a=i(t[s],t,s,n,r,c);null==a?delete o[s]:o[s]=a})),o})(this.schema,...e)}denormalize(...e){return((e,n,i)=>{if(t(n))return s(e,n,i);const r=Object.assign({},n);let c=!0,o=!1;return Object.keys(e).forEach((t=>{const[s,n,a]=i(r[t],e[t]);void 0!==r[t]&&(r[t]=s),a&&(o=!0),n||(c=!1)})),[r,c,o]})(this.schema,...e)}infer(e,t,s,n){return function(e,t,s,n,i){const r={};for(const c of Object.keys(e))r[c]=n(e[c],t,s,i);return r}(this.schema,e,t,s,n)}},Delete:class{constructor(e){this._entity=e}get key(){return this._entity.key}normalize(e,t,s,n,i,r){const o=this._entity.process(e,t,s),a=this._entity.pk(o,t,s);return i(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,n){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,n){return e.fetchedAt<=t.fetchedAt}static merge(e,t){return Object.assign({},e,t)}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,n,i,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]=n(c[e],c,e,t,i,r)}})),i(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 n=this.pk(e[0],void 0,"");if(void 0!==n&&""!==n)return n;const i=function(e,t){return t?t.find((t=>Object.hasOwn(e,t))):void 0}(e[0],this.indexes);if(i&&t[this.key]){return t[this.key][i][e[0][i]]}}static expiresAt(e,t){return e.expiresAt}static denormalize(e,n){if("symbol"==typeof e)return[void 0,!0,!0];if(t(e)){if(this.validate(e.toJS()))return[void 0,!1,!0];null==n.setLocal||n.setLocal(e);const[t,i,r]=s(this.schema,e,n);return[this.fromJS(t.toObject()),i,r]}if(this.validate(e))return[void 0,!1,!0];const i=this.fromJS(e);null==n.setLocal||n.setLocal(i);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]=n(c,s);!a||Object.hasOwn(e,t)&&!this.defaults[t]||(r=!0),Object.hasOwn(e,t)&&e[t]!==o&&this.set(i,t,o)})),[i,!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,n=this.key;return this.extend({fetch(){return s.apply(null!=e?e:this,t)},key(){return n.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},n)=>{if(void 0===s)return[void 0,!1,!0];const[i,r,c]=e.denormalize(s,n);return[r?this.process(i,...t):void 0,r,c]},t.infer=(t,s,n,i)=>({args:t,input:n(e,t,s,i)}),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,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})}));
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { isImmutable, denormalizeImmutable } from './ImmutableUtils.js';
/**

@@ -49,2 +50,19 @@ * Represents data that should be deduped by specifying a primary key.

/** Run when an existing entity is found in the store */
static mergeWithStore(existingMeta, incomingMeta, existing, incoming) {
const useIncoming =
// we may have in store but not in meta; so this existance check is still important
!existingMeta || this.useIncoming(existingMeta, incomingMeta, existing, incoming);
if (useIncoming) {
// distinct types are not mergeable, so just replace
if (typeof incoming !== typeof existing) {
return incoming;
} else {
return this.merge(existing, incoming);
}
} else {
return existing;
}
}
/** Factory method to convert from Plain JS Objects.

@@ -302,2 +320,2 @@ *

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsImRlbm9ybWFsaXplSW1tdXRhYmxlIiwiRW50aXR5IiwidG9KU09OIiwibmFtZSIsInNjaGVtYSIsImtleSIsInByb2Nlc3MiLCJlbnYiLCJOT0RFX0VOViIsIkVycm9yIiwicGsiLCJ2YWx1ZSIsInBhcmVudCIsInByb3RvdHlwZSIsImNhbGwiLCJ1c2VJbmNvbWluZyIsImV4aXN0aW5nTWV0YSIsImluY29taW5nTWV0YSIsImV4aXN0aW5nIiwiaW5jb21pbmciLCJmZXRjaGVkQXQiLCJtZXJnZSIsImZyb21KUyIsInByb3BzIiwiaW5zdGFuY2UiLCJPYmplY3QiLCJhc3NpZ24iLCJpbnB1dCIsIm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N6QyxNQUFNdUYsU0FBUyxHQUFHOUYsTUFBTSxDQUFDc0IsTUFBTTtFQUMvQjtFQUNBO0VBQ0F0QixNQUFNLENBQUNzQixNQUFNLEdBQUcsU0FBU0EsTUFBTSxDQUU3QkMsS0FBdUMsRUFDZDtJQUN6QixJQUFLLElBQUksQ0FBU1gsU0FBUyxDQUFDSCxFQUFFLEtBQUtvQyxTQUFTLEVBQzFDLE1BQU0sSUFBSXJDLEtBQUssQ0FBQyxvQ0FBb0MsQ0FBQztJQUN2RCxPQUFPc0YsU0FBUyxDQUFDakYsSUFBSSxDQUFDLElBQUksRUFBRVUsS0FBSyxDQUFDO0VBQ3BDLENBQUM7QUFDSDtBQUVBLFNBQVN3RCxlQUFlLENBQ3RCZ0IsTUFBd0IsRUFDeEJuQixPQUF1QixFQUN2QjtFQUNBLElBQUksQ0FBQ0EsT0FBTyxFQUFFLE9BQU8vQixTQUFTO0VBQzlCLE9BQU8rQixPQUFPLENBQUNvQixJQUFJLENBQUNDLEtBQUssSUFBSXhFLE1BQU0sQ0FBQzRCLE1BQU0sQ0FBQzBDLE1BQU0sRUFBRUUsS0FBSyxDQUFDLENBQUM7QUFDNUQifQ==

@@ -57,2 +57,10 @@ import type { Schema, NormalizedIndex, UnvisitFunction } from '../interface.js';

static merge(existing: any, incoming: any): any;
/** Run when an existing entity is found in the store */
static mergeWithStore(existingMeta: {
date: number;
fetchedAt: number;
} | undefined, incomingMeta: {
date: number;
fetchedAt: number;
}, existing: any, incoming: any): any;
/** Factory method to convert from Plain JS Objects.

@@ -59,0 +67,0 @@ *

/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { isImmutable, denormalizeImmutable } from './ImmutableUtils.js';
/**

@@ -52,2 +53,19 @@ * Represents data that should be deduped by specifying a primary key.

/** Run when an existing entity is found in the store */
static mergeWithStore(existingMeta, incomingMeta, existing, incoming) {
const useIncoming =
// we may have in store but not in meta; so this existance check is still important
!existingMeta || this.useIncoming(existingMeta, incomingMeta, existing, incoming);
if (useIncoming) {
// distinct types are not mergeable, so just replace
if (typeof incoming !== typeof existing) {
return incoming;
} else {
return this.merge(existing, incoming);
}
} else {
return existing;
}
}
/** Factory method to convert from Plain JS Objects.

@@ -307,2 +325,2 @@ *

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsImRlbm9ybWFsaXplSW1tdXRhYmxlIiwiRW50aXR5IiwidG9KU09OIiwibmFtZSIsInNjaGVtYSIsImtleSIsInByb2Nlc3MiLCJlbnYiLCJOT0RFX0VOViIsIkVycm9yIiwicGsiLCJ2YWx1ZSIsInBhcmVudCIsInByb3RvdHlwZSIsImNhbGwiLCJ1c2VJbmNvbWluZyIsImV4aXN0aW5nTWV0YSIsImluY29taW5nTWV0YSIsImV4aXN0aW5nIiwiaW5jb21pbmciLCJmZXRjaGVkQXQiLCJtZXJnZSIsImZyb21KUyIsInByb3BzIiwiaW5zdGFuY2UiLCJPYmplY3QiLCJhc3NpZ24iLCJpbnB1dCIsImF1dG9tYXRpY1ZhbGlkYXRpb24iLCJBcnJheSIsImlzQXJyYXkiLCJlcnJvck1lc3NhZ2UiLCJKU09OIiwic3RyaW5naWZ5Iiwic2xpY2UiLCJlcnJvciIsInN0YXR1cyIsImNvbnNvbGUiLCJ3YXJuIiwibm9ybWFsaXplIiwidmlzaXQiLCJhZGRFbnRpdHkiLCJ2aXNpdGVkRW50aXRpZXMiLCJwcm9jZXNzZWRFbnRpdHkiLCJpZCIsInVuZGVmaW5lZCIsImVudGl0eVR5cGUiLCJzb21lIiwiZW50aXR5IiwidmFsaWRhdGUiLCJwdXNoIiwia2V5cyIsImZvckVhY2giLCJoYXNPd24iLCJrZXlzT2ZSZWNvcmQiLCJTZXQiLCJkZWZhdWx0cyIsImtleXNPZlByb3BzIiwiZm91bmQiLCJtaXNzaW5nIiwidW5leHBlY3RlZCIsImtleU9mUHJvcHMiLCJoYXMiLCJrZXlPZlJlY29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FDeEJuQixPQUF1QixFQUN2QjtFQUNBLElBQUksQ0FBQ0EsT0FBTyxFQUFFLE9BQU8vQixTQUFTO0VBQzlCLE9BQU8rQixPQUFPLENBQUNvQixJQUFJLENBQUNDLEtBQUssSUFBSXhFLE1BQU0sQ0FBQzRCLE1BQU0sQ0FBQzBDLE1BQU0sRUFBRUUsS0FBSyxDQUFDLENBQUM7QUFDNUQifQ==
{
"name": "@rest-hooks/endpoint",
"version": "3.3.0",
"version": "3.4.0",
"description": "Declarative Network Interface Definitions",

@@ -120,3 +120,3 @@ "sideEffects": false,

},
"gitHead": "86c630b4b313679c7a441cc7fa060dfb9005d1da"
"gitHead": "8b95633f971eb65723424cf4986b1f5e6325df73"
}
/* 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';

@@ -91,2 +91,31 @@ /**

/** Run when an existing entity is found in the store */
static mergeWithStore(
existingMeta:
| {
date: number;
fetchedAt: number;
}
| undefined,
incomingMeta: { date: number; fetchedAt: number },
existing: any,
incoming: any,
) {
const useIncoming =
// we may have in store but not in meta; so this existance check is still important
!existingMeta ||
this.useIncoming(existingMeta, incomingMeta, existing, incoming);
if (useIncoming) {
// distinct types are not mergeable, so just replace
if (typeof incoming !== typeof existing) {
return incoming;
} else {
return this.merge(existing, incoming);
}
} else {
return existing;
}
}
/** Factory method to convert from Plain JS Objects.

@@ -93,0 +122,0 @@ *

@@ -57,2 +57,10 @@ import { Schema, NormalizedIndex, UnvisitFunction } from '../interface.js';

static merge(existing: any, incoming: any): any;
/** Run when an existing entity is found in the store */
static mergeWithStore(existingMeta: {
date: number;
fetchedAt: number;
} | undefined, incomingMeta: {
date: number;
fetchedAt: number;
}, existing: any, incoming: any): any;
/** Factory method to convert from Plain JS Objects.

@@ -59,0 +67,0 @@ *

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc