@rest-hooks/normalizr
Advanced tools
Comparing version 9.5.1 to 10.0.0
@@ -127,6 +127,69 @@ define(['exports'], (function (exports) { 'use strict'; | ||
/** Maps entity dependencies to a value (usually their denormalized form) | ||
* | ||
* Dependencies store `Path` to enable quick traversal using only `State` | ||
* If *any* members of the dependency get cleaned up, so does that key/value pair get removed. | ||
*/ | ||
class WeakEntityMap { | ||
constructor() { | ||
this.next = new WeakMap(); | ||
} | ||
get(entity, getEntity) { | ||
let curLink = this.next.get(entity); | ||
if (!curLink) return EMPTY; | ||
while (curLink.nextPath) { | ||
const nextEntity = getEntity(curLink.nextPath); | ||
curLink = curLink.next.get(nextEntity); | ||
if (!curLink) return EMPTY; | ||
} | ||
// curLink exists, but has no path - so must have a value | ||
return [curLink.value, curLink.journey]; | ||
} | ||
set(dependencies, value) { | ||
if (dependencies.length < 1) throw new KeySize(); | ||
let curLink = this; | ||
for (const { | ||
entity, | ||
path | ||
} of dependencies) { | ||
let nextLink = curLink.next.get(entity); | ||
if (!nextLink) { | ||
nextLink = new Link(); | ||
curLink.next.set(entity, nextLink); | ||
} | ||
curLink.nextPath = path; | ||
curLink = nextLink; | ||
} | ||
// in case there used to be more | ||
delete curLink.nextPath; | ||
curLink.value = value; | ||
// we could recompute this on get, but it would have a cost and we optimize for `get` | ||
curLink.journey = depToPaths(dependencies); | ||
} | ||
} | ||
const EMPTY = [undefined, undefined]; | ||
function getEntities(state) { | ||
const entityIsImmutable = isImmutable(state); | ||
if (entityIsImmutable) { | ||
return ({ | ||
key, | ||
pk | ||
}) => state.getIn([key, pk]); | ||
} else { | ||
return ({ | ||
key, | ||
pk | ||
}) => { | ||
var _state$key; | ||
return (_state$key = state[key]) == null ? void 0 : _state$key[pk]; | ||
}; | ||
} | ||
} | ||
function depToPaths(dependencies) { | ||
return dependencies.map(dep => dep.path); | ||
} | ||
/** Link in a chain */ | ||
class Link { | ||
constructor() { | ||
this.children = new WeakMap(); | ||
this.next = new WeakMap(); | ||
} | ||
@@ -141,57 +204,7 @@ } | ||
/** Maps from a list of objects (referentially) to any value | ||
* | ||
* If *any* members of the list get claned up, so does that key/value pair get removed. | ||
*/ | ||
class WeakListMap { | ||
constructor() { | ||
this.first = new WeakMap(); | ||
} | ||
delete(key) { | ||
const link = this.traverse(key); | ||
link == null ? true : delete link.value; | ||
return !!link; | ||
} | ||
get(key) { | ||
const link = this.traverse(key); | ||
return link == null ? void 0 : link.value; | ||
} | ||
has(key) { | ||
const link = this.traverse(key); | ||
if (!link) return false; | ||
return Object.hasOwn(link, 'value'); | ||
} | ||
set(key, value) { | ||
if (key.length < 1) throw new KeySize(); | ||
let cur = this.first; | ||
let link; | ||
for (let i = 0; i < key.length; i++) { | ||
if (!cur.has(key[i])) { | ||
link = new Link(); | ||
cur.set(key[i], link); | ||
} else { | ||
link = cur.get(key[i]); | ||
} | ||
cur = link.children; | ||
// do on later iteration of loop. this makes typescript happy rather than putting after loop | ||
if (i === key.length - 1) { | ||
link.value = value; | ||
} | ||
} | ||
return this; | ||
} | ||
traverse(key) { | ||
let cur = this.first; | ||
let link; | ||
for (let i = 0; i < key.length; i++) { | ||
link = cur.get(key[i]); | ||
if (!link) return; | ||
cur = link.children; | ||
} | ||
return link; | ||
} | ||
} | ||
const unvisitEntity = (entityOrId, schema, unvisit, getEntity, localCache, cycleCache, entityCache, dependencies, cycleIndex) => { | ||
const entity = getEntity(entityOrId, schema); | ||
const unvisitEntity = (entityOrId, schema, unvisit, getEntity, getCache, localCache, cycleCache, dependencies, cycleIndex) => { | ||
const entity = typeof entityOrId === 'object' ? entityOrId : getEntity({ | ||
pk: entityOrId, | ||
key: schema.key | ||
}); | ||
if (typeof entity === 'symbol' && entity.toString().includes('DELETED')) { | ||
@@ -224,45 +237,62 @@ return [undefined, true, true]; | ||
} | ||
if (!(key in entityCache)) { | ||
entityCache[key] = Object.create(null); | ||
} | ||
const localCacheKey = localCache[key]; | ||
const cycleCacheKey = cycleCache[key]; | ||
const entityCacheKey = entityCache[key]; | ||
let found = true; | ||
let deleted = false; | ||
// local cache lookup first | ||
if (!localCacheKey[pk]) { | ||
const trackingIndex = dependencies.length; | ||
dependencies.push(entity); | ||
let entityCopy; | ||
if (schema.createIfValid) { | ||
entityCopy = localCacheKey[pk] = isImmutable(entity) ? schema.createIfValid(entity.toObject()) : schema.createIfValid(entity); | ||
// TODO(breaking): remove once old verions no longer supported | ||
} else { | ||
entityCopy = entity; | ||
unvisit = withTrackedEntities(unvisit); | ||
unvisit.setLocal = entityCopy => localCacheKey[pk] = entityCopy; | ||
} | ||
cycleCacheKey[pk] = trackingIndex; | ||
if (entityCopy === undefined) { | ||
// undefined indicates we should suspense (perhaps failed validation) | ||
found = false; | ||
deleted = true; | ||
} else { | ||
[localCacheKey[pk], found, deleted] = schema.denormalize(entityCopy, unvisit); | ||
} | ||
delete cycleCacheKey[pk]; | ||
const globalCacheEntry = getGlobalCacheEntry(entityCacheKey, pk); | ||
const globalCache = getCache(pk, schema); | ||
const [cacheValue] = globalCache.get(entity, getEntity); | ||
// TODO: what if this just returned the deps - then we don't need to store them | ||
// if in cycle, use the start of the cycle to track all deps | ||
// otherwise, we use our own trackingIndex | ||
const localKey = dependencies.slice(cycleIndex.i === -1 ? trackingIndex : cycleIndex.i); | ||
if (!globalCacheEntry.has(localKey)) { | ||
globalCacheEntry.set(localKey, localCacheKey[pk]); | ||
} else { | ||
localCacheKey[pk] = globalCacheEntry.get(localKey); | ||
if (cacheValue) { | ||
localCacheKey[pk] = cacheValue.value[0]; | ||
// TODO: can we store the cache values instead of tracking *all* their sources? | ||
// this is only used for setting results cache correctly. if we got this far we will def need to set as we would have already tried getting it | ||
dependencies.push(...cacheValue.dependencies); | ||
return cacheValue.value; | ||
} | ||
// if we don't find in denormalize cache then do full denormalize | ||
else { | ||
const trackingIndex = dependencies.length; | ||
dependencies.push({ | ||
entity, | ||
path: { | ||
key, | ||
pk | ||
} | ||
}); | ||
let entityCopy; | ||
if (schema.createIfValid) { | ||
entityCopy = localCacheKey[pk] = isImmutable(entity) ? schema.createIfValid(entity.toObject()) : schema.createIfValid(entity); | ||
// TODO(breaking): remove once old verions no longer supported | ||
} else { | ||
entityCopy = entity; | ||
unvisit = withTrackedEntities(unvisit); | ||
unvisit.setLocal = entityCopy => localCacheKey[pk] = entityCopy; | ||
} | ||
cycleCacheKey[pk] = trackingIndex; | ||
if (entityCopy === undefined) { | ||
// undefined indicates we should suspense (perhaps failed validation) | ||
found = false; | ||
deleted = true; | ||
} else { | ||
[localCacheKey[pk], found, deleted] = schema.denormalize(entityCopy, unvisit); | ||
} | ||
delete cycleCacheKey[pk]; | ||
// start of cycle - reset cycle detection | ||
if (cycleIndex.i === trackingIndex) { | ||
cycleIndex.i = -1; | ||
// if in cycle, use the start of the cycle to track all deps | ||
// otherwise, we use our own trackingIndex | ||
const localKey = dependencies.slice(cycleIndex.i === -1 ? trackingIndex : cycleIndex.i); | ||
const cacheValue = { | ||
dependencies: localKey, | ||
value: [localCacheKey[pk], found, deleted] | ||
}; | ||
globalCache.set(localKey, cacheValue); | ||
// start of cycle - reset cycle detection | ||
if (cycleIndex.i === trackingIndex) { | ||
cycleIndex.i = -1; | ||
} | ||
} | ||
@@ -275,3 +305,9 @@ } else { | ||
// with no cycle, globalCacheEntry will have already been set | ||
dependencies.push(entity); | ||
dependencies.push({ | ||
entity, | ||
path: { | ||
key, | ||
pk | ||
} | ||
}); | ||
} | ||
@@ -281,4 +317,6 @@ } | ||
}; | ||
const getUnvisit = (entities, entityCache, resultCache, localCache) => { | ||
const getUnvisit = (entities, entityCache, resultCache) => { | ||
const getEntity = getEntities(entities); | ||
const getCache = getEntityCaches(entityCache); | ||
const localCache = {}; | ||
const dependencies = []; | ||
@@ -297,2 +335,4 @@ const cycleIndex = { | ||
const hasDenormalize = typeof schema.denormalize === 'function'; | ||
// deserialize fields (like Date) | ||
if (!hasDenormalize && typeof schema === 'function') { | ||
@@ -312,3 +352,3 @@ if (input instanceof schema) return [input, true, false]; | ||
if (isEntity(schema)) { | ||
return unvisitEntity(input, schema, unvisit, getEntity, localCache, cycleCache, entityCache, dependencies, cycleIndex); | ||
return unvisitEntity(input, schema, unvisit, getEntity, getCache, localCache, cycleCache, dependencies, cycleIndex); | ||
} | ||
@@ -320,50 +360,57 @@ if (hasDenormalize) { | ||
} | ||
//const wrappedUnvisit = withTrackedEntities(unvisit, globalKey); | ||
return (input, schema) => { | ||
const ret = unvisit(input, schema); | ||
// in the case where WeakMap cannot be used | ||
// this test ensures null is properly excluded from WeakMap | ||
if (Object(input) !== input) return ret; | ||
dependencies.push(input); | ||
if (!resultCache.has(dependencies)) { | ||
resultCache.set(dependencies, ret[0]); | ||
return ret; | ||
} else { | ||
return [resultCache.get(dependencies), ret[1], ret[2]]; | ||
const cachable = Object(input) === input && Object(schema) === schema; | ||
if (!cachable) { | ||
const ret = unvisit(input, schema); | ||
// this is faster than spread | ||
// https://www.measurethat.net/Benchmarks/Show/23636/0/spread-with-tuples | ||
return [ret[0], ret[1], ret[2], depToPaths(dependencies)]; | ||
} | ||
let [ret, entityPaths] = resultCache.get(input, getEntity); | ||
if (ret === undefined) { | ||
ret = unvisit(input, schema); | ||
// we want to do this before we add our 'input' entry | ||
entityPaths = depToPaths(dependencies); | ||
// for the first entry, `path` is ignored so empty members is fine | ||
dependencies.unshift({ | ||
entity: input, | ||
path: { | ||
key: '', | ||
pk: '' | ||
} | ||
}); | ||
resultCache.set(dependencies, ret); | ||
} | ||
return [ret[0], ret[1], ret[2], entityPaths]; | ||
}; | ||
}; | ||
const getEntities = entities => { | ||
const entityIsImmutable = isImmutable(entities); | ||
return (entityOrId, schema) => { | ||
var _entities$schemaKey; | ||
const schemaKey = schema.key; | ||
if (typeof entityOrId === 'object') { | ||
return entityOrId; | ||
const getEntityCaches = entityCache => { | ||
return (pk, schema) => { | ||
const key = schema.key; | ||
if (!(key in entityCache)) { | ||
entityCache[key] = Object.create(null); | ||
} | ||
if (entityIsImmutable) { | ||
return entities.getIn([schemaKey, entityOrId]); | ||
const entityCacheKey = entityCache[key]; | ||
if (!entityCacheKey[pk]) entityCacheKey[pk] = new WeakMap(); | ||
let wem = entityCacheKey[pk].get(schema); | ||
if (!wem) { | ||
wem = new WeakEntityMap(); | ||
entityCacheKey[pk].set(schema, wem); | ||
} | ||
return (_entities$schemaKey = entities[schemaKey]) == null ? void 0 : _entities$schemaKey[entityOrId]; | ||
return wem; | ||
}; | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
const denormalize = (input, schema, entities, entityCache = {}, resultCache = new WeakListMap()) => { | ||
const denormalize = (input, schema, entities, entityCache = {}, resultCache = new WeakEntityMap()) => { | ||
// undefined mean don't do anything | ||
if (schema === undefined) { | ||
return [input, true, false, {}]; | ||
return [input, true, false, []]; | ||
} | ||
if (input === undefined) { | ||
return [undefined, false, false, {}]; | ||
return [undefined, false, false, []]; | ||
} | ||
const resolvedEntities = {}; | ||
const unvisit = getUnvisit(entities, entityCache, resultCache, resolvedEntities); | ||
return [...unvisit(input, schema), resolvedEntities]; | ||
return getUnvisit(entities, entityCache, resultCache)(input, schema); | ||
}; | ||
function getGlobalCacheEntry(entityCache, id) { | ||
if (!entityCache[id]) entityCache[id] = new WeakListMap(); | ||
return entityCache[id]; | ||
} | ||
@@ -592,3 +639,3 @@ // TODO(breaking): remove once unused | ||
exports.ExpiryStatus = ExpiryStatus; | ||
exports.WeakListMap = WeakListMap; | ||
exports.WeakEntityMap = WeakEntityMap; | ||
exports.denormalize = denormalize; | ||
@@ -595,0 +642,0 @@ exports.inferResults = inferResults; |
@@ -128,6 +128,69 @@ var rest_hooks_normalizr = (function (exports) { | ||
/** Maps entity dependencies to a value (usually their denormalized form) | ||
* | ||
* Dependencies store `Path` to enable quick traversal using only `State` | ||
* If *any* members of the dependency get cleaned up, so does that key/value pair get removed. | ||
*/ | ||
class WeakEntityMap { | ||
constructor() { | ||
this.next = new WeakMap(); | ||
} | ||
get(entity, getEntity) { | ||
let curLink = this.next.get(entity); | ||
if (!curLink) return EMPTY; | ||
while (curLink.nextPath) { | ||
const nextEntity = getEntity(curLink.nextPath); | ||
curLink = curLink.next.get(nextEntity); | ||
if (!curLink) return EMPTY; | ||
} | ||
// curLink exists, but has no path - so must have a value | ||
return [curLink.value, curLink.journey]; | ||
} | ||
set(dependencies, value) { | ||
if (dependencies.length < 1) throw new KeySize(); | ||
let curLink = this; | ||
for (const { | ||
entity, | ||
path | ||
} of dependencies) { | ||
let nextLink = curLink.next.get(entity); | ||
if (!nextLink) { | ||
nextLink = new Link(); | ||
curLink.next.set(entity, nextLink); | ||
} | ||
curLink.nextPath = path; | ||
curLink = nextLink; | ||
} | ||
// in case there used to be more | ||
delete curLink.nextPath; | ||
curLink.value = value; | ||
// we could recompute this on get, but it would have a cost and we optimize for `get` | ||
curLink.journey = depToPaths(dependencies); | ||
} | ||
} | ||
const EMPTY = [undefined, undefined]; | ||
function getEntities(state) { | ||
const entityIsImmutable = isImmutable(state); | ||
if (entityIsImmutable) { | ||
return ({ | ||
key, | ||
pk | ||
}) => state.getIn([key, pk]); | ||
} else { | ||
return ({ | ||
key, | ||
pk | ||
}) => { | ||
var _state$key; | ||
return (_state$key = state[key]) == null ? void 0 : _state$key[pk]; | ||
}; | ||
} | ||
} | ||
function depToPaths(dependencies) { | ||
return dependencies.map(dep => dep.path); | ||
} | ||
/** Link in a chain */ | ||
class Link { | ||
constructor() { | ||
this.children = new WeakMap(); | ||
this.next = new WeakMap(); | ||
} | ||
@@ -142,57 +205,7 @@ } | ||
/** Maps from a list of objects (referentially) to any value | ||
* | ||
* If *any* members of the list get claned up, so does that key/value pair get removed. | ||
*/ | ||
class WeakListMap { | ||
constructor() { | ||
this.first = new WeakMap(); | ||
} | ||
delete(key) { | ||
const link = this.traverse(key); | ||
link == null ? true : delete link.value; | ||
return !!link; | ||
} | ||
get(key) { | ||
const link = this.traverse(key); | ||
return link == null ? void 0 : link.value; | ||
} | ||
has(key) { | ||
const link = this.traverse(key); | ||
if (!link) return false; | ||
return Object.hasOwn(link, 'value'); | ||
} | ||
set(key, value) { | ||
if (key.length < 1) throw new KeySize(); | ||
let cur = this.first; | ||
let link; | ||
for (let i = 0; i < key.length; i++) { | ||
if (!cur.has(key[i])) { | ||
link = new Link(); | ||
cur.set(key[i], link); | ||
} else { | ||
link = cur.get(key[i]); | ||
} | ||
cur = link.children; | ||
// do on later iteration of loop. this makes typescript happy rather than putting after loop | ||
if (i === key.length - 1) { | ||
link.value = value; | ||
} | ||
} | ||
return this; | ||
} | ||
traverse(key) { | ||
let cur = this.first; | ||
let link; | ||
for (let i = 0; i < key.length; i++) { | ||
link = cur.get(key[i]); | ||
if (!link) return; | ||
cur = link.children; | ||
} | ||
return link; | ||
} | ||
} | ||
const unvisitEntity = (entityOrId, schema, unvisit, getEntity, localCache, cycleCache, entityCache, dependencies, cycleIndex) => { | ||
const entity = getEntity(entityOrId, schema); | ||
const unvisitEntity = (entityOrId, schema, unvisit, getEntity, getCache, localCache, cycleCache, dependencies, cycleIndex) => { | ||
const entity = typeof entityOrId === 'object' ? entityOrId : getEntity({ | ||
pk: entityOrId, | ||
key: schema.key | ||
}); | ||
if (typeof entity === 'symbol' && entity.toString().includes('DELETED')) { | ||
@@ -225,45 +238,62 @@ return [undefined, true, true]; | ||
} | ||
if (!(key in entityCache)) { | ||
entityCache[key] = Object.create(null); | ||
} | ||
const localCacheKey = localCache[key]; | ||
const cycleCacheKey = cycleCache[key]; | ||
const entityCacheKey = entityCache[key]; | ||
let found = true; | ||
let deleted = false; | ||
// local cache lookup first | ||
if (!localCacheKey[pk]) { | ||
const trackingIndex = dependencies.length; | ||
dependencies.push(entity); | ||
let entityCopy; | ||
if (schema.createIfValid) { | ||
entityCopy = localCacheKey[pk] = isImmutable(entity) ? schema.createIfValid(entity.toObject()) : schema.createIfValid(entity); | ||
// TODO(breaking): remove once old verions no longer supported | ||
} else { | ||
entityCopy = entity; | ||
unvisit = withTrackedEntities(unvisit); | ||
unvisit.setLocal = entityCopy => localCacheKey[pk] = entityCopy; | ||
} | ||
cycleCacheKey[pk] = trackingIndex; | ||
if (entityCopy === undefined) { | ||
// undefined indicates we should suspense (perhaps failed validation) | ||
found = false; | ||
deleted = true; | ||
} else { | ||
[localCacheKey[pk], found, deleted] = schema.denormalize(entityCopy, unvisit); | ||
} | ||
delete cycleCacheKey[pk]; | ||
const globalCacheEntry = getGlobalCacheEntry(entityCacheKey, pk); | ||
const globalCache = getCache(pk, schema); | ||
const [cacheValue] = globalCache.get(entity, getEntity); | ||
// TODO: what if this just returned the deps - then we don't need to store them | ||
// if in cycle, use the start of the cycle to track all deps | ||
// otherwise, we use our own trackingIndex | ||
const localKey = dependencies.slice(cycleIndex.i === -1 ? trackingIndex : cycleIndex.i); | ||
if (!globalCacheEntry.has(localKey)) { | ||
globalCacheEntry.set(localKey, localCacheKey[pk]); | ||
} else { | ||
localCacheKey[pk] = globalCacheEntry.get(localKey); | ||
if (cacheValue) { | ||
localCacheKey[pk] = cacheValue.value[0]; | ||
// TODO: can we store the cache values instead of tracking *all* their sources? | ||
// this is only used for setting results cache correctly. if we got this far we will def need to set as we would have already tried getting it | ||
dependencies.push(...cacheValue.dependencies); | ||
return cacheValue.value; | ||
} | ||
// if we don't find in denormalize cache then do full denormalize | ||
else { | ||
const trackingIndex = dependencies.length; | ||
dependencies.push({ | ||
entity, | ||
path: { | ||
key, | ||
pk | ||
} | ||
}); | ||
let entityCopy; | ||
if (schema.createIfValid) { | ||
entityCopy = localCacheKey[pk] = isImmutable(entity) ? schema.createIfValid(entity.toObject()) : schema.createIfValid(entity); | ||
// TODO(breaking): remove once old verions no longer supported | ||
} else { | ||
entityCopy = entity; | ||
unvisit = withTrackedEntities(unvisit); | ||
unvisit.setLocal = entityCopy => localCacheKey[pk] = entityCopy; | ||
} | ||
cycleCacheKey[pk] = trackingIndex; | ||
if (entityCopy === undefined) { | ||
// undefined indicates we should suspense (perhaps failed validation) | ||
found = false; | ||
deleted = true; | ||
} else { | ||
[localCacheKey[pk], found, deleted] = schema.denormalize(entityCopy, unvisit); | ||
} | ||
delete cycleCacheKey[pk]; | ||
// start of cycle - reset cycle detection | ||
if (cycleIndex.i === trackingIndex) { | ||
cycleIndex.i = -1; | ||
// if in cycle, use the start of the cycle to track all deps | ||
// otherwise, we use our own trackingIndex | ||
const localKey = dependencies.slice(cycleIndex.i === -1 ? trackingIndex : cycleIndex.i); | ||
const cacheValue = { | ||
dependencies: localKey, | ||
value: [localCacheKey[pk], found, deleted] | ||
}; | ||
globalCache.set(localKey, cacheValue); | ||
// start of cycle - reset cycle detection | ||
if (cycleIndex.i === trackingIndex) { | ||
cycleIndex.i = -1; | ||
} | ||
} | ||
@@ -276,3 +306,9 @@ } else { | ||
// with no cycle, globalCacheEntry will have already been set | ||
dependencies.push(entity); | ||
dependencies.push({ | ||
entity, | ||
path: { | ||
key, | ||
pk | ||
} | ||
}); | ||
} | ||
@@ -282,4 +318,6 @@ } | ||
}; | ||
const getUnvisit = (entities, entityCache, resultCache, localCache) => { | ||
const getUnvisit = (entities, entityCache, resultCache) => { | ||
const getEntity = getEntities(entities); | ||
const getCache = getEntityCaches(entityCache); | ||
const localCache = {}; | ||
const dependencies = []; | ||
@@ -298,2 +336,4 @@ const cycleIndex = { | ||
const hasDenormalize = typeof schema.denormalize === 'function'; | ||
// deserialize fields (like Date) | ||
if (!hasDenormalize && typeof schema === 'function') { | ||
@@ -313,3 +353,3 @@ if (input instanceof schema) return [input, true, false]; | ||
if (isEntity(schema)) { | ||
return unvisitEntity(input, schema, unvisit, getEntity, localCache, cycleCache, entityCache, dependencies, cycleIndex); | ||
return unvisitEntity(input, schema, unvisit, getEntity, getCache, localCache, cycleCache, dependencies, cycleIndex); | ||
} | ||
@@ -321,50 +361,57 @@ if (hasDenormalize) { | ||
} | ||
//const wrappedUnvisit = withTrackedEntities(unvisit, globalKey); | ||
return (input, schema) => { | ||
const ret = unvisit(input, schema); | ||
// in the case where WeakMap cannot be used | ||
// this test ensures null is properly excluded from WeakMap | ||
if (Object(input) !== input) return ret; | ||
dependencies.push(input); | ||
if (!resultCache.has(dependencies)) { | ||
resultCache.set(dependencies, ret[0]); | ||
return ret; | ||
} else { | ||
return [resultCache.get(dependencies), ret[1], ret[2]]; | ||
const cachable = Object(input) === input && Object(schema) === schema; | ||
if (!cachable) { | ||
const ret = unvisit(input, schema); | ||
// this is faster than spread | ||
// https://www.measurethat.net/Benchmarks/Show/23636/0/spread-with-tuples | ||
return [ret[0], ret[1], ret[2], depToPaths(dependencies)]; | ||
} | ||
let [ret, entityPaths] = resultCache.get(input, getEntity); | ||
if (ret === undefined) { | ||
ret = unvisit(input, schema); | ||
// we want to do this before we add our 'input' entry | ||
entityPaths = depToPaths(dependencies); | ||
// for the first entry, `path` is ignored so empty members is fine | ||
dependencies.unshift({ | ||
entity: input, | ||
path: { | ||
key: '', | ||
pk: '' | ||
} | ||
}); | ||
resultCache.set(dependencies, ret); | ||
} | ||
return [ret[0], ret[1], ret[2], entityPaths]; | ||
}; | ||
}; | ||
const getEntities = entities => { | ||
const entityIsImmutable = isImmutable(entities); | ||
return (entityOrId, schema) => { | ||
var _entities$schemaKey; | ||
const schemaKey = schema.key; | ||
if (typeof entityOrId === 'object') { | ||
return entityOrId; | ||
const getEntityCaches = entityCache => { | ||
return (pk, schema) => { | ||
const key = schema.key; | ||
if (!(key in entityCache)) { | ||
entityCache[key] = Object.create(null); | ||
} | ||
if (entityIsImmutable) { | ||
return entities.getIn([schemaKey, entityOrId]); | ||
const entityCacheKey = entityCache[key]; | ||
if (!entityCacheKey[pk]) entityCacheKey[pk] = new WeakMap(); | ||
let wem = entityCacheKey[pk].get(schema); | ||
if (!wem) { | ||
wem = new WeakEntityMap(); | ||
entityCacheKey[pk].set(schema, wem); | ||
} | ||
return (_entities$schemaKey = entities[schemaKey]) == null ? void 0 : _entities$schemaKey[entityOrId]; | ||
return wem; | ||
}; | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
const denormalize = (input, schema, entities, entityCache = {}, resultCache = new WeakListMap()) => { | ||
const denormalize = (input, schema, entities, entityCache = {}, resultCache = new WeakEntityMap()) => { | ||
// undefined mean don't do anything | ||
if (schema === undefined) { | ||
return [input, true, false, {}]; | ||
return [input, true, false, []]; | ||
} | ||
if (input === undefined) { | ||
return [undefined, false, false, {}]; | ||
return [undefined, false, false, []]; | ||
} | ||
const resolvedEntities = {}; | ||
const unvisit = getUnvisit(entities, entityCache, resultCache, resolvedEntities); | ||
return [...unvisit(input, schema), resolvedEntities]; | ||
return getUnvisit(entities, entityCache, resultCache)(input, schema); | ||
}; | ||
function getGlobalCacheEntry(entityCache, id) { | ||
if (!entityCache[id]) entityCache[id] = new WeakListMap(); | ||
return entityCache[id]; | ||
} | ||
@@ -593,3 +640,3 @@ // TODO(breaking): remove once unused | ||
exports.ExpiryStatus = ExpiryStatus; | ||
exports.WeakListMap = WeakListMap; | ||
exports.WeakEntityMap = WeakEntityMap; | ||
exports.denormalize = denormalize; | ||
@@ -596,0 +643,0 @@ exports.inferResults = inferResults; |
@@ -1,1 +0,1 @@ | ||
function e(e){return null!==e&&void 0!==e.pk}const t=e=>{if("production"!==process.env.NODE_ENV){if(Array.isArray(e)&&e.length>1)throw new Error(`Expected schema definition to be a single schema, but found ${e.length}.`)}return e[0]},n=([e,,t])=>void 0!==e&&!t,r=(e,n,r,o,i,s,c)=>{e=t(e);const u=(e=>Array.isArray(e)?e:Object.keys(e).map((t=>e[t])))(n);return u.map(((t,n)=>i(t,r,o,e,s,c)))},o=(e,r,o)=>(e=t(e),[r.map?r.map((t=>o(t,e))).filter(n).map((([e])=>e)):r,!0,!1]);function i(e,t,n,r){}function s(e){return!("function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}const c=(e,t,n,r,o,i,s)=>{const c=Object.assign({},t);return Object.keys(e).forEach((n=>{const r=e[n],u=o(t[n],t,n,r,i,s);null==u?delete c[n]:c[n]=u})),c},u=(e,t,n)=>{if(s(t))return function(e,t,n){let r=!0,o=!1;return[Object.keys(e).reduce(((t,i)=>{const s=`${i}`,[c,u,a]=n(t.get(s),e[s]);return u||(r=!1),a&&(o=!0),t.has(s)?t.set(s,c):t}),t),r,o]}(e,t,n);const r=Object.assign({},t);let o=!0,i=!1;return Object.keys(e).forEach((t=>{const[s,c,u]=n(r[t],e[t]);void 0!==r[t]&&(r[t]=s),u&&(i=!0),c||(o=!1)})),[r,o,i]};function a(e,t,n,r,o){const i={};for(const s of Object.keys(e))i[s]=r(e[s],t,n,o);return i}class l{constructor(){this.children=new WeakMap}}class f extends Error{constructor(...e){super(...e),this.message="Keys must include at least one member"}}class d{constructor(){this.first=new WeakMap}delete(e){const t=this.traverse(e);return null==t||delete t.value,!!t}get(e){const t=this.traverse(e);return null==t?void 0:t.value}has(e){const t=this.traverse(e);return!!t&&Object.hasOwn(t,"value")}set(e,t){if(e.length<1)throw new f;let n,r=this.first;for(let o=0;o<e.length;o++)r.has(e[o])?n=r.get(e[o]):(n=new l,r.set(e[o],n)),r=n.children,o===e.length-1&&(n.value=t);return this}traverse(e){let t,n=this.first;for(let r=0;r<e.length;r++){if(t=n.get(e[r]),!t)return;n=t.children}return t}}const p=(e,t,n,r,o,i,c,u,a)=>{const l=r(e,t);if("symbol"==typeof l&&l.toString().includes("DELETED"))return[void 0,!0,!0];if("object"!=typeof l||null===l)return[l,!1,!1];const f="string"==typeof e?e:t.pk(s(l)?l.toJS():l);if(void 0===f||""===f||"undefined"===f)return[l,!1,!1];const p=t.key;p in o||(o[p]=Object.create(null)),p in i||(i[p]=Object.create(null)),p in c||(c[p]=Object.create(null));const y=o[p],h=i[p],g=c[p];let b=!0,m=!1;if(y[f])f in h?a.i=h[f]:u.push(l);else{const e=u.length;let r;u.push(l),t.createIfValid?r=y[f]=s(l)?t.createIfValid(l.toObject()):t.createIfValid(l):(r=l,n=function(e){const t=e.og||e,n=(e,n)=>t(e,n);return n.og=e,n}(n),n.setLocal=e=>y[f]=e),h[f]=e,void 0===r?(b=!1,m=!0):[y[f],b,m]=t.denormalize(r,n),delete h[f];const o=function(e,t){e[t]||(e[t]=new d);return e[t]}(g,f),i=u.slice(-1===a.i?e:a.i);o.has(i)?y[f]=o.get(i):o.set(i,y[f]),a.i===e&&(a.i=-1)}return[y[f],b,m]},y=e=>{const t=s(e);return(n,r)=>{var o;const i=r.key;return"object"==typeof n?n:t?e.getIn([i,n]):null==(o=e[i])?void 0:o[n]}},h=(t,n,r,i={},s=new d)=>{if(void 0===n)return[t,!0,!1,{}];if(void 0===t)return[void 0,!1,!1,{}];const c={},a=((t,n,r,i)=>{const s=y(t),c=[],a={i:-1},l={};function f(t,r){if(!r)return[t,!0,!1];if(null===t)return[t,!0,!1];const d="function"==typeof r.denormalize;return d||"function"!=typeof r?void 0===t?[t,!1,!1]:d||"object"!=typeof r?e(r)?p(t,r,f,s,i,l,n,c,a):d?r.denormalize(t,f):[t,!0,!1]:(Array.isArray(r)?o:u)(r,t,f):t instanceof r||void 0===t?[t,!0,!1]:[new r(t),!0,!1]}return(e,t)=>{const n=f(e,t);return Object(e)!==e?n:(c.push(e),r.has(c)?[r.get(c),n[1],n[2]]:(r.set(c,n[0]),n))}})(r,i,s,c);return[...a(t,n),c]};const g=Symbol("ENTITY WAS DELETED"),b=(e,t,n,o,i,s)=>{if(!e||!o)return e;if(o.normalize&&"function"==typeof o.normalize)return"object"!=typeof e?e:o.normalize(e,t,n,b,i,s);if("function"==typeof o)return new o(e);if("object"!=typeof e||"object"!=typeof o)return e;return(Array.isArray(o)?r:c)(o,e,t,n,b,i,s)};const m=(e,t,n={},r={},o={},i={date:Date.now(),expiresAt:1/0,fetchedAt:0})=>{if(null==t)return{entities:n,indexes:r,result:e,entityMeta:o};const s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s&&(void 0===t.key||void 0!==t.pk||"string"!=typeof e)){if("production"!==process.env.NODE_ENV){const n=e=>{try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}};throw"string"==typeof e&&n(e)?new Error(`Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/rest/api/RestEndpoint#parseResponse for more information\n\n Schema: ${JSON.stringify(t,void 0,2)}\n Input: "${e}"`):new Error(`Unexpected input given to normalize. Expected type to be "${s}", found "${null===e?"null":typeof e}".\n\n Schema: ${JSON.stringify(t,void 0,2)}\n Input: "${e}"`)}throw new Error(`Unexpected input given to normalize. Expected type to be "${s}", found "${null===e?"null":typeof e}".`)}const c=Object.assign({},n),u=Object.assign({},r),a=Object.assign({},o),l=((e,t,n,r,o,i)=>(s,c,u)=>{const a=s.key;a in e||(e[a]={},n[a]=Object.assign({},n[a]),o[a]=Object.assign({},o[a]));const l=e[a][u];if(l)e[a][u]=s.merge(l,c);else{const t=s.expiresAt?s.expiresAt(i,c):i.expiresAt,r=n[a][u];if(r){var f,d,p;const n=o[a][u];e[a][u]=s.mergeWithStore?s.mergeWithStore(n,i,r,c):function(e,t,n,r,o){return!t||(e.useIncoming&&n.fetchedAt?e.useIncoming(t,n,r,o):t.date<=n.date)?typeof o!=typeof r?o:e.merge(r,o):r}(s,n,i,r,c),o[a][u]={expiresAt:Math.max(t,null==n?void 0:n.expiresAt),date:Math.max(i.date,null!=(f=null==n?void 0:n.date)?f:0),fetchedAt:Math.max(null!=(d=i.fetchedAt)?d:0,null!=(p=null==n?void 0:n.fetchedAt)?p:0)}}else{var y;e[a][u]=c,o[a][u]={expiresAt:t,date:i.date,fetchedAt:null!=(y=i.fetchedAt)?y:i.date}}}if(Array.isArray(s.indexes)){const o=e[a][u];a in t||(t[a]={},r[a]=Object.assign({},r[a]));for(const e of s.indexes){e in t[a]||(r[a][e]=t[a][e]={});const i=t[a][e];l&&delete i[l[e]],n[a]&&n[a][u]&&n[a][u][e]!==o[e]&&(i[n[a][u][e]]=g),e in o?i[o[e]]=u:"production"!==process.env.NODE_ENV&&console.warn(`Index not found in entity. Indexes must be top-level members of your entity.\nIndex: ${e}\nEntity: ${JSON.stringify(o,void 0,2)}`)}}n[a][u]=e[a][u]})({},{},c,u,a,i);return{entities:c,indexes:u,result:b(e,e,void 0,t,l,{}),entityMeta:a}};function v(e,t,n,r={}){if(function(e){return!!e&&"function"==typeof e.infer}(e))return e.infer(t,n,v,r);if("object"==typeof e&&e){return(Array.isArray(e)?i:a)(e,t,n,v,r)}return e}var O={Invalid:1,InvalidIfStale:2,Valid:3};Object.hasOwn=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};export{g as DELETED,O as ExpiryStatus,d as WeakListMap,h as denormalize,v as inferResults,e as isEntity,m as normalize}; | ||
function e(e){return null!==e&&void 0!==e.pk}const t=e=>{if("production"!==process.env.NODE_ENV){if(Array.isArray(e)&&e.length>1)throw new Error(`Expected schema definition to be a single schema, but found ${e.length}.`)}return e[0]},n=([e,,t])=>void 0!==e&&!t,r=(e,n,r,o,i,s,c)=>{e=t(e);const a=(e=>Array.isArray(e)?e:Object.keys(e).map((t=>e[t])))(n);return a.map(((t,n)=>i(t,r,o,e,s,c)))},o=(e,r,o)=>(e=t(e),[r.map?r.map((t=>o(t,e))).filter(n).map((([e])=>e)):r,!0,!1]);function i(e,t,n,r){}function s(e){return!("function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}const c=(e,t,n,r,o,i,s)=>{const c=Object.assign({},t);return Object.keys(e).forEach((n=>{const r=e[n],a=o(t[n],t,n,r,i,s);null==a?delete c[n]:c[n]=a})),c},a=(e,t,n)=>{if(s(t))return function(e,t,n){let r=!0,o=!1;return[Object.keys(e).reduce(((t,i)=>{const s=`${i}`,[c,a,u]=n(t.get(s),e[s]);return a||(r=!1),u&&(o=!0),t.has(s)?t.set(s,c):t}),t),r,o]}(e,t,n);const r=Object.assign({},t);let o=!0,i=!1;return Object.keys(e).forEach((t=>{const[s,c,a]=n(r[t],e[t]);void 0!==r[t]&&(r[t]=s),a&&(i=!0),c||(o=!1)})),[r,o,i]};function u(e,t,n,r,o){const i={};for(const s of Object.keys(e))i[s]=r(e[s],t,n,o);return i}class f{constructor(){this.next=new WeakMap}get(e,t){let n=this.next.get(e);if(!n)return l;for(;n.nextPath;){const e=t(n.nextPath);if(n=n.next.get(e),!n)return l}return[n.value,n.journey]}set(e,t){if(e.length<1)throw new y;let n=this;for(const{entity:t,path:r}of e){let e=n.next.get(t);e||(e=new d,n.next.set(t,e)),n.nextPath=r,n=e}delete n.nextPath,n.value=t,n.journey=p(e)}}const l=[void 0,void 0];function p(e){return e.map((e=>e.path))}class d{constructor(){this.next=new WeakMap}}class y extends Error{constructor(...e){super(...e),this.message="Keys must include at least one member"}}const h=(t,n,r)=>{const i=s(c=t)?({key:e,pk:t})=>c.getIn([e,t]):({key:e,pk:t})=>{var n;return null==(n=c[e])?void 0:n[t]};var c;const u=g(n),f={},l=[],d={i:-1},y={};function h(t,n){if(!n)return[t,!0,!1];if(null===t)return[t,!0,!1];const r="function"==typeof n.denormalize;if(!r&&"function"==typeof n)return t instanceof n||void 0===t?[t,!0,!1]:[new n(t),!0,!1];if(void 0===t)return[t,!1,!1];if(!r&&"object"==typeof n){return(Array.isArray(n)?o:a)(n,t,h)}return e(n)?((e,t,n,r,o,i,c,a,u)=>{const f="object"==typeof e?e:r({pk:e,key:t.key});if("symbol"==typeof f&&f.toString().includes("DELETED"))return[void 0,!0,!0];if("object"!=typeof f||null===f)return[f,!1,!1];const l="string"==typeof e?e:t.pk(s(f)?f.toJS():f);if(void 0===l||""===l||"undefined"===l)return[f,!1,!1];const p=t.key;p in i||(i[p]=Object.create(null)),p in c||(c[p]=Object.create(null));const d=i[p],y=c[p];let h=!0,g=!1;if(d[l])l in y?u.i=y[l]:a.push({entity:f,path:{key:p,pk:l}});else{const e=o(l,t),[i]=e.get(f,r);if(i)return d[l]=i.value[0],a.push(...i.dependencies),i.value;{const r=a.length;let o;a.push({entity:f,path:{key:p,pk:l}}),t.createIfValid?o=d[l]=s(f)?t.createIfValid(f.toObject()):t.createIfValid(f):(o=f,n=function(e){const t=e.og||e,n=(e,n)=>t(e,n);return n.og=e,n}(n),n.setLocal=e=>d[l]=e),y[l]=r,void 0===o?(h=!1,g=!0):[d[l],h,g]=t.denormalize(o,n),delete y[l];const i=a.slice(-1===u.i?r:u.i),c={dependencies:i,value:[d[l],h,g]};e.set(i,c),u.i===r&&(u.i=-1)}}return[d[l],h,g]})(t,n,h,i,u,f,y,l,d):r?n.denormalize(t,h):[t,!0,!1]}return(e,t)=>{if(!(Object(e)===e&&Object(t)===t)){const n=h(e,t);return[n[0],n[1],n[2],p(l)]}let[n,o]=r.get(e,i);return void 0===n&&(n=h(e,t),o=p(l),l.unshift({entity:e,path:{key:"",pk:""}}),r.set(l,n)),[n[0],n[1],n[2],o]}},g=e=>(t,n)=>{const r=n.key;r in e||(e[r]=Object.create(null));const o=e[r];o[t]||(o[t]=new WeakMap);let i=o[t].get(n);return i||(i=new f,o[t].set(n,i)),i},b=(e,t,n,r={},o=new f)=>void 0===t?[e,!0,!1,[]]:void 0===e?[void 0,!1,!1,[]]:h(n,r,o)(e,t);const m=Symbol("ENTITY WAS DELETED"),v=(e,t,n,o,i,s)=>{if(!e||!o)return e;if(o.normalize&&"function"==typeof o.normalize)return"object"!=typeof e?e:o.normalize(e,t,n,v,i,s);if("function"==typeof o)return new o(e);if("object"!=typeof e||"object"!=typeof o)return e;return(Array.isArray(o)?r:c)(o,e,t,n,v,i,s)};const O=(e,t,n={},r={},o={},i={date:Date.now(),expiresAt:1/0,fetchedAt:0})=>{if(null==t)return{entities:n,indexes:r,result:e,entityMeta:o};const s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s&&(void 0===t.key||void 0!==t.pk||"string"!=typeof e)){if("production"!==process.env.NODE_ENV){const n=e=>{try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}};throw"string"==typeof e&&n(e)?new Error(`Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/rest/api/RestEndpoint#parseResponse for more information\n\n Schema: ${JSON.stringify(t,void 0,2)}\n Input: "${e}"`):new Error(`Unexpected input given to normalize. Expected type to be "${s}", found "${null===e?"null":typeof e}".\n\n Schema: ${JSON.stringify(t,void 0,2)}\n Input: "${e}"`)}throw new Error(`Unexpected input given to normalize. Expected type to be "${s}", found "${null===e?"null":typeof e}".`)}const c=Object.assign({},n),a=Object.assign({},r),u=Object.assign({},o),f=((e,t,n,r,o,i)=>(s,c,a)=>{const u=s.key;u in e||(e[u]={},n[u]=Object.assign({},n[u]),o[u]=Object.assign({},o[u]));const f=e[u][a];if(f)e[u][a]=s.merge(f,c);else{const t=s.expiresAt?s.expiresAt(i,c):i.expiresAt,r=n[u][a];if(r){var l,p,d;const n=o[u][a];e[u][a]=s.mergeWithStore?s.mergeWithStore(n,i,r,c):function(e,t,n,r,o){return!t||(e.useIncoming&&n.fetchedAt?e.useIncoming(t,n,r,o):t.date<=n.date)?typeof o!=typeof r?o:e.merge(r,o):r}(s,n,i,r,c),o[u][a]={expiresAt:Math.max(t,null==n?void 0:n.expiresAt),date:Math.max(i.date,null!=(l=null==n?void 0:n.date)?l:0),fetchedAt:Math.max(null!=(p=i.fetchedAt)?p:0,null!=(d=null==n?void 0:n.fetchedAt)?d:0)}}else{var y;e[u][a]=c,o[u][a]={expiresAt:t,date:i.date,fetchedAt:null!=(y=i.fetchedAt)?y:i.date}}}if(Array.isArray(s.indexes)){const o=e[u][a];u in t||(t[u]={},r[u]=Object.assign({},r[u]));for(const e of s.indexes){e in t[u]||(r[u][e]=t[u][e]={});const i=t[u][e];f&&delete i[f[e]],n[u]&&n[u][a]&&n[u][a][e]!==o[e]&&(i[n[u][a][e]]=m),e in o?i[o[e]]=a:"production"!==process.env.NODE_ENV&&console.warn(`Index not found in entity. Indexes must be top-level members of your entity.\nIndex: ${e}\nEntity: ${JSON.stringify(o,void 0,2)}`)}}n[u][a]=e[u][a]})({},{},c,a,u,i);return{entities:c,indexes:a,result:v(e,e,void 0,t,f,{}),entityMeta:u}};function j(e,t,n,r={}){if(function(e){return!!e&&"function"==typeof e.infer}(e))return e.infer(t,n,j,r);if("object"==typeof e&&e){return(Array.isArray(e)?i:u)(e,t,n,j,r)}return e}var x={Invalid:1,InvalidIfStale:2,Valid:3};Object.hasOwn=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};export{m as DELETED,x as ExpiryStatus,f as WeakEntityMap,b as denormalize,j as inferResults,e as isEntity,O as normalize}; |
@@ -133,6 +133,69 @@ 'use strict'; | ||
/** Maps entity dependencies to a value (usually their denormalized form) | ||
* | ||
* Dependencies store `Path` to enable quick traversal using only `State` | ||
* If *any* members of the dependency get cleaned up, so does that key/value pair get removed. | ||
*/ | ||
class WeakEntityMap { | ||
constructor() { | ||
this.next = new WeakMap(); | ||
} | ||
get(entity, getEntity) { | ||
let curLink = this.next.get(entity); | ||
if (!curLink) return EMPTY; | ||
while (curLink.nextPath) { | ||
const nextEntity = getEntity(curLink.nextPath); | ||
curLink = curLink.next.get(nextEntity); | ||
if (!curLink) return EMPTY; | ||
} | ||
// curLink exists, but has no path - so must have a value | ||
return [curLink.value, curLink.journey]; | ||
} | ||
set(dependencies, value) { | ||
if (dependencies.length < 1) throw new KeySize(); | ||
let curLink = this; | ||
for (const { | ||
entity, | ||
path | ||
} of dependencies) { | ||
let nextLink = curLink.next.get(entity); | ||
if (!nextLink) { | ||
nextLink = new Link(); | ||
curLink.next.set(entity, nextLink); | ||
} | ||
curLink.nextPath = path; | ||
curLink = nextLink; | ||
} | ||
// in case there used to be more | ||
delete curLink.nextPath; | ||
curLink.value = value; | ||
// we could recompute this on get, but it would have a cost and we optimize for `get` | ||
curLink.journey = depToPaths(dependencies); | ||
} | ||
} | ||
const EMPTY = [undefined, undefined]; | ||
function getEntities(state) { | ||
const entityIsImmutable = isImmutable(state); | ||
if (entityIsImmutable) { | ||
return ({ | ||
key, | ||
pk | ||
}) => state.getIn([key, pk]); | ||
} else { | ||
return ({ | ||
key, | ||
pk | ||
}) => { | ||
var _state$key; | ||
return (_state$key = state[key]) == null ? void 0 : _state$key[pk]; | ||
}; | ||
} | ||
} | ||
function depToPaths(dependencies) { | ||
return dependencies.map(dep => dep.path); | ||
} | ||
/** Link in a chain */ | ||
class Link { | ||
constructor() { | ||
this.children = new WeakMap(); | ||
this.next = new WeakMap(); | ||
} | ||
@@ -147,57 +210,7 @@ } | ||
/** Maps from a list of objects (referentially) to any value | ||
* | ||
* If *any* members of the list get claned up, so does that key/value pair get removed. | ||
*/ | ||
class WeakListMap { | ||
constructor() { | ||
this.first = new WeakMap(); | ||
} | ||
delete(key) { | ||
const link = this.traverse(key); | ||
link == null ? true : delete link.value; | ||
return !!link; | ||
} | ||
get(key) { | ||
const link = this.traverse(key); | ||
return link == null ? void 0 : link.value; | ||
} | ||
has(key) { | ||
const link = this.traverse(key); | ||
if (!link) return false; | ||
return Object.hasOwn(link, 'value'); | ||
} | ||
set(key, value) { | ||
if (key.length < 1) throw new KeySize(); | ||
let cur = this.first; | ||
let link; | ||
for (let i = 0; i < key.length; i++) { | ||
if (!cur.has(key[i])) { | ||
link = new Link(); | ||
cur.set(key[i], link); | ||
} else { | ||
link = cur.get(key[i]); | ||
} | ||
cur = link.children; | ||
// do on later iteration of loop. this makes typescript happy rather than putting after loop | ||
if (i === key.length - 1) { | ||
link.value = value; | ||
} | ||
} | ||
return this; | ||
} | ||
traverse(key) { | ||
let cur = this.first; | ||
let link; | ||
for (let i = 0; i < key.length; i++) { | ||
link = cur.get(key[i]); | ||
if (!link) return; | ||
cur = link.children; | ||
} | ||
return link; | ||
} | ||
} | ||
const unvisitEntity = (entityOrId, schema, unvisit, getEntity, localCache, cycleCache, entityCache, dependencies, cycleIndex) => { | ||
const entity = getEntity(entityOrId, schema); | ||
const unvisitEntity = (entityOrId, schema, unvisit, getEntity, getCache, localCache, cycleCache, dependencies, cycleIndex) => { | ||
const entity = typeof entityOrId === 'object' ? entityOrId : getEntity({ | ||
pk: entityOrId, | ||
key: schema.key | ||
}); | ||
if (typeof entity === 'symbol' && entity.toString().includes('DELETED')) { | ||
@@ -230,45 +243,62 @@ return [undefined, true, true]; | ||
} | ||
if (!(key in entityCache)) { | ||
entityCache[key] = Object.create(null); | ||
} | ||
const localCacheKey = localCache[key]; | ||
const cycleCacheKey = cycleCache[key]; | ||
const entityCacheKey = entityCache[key]; | ||
let found = true; | ||
let deleted = false; | ||
// local cache lookup first | ||
if (!localCacheKey[pk]) { | ||
const trackingIndex = dependencies.length; | ||
dependencies.push(entity); | ||
let entityCopy; | ||
if (schema.createIfValid) { | ||
entityCopy = localCacheKey[pk] = isImmutable(entity) ? schema.createIfValid(entity.toObject()) : schema.createIfValid(entity); | ||
// TODO(breaking): remove once old verions no longer supported | ||
} else { | ||
entityCopy = entity; | ||
unvisit = withTrackedEntities(unvisit); | ||
unvisit.setLocal = entityCopy => localCacheKey[pk] = entityCopy; | ||
} | ||
cycleCacheKey[pk] = trackingIndex; | ||
if (entityCopy === undefined) { | ||
// undefined indicates we should suspense (perhaps failed validation) | ||
found = false; | ||
deleted = true; | ||
} else { | ||
[localCacheKey[pk], found, deleted] = schema.denormalize(entityCopy, unvisit); | ||
} | ||
delete cycleCacheKey[pk]; | ||
const globalCacheEntry = getGlobalCacheEntry(entityCacheKey, pk); | ||
const globalCache = getCache(pk, schema); | ||
const [cacheValue] = globalCache.get(entity, getEntity); | ||
// TODO: what if this just returned the deps - then we don't need to store them | ||
// if in cycle, use the start of the cycle to track all deps | ||
// otherwise, we use our own trackingIndex | ||
const localKey = dependencies.slice(cycleIndex.i === -1 ? trackingIndex : cycleIndex.i); | ||
if (!globalCacheEntry.has(localKey)) { | ||
globalCacheEntry.set(localKey, localCacheKey[pk]); | ||
} else { | ||
localCacheKey[pk] = globalCacheEntry.get(localKey); | ||
if (cacheValue) { | ||
localCacheKey[pk] = cacheValue.value[0]; | ||
// TODO: can we store the cache values instead of tracking *all* their sources? | ||
// this is only used for setting results cache correctly. if we got this far we will def need to set as we would have already tried getting it | ||
dependencies.push(...cacheValue.dependencies); | ||
return cacheValue.value; | ||
} | ||
// if we don't find in denormalize cache then do full denormalize | ||
else { | ||
const trackingIndex = dependencies.length; | ||
dependencies.push({ | ||
entity, | ||
path: { | ||
key, | ||
pk | ||
} | ||
}); | ||
let entityCopy; | ||
if (schema.createIfValid) { | ||
entityCopy = localCacheKey[pk] = isImmutable(entity) ? schema.createIfValid(entity.toObject()) : schema.createIfValid(entity); | ||
// TODO(breaking): remove once old verions no longer supported | ||
} else { | ||
entityCopy = entity; | ||
unvisit = withTrackedEntities(unvisit); | ||
unvisit.setLocal = entityCopy => localCacheKey[pk] = entityCopy; | ||
} | ||
cycleCacheKey[pk] = trackingIndex; | ||
if (entityCopy === undefined) { | ||
// undefined indicates we should suspense (perhaps failed validation) | ||
found = false; | ||
deleted = true; | ||
} else { | ||
[localCacheKey[pk], found, deleted] = schema.denormalize(entityCopy, unvisit); | ||
} | ||
delete cycleCacheKey[pk]; | ||
// start of cycle - reset cycle detection | ||
if (cycleIndex.i === trackingIndex) { | ||
cycleIndex.i = -1; | ||
// if in cycle, use the start of the cycle to track all deps | ||
// otherwise, we use our own trackingIndex | ||
const localKey = dependencies.slice(cycleIndex.i === -1 ? trackingIndex : cycleIndex.i); | ||
const cacheValue = { | ||
dependencies: localKey, | ||
value: [localCacheKey[pk], found, deleted] | ||
}; | ||
globalCache.set(localKey, cacheValue); | ||
// start of cycle - reset cycle detection | ||
if (cycleIndex.i === trackingIndex) { | ||
cycleIndex.i = -1; | ||
} | ||
} | ||
@@ -281,3 +311,9 @@ } else { | ||
// with no cycle, globalCacheEntry will have already been set | ||
dependencies.push(entity); | ||
dependencies.push({ | ||
entity, | ||
path: { | ||
key, | ||
pk | ||
} | ||
}); | ||
} | ||
@@ -287,4 +323,6 @@ } | ||
}; | ||
const getUnvisit = (entities, entityCache, resultCache, localCache) => { | ||
const getUnvisit = (entities, entityCache, resultCache) => { | ||
const getEntity = getEntities(entities); | ||
const getCache = getEntityCaches(entityCache); | ||
const localCache = {}; | ||
const dependencies = []; | ||
@@ -303,2 +341,4 @@ const cycleIndex = { | ||
const hasDenormalize = typeof schema.denormalize === 'function'; | ||
// deserialize fields (like Date) | ||
if (!hasDenormalize && typeof schema === 'function') { | ||
@@ -318,3 +358,3 @@ if (input instanceof schema) return [input, true, false]; | ||
if (isEntity(schema)) { | ||
return unvisitEntity(input, schema, unvisit, getEntity, localCache, cycleCache, entityCache, dependencies, cycleIndex); | ||
return unvisitEntity(input, schema, unvisit, getEntity, getCache, localCache, cycleCache, dependencies, cycleIndex); | ||
} | ||
@@ -326,50 +366,57 @@ if (hasDenormalize) { | ||
} | ||
//const wrappedUnvisit = withTrackedEntities(unvisit, globalKey); | ||
return (input, schema) => { | ||
const ret = unvisit(input, schema); | ||
// in the case where WeakMap cannot be used | ||
// this test ensures null is properly excluded from WeakMap | ||
if (Object(input) !== input) return ret; | ||
dependencies.push(input); | ||
if (!resultCache.has(dependencies)) { | ||
resultCache.set(dependencies, ret[0]); | ||
return ret; | ||
} else { | ||
return [resultCache.get(dependencies), ret[1], ret[2]]; | ||
const cachable = Object(input) === input && Object(schema) === schema; | ||
if (!cachable) { | ||
const ret = unvisit(input, schema); | ||
// this is faster than spread | ||
// https://www.measurethat.net/Benchmarks/Show/23636/0/spread-with-tuples | ||
return [ret[0], ret[1], ret[2], depToPaths(dependencies)]; | ||
} | ||
let [ret, entityPaths] = resultCache.get(input, getEntity); | ||
if (ret === undefined) { | ||
ret = unvisit(input, schema); | ||
// we want to do this before we add our 'input' entry | ||
entityPaths = depToPaths(dependencies); | ||
// for the first entry, `path` is ignored so empty members is fine | ||
dependencies.unshift({ | ||
entity: input, | ||
path: { | ||
key: '', | ||
pk: '' | ||
} | ||
}); | ||
resultCache.set(dependencies, ret); | ||
} | ||
return [ret[0], ret[1], ret[2], entityPaths]; | ||
}; | ||
}; | ||
const getEntities = entities => { | ||
const entityIsImmutable = isImmutable(entities); | ||
return (entityOrId, schema) => { | ||
var _entities$schemaKey; | ||
const schemaKey = schema.key; | ||
if (typeof entityOrId === 'object') { | ||
return entityOrId; | ||
const getEntityCaches = entityCache => { | ||
return (pk, schema) => { | ||
const key = schema.key; | ||
if (!(key in entityCache)) { | ||
entityCache[key] = Object.create(null); | ||
} | ||
if (entityIsImmutable) { | ||
return entities.getIn([schemaKey, entityOrId]); | ||
const entityCacheKey = entityCache[key]; | ||
if (!entityCacheKey[pk]) entityCacheKey[pk] = new WeakMap(); | ||
let wem = entityCacheKey[pk].get(schema); | ||
if (!wem) { | ||
wem = new WeakEntityMap(); | ||
entityCacheKey[pk].set(schema, wem); | ||
} | ||
return (_entities$schemaKey = entities[schemaKey]) == null ? void 0 : _entities$schemaKey[entityOrId]; | ||
return wem; | ||
}; | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
const denormalize = (input, schema, entities, entityCache = {}, resultCache = new WeakListMap()) => { | ||
const denormalize = (input, schema, entities, entityCache = {}, resultCache = new WeakEntityMap()) => { | ||
// undefined mean don't do anything | ||
if (schema === undefined) { | ||
return [input, true, false, {}]; | ||
return [input, true, false, []]; | ||
} | ||
if (input === undefined) { | ||
return [undefined, false, false, {}]; | ||
return [undefined, false, false, []]; | ||
} | ||
const resolvedEntities = {}; | ||
const unvisit = getUnvisit(entities, entityCache, resultCache, resolvedEntities); | ||
return [...unvisit(input, schema), resolvedEntities]; | ||
return getUnvisit(entities, entityCache, resultCache)(input, schema); | ||
}; | ||
function getGlobalCacheEntry(entityCache, id) { | ||
if (!entityCache[id]) entityCache[id] = new WeakListMap(); | ||
return entityCache[id]; | ||
} | ||
@@ -605,3 +652,3 @@ // TODO(breaking): remove once unused | ||
exports.ExpiryStatus = ExpiryStatus; | ||
exports.WeakListMap = WeakListMap; | ||
exports.WeakEntityMap = WeakEntityMap; | ||
exports.denormalize = denormalize; | ||
@@ -608,0 +655,0 @@ exports.inferResults = inferResults; |
@@ -131,6 +131,69 @@ (function (global, factory) { | ||
/** Maps entity dependencies to a value (usually their denormalized form) | ||
* | ||
* Dependencies store `Path` to enable quick traversal using only `State` | ||
* If *any* members of the dependency get cleaned up, so does that key/value pair get removed. | ||
*/ | ||
class WeakEntityMap { | ||
constructor() { | ||
this.next = new WeakMap(); | ||
} | ||
get(entity, getEntity) { | ||
let curLink = this.next.get(entity); | ||
if (!curLink) return EMPTY; | ||
while (curLink.nextPath) { | ||
const nextEntity = getEntity(curLink.nextPath); | ||
curLink = curLink.next.get(nextEntity); | ||
if (!curLink) return EMPTY; | ||
} | ||
// curLink exists, but has no path - so must have a value | ||
return [curLink.value, curLink.journey]; | ||
} | ||
set(dependencies, value) { | ||
if (dependencies.length < 1) throw new KeySize(); | ||
let curLink = this; | ||
for (const { | ||
entity, | ||
path | ||
} of dependencies) { | ||
let nextLink = curLink.next.get(entity); | ||
if (!nextLink) { | ||
nextLink = new Link(); | ||
curLink.next.set(entity, nextLink); | ||
} | ||
curLink.nextPath = path; | ||
curLink = nextLink; | ||
} | ||
// in case there used to be more | ||
delete curLink.nextPath; | ||
curLink.value = value; | ||
// we could recompute this on get, but it would have a cost and we optimize for `get` | ||
curLink.journey = depToPaths(dependencies); | ||
} | ||
} | ||
const EMPTY = [undefined, undefined]; | ||
function getEntities(state) { | ||
const entityIsImmutable = isImmutable(state); | ||
if (entityIsImmutable) { | ||
return ({ | ||
key, | ||
pk | ||
}) => state.getIn([key, pk]); | ||
} else { | ||
return ({ | ||
key, | ||
pk | ||
}) => { | ||
var _state$key; | ||
return (_state$key = state[key]) == null ? void 0 : _state$key[pk]; | ||
}; | ||
} | ||
} | ||
function depToPaths(dependencies) { | ||
return dependencies.map(dep => dep.path); | ||
} | ||
/** Link in a chain */ | ||
class Link { | ||
constructor() { | ||
this.children = new WeakMap(); | ||
this.next = new WeakMap(); | ||
} | ||
@@ -145,57 +208,7 @@ } | ||
/** Maps from a list of objects (referentially) to any value | ||
* | ||
* If *any* members of the list get claned up, so does that key/value pair get removed. | ||
*/ | ||
class WeakListMap { | ||
constructor() { | ||
this.first = new WeakMap(); | ||
} | ||
delete(key) { | ||
const link = this.traverse(key); | ||
link == null ? true : delete link.value; | ||
return !!link; | ||
} | ||
get(key) { | ||
const link = this.traverse(key); | ||
return link == null ? void 0 : link.value; | ||
} | ||
has(key) { | ||
const link = this.traverse(key); | ||
if (!link) return false; | ||
return Object.hasOwn(link, 'value'); | ||
} | ||
set(key, value) { | ||
if (key.length < 1) throw new KeySize(); | ||
let cur = this.first; | ||
let link; | ||
for (let i = 0; i < key.length; i++) { | ||
if (!cur.has(key[i])) { | ||
link = new Link(); | ||
cur.set(key[i], link); | ||
} else { | ||
link = cur.get(key[i]); | ||
} | ||
cur = link.children; | ||
// do on later iteration of loop. this makes typescript happy rather than putting after loop | ||
if (i === key.length - 1) { | ||
link.value = value; | ||
} | ||
} | ||
return this; | ||
} | ||
traverse(key) { | ||
let cur = this.first; | ||
let link; | ||
for (let i = 0; i < key.length; i++) { | ||
link = cur.get(key[i]); | ||
if (!link) return; | ||
cur = link.children; | ||
} | ||
return link; | ||
} | ||
} | ||
const unvisitEntity = (entityOrId, schema, unvisit, getEntity, localCache, cycleCache, entityCache, dependencies, cycleIndex) => { | ||
const entity = getEntity(entityOrId, schema); | ||
const unvisitEntity = (entityOrId, schema, unvisit, getEntity, getCache, localCache, cycleCache, dependencies, cycleIndex) => { | ||
const entity = typeof entityOrId === 'object' ? entityOrId : getEntity({ | ||
pk: entityOrId, | ||
key: schema.key | ||
}); | ||
if (typeof entity === 'symbol' && entity.toString().includes('DELETED')) { | ||
@@ -228,45 +241,62 @@ return [undefined, true, true]; | ||
} | ||
if (!(key in entityCache)) { | ||
entityCache[key] = Object.create(null); | ||
} | ||
const localCacheKey = localCache[key]; | ||
const cycleCacheKey = cycleCache[key]; | ||
const entityCacheKey = entityCache[key]; | ||
let found = true; | ||
let deleted = false; | ||
// local cache lookup first | ||
if (!localCacheKey[pk]) { | ||
const trackingIndex = dependencies.length; | ||
dependencies.push(entity); | ||
let entityCopy; | ||
if (schema.createIfValid) { | ||
entityCopy = localCacheKey[pk] = isImmutable(entity) ? schema.createIfValid(entity.toObject()) : schema.createIfValid(entity); | ||
// TODO(breaking): remove once old verions no longer supported | ||
} else { | ||
entityCopy = entity; | ||
unvisit = withTrackedEntities(unvisit); | ||
unvisit.setLocal = entityCopy => localCacheKey[pk] = entityCopy; | ||
} | ||
cycleCacheKey[pk] = trackingIndex; | ||
if (entityCopy === undefined) { | ||
// undefined indicates we should suspense (perhaps failed validation) | ||
found = false; | ||
deleted = true; | ||
} else { | ||
[localCacheKey[pk], found, deleted] = schema.denormalize(entityCopy, unvisit); | ||
} | ||
delete cycleCacheKey[pk]; | ||
const globalCacheEntry = getGlobalCacheEntry(entityCacheKey, pk); | ||
const globalCache = getCache(pk, schema); | ||
const [cacheValue] = globalCache.get(entity, getEntity); | ||
// TODO: what if this just returned the deps - then we don't need to store them | ||
// if in cycle, use the start of the cycle to track all deps | ||
// otherwise, we use our own trackingIndex | ||
const localKey = dependencies.slice(cycleIndex.i === -1 ? trackingIndex : cycleIndex.i); | ||
if (!globalCacheEntry.has(localKey)) { | ||
globalCacheEntry.set(localKey, localCacheKey[pk]); | ||
} else { | ||
localCacheKey[pk] = globalCacheEntry.get(localKey); | ||
if (cacheValue) { | ||
localCacheKey[pk] = cacheValue.value[0]; | ||
// TODO: can we store the cache values instead of tracking *all* their sources? | ||
// this is only used for setting results cache correctly. if we got this far we will def need to set as we would have already tried getting it | ||
dependencies.push(...cacheValue.dependencies); | ||
return cacheValue.value; | ||
} | ||
// if we don't find in denormalize cache then do full denormalize | ||
else { | ||
const trackingIndex = dependencies.length; | ||
dependencies.push({ | ||
entity, | ||
path: { | ||
key, | ||
pk | ||
} | ||
}); | ||
let entityCopy; | ||
if (schema.createIfValid) { | ||
entityCopy = localCacheKey[pk] = isImmutable(entity) ? schema.createIfValid(entity.toObject()) : schema.createIfValid(entity); | ||
// TODO(breaking): remove once old verions no longer supported | ||
} else { | ||
entityCopy = entity; | ||
unvisit = withTrackedEntities(unvisit); | ||
unvisit.setLocal = entityCopy => localCacheKey[pk] = entityCopy; | ||
} | ||
cycleCacheKey[pk] = trackingIndex; | ||
if (entityCopy === undefined) { | ||
// undefined indicates we should suspense (perhaps failed validation) | ||
found = false; | ||
deleted = true; | ||
} else { | ||
[localCacheKey[pk], found, deleted] = schema.denormalize(entityCopy, unvisit); | ||
} | ||
delete cycleCacheKey[pk]; | ||
// start of cycle - reset cycle detection | ||
if (cycleIndex.i === trackingIndex) { | ||
cycleIndex.i = -1; | ||
// if in cycle, use the start of the cycle to track all deps | ||
// otherwise, we use our own trackingIndex | ||
const localKey = dependencies.slice(cycleIndex.i === -1 ? trackingIndex : cycleIndex.i); | ||
const cacheValue = { | ||
dependencies: localKey, | ||
value: [localCacheKey[pk], found, deleted] | ||
}; | ||
globalCache.set(localKey, cacheValue); | ||
// start of cycle - reset cycle detection | ||
if (cycleIndex.i === trackingIndex) { | ||
cycleIndex.i = -1; | ||
} | ||
} | ||
@@ -279,3 +309,9 @@ } else { | ||
// with no cycle, globalCacheEntry will have already been set | ||
dependencies.push(entity); | ||
dependencies.push({ | ||
entity, | ||
path: { | ||
key, | ||
pk | ||
} | ||
}); | ||
} | ||
@@ -285,4 +321,6 @@ } | ||
}; | ||
const getUnvisit = (entities, entityCache, resultCache, localCache) => { | ||
const getUnvisit = (entities, entityCache, resultCache) => { | ||
const getEntity = getEntities(entities); | ||
const getCache = getEntityCaches(entityCache); | ||
const localCache = {}; | ||
const dependencies = []; | ||
@@ -301,2 +339,4 @@ const cycleIndex = { | ||
const hasDenormalize = typeof schema.denormalize === 'function'; | ||
// deserialize fields (like Date) | ||
if (!hasDenormalize && typeof schema === 'function') { | ||
@@ -316,3 +356,3 @@ if (input instanceof schema) return [input, true, false]; | ||
if (isEntity(schema)) { | ||
return unvisitEntity(input, schema, unvisit, getEntity, localCache, cycleCache, entityCache, dependencies, cycleIndex); | ||
return unvisitEntity(input, schema, unvisit, getEntity, getCache, localCache, cycleCache, dependencies, cycleIndex); | ||
} | ||
@@ -324,50 +364,57 @@ if (hasDenormalize) { | ||
} | ||
//const wrappedUnvisit = withTrackedEntities(unvisit, globalKey); | ||
return (input, schema) => { | ||
const ret = unvisit(input, schema); | ||
// in the case where WeakMap cannot be used | ||
// this test ensures null is properly excluded from WeakMap | ||
if (Object(input) !== input) return ret; | ||
dependencies.push(input); | ||
if (!resultCache.has(dependencies)) { | ||
resultCache.set(dependencies, ret[0]); | ||
return ret; | ||
} else { | ||
return [resultCache.get(dependencies), ret[1], ret[2]]; | ||
const cachable = Object(input) === input && Object(schema) === schema; | ||
if (!cachable) { | ||
const ret = unvisit(input, schema); | ||
// this is faster than spread | ||
// https://www.measurethat.net/Benchmarks/Show/23636/0/spread-with-tuples | ||
return [ret[0], ret[1], ret[2], depToPaths(dependencies)]; | ||
} | ||
let [ret, entityPaths] = resultCache.get(input, getEntity); | ||
if (ret === undefined) { | ||
ret = unvisit(input, schema); | ||
// we want to do this before we add our 'input' entry | ||
entityPaths = depToPaths(dependencies); | ||
// for the first entry, `path` is ignored so empty members is fine | ||
dependencies.unshift({ | ||
entity: input, | ||
path: { | ||
key: '', | ||
pk: '' | ||
} | ||
}); | ||
resultCache.set(dependencies, ret); | ||
} | ||
return [ret[0], ret[1], ret[2], entityPaths]; | ||
}; | ||
}; | ||
const getEntities = entities => { | ||
const entityIsImmutable = isImmutable(entities); | ||
return (entityOrId, schema) => { | ||
var _entities$schemaKey; | ||
const schemaKey = schema.key; | ||
if (typeof entityOrId === 'object') { | ||
return entityOrId; | ||
const getEntityCaches = entityCache => { | ||
return (pk, schema) => { | ||
const key = schema.key; | ||
if (!(key in entityCache)) { | ||
entityCache[key] = Object.create(null); | ||
} | ||
if (entityIsImmutable) { | ||
return entities.getIn([schemaKey, entityOrId]); | ||
const entityCacheKey = entityCache[key]; | ||
if (!entityCacheKey[pk]) entityCacheKey[pk] = new WeakMap(); | ||
let wem = entityCacheKey[pk].get(schema); | ||
if (!wem) { | ||
wem = new WeakEntityMap(); | ||
entityCacheKey[pk].set(schema, wem); | ||
} | ||
return (_entities$schemaKey = entities[schemaKey]) == null ? void 0 : _entities$schemaKey[entityOrId]; | ||
return wem; | ||
}; | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
const denormalize = (input, schema, entities, entityCache = {}, resultCache = new WeakListMap()) => { | ||
const denormalize = (input, schema, entities, entityCache = {}, resultCache = new WeakEntityMap()) => { | ||
// undefined mean don't do anything | ||
if (schema === undefined) { | ||
return [input, true, false, {}]; | ||
return [input, true, false, []]; | ||
} | ||
if (input === undefined) { | ||
return [undefined, false, false, {}]; | ||
return [undefined, false, false, []]; | ||
} | ||
const resolvedEntities = {}; | ||
const unvisit = getUnvisit(entities, entityCache, resultCache, resolvedEntities); | ||
return [...unvisit(input, schema), resolvedEntities]; | ||
return getUnvisit(entities, entityCache, resultCache)(input, schema); | ||
}; | ||
function getGlobalCacheEntry(entityCache, id) { | ||
if (!entityCache[id]) entityCache[id] = new WeakListMap(); | ||
return entityCache[id]; | ||
} | ||
@@ -596,3 +643,3 @@ // TODO(breaking): remove once unused | ||
exports.ExpiryStatus = ExpiryStatus; | ||
exports.WeakListMap = WeakListMap; | ||
exports.WeakEntityMap = WeakEntityMap; | ||
exports.denormalize = denormalize; | ||
@@ -599,0 +646,0 @@ exports.inferResults = inferResults; |
@@ -5,5 +5,8 @@ import { isEntity } from './isEntity.js'; | ||
import { denormalize as objectDenormalize } from './schemas/Object.js'; | ||
import WeakListMap from './WeakListMap.js'; | ||
const unvisitEntity = (entityOrId, schema, unvisit, getEntity, localCache, cycleCache, entityCache, dependencies, cycleIndex) => { | ||
const entity = getEntity(entityOrId, schema); | ||
import WeakEntityMap, { getEntities, depToPaths } from './WeakEntityMap.js'; | ||
const unvisitEntity = (entityOrId, schema, unvisit, getEntity, getCache, localCache, cycleCache, dependencies, cycleIndex) => { | ||
const entity = typeof entityOrId === 'object' ? entityOrId : getEntity({ | ||
pk: entityOrId, | ||
key: schema.key | ||
}); | ||
if (typeof entity === 'symbol' && entity.toString().includes('DELETED')) { | ||
@@ -36,45 +39,62 @@ return [undefined, true, true]; | ||
} | ||
if (!(key in entityCache)) { | ||
entityCache[key] = Object.create(null); | ||
} | ||
const localCacheKey = localCache[key]; | ||
const cycleCacheKey = cycleCache[key]; | ||
const entityCacheKey = entityCache[key]; | ||
let found = true; | ||
let deleted = false; | ||
// local cache lookup first | ||
if (!localCacheKey[pk]) { | ||
const trackingIndex = dependencies.length; | ||
dependencies.push(entity); | ||
let entityCopy; | ||
if (schema.createIfValid) { | ||
entityCopy = localCacheKey[pk] = isImmutable(entity) ? schema.createIfValid(entity.toObject()) : schema.createIfValid(entity); | ||
// TODO(breaking): remove once old verions no longer supported | ||
} else { | ||
entityCopy = entity; | ||
unvisit = withTrackedEntities(unvisit); | ||
unvisit.setLocal = entityCopy => localCacheKey[pk] = entityCopy; | ||
} | ||
cycleCacheKey[pk] = trackingIndex; | ||
if (entityCopy === undefined) { | ||
// undefined indicates we should suspense (perhaps failed validation) | ||
found = false; | ||
deleted = true; | ||
} else { | ||
[localCacheKey[pk], found, deleted] = schema.denormalize(entityCopy, unvisit); | ||
} | ||
delete cycleCacheKey[pk]; | ||
const globalCacheEntry = getGlobalCacheEntry(entityCacheKey, pk); | ||
const globalCache = getCache(pk, schema); | ||
const [cacheValue] = globalCache.get(entity, getEntity); | ||
// TODO: what if this just returned the deps - then we don't need to store them | ||
// if in cycle, use the start of the cycle to track all deps | ||
// otherwise, we use our own trackingIndex | ||
const localKey = dependencies.slice(cycleIndex.i === -1 ? trackingIndex : cycleIndex.i); | ||
if (!globalCacheEntry.has(localKey)) { | ||
globalCacheEntry.set(localKey, localCacheKey[pk]); | ||
} else { | ||
localCacheKey[pk] = globalCacheEntry.get(localKey); | ||
if (cacheValue) { | ||
localCacheKey[pk] = cacheValue.value[0]; | ||
// TODO: can we store the cache values instead of tracking *all* their sources? | ||
// this is only used for setting results cache correctly. if we got this far we will def need to set as we would have already tried getting it | ||
dependencies.push(...cacheValue.dependencies); | ||
return cacheValue.value; | ||
} | ||
// if we don't find in denormalize cache then do full denormalize | ||
else { | ||
const trackingIndex = dependencies.length; | ||
dependencies.push({ | ||
entity, | ||
path: { | ||
key, | ||
pk | ||
} | ||
}); | ||
let entityCopy; | ||
if (schema.createIfValid) { | ||
entityCopy = localCacheKey[pk] = isImmutable(entity) ? schema.createIfValid(entity.toObject()) : schema.createIfValid(entity); | ||
// TODO(breaking): remove once old verions no longer supported | ||
} else { | ||
entityCopy = entity; | ||
unvisit = withTrackedEntities(unvisit); | ||
unvisit.setLocal = entityCopy => localCacheKey[pk] = entityCopy; | ||
} | ||
cycleCacheKey[pk] = trackingIndex; | ||
if (entityCopy === undefined) { | ||
// undefined indicates we should suspense (perhaps failed validation) | ||
found = false; | ||
deleted = true; | ||
} else { | ||
[localCacheKey[pk], found, deleted] = schema.denormalize(entityCopy, unvisit); | ||
} | ||
delete cycleCacheKey[pk]; | ||
// start of cycle - reset cycle detection | ||
if (cycleIndex.i === trackingIndex) { | ||
cycleIndex.i = -1; | ||
// if in cycle, use the start of the cycle to track all deps | ||
// otherwise, we use our own trackingIndex | ||
const localKey = dependencies.slice(cycleIndex.i === -1 ? trackingIndex : cycleIndex.i); | ||
const cacheValue = { | ||
dependencies: localKey, | ||
value: [localCacheKey[pk], found, deleted] | ||
}; | ||
globalCache.set(localKey, cacheValue); | ||
// start of cycle - reset cycle detection | ||
if (cycleIndex.i === trackingIndex) { | ||
cycleIndex.i = -1; | ||
} | ||
} | ||
@@ -87,3 +107,9 @@ } else { | ||
// with no cycle, globalCacheEntry will have already been set | ||
dependencies.push(entity); | ||
dependencies.push({ | ||
entity, | ||
path: { | ||
key, | ||
pk | ||
} | ||
}); | ||
} | ||
@@ -93,4 +119,6 @@ } | ||
}; | ||
const getUnvisit = (entities, entityCache, resultCache, localCache) => { | ||
const getUnvisit = (entities, entityCache, resultCache) => { | ||
const getEntity = getEntities(entities); | ||
const getCache = getEntityCaches(entityCache); | ||
const localCache = {}; | ||
const dependencies = []; | ||
@@ -109,2 +137,4 @@ const cycleIndex = { | ||
const hasDenormalize = typeof schema.denormalize === 'function'; | ||
// deserialize fields (like Date) | ||
if (!hasDenormalize && typeof schema === 'function') { | ||
@@ -124,3 +154,3 @@ if (input instanceof schema) return [input, true, false]; | ||
if (isEntity(schema)) { | ||
return unvisitEntity(input, schema, unvisit, getEntity, localCache, cycleCache, entityCache, dependencies, cycleIndex); | ||
return unvisitEntity(input, schema, unvisit, getEntity, getCache, localCache, cycleCache, dependencies, cycleIndex); | ||
} | ||
@@ -132,51 +162,58 @@ if (hasDenormalize) { | ||
} | ||
//const wrappedUnvisit = withTrackedEntities(unvisit, globalKey); | ||
return (input, schema) => { | ||
const ret = unvisit(input, schema); | ||
// in the case where WeakMap cannot be used | ||
// this test ensures null is properly excluded from WeakMap | ||
if (Object(input) !== input) return ret; | ||
dependencies.push(input); | ||
if (!resultCache.has(dependencies)) { | ||
resultCache.set(dependencies, ret[0]); | ||
return ret; | ||
} else { | ||
return [resultCache.get(dependencies), ret[1], ret[2]]; | ||
const cachable = Object(input) === input && Object(schema) === schema; | ||
if (!cachable) { | ||
const ret = unvisit(input, schema); | ||
// this is faster than spread | ||
// https://www.measurethat.net/Benchmarks/Show/23636/0/spread-with-tuples | ||
return [ret[0], ret[1], ret[2], depToPaths(dependencies)]; | ||
} | ||
let [ret, entityPaths] = resultCache.get(input, getEntity); | ||
if (ret === undefined) { | ||
ret = unvisit(input, schema); | ||
// we want to do this before we add our 'input' entry | ||
entityPaths = depToPaths(dependencies); | ||
// for the first entry, `path` is ignored so empty members is fine | ||
dependencies.unshift({ | ||
entity: input, | ||
path: { | ||
key: '', | ||
pk: '' | ||
} | ||
}); | ||
resultCache.set(dependencies, ret); | ||
} | ||
return [ret[0], ret[1], ret[2], entityPaths]; | ||
}; | ||
}; | ||
const getEntities = entities => { | ||
const entityIsImmutable = isImmutable(entities); | ||
return (entityOrId, schema) => { | ||
var _entities$schemaKey; | ||
const schemaKey = schema.key; | ||
if (typeof entityOrId === 'object') { | ||
return entityOrId; | ||
const getEntityCaches = entityCache => { | ||
return (pk, schema) => { | ||
const key = schema.key; | ||
if (!(key in entityCache)) { | ||
entityCache[key] = Object.create(null); | ||
} | ||
if (entityIsImmutable) { | ||
return entities.getIn([schemaKey, entityOrId]); | ||
const entityCacheKey = entityCache[key]; | ||
if (!entityCacheKey[pk]) entityCacheKey[pk] = new WeakMap(); | ||
let wem = entityCacheKey[pk].get(schema); | ||
if (!wem) { | ||
wem = new WeakEntityMap(); | ||
entityCacheKey[pk].set(schema, wem); | ||
} | ||
return (_entities$schemaKey = entities[schemaKey]) == null ? void 0 : _entities$schemaKey[entityOrId]; | ||
return wem; | ||
}; | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
export const denormalize = (input, schema, entities, entityCache = {}, resultCache = new WeakListMap()) => { | ||
export const denormalize = (input, schema, entities, entityCache = {}, resultCache = new WeakEntityMap()) => { | ||
// undefined mean don't do anything | ||
if (schema === undefined) { | ||
return [input, true, false, {}]; | ||
return [input, true, false, []]; | ||
} | ||
if (input === undefined) { | ||
return [undefined, false, false, {}]; | ||
return [undefined, false, false, []]; | ||
} | ||
const resolvedEntities = {}; | ||
const unvisit = getUnvisit(entities, entityCache, resultCache, resolvedEntities); | ||
return [...unvisit(input, schema), resolvedEntities]; | ||
return getUnvisit(entities, entityCache, resultCache)(input, schema); | ||
}; | ||
export const denormalizeSimple = (input, schema, entities, entityCache = {}, resultCache = new WeakListMap()) => denormalize(input, schema, entities, entityCache, resultCache).slice(0, 3); | ||
function getGlobalCacheEntry(entityCache, id) { | ||
if (!entityCache[id]) entityCache[id] = new WeakListMap(); | ||
return entityCache[id]; | ||
} | ||
export const denormalizeSimple = (input, schema, entities, entityCache, resultCache) => denormalize(input, schema, entities, entityCache, resultCache).slice(0, 3); | ||
@@ -192,2 +229,2 @@ // TODO(breaking): remove once unused | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0VudGl0eSIsImRlbm9ybWFsaXplIiwiYXJyYXlEZW5vcm1hbGl6ZSIsImlzSW1tdXRhYmxlIiwib2JqZWN0RGVub3JtYWxpemUiLCJXZWFrTGlzdE1hcCIsInVudmlzaXRFbnRpdHkiLCJlbnRpdHlPcklkIiwic2NoZW1hIiwidW52aXNpdCIsImdldEVudGl0eSIsImxvY2FsQ2FjaGUiLCJjeWNsZUNhY2hlIiwiZW50aXR5Q2FjaGUiLCJkZXBlbmRlbmNpZXMiLCJjeWNsZUluZGV4IiwiZW50aXR5IiwidG9TdHJpbmciLCJpbmNsdWRlcyIsInVuZGVmaW5lZCIsInBrIiwidG9KUyIsImtleSIsIk9iamVjdCIsImNyZWF0ZSIsImxvY2FsQ2FjaGVLZXkiLCJjeWNsZUNhY2hlS2V5IiwiZW50aXR5Q2FjaGVLZXkiLCJmb3VuZCIsImRlbGV0ZWQiLCJ0cmFja2luZ0luZGV4IiwibGVuZ3RoIiwicHVzaCIsImVudGl0eUNvcHkiLCJjcmVhdGVJZlZhbGlkIiwidG9PYmplY3QiLCJ3aXRoVHJhY2tlZEVudGl0aWVzIiwic2V0TG9jYWwiLCJnbG9iYWxDYWNoZUVudHJ5IiwiZ2V0R2xvYmFsQ2FjaGVFbnRyeSIsImxvY2FsS2V5Iiwic2xpY2UiLCJpIiwiaGFzIiwic2V0IiwiZ2V0IiwiZ2V0VW52aXNpdCIsImVudGl0aWVzIiwicmVzdWx0Q2FjaGUiLCJnZXRFbnRpdGllcyIsImlucHV0IiwiaGFzRGVub3JtYWxpemUiLCJtZXRob2QiLCJBcnJheSIsImlzQXJyYXkiLCJyZXQiLCJlbnRpdHlJc0ltbXV0YWJsZSIsInNjaGVtYUtleSIsImdldEluIiwicmVzb2x2ZWRFbnRpd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zdDd0QsZUFBZSxDQUFDYixLQUFLLEVBQUUzQyxNQUFNLENBQUM7RUFDaEMwRCxjQUFjLENBQUNELEVBQUUsR0FBR3hELE9BQU87RUFDM0IsT0FBT3lELGNBQWM7QUFDdkIifQ== |
@@ -7,3 +7,3 @@ Object.hasOwn = Object.hasOwn || /* istanbul ignore next */function hasOwn(it, key) { | ||
import { normalize } from './normalize.js'; | ||
import WeakListMap from './WeakListMap.js'; | ||
import WeakEntityMap from './WeakEntityMap.js'; | ||
export { default as inferResults } from './inferResults.js'; | ||
@@ -15,3 +15,3 @@ export { DELETED } from './special.js'; | ||
export * from './normal.js'; | ||
export { denormalize, normalize, isEntity, WeakListMap }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJPYmplY3QiLCJoYXNPd24iLCJpdCIsImtleSIsInByb3RvdHlwZSIsImhhc093blByb3BlcnR5IiwiY2FsbCIsImRlbm9ybWFsaXplIiwiaXNFbnRpdHkiLCJub3JtYWxpemUiLCJXZWFrTGlzdE1hcCIsImRlZmF1bHQiLCJpbmZlclJlc3VsdHMiLCJERUxFVEVEIl0sInNvdXJjZXMiOlsiLi4vc3JjL2luZGV4LnRzIl0sInNvdXJjZXNDb250ZW50IjpbIk9iamVjdC5oYXNPd24gPVxuICBPYmplY3QuaGFzT3duIHx8XG4gIC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovIGZ1bmN0aW9uIGhhc093bihpdCwga2V5KSB7XG4gICAgcmV0dXJuIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChpdCwga2V5KTtcbiAgfTtcbmltcG9ydCB7IGRlbm9ybWFsaXplIH0gZnJvbSAnLi9kZW5vcm1hbGl6ZS5qcyc7XG5pbXBvcnQgeyBpc0VudGl0eSB9IGZyb20gJy4vaXNFbnRpdHkuanMnO1xuaW1wb3J0IHsgbm9ybWFsaXplIH0gZnJvbSAnLi9ub3JtYWxpem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MsT0FBT0MsV0FBVyxNQUFNLGtCQUFrQjtBQUMxQyxTQUFTQyxPQUFPLElBQUlDLFlBQVksUUFBUSxtQkFBbUI7QUFDM0QsU0FBU0MsT0FBTyxRQUFRLGNBQWM7QUFTdEMsY0FBYyxxQkFBcUI7QUFDbkMsY0FBYyxnQkFBZ0I7QUFDOUIsY0FBYyxhQUFhO0FBQzNCLGNBQWMsYUFBYTtBQUUzQixTQUFTTixXQUFXLEVBQUVFLFNBQVMsRUFBRUQsUUFBUSxFQUFFRSxXQUFXIn0= | ||
export { denormalize, normalize, isEntity, WeakEntityMap }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJPYmplY3QiLCJoYXNPd24iLCJpdCIsImtleSIsInByb3RvdHlwZSIsImhhc093blByb3BlcnR5IiwiY2FsbCIsImRlbm9ybWFsaXplIiwiaXNFbnRpdHkiLCJub3JtYWxpemUiLCJXZWFrRW50aXR5TWFwIiwiZGVmYXVsdCIsImluZmVyUmVzdWx0cyIsIkRFTEVURUQiXSwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwic291cmNlc0NvbnRlbnQiOlsiT2JqZWN0Lmhhc093biA9XG4gIE9iamVjdC5oYXNPd24gfHxcbiAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi8gZnVuY3Rpb24gaGFzT3duKGl0LCBrZXkpIHtcbiAgICByZXR1cm4gT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKGl0LCBrZXkpO1xuICB9O1xuaW1wb3J0IHsgZGVub3JtYWxpemUgfSBmcm9tICcuL2Rlbm9ybWFsaXplLmpzJztcbmltcG9ydCB7IGlzRW50aXR5IH0gZnJvbSAnLi9pc0VudGl0eS5qcyc7XG5pbXBvcnQgeyBub3JtYWxpemUgfSBmcm9tICcuL25vcm1hbGl6ZS5qcyc7XG5pbXBvcnQgV2Vha0VudGl0eU1hcCBmcm9tICcu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bnRpdGllczogRTtcbiAgcmVzdWx0OiBSO1xuICBpbmRleGVzOiBOb3JtYWxpemVkSW5kZXg7XG4gIGVudGl0eU1ldGE6IHtcbiAgICByZWFkb25seSBbZW50aXR5S2V5OiBzdHJpbmddOiB7XG4gICAgICByZWFkb25seSBbcGs6IHN0cmluZ106IHtcbiAgICAgICAgcmVhZG9ubHkgZGF0ZTogbnVtYmVyO1xuICAgICAgICByZWFkb25seSBleHBpcmVzQXQ6IG51bWJlcjtcbiAgICAgICAgcmVhZG9ubHkgZmV0Y2hlZEF0OiBudW1iZXI7XG4gICAgICB9O1xuICAgIH07XG4gIH07XG59O1xuXG5leHBvcnQgdHlwZSBFbnRpdHlNYXA8VCA9IGFueT4gPSBSZWNvcmQ8c3RyaW5nLCBFbnRpdHlJbnRlcmZhY2U8VD4+O1xuIl0sIm1hcHBpbmdzIjoiIn0= | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vc3JjL3R5cGVzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHtcbiAgU2NoZW1hLFxuICBTZXJpYWxpemFibGUsXG4gIEVudGl0eUludGVyZmFjZSxcbiAgTm9ybWFsaXplZEluZGV4LFxuICBTY2hlbWFDbGFzcyxcbn0gZnJvbSAnLi9pbnRlcmZhY2UuanMnO1xuaW1wb3J0IHR5cGUgV2Vha0VudGl0eU1hcCBmcm9tICcuL1dlYWtFbnRpdHlNYXAuanMnO1xuXG5leHBvcnQgaW50ZXJmYWNlIFBhdGgge1xuICBrZXk6IHN0cmluZztcbiAgcGs6IHN0cmluZztcbn1cblxuZXhwb3J0IHR5cGUgQWJzdHJhY3RJbnN0YW5jZVR5cGU8VD4gPSBUIGV4dGVuZHMgeyBwcm90b3R5cGU6IGluZmVyIFUgfVxuICA/IFVcbiAgOiBuZXZlcjtcblxuZXhwb3J0IHR5cGUgTm9ybWFsaXplZE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bGxhYmxlJ10+XG4gIDogUyBleHRlbmRzIFNlcmlhbGl6YWJsZTxpbmZlciBUPlxuICA/IFRcbiAgOiBTIGV4dGVuZHMgQXJyYXk8aW5mZXIgRj5cbiAgPyBOb3JtYWxpemU8Rj5bXSB8IHVuZGVmaW5lZFxuICA6IFMgZXh0ZW5kcyB7IFtLOiBzdHJpbmddOiBhbnkgfVxuICA/IE5vcm1hbGl6ZWROdWxsYWJsZU9iamVjdDxTPlxuICA6IFM7XG5cbmV4cG9ydCB0eXBlIE5vcm1hbGl6ZWRTY2hlbWE8RSwgUj4gPSB7XG4gIGVudGl0aWVzOiBFO1xuICByZXN1bHQ6IFI7XG4gIGluZGV4ZXM6IE5vcm1hbGl6ZWRJbmRleDtcbiAgZW50aXR5TWV0YToge1xuICAgIHJlYWRvbmx5IFtlbnRpdHlLZXk6IHN0cmluZ106IHtcbiAgICAgIHJlYWRvbmx5IFtwazogc3RyaW5nXToge1xuICAgICAgICByZWFkb25seSBkYXRlOiBudW1iZXI7XG4gICAgICAgIHJlYWRvbmx5IGV4cGlyZXNBdDogbnVtYmVyO1xuICAgICAgICByZWFkb25seSBmZXRjaGVkQXQ6IG51bWJlcjtcbiAgICAgIH07XG4gICAgfTtcbiAgfTtcbn07XG5cbmV4cG9ydCB0eXBlIEVudGl0eU1hcDxUID0gYW55PiA9IFJlY29yZDxzdHJpbmcsIEVudGl0eUludGVyZmFjZTxUPj47XG4iXSwibWFwcGluZ3MiOiIifQ== |
import type { Schema } from './interface.js'; | ||
import type { Denormalize, DenormalizeNullable, DenormalizeCache } from './types.js'; | ||
import WeakListMap from './WeakListMap.js'; | ||
import type { Denormalize, DenormalizeNullable, DenormalizeCache, Path } from './types.js'; | ||
type DenormalizeReturn<S extends Schema> = [ | ||
@@ -8,3 +7,3 @@ denormalized: Denormalize<S>, | ||
deleted: false, | ||
resolvedEntities: Record<string, Record<string, any>> | ||
entityPaths: Path[] | ||
] | [ | ||
@@ -14,3 +13,3 @@ denormalized: DenormalizeNullable<S>, | ||
deleted: true, | ||
resolvedEntities: Record<string, Record<string, any>> | ||
entityPaths: Path[] | ||
] | [ | ||
@@ -20,7 +19,7 @@ denormalized: DenormalizeNullable<S>, | ||
deleted: boolean, | ||
resolvedEntities: Record<string, Record<string, any>> | ||
entityPaths: Path[] | ||
]; | ||
export declare const denormalize: <S extends Schema>(input: unknown, schema: S | undefined, entities: any, entityCache?: DenormalizeCache['entities'], resultCache?: WeakListMap<object, any>) => DenormalizeReturn<S>; | ||
export declare const denormalizeSimple: <S extends Schema>(input: any, schema: S | undefined, entities: any, entityCache?: DenormalizeCache['entities'], resultCache?: WeakListMap<object, any>) => [denormalized: Denormalize<S>, found: true, deleted: false] | [denormalized: DenormalizeNullable<S>, found: boolean, deleted: true] | [denormalized: DenormalizeNullable<S>, found: false, deleted: boolean]; | ||
export declare const denormalize: <S extends Schema>(input: unknown, schema: S | undefined, entities: any, entityCache?: DenormalizeCache['entities'], resultCache?: DenormalizeCache['results'][string]) => DenormalizeReturn<S>; | ||
export declare const denormalizeSimple: <S extends Schema>(input: any, schema: S | undefined, entities: any, entityCache?: DenormalizeCache['entities'], resultCache?: DenormalizeCache['results'][string]) => [denormalized: Denormalize<S>, found: true, deleted: false] | [denormalized: DenormalizeNullable<S>, found: boolean, deleted: true] | [denormalized: DenormalizeNullable<S>, found: false, deleted: boolean]; | ||
export {}; | ||
//# sourceMappingURL=denormalize.d.ts.map |
@@ -5,5 +5,8 @@ import { isEntity } from './isEntity.js'; | ||
import { denormalize as objectDenormalize } from './schemas/Object.js'; | ||
import WeakListMap from './WeakListMap.js'; | ||
const unvisitEntity = (entityOrId, schema, unvisit, getEntity, localCache, cycleCache, entityCache, dependencies, cycleIndex) => { | ||
const entity = getEntity(entityOrId, schema); | ||
import WeakEntityMap, { getEntities, depToPaths } from './WeakEntityMap.js'; | ||
const unvisitEntity = (entityOrId, schema, unvisit, getEntity, getCache, localCache, cycleCache, dependencies, cycleIndex) => { | ||
const entity = typeof entityOrId === 'object' ? entityOrId : getEntity({ | ||
pk: entityOrId, | ||
key: schema.key | ||
}); | ||
if (typeof entity === 'symbol' && entity.toString().includes('DELETED')) { | ||
@@ -36,45 +39,62 @@ return [undefined, true, true]; | ||
} | ||
if (!(key in entityCache)) { | ||
entityCache[key] = Object.create(null); | ||
} | ||
const localCacheKey = localCache[key]; | ||
const cycleCacheKey = cycleCache[key]; | ||
const entityCacheKey = entityCache[key]; | ||
let found = true; | ||
let deleted = false; | ||
// local cache lookup first | ||
if (!localCacheKey[pk]) { | ||
const trackingIndex = dependencies.length; | ||
dependencies.push(entity); | ||
let entityCopy; | ||
if (schema.createIfValid) { | ||
entityCopy = localCacheKey[pk] = isImmutable(entity) ? schema.createIfValid(entity.toObject()) : schema.createIfValid(entity); | ||
// TODO(breaking): remove once old verions no longer supported | ||
} else { | ||
entityCopy = entity; | ||
unvisit = withTrackedEntities(unvisit); | ||
unvisit.setLocal = entityCopy => localCacheKey[pk] = entityCopy; | ||
} | ||
cycleCacheKey[pk] = trackingIndex; | ||
if (entityCopy === undefined) { | ||
// undefined indicates we should suspense (perhaps failed validation) | ||
found = false; | ||
deleted = true; | ||
} else { | ||
[localCacheKey[pk], found, deleted] = schema.denormalize(entityCopy, unvisit); | ||
} | ||
delete cycleCacheKey[pk]; | ||
const globalCacheEntry = getGlobalCacheEntry(entityCacheKey, pk); | ||
const globalCache = getCache(pk, schema); | ||
const [cacheValue] = globalCache.get(entity, getEntity); | ||
// TODO: what if this just returned the deps - then we don't need to store them | ||
// if in cycle, use the start of the cycle to track all deps | ||
// otherwise, we use our own trackingIndex | ||
const localKey = dependencies.slice(cycleIndex.i === -1 ? trackingIndex : cycleIndex.i); | ||
if (!globalCacheEntry.has(localKey)) { | ||
globalCacheEntry.set(localKey, localCacheKey[pk]); | ||
} else { | ||
localCacheKey[pk] = globalCacheEntry.get(localKey); | ||
if (cacheValue) { | ||
localCacheKey[pk] = cacheValue.value[0]; | ||
// TODO: can we store the cache values instead of tracking *all* their sources? | ||
// this is only used for setting results cache correctly. if we got this far we will def need to set as we would have already tried getting it | ||
dependencies.push(...cacheValue.dependencies); | ||
return cacheValue.value; | ||
} | ||
// if we don't find in denormalize cache then do full denormalize | ||
else { | ||
const trackingIndex = dependencies.length; | ||
dependencies.push({ | ||
entity, | ||
path: { | ||
key, | ||
pk | ||
} | ||
}); | ||
let entityCopy; | ||
if (schema.createIfValid) { | ||
entityCopy = localCacheKey[pk] = isImmutable(entity) ? schema.createIfValid(entity.toObject()) : schema.createIfValid(entity); | ||
// TODO(breaking): remove once old verions no longer supported | ||
} else { | ||
entityCopy = entity; | ||
unvisit = withTrackedEntities(unvisit); | ||
unvisit.setLocal = entityCopy => localCacheKey[pk] = entityCopy; | ||
} | ||
cycleCacheKey[pk] = trackingIndex; | ||
if (entityCopy === undefined) { | ||
// undefined indicates we should suspense (perhaps failed validation) | ||
found = false; | ||
deleted = true; | ||
} else { | ||
[localCacheKey[pk], found, deleted] = schema.denormalize(entityCopy, unvisit); | ||
} | ||
delete cycleCacheKey[pk]; | ||
// start of cycle - reset cycle detection | ||
if (cycleIndex.i === trackingIndex) { | ||
cycleIndex.i = -1; | ||
// if in cycle, use the start of the cycle to track all deps | ||
// otherwise, we use our own trackingIndex | ||
const localKey = dependencies.slice(cycleIndex.i === -1 ? trackingIndex : cycleIndex.i); | ||
const cacheValue = { | ||
dependencies: localKey, | ||
value: [localCacheKey[pk], found, deleted] | ||
}; | ||
globalCache.set(localKey, cacheValue); | ||
// start of cycle - reset cycle detection | ||
if (cycleIndex.i === trackingIndex) { | ||
cycleIndex.i = -1; | ||
} | ||
} | ||
@@ -87,3 +107,9 @@ } else { | ||
// with no cycle, globalCacheEntry will have already been set | ||
dependencies.push(entity); | ||
dependencies.push({ | ||
entity, | ||
path: { | ||
key, | ||
pk | ||
} | ||
}); | ||
} | ||
@@ -93,4 +119,6 @@ } | ||
}; | ||
const getUnvisit = (entities, entityCache, resultCache, localCache) => { | ||
const getUnvisit = (entities, entityCache, resultCache) => { | ||
const getEntity = getEntities(entities); | ||
const getCache = getEntityCaches(entityCache); | ||
const localCache = {}; | ||
const dependencies = []; | ||
@@ -109,2 +137,4 @@ const cycleIndex = { | ||
const hasDenormalize = typeof schema.denormalize === 'function'; | ||
// deserialize fields (like Date) | ||
if (!hasDenormalize && typeof schema === 'function') { | ||
@@ -124,3 +154,3 @@ if (input instanceof schema) return [input, true, false]; | ||
if (isEntity(schema)) { | ||
return unvisitEntity(input, schema, unvisit, getEntity, localCache, cycleCache, entityCache, dependencies, cycleIndex); | ||
return unvisitEntity(input, schema, unvisit, getEntity, getCache, localCache, cycleCache, dependencies, cycleIndex); | ||
} | ||
@@ -132,51 +162,58 @@ if (hasDenormalize) { | ||
} | ||
//const wrappedUnvisit = withTrackedEntities(unvisit, globalKey); | ||
return (input, schema) => { | ||
const ret = unvisit(input, schema); | ||
// in the case where WeakMap cannot be used | ||
// this test ensures null is properly excluded from WeakMap | ||
if (Object(input) !== input) return ret; | ||
dependencies.push(input); | ||
if (!resultCache.has(dependencies)) { | ||
resultCache.set(dependencies, ret[0]); | ||
return ret; | ||
} else { | ||
return [resultCache.get(dependencies), ret[1], ret[2]]; | ||
const cachable = Object(input) === input && Object(schema) === schema; | ||
if (!cachable) { | ||
const ret = unvisit(input, schema); | ||
// this is faster than spread | ||
// https://www.measurethat.net/Benchmarks/Show/23636/0/spread-with-tuples | ||
return [ret[0], ret[1], ret[2], depToPaths(dependencies)]; | ||
} | ||
let [ret, entityPaths] = resultCache.get(input, getEntity); | ||
if (ret === undefined) { | ||
ret = unvisit(input, schema); | ||
// we want to do this before we add our 'input' entry | ||
entityPaths = depToPaths(dependencies); | ||
// for the first entry, `path` is ignored so empty members is fine | ||
dependencies.unshift({ | ||
entity: input, | ||
path: { | ||
key: '', | ||
pk: '' | ||
} | ||
}); | ||
resultCache.set(dependencies, ret); | ||
} | ||
return [ret[0], ret[1], ret[2], entityPaths]; | ||
}; | ||
}; | ||
const getEntities = entities => { | ||
const entityIsImmutable = isImmutable(entities); | ||
return (entityOrId, schema) => { | ||
var _entities$schemaKey; | ||
const schemaKey = schema.key; | ||
if (typeof entityOrId === 'object') { | ||
return entityOrId; | ||
const getEntityCaches = entityCache => { | ||
return (pk, schema) => { | ||
const key = schema.key; | ||
if (!(key in entityCache)) { | ||
entityCache[key] = Object.create(null); | ||
} | ||
if (entityIsImmutable) { | ||
return entities.getIn([schemaKey, entityOrId]); | ||
const entityCacheKey = entityCache[key]; | ||
if (!entityCacheKey[pk]) entityCacheKey[pk] = new WeakMap(); | ||
let wem = entityCacheKey[pk].get(schema); | ||
if (!wem) { | ||
wem = new WeakEntityMap(); | ||
entityCacheKey[pk].set(schema, wem); | ||
} | ||
return (_entities$schemaKey = entities[schemaKey]) == null ? void 0 : _entities$schemaKey[entityOrId]; | ||
return wem; | ||
}; | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
export const denormalize = (input, schema, entities, entityCache = {}, resultCache = new WeakListMap()) => { | ||
export const denormalize = (input, schema, entities, entityCache = {}, resultCache = new WeakEntityMap()) => { | ||
// undefined mean don't do anything | ||
if (schema === undefined) { | ||
return [input, true, false, {}]; | ||
return [input, true, false, []]; | ||
} | ||
if (input === undefined) { | ||
return [undefined, false, false, {}]; | ||
return [undefined, false, false, []]; | ||
} | ||
const resolvedEntities = {}; | ||
const unvisit = getUnvisit(entities, entityCache, resultCache, resolvedEntities); | ||
return [...unvisit(input, schema), resolvedEntities]; | ||
return getUnvisit(entities, entityCache, resultCache)(input, schema); | ||
}; | ||
export const denormalizeSimple = (input, schema, entities, entityCache = {}, resultCache = new WeakListMap()) => denormalize(input, schema, entities, entityCache, resultCache).slice(0, 3); | ||
function getGlobalCacheEntry(entityCache, id) { | ||
if (!entityCache[id]) entityCache[id] = new WeakListMap(); | ||
return entityCache[id]; | ||
} | ||
export const denormalizeSimple = (input, schema, entities, entityCache, resultCache) => denormalize(input, schema, entities, entityCache, resultCache).slice(0, 3); | ||
@@ -192,2 +229,2 @@ // TODO(breaking): remove once unused | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0VudGl0eSIsImRlbm9ybWFsaXplIiwiYXJyYXlEZW5vcm1hbGl6ZSIsImlzSW1tdXRhYmxlIiwib2JqZWN0RGVub3JtYWxpemUiLCJXZWFrTGlzdE1hcCIsInVudmlzaXRFbnRpdHkiLCJlbnRpdHlPcklkIiwic2NoZW1hIiwidW52aXNpdCIsImdldEVudGl0eSIsImxvY2FsQ2FjaGUiLCJjeWNsZUNhY2hlIiwiZW50aXR5Q2FjaGUiLCJkZXBlbmRlbmNpZXMiLCJjeWNsZUluZGV4IiwiZW50aXR5IiwidG9TdHJpbmciLCJpbmNsdWRlcyIsInVuZGVmaW5lZCIsInBrIiwidG9KUyIsImtleSIsIk9iamVjdCIsImNyZWF0ZSIsImxvY2FsQ2FjaGVLZXkiLCJjeWNsZUNhY2hlS2V5IiwiZW50aXR5Q2FjaGVLZXkiLCJmb3VuZCIsImRlbGV0ZWQiLCJ0cmFja2luZ0luZGV4IiwibGVuZ3RoIiwicHVzaCIsImVudGl0eUNvcHkiLCJjcmVhdGVJZlZhbGlkIiwidG9PYmplY3QiLCJ3aXRoVHJhY2tlZEVudGl0aWVzIiwic2V0TG9jYWwiLCJnbG9iYWxDYWNoZUVudHJ5IiwiZ2V0R2xvYmFsQ2FjaGVFbnRyeSIsImxvY2FsS2V5Iiwic2xpY2UiLCJpIiwiaGFzIiwic2V0IiwiZ2V0IiwiZ2V0VW52aXNpdCIsImVudGl0aWVzIiwicmVzdWx0Q2FjaGUiLCJnZXRFbnRpdGllcyIsImlucHV0IiwiaGFzRGVub3JtYWxpemUiLCJtZXRob2QiLCJBcnJheSIsImlzQXJyYXkiLCJyZXQiLCJlbnRpdHlJc0ltbXV0YWJsZSIsInNjaGVtYUtleSIsImdldEluIiwicmVzb2x2ZWRFbnRpdGllcyIsImRlbm9ybWFsaXplU2ltcGxlIiwiaW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QyxNQUFNLENBQUM7RUFDaEMwRCxjQUFjLENBQUNELEVBQUUsR0FBR3hELE9BQU87RUFDM0IsT0FBT3lELGNBQWM7QUFDdkIifQ== |
import { denormalize } from './denormalize.js'; | ||
import { isEntity } from './isEntity.js'; | ||
import { normalize } from './normalize.js'; | ||
import WeakListMap from './WeakListMap.js'; | ||
import WeakEntityMap from './WeakEntityMap.js'; | ||
export { default as inferResults } from './inferResults.js'; | ||
export { DELETED } from './special.js'; | ||
export type { AbstractInstanceType, NormalizeReturnType, NormalizedSchema, DenormalizeReturnType, DenormalizeCache, } from './types.js'; | ||
export type { AbstractInstanceType, NormalizeReturnType, NormalizedSchema, DenormalizeReturnType, DenormalizeCache, Path, } from './types.js'; | ||
export * from './endpoint/types.js'; | ||
@@ -12,3 +12,3 @@ export * from './interface.js'; | ||
export * from './normal.js'; | ||
export { denormalize, normalize, isEntity, WeakListMap }; | ||
export { denormalize, normalize, isEntity, WeakEntityMap }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,3 +7,3 @@ Object.hasOwn = Object.hasOwn || /* istanbul ignore next */function hasOwn(it, key) { | ||
import { normalize } from './normalize.js'; | ||
import WeakListMap from './WeakListMap.js'; | ||
import WeakEntityMap from './WeakEntityMap.js'; | ||
export { default as inferResults } from './inferResults.js'; | ||
@@ -15,3 +15,3 @@ export { DELETED } from './special.js'; | ||
export * from './normal.js'; | ||
export { denormalize, normalize, isEntity, WeakListMap }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJPYmplY3QiLCJoYXNPd24iLCJpdCIsImtleSIsInByb3RvdHlwZSIsImhhc093blByb3BlcnR5IiwiY2FsbCIsImRlbm9ybWFsaXplIiwiaXNFbnRpdHkiLCJub3JtYWxpemUiLCJXZWFrTGlzdE1hcCIsImRlZmF1bHQiLCJpbmZlclJlc3VsdHMiLCJERUxFVEVEIl0sInNvdXJjZXMiOlsiLi4vc3JjL2luZGV4LnR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QUFBQUEsTUFBTSxDQUFDQyxNQUFNLEdBQ1hELE1BQU0sQ0FBQ0MsTUFBTSxJQUNiLDBCQUEyQixTQUFTQSxNQUFNLENBQUNDLEVBQUUsRUFBRUMsR0FBRyxFQUFFO0VBQ2xELE9BQU9ILE1BQU0sQ0FBQ0ksU0FBUyxDQUFDQyxjQUFjLENBQUNDLElBQUksQ0FBQ0osRUFBRSxFQUFFQyxHQUFHLENBQUM7QUFDdEQsQ0FBQztBQUNILFNBQVNJLFdBQVcsUUFBUSxrQkFBa0I7QUFDOUMsU0FBU0MsUUFBUSxRQUFRLGVBQWU7QUFDeEMsU0FBU0MsU0FBUyxRQUFRLGdCQUFnQjtBQUMxQyxPQUFPQyxhQUFhLE1BQU0sb0JBQW9CO0FBQzlDLFNBQVNDLE9BQU8sSUFBSUMsWUFBWSxRQUFRLG1CQUFtQjtBQUMzRCxTQUFTQyxPQUFPLFFBQVEsY0FBYztBQVV0QyxjQUFjLHFCQUFxQjtBQUNuQyxjQUFjLGdCQUFnQjtBQUM5QixjQUFjLGFBQWE7QUFDM0IsY0FBYyxhQUFhO0FBRTNCLFNBQVNOLFdBQVcsRUFBRUUsU0FBUyxFQUFFRCxRQUFRLEVBQUVFLGFBQWEifQ== |
import type { Schema, Serializable, EntityInterface, NormalizedIndex, SchemaClass } from './interface.js'; | ||
import type WeakListMap from './WeakListMap.js'; | ||
import type WeakEntityMap from './WeakEntityMap.js'; | ||
export interface Path { | ||
key: string; | ||
pk: string; | ||
} | ||
export type AbstractInstanceType<T> = T extends { | ||
@@ -36,7 +40,7 @@ prototype: infer U; | ||
[key: string]: { | ||
[pk: string]: WeakListMap<object, EntityInterface>; | ||
[pk: string]: WeakMap<EntityInterface, WeakEntityMap<object, any>>; | ||
}; | ||
}; | ||
results: { | ||
[key: string]: WeakListMap<object, any>; | ||
[key: string]: WeakEntityMap<object, any>; | ||
}; | ||
@@ -43,0 +47,0 @@ } |
export {}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;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TY2hlbWE8RSwgUj4gPSB7XG4gIGVudGl0aWVzOiBFO1xuICByZXN1bHQ6IFI7XG4gIGluZGV4ZXM6IE5vcm1hbGl6ZWRJbmRleDtcbiAgZW50aXR5TWV0YToge1xuICAgIHJlYWRvbmx5IFtlbnRpdHlLZXk6IHN0cmluZ106IHtcbiAgICAgIHJlYWRvbmx5IFtwazogc3RyaW5nXToge1xuICAgICAgICByZWFkb25seSBkYXRlOiBudW1iZXI7XG4gICAgICAgIHJlYWRvbmx5IGV4cGlyZXNBdDogbnVtYmVyO1xuICAgICAgICByZWFkb25seSBmZXRjaGVkQXQ6IG51bWJlcjtcbiAgICAgIH07XG4gICAgfTtcbiAgfTtcbn07XG5cbmV4cG9ydCB0eXBlIEVudGl0eU1hcDxUID0gYW55PiA9IFJlY29yZDxzdHJpbmcsIEVudGl0eUludGVyZmFjZTxUPj47XG4iXSwibWFwcGluZ3MiOiIifQ== |
{ | ||
"name": "@rest-hooks/normalizr", | ||
"version": "9.5.1", | ||
"version": "10.0.0", | ||
"description": "Normalizes and denormalizes JSON according to schema for Redux and Flux applications", | ||
@@ -118,3 +118,3 @@ "homepage": "https://resthooks.io/docs/concepts/normalization", | ||
}, | ||
"gitHead": "8d3be93d44408c4b2b565486df25a30df543f21f" | ||
"gitHead": "8b0eda4d5e129ba0a02d704a65cdfeb402bafc4f" | ||
} |
import { Schema } from './interface.js'; | ||
import { Denormalize, DenormalizeNullable, DenormalizeCache } from './types.js'; | ||
import WeakListMap from './WeakListMap.js'; | ||
import { Denormalize, DenormalizeNullable, DenormalizeCache, Path } from './types.js'; | ||
type DenormalizeReturn<S extends Schema> = [ | ||
@@ -8,3 +7,3 @@ /*denormalized*/ Denormalize<S>, | ||
/*deleted*/ false, | ||
/*resolvedEntities*/ Record<string, Record<string, any>> | ||
/*entityPaths*/ Path[] | ||
] | [ | ||
@@ -14,3 +13,3 @@ /*denormalized*/ DenormalizeNullable<S>, | ||
/*deleted*/ true, | ||
/*resolvedEntities*/ Record<string, Record<string, any>> | ||
/*entityPaths*/ Path[] | ||
] | [ | ||
@@ -20,6 +19,6 @@ /*denormalized*/ DenormalizeNullable<S>, | ||
/*deleted*/ boolean, | ||
/*resolvedEntities*/ Record<string, Record<string, any>> | ||
/*entityPaths*/ Path[] | ||
]; | ||
export declare const denormalize: <S extends Schema>(input: unknown, schema: S | undefined, entities: any, entityCache?: DenormalizeCache['entities'], resultCache?: WeakListMap<object, any>) => DenormalizeReturn<S>; | ||
export declare const denormalizeSimple: <S extends Schema>(input: any, schema: S | undefined, entities: any, entityCache?: DenormalizeCache['entities'], resultCache?: WeakListMap<object, any>) => [ | ||
export declare const denormalize: <S extends Schema>(input: unknown, schema: S | undefined, entities: any, entityCache?: DenormalizeCache['entities'], resultCache?: DenormalizeCache['results'][string]) => DenormalizeReturn<S>; | ||
export declare const denormalizeSimple: <S extends Schema>(input: any, schema: S | undefined, entities: any, entityCache?: DenormalizeCache['entities'], resultCache?: DenormalizeCache['results'][string]) => [ | ||
/*denormalized*/ Denormalize<S>, | ||
@@ -26,0 +25,0 @@ /*found*/ true, |
import { denormalize } from './denormalize.js'; | ||
import { isEntity } from './isEntity.js'; | ||
import { normalize } from './normalize.js'; | ||
import WeakListMap from './WeakListMap.js'; | ||
import WeakEntityMap from './WeakEntityMap.js'; | ||
export { default as inferResults } from './inferResults.js'; | ||
export { DELETED } from './special.js'; | ||
export { AbstractInstanceType, NormalizeReturnType, NormalizedSchema, DenormalizeReturnType, DenormalizeCache, } from './types.js'; | ||
export { AbstractInstanceType, NormalizeReturnType, NormalizedSchema, DenormalizeReturnType, DenormalizeCache, Path, } from './types.js'; | ||
export * from './endpoint/types.js'; | ||
@@ -12,3 +12,3 @@ export * from './interface.js'; | ||
export * from './normal.js'; | ||
export { denormalize, normalize, isEntity, WeakListMap }; | ||
export { denormalize, normalize, isEntity, WeakEntityMap }; | ||
//# sourceMappingURL=index.d.ts.map |
import { Schema, Serializable, EntityInterface, NormalizedIndex, SchemaClass } from './interface.js'; | ||
import WeakListMap from './WeakListMap.js'; | ||
import WeakEntityMap from './WeakEntityMap.js'; | ||
export interface Path { | ||
key: string; | ||
pk: string; | ||
} | ||
export type AbstractInstanceType<T> = T extends { | ||
@@ -36,7 +40,7 @@ prototype: infer U; | ||
[key: string]: { | ||
[pk: string]: WeakListMap<object, EntityInterface>; | ||
[pk: string]: WeakMap<EntityInterface, WeakEntityMap<object, any>>; | ||
}; | ||
}; | ||
results: { | ||
[key: string]: WeakListMap<object, any>; | ||
[key: string]: WeakEntityMap<object, any>; | ||
}; | ||
@@ -43,0 +47,0 @@ } |
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
404816
4514