@rest-hooks/endpoint
Advanced tools
Comparing version 3.7.4 to 3.8.0-next.0
@@ -55,2 +55,34 @@ 'use strict'; | ||
/** | ||
* Denormalize an immutable entity. | ||
* | ||
* @param {Schema} schema | ||
* @param {Immutable.Map|Immutable.Record} input | ||
* @param {function} unvisit | ||
* @param {function} getDenormalizedEntity | ||
* @return {Immutable.Map|Immutable.Record} | ||
*/ | ||
function denormalizeOnlyImmutable(schema, input, unvisit) { | ||
var _deleted; | ||
let deleted; | ||
const value = Object.keys(schema).reduce((object, key) => { | ||
// Immutable maps cast keys to strings on write so we need to ensure | ||
// we're accessing them using string keys. | ||
const stringKey = `${key}`; | ||
const item = unvisit(object.get(stringKey), schema[stringKey]); | ||
if (typeof item === 'symbol') { | ||
deleted = item; | ||
} | ||
if (object.has(stringKey)) { | ||
return object.set(stringKey, item); | ||
} else { | ||
return object; | ||
} | ||
}, input); | ||
return (_deleted = deleted) != null ? _deleted : value; | ||
} | ||
const DELETED = Symbol('ENTITY WAS DELETED'); | ||
const INVALID = DELETED; | ||
class PolymorphicSchema { | ||
@@ -68,3 +100,9 @@ constructor(definition, schemaAttribute) { | ||
define(definition) { | ||
this.schema = definition; | ||
// sending Union into another Polymorphic gets hoisted | ||
if ('_schemaAttribute' in definition && !this._schemaAttribute) { | ||
this.schema = definition.schema; | ||
this._schemaAttribute = definition._schemaAttribute; | ||
} else { | ||
this.schema = definition; | ||
} | ||
} | ||
@@ -81,3 +119,4 @@ getSchemaAttribute(input, parent, key) { | ||
} | ||
normalizeValue(value, parent, key, visit, addEntity, visitedEntities) { | ||
normalizeValue(value, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
if (!value) return value; | ||
const schema = this.inferSchema(value, parent, key); | ||
@@ -95,3 +134,3 @@ if (!schema) { | ||
} | ||
const normalizedValue = visit(value, parent, key, schema, addEntity, visitedEntities); | ||
const normalizedValue = visit(value, parent, key, schema, addEntity, visitedEntities, storeEntities, args); | ||
return this.isSingleSchema || normalizedValue === undefined || normalizedValue === null ? normalizedValue : { | ||
@@ -112,7 +151,12 @@ id: normalizedValue, | ||
} | ||
return [value, true, false]; | ||
return value; | ||
} | ||
const id = this.isSingleSchema ? undefined : isImmutable(value) ? value.get('id') : value.id; | ||
const schema = this.isSingleSchema ? this.schema : this.schema[schemaKey]; | ||
return unvisit(id || value, schema); | ||
const ret = unvisit(id || value, schema); | ||
if (Array.isArray(ret) && ret.length === 3) { | ||
if (ret[2] === true) return DELETED; | ||
return ret[0]; | ||
} | ||
return ret; | ||
} | ||
@@ -132,4 +176,4 @@ } | ||
} | ||
normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
return this.normalizeValue(input, parent, key, visit, addEntity, visitedEntities); | ||
normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
return this.normalizeValue(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args); | ||
} | ||
@@ -139,2 +183,6 @@ | ||
denormalize(input, unvisit) { | ||
const value = this.denormalizeValue(input, unvisit); | ||
return [value, value !== undefined, typeof value === 'symbol']; | ||
} | ||
denormalizeOnly(input, args, unvisit) { | ||
return this.denormalizeValue(input, unvisit); | ||
@@ -161,3 +209,3 @@ } | ||
class ValuesSchema extends PolymorphicSchema { | ||
normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
return Object.keys(input).reduce((output, key, index) => { | ||
@@ -167,3 +215,3 @@ const value = input[key]; | ||
...output, | ||
[key]: this.normalizeValue(value, input, key, visit, addEntity, visitedEntities) | ||
[key]: this.normalizeValue(value, input, key, visit, addEntity, visitedEntities, storeEntities, args) | ||
} : output; | ||
@@ -175,14 +223,6 @@ }, {}); | ||
denormalize(input, unvisit) { | ||
let found = true; | ||
let deleted = false; | ||
return [Object.keys(input).reduce((output, key) => { | ||
const entityOrId = input[key]; | ||
const [value, foundItem, deletedItem] = this.denormalizeValue(entityOrId, unvisit); | ||
if (!foundItem) { | ||
found = false; | ||
} | ||
if (deletedItem) { | ||
deleted = true; | ||
} | ||
if (!foundItem || deletedItem) return output; | ||
const value = this.denormalizeValue(entityOrId, unvisit); | ||
if (!value || typeof value === 'symbol') return output; | ||
return { | ||
@@ -192,4 +232,17 @@ ...output, | ||
}; | ||
}, {}), found, deleted]; | ||
}, {}), true, false]; | ||
} | ||
denormalizeOnly(input, args, unvisit) { | ||
return Object.keys(input).reduce((output, key) => { | ||
const entityOrId = input[key]; | ||
const value = this.denormalizeValue(entityOrId, unvisit); | ||
// remove empty or deleted values | ||
if (!value || typeof value === 'symbol') return output; | ||
return { | ||
...output, | ||
[key]: value | ||
}; | ||
}, {}); | ||
} | ||
infer(args, indexes, recurse) { | ||
@@ -201,3 +254,3 @@ return undefined; | ||
const getValues = input => Array.isArray(input) ? input : Object.keys(input).map(key => input[key]); | ||
const filterEmpty = ([item,, deletedItem]) => item !== undefined && !deletedItem; | ||
const filterEmpty = item => item !== undefined && typeof item !== 'symbol'; | ||
@@ -209,9 +262,12 @@ /** | ||
class ArraySchema extends PolymorphicSchema { | ||
normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
const values = getValues(input); | ||
return values.map((value, index) => this.normalizeValue(value, parent, key, visit, addEntity, visitedEntities)).filter(value => value !== undefined && value !== null); | ||
return values.map((value, index) => this.normalizeValue(value, parent, key, visit, addEntity, visitedEntities, storeEntities, args)).filter(value => value !== undefined && value !== null); | ||
} | ||
denormalize(input, unvisit) { | ||
return [input.map ? input.map(entityOrId => this.denormalizeValue(entityOrId, unvisit)).filter(filterEmpty).map(([value]) => value) : input, true, false]; | ||
return [this.denormalizeOnly(input, [], unvisit), true, false]; | ||
} | ||
denormalizeOnly(input, args, unvisit) { | ||
return input.map ? input.map(entityOrId => this.denormalizeValue(entityOrId, unvisit)).filter(filterEmpty) : input; | ||
} | ||
infer(args, indexes, recurse, entities) { | ||
@@ -234,5 +290,5 @@ return undefined; | ||
} | ||
normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
// we return undefined | ||
super.normalize(input, parent, key, visit, addEntity, visitedEntities); | ||
super.normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args); | ||
} | ||
@@ -260,3 +316,3 @@ infer(args, indexes, recurse, entities) { | ||
const normalize = (schema, input, parent, key, visit, addEntity, visitedEntities) => { | ||
const normalize = (schema, input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) => { | ||
const object = { | ||
@@ -267,3 +323,3 @@ ...input | ||
const localSchema = schema[key]; | ||
const value = visit(input[key], input, key, localSchema, addEntity, visitedEntities); | ||
const value = visit(input[key], input, key, localSchema, addEntity, visitedEntities, storeEntities, args); | ||
if (value === undefined || value === null) { | ||
@@ -300,2 +356,20 @@ delete object[key]; | ||
}; | ||
function denormalizeOnly$1(schema, input, args, unvisit) { | ||
if (isImmutable(input)) { | ||
return denormalizeOnlyImmutable(schema, input, unvisit); | ||
} | ||
const object = { | ||
...input | ||
}; | ||
for (const key of Object.keys(schema)) { | ||
const item = unvisit(object[key], schema[key]); | ||
if (object[key] !== undefined) { | ||
object[key] = item; | ||
} | ||
if (typeof item === 'symbol') { | ||
return item; | ||
} | ||
} | ||
return object; | ||
} | ||
function infer(schema, args, indexes, recurse, entities) { | ||
@@ -308,3 +382,2 @@ const resultObject = {}; | ||
} | ||
/** | ||
@@ -336,2 +409,5 @@ * Represents objects with statically known members | ||
} | ||
denormalizeOnly(input, args, unvisit) { | ||
return denormalizeOnly$1(this.schema, input, args, unvisit); | ||
} | ||
infer(args, indexes, recurse, entities) { | ||
@@ -342,11 +418,12 @@ return infer(this.schema, args, indexes, recurse, entities); | ||
const DELETED = Symbol('ENTITY WAS DELETED'); | ||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
/** | ||
* Marks entity as deleted. | ||
* @see https://resthooks.io/rest/api/Delete | ||
* Marks entity as Invalid. | ||
* | ||
* This triggers suspense for all endpoints requiring it. | ||
* Optional (like variable sized Array and Values) will simply remove the item. | ||
* @see https://resthooks.io/rest/api/Invalidate | ||
*/ | ||
class Delete { | ||
class Invalidate { | ||
constructor(entity) { | ||
@@ -361,6 +438,9 @@ if (process.env.NODE_ENV !== 'production' && !entity) { | ||
} | ||
normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
/** Normalize lifecycles **/ | ||
normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
// TODO: what's store needs to be a differing type from fromJS | ||
const processedEntity = this._entity.process(input, parent, key); | ||
const id = this._entity.pk(processedEntity, parent, key); | ||
const id = this._entity.pk(processedEntity, parent, key, args); | ||
if (process.env.NODE_ENV !== 'production' && (id === undefined || id === '')) { | ||
@@ -381,9 +461,24 @@ var _name; | ||
} | ||
addEntity(this, DELETED, id); | ||
addEntity(this, INVALID, id); | ||
return id; | ||
} | ||
/* istanbul ignore next */ | ||
merge(existing, incoming) { | ||
return incoming; | ||
} | ||
mergeWithStore(existingMeta, incomingMeta, existing, incoming) { | ||
// any queued updates are meaningless with delete, so we should just set it | ||
return this.merge(existing, incoming); | ||
} | ||
mergeMetaWithStore(existingMeta, incomingMeta, existing, incoming) { | ||
return incomingMeta; | ||
} | ||
/** /End Normalize lifecycles **/ | ||
infer(args, indexes, recurse) { | ||
return undefined; | ||
} | ||
denormalize(id, unvisit) { | ||
denormalizeOnly(id, args, unvisit) { | ||
return unvisit(id, this._entity); | ||
@@ -394,3 +489,3 @@ } | ||
_denormalizeNullable() { | ||
return []; | ||
return {}; | ||
} | ||
@@ -400,13 +495,163 @@ | ||
_normalizeNullable() { | ||
return []; | ||
return {}; | ||
} | ||
} | ||
/* istanbul ignore next */ | ||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
// TODO(breaking): mark deprecated | ||
/** | ||
* Marks entity as deleted. | ||
* @see https://resthooks.io/rest/api/Delete | ||
*/ | ||
class Delete extends Invalidate { | ||
denormalize(id, unvisit) { | ||
return unvisit(id, this._entity); | ||
} | ||
} | ||
const pushMerge = (existing, incoming) => { | ||
return [...existing, ...incoming]; | ||
}; | ||
const unshiftMerge = (existing, incoming) => { | ||
return [...incoming, ...existing]; | ||
}; | ||
const valuesMerge = (existing, incoming) => { | ||
return { | ||
...existing, | ||
...incoming | ||
}; | ||
}; | ||
const createArray = value => [...value]; | ||
const createValue = value => ({ | ||
...value | ||
}); | ||
/** | ||
* Entities but for Arrays instead of classes | ||
* @see https://resthooks.io/rest/api/Collection | ||
*/ | ||
class CollectionSchema { | ||
addWith(merge, createCollectionFilter) { | ||
return CreateAdder(this, merge, createCollectionFilter); | ||
} | ||
constructor(schema, options) { | ||
var _options$createCollec; | ||
this.schema = Array.isArray(schema) ? new ArraySchema(schema[0]) : schema; | ||
if ('nestKey' in options) { | ||
this.nestKey = options.nestKey; | ||
} else { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (!('argsKey' in options)) throw new Error('argsKey or nestKey needed'); | ||
} | ||
this.argsKey = options.argsKey; | ||
} | ||
this.createCollectionFilter = (_options$createCollec = options.createCollectionFilter) != null ? _options$createCollec : defaultFilter; | ||
// >>>>>>>>>>>>>>CREATION<<<<<<<<<<<<<< | ||
if (this.schema instanceof ArraySchema) { | ||
this.createIfValid = createArray; | ||
this.push = CreateAdder(this, pushMerge); | ||
this.unshift = CreateAdder(this, unshiftMerge); | ||
} else if (schema instanceof ValuesSchema) { | ||
this.createIfValid = createValue; | ||
this.assign = CreateAdder(this, valuesMerge); | ||
} | ||
} | ||
toJSON() { | ||
return { | ||
name: `Collection(${this.schema.schema.name})`, | ||
schema: this.schema.schema, | ||
key: this.key | ||
}; | ||
} | ||
get key() { | ||
// this assumes the definition of Array/Values is Entity | ||
return `COLLECT:${this.schema.constructor.name}(${this.schema.schema.key})`; | ||
} | ||
pk(value, parent, key, args) { | ||
return JSON.stringify(this.argsKey ? this.argsKey(...args) : this.nestKey(parent, key)); | ||
} | ||
// >>>>>>>>>>>>>>NORMALIZE<<<<<<<<<<<<<< | ||
normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (args === undefined) { | ||
throw new Error('Collections only work with @rest-hooks/react>=7.4'); | ||
} | ||
} | ||
const pkList = this.schema.normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args); | ||
const id = this.pk(pkList, parent, key, args); | ||
addEntity(this, pkList, id); | ||
return id; | ||
} | ||
merge(existing, incoming) { | ||
return incoming; | ||
} | ||
useIncoming(existingMeta, incomingMeta, existing, incoming) { | ||
return existingMeta.date <= incomingMeta.date; | ||
shouldReorder(existingMeta, incomingMeta, existing, incoming) { | ||
return incomingMeta.fetchedAt < existingMeta.fetchedAt; | ||
} | ||
mergeWithStore(existingMeta, incomingMeta, existing, incoming) { | ||
return this.shouldReorder(existingMeta, incomingMeta, existing, incoming) ? this.merge(incoming, existing) : this.merge(existing, incoming); | ||
} | ||
mergeMetaWithStore(existingMeta, incomingMeta, existing, incoming) { | ||
return this.shouldReorder(existingMeta, incomingMeta, existing, incoming) ? existingMeta : incomingMeta; | ||
} | ||
// >>>>>>>>>>>>>>DENORMALIZE<<<<<<<<<<<<<< | ||
infer(args, indexes, recurse, entities) { | ||
return undefined; | ||
} | ||
denormalizeOnly(input, args, unvisit) { | ||
return this.schema.denormalizeOnly(input, args, unvisit); | ||
} | ||
} | ||
// this adds to any list *in store* that has same members as the urlParams | ||
// so fetch(create, { userId: 'bob', completed: true }, data) | ||
// would possibly add to {}, {userId: 'bob'}, {completed: true}, {userId: 'bob', completed: true } - but only those already in the store | ||
// it ignores keys that start with sort as those are presumed to not filter results | ||
const defaultFilter = (urlParams, body) => collectionKey => Object.entries(collectionKey).every(([key, value]) => key.startsWith('order') || urlParams[key] === value || (body == null ? void 0 : body[key]) === value); | ||
function CreateAdder(collection, merge, createCollectionFilter) { | ||
const properties = { | ||
merge: { | ||
value: merge | ||
}, | ||
normalize: { | ||
value: normalizeCreate | ||
} | ||
}; | ||
if (collection.schema instanceof ArraySchema) { | ||
properties.createIfValid = { | ||
value: createIfValid | ||
}; | ||
properties.denormalizeOnly = { | ||
value: denormalizeOnly | ||
}; | ||
} | ||
if (createCollectionFilter) { | ||
properties.createCollectionFilter = { | ||
value: createCollectionFilter | ||
}; | ||
} | ||
return Object.create(collection, properties); | ||
} | ||
function normalizeCreate(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
const pkList = this.schema.normalize(!(this.schema instanceof ArraySchema) || Array.isArray(input) ? input : [input], parent, key, visit, addEntity, visitedEntities, storeEntities, args); | ||
// parent is args when not nested | ||
const filterCollections = this.createCollectionFilter(...args); | ||
Object.keys(storeEntities[this.key]).forEach(collectionPk => { | ||
if (!filterCollections(JSON.parse(collectionPk))) return; | ||
addEntity(this, pkList, collectionPk); | ||
}); | ||
return pkList; | ||
} | ||
function createIfValid(value) { | ||
return Array.isArray(value) ? [...value] : { | ||
...value | ||
}; | ||
} | ||
function denormalizeOnly(input, args, unvisit) { | ||
return Array.isArray(input) ? this.schema.denormalizeOnly(input, args, unvisit) : this.schema.schema.denormalizeOnly(input, args, unvisit); | ||
} | ||
@@ -439,2 +684,14 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
* | ||
* @param [parent] When normalizing, the object which included the entity | ||
* @param [key] When normalizing, the key where this entity was found | ||
*/ | ||
/** Returns the globally unique identifier for the static Entity */ | ||
// default implementation in class static block at bottom of definition | ||
/** Defines indexes to enable lookup by */ | ||
/** | ||
* A unique identifier for each Entity | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#pk | ||
* @param [value] POJO of the entity or subset used | ||
@@ -444,4 +701,4 @@ * @param [parent] When normalizing, the object which included the entity | ||
*/ | ||
static pk(value, parent, key) { | ||
return this.prototype.pk.call(value, parent, key); | ||
static pk(value, parent, key, args) { | ||
return this.prototype.pk.call(value, parent, key, args); | ||
} | ||
@@ -466,3 +723,6 @@ | ||
/** Creates new instance copying over defined values of arguments */ | ||
/** Creates new instance copying over defined values of arguments | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#merge | ||
*/ | ||
static merge(existing, incoming) { | ||
@@ -475,3 +735,6 @@ return { | ||
/** Run when an existing entity is found in the store */ | ||
/** Run when an existing entity is found in the store | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#mergeWithStore | ||
*/ | ||
static mergeWithStore(existingMeta, incomingMeta, existing, incoming) { | ||
@@ -491,2 +754,10 @@ const useIncoming = this.useIncoming(existingMeta, incomingMeta, existing, incoming); | ||
/** Run when an existing entity is found in the store | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#mergeMetaWithStore | ||
*/ | ||
static mergeMetaWithStore(existingMeta, incomingMeta, existing, incoming) { | ||
return this.shouldReorder(existingMeta, incomingMeta, existing, incoming) ? existingMeta : incomingMeta; | ||
} | ||
/** Factory method to convert from Plain JS Objects. | ||
@@ -507,5 +778,6 @@ * | ||
/** Factory method to convert from Plain JS Objects. | ||
/** Called when denormalizing an entity to create an instance when 'valid' | ||
* | ||
* @param [props] Plain Object of properties to assign. | ||
* @see https://resthooks.io/docs/api/schema.Entity#createIfValid | ||
*/ | ||
@@ -521,3 +793,6 @@ static createIfValid( | ||
/** Do any transformations when first receiving input */ | ||
/** Do any transformations when first receiving input | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#process | ||
*/ | ||
static process(input, parent, key) { | ||
@@ -528,5 +803,5 @@ return { | ||
} | ||
static normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
static normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
const processedEntity = this.process(input, parent, key); | ||
const id = this.pk(processedEntity, parent, key); | ||
const id = this.pk(processedEntity, parent, key, args); | ||
if (id === undefined || id === '') { | ||
@@ -547,4 +822,4 @@ if (process.env.NODE_ENV !== 'production') { | ||
} else { | ||
// these make the keys get deleted | ||
return undefined; | ||
// these make the keys get deleted; return undefined | ||
return; | ||
} | ||
@@ -568,3 +843,3 @@ } | ||
const schema = this.schema[key]; | ||
processedEntity[key] = visit(processedEntity[key], processedEntity, key, schema, addEntity, visitedEntities); | ||
processedEntity[key] = visit(processedEntity[key], processedEntity, key, schema, addEntity, visitedEntities, storeEntities, args); | ||
} | ||
@@ -594,22 +869,10 @@ }); | ||
} | ||
static infer(args, indexes, recurse) { | ||
static infer(args, indexes, recurse, entities) { | ||
var _entities$this$key; | ||
if (!args[0]) return undefined; | ||
if (['string', 'number'].includes(typeof args[0])) { | ||
return `${args[0]}`; | ||
} | ||
const id = this.pk(args[0], undefined, ''); | ||
// Was able to infer the entity's primary key from params | ||
if (id !== undefined && id !== '') return id; | ||
// now attempt lookup in indexes | ||
const indexName = indexFromParams(args[0], this.indexes); | ||
if (indexName && indexes[this.key]) { | ||
// 'as Record<string, any>': indexName can only be found if params is a string key'd object | ||
const id = indexes[this.key][indexName][args[0][indexName]]; | ||
return id; | ||
} | ||
const id = inferId(this, args, indexes); | ||
// no entity arg is back-compatibility | ||
if (!entities || (_entities$this$key = entities[this.key]) != null && _entities$this$key[id]) return id; | ||
return undefined; | ||
} | ||
static expiresAt(meta, input) { | ||
return meta.expiresAt; | ||
} | ||
static denormalize(input, unvisit) { | ||
@@ -634,3 +897,24 @@ // TODO: remove codecov ignore once denormalize is modified to expect this | ||
} | ||
static denormalizeOnly(input, args, unvisit) { | ||
if (typeof input === 'symbol') { | ||
return input; | ||
} | ||
// note: iteration order must be stable | ||
for (const key of Object.keys(this.schema)) { | ||
const schema = this.schema[key]; | ||
const value = unvisit(input[key], schema); | ||
if (typeof value === 'symbol') { | ||
// if default is not 'fasly', then this is required, so propagate INVALID symbol | ||
if (this.defaults[key]) { | ||
return value; | ||
} | ||
input[key] = undefined; | ||
} else { | ||
input[key] = value; | ||
} | ||
} | ||
return input; | ||
} | ||
/** All instance defaults set */ | ||
@@ -730,2 +1014,17 @@ static get defaults() { | ||
} | ||
function inferId(schema, args, indexes) { | ||
if (['string', 'number'].includes(typeof args[0])) { | ||
return `${args[0]}`; | ||
} | ||
const id = schema.pk(args[0], undefined, '', args); | ||
// Was able to infer the entity's primary key from params | ||
if (id !== undefined && id !== '') return id; | ||
// now attempt lookup in indexes | ||
const indexName = indexFromParams(args[0], schema.indexes); | ||
if (indexName && indexes[schema.key]) { | ||
// 'as Record<string, any>': indexName can only be found if params is a string key'd object | ||
const id = indexes[schema.key][indexName][args[0][indexName]]; | ||
return id; | ||
} | ||
} | ||
@@ -742,2 +1041,4 @@ /* istanbul ignore file */ | ||
Delete: Delete, | ||
Invalidate: Invalidate, | ||
Collection: CollectionSchema, | ||
Entity: EntitySchema | ||
@@ -761,2 +1062,11 @@ }); | ||
/** Control how automatic schema validation is handled | ||
* | ||
* `undefined`: Defaults - throw error in worst offense | ||
* 'warn': only ever warn | ||
* 'silent': Don't bother with processing at all | ||
* | ||
* Note: this only applies to non-nested members. | ||
*/ | ||
/** Return true to merge incoming data; false keeps existing entity | ||
@@ -786,2 +1096,9 @@ * | ||
} | ||
static mergeMetaWithStore(existingMeta, incomingMeta, existing, incoming) { | ||
return { | ||
expiresAt: Math.max(this.expiresAt(incomingMeta, incoming), existingMeta.expiresAt), | ||
date: Math.max(incomingMeta.date, existingMeta.date), | ||
fetchedAt: Math.max(incomingMeta.fetchedAt, existingMeta.fetchedAt) | ||
}; | ||
} | ||
@@ -793,2 +1110,10 @@ /** Factory method to convert from Plain JS Objects. | ||
/** | ||
* A unique identifier for each Entity | ||
* | ||
* @param [value] POJO of the entity or subset used | ||
* @param [parent] When normalizing, the object which included the entity | ||
* @param [key] When normalizing, the key where this entity was found | ||
*/ | ||
/** Do any transformations when first receiving input */ | ||
@@ -944,2 +1269,7 @@ static process(input, parent, key) { | ||
// we're avoiding this on the type | ||
Entity.expiresAt = function (meta, input) { | ||
return meta.expiresAt; | ||
}; | ||
function validateRequired(processedEntity, requiredDefaults) { | ||
@@ -1129,6 +1459,14 @@ let missingKey = ''; | ||
}, unvisit) => { | ||
if (input === undefined) return [undefined, false, true]; | ||
if (input === undefined) return [undefined, false, false]; | ||
const [value, found, deleted] = schema.denormalize(input, unvisit); | ||
return [found ? this.process(value, ...args) : undefined, found, deleted]; | ||
}; | ||
if (schema.denormalizeOnly) query.denormalizeOnly = ({ | ||
args, | ||
input | ||
}, _, unvisit) => { | ||
if (input === undefined) return undefined; | ||
const value = schema.denormalizeOnly(input, args, unvisit); | ||
return typeof value === 'symbol' ? undefined : this.process(value, ...args); | ||
}; | ||
query.infer = (args, indexes, recurse, entities) => { | ||
@@ -1155,2 +1493,3 @@ return { | ||
exports.ExtendableEndpoint = ExtendableEndpoint; | ||
exports.INVALID = INVALID; | ||
exports.Index = Index; | ||
@@ -1157,0 +1496,0 @@ exports.Query = Query; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).restHookEndpoint={})}(this,(function(e){"use strict";function t(e){return!("function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function s(e,t,s){let n=!0,r=!1;return[Object.keys(e).reduce(((t,i)=>{const o=`${i}`,[c,a,h]=s(t.get(o),e[o]);return a||(n=!1),h&&(r=!0),t.has(o)?t.set(o,c):t}),t),n,r]}class n{constructor(e,t){this.schema=void 0,t&&(this._schemaAttribute="string"==typeof t?e=>e[t]:t),this.define(e)}get isSingleSchema(){return!this._schemaAttribute}define(e){this.schema=e}getSchemaAttribute(e,t,s){return!this.isSingleSchema&&this._schemaAttribute(e,t,s)}inferSchema(e,t,s){if(this.isSingleSchema)return this.schema;const n=this.getSchemaAttribute(e,t,s);return this.schema[n]}normalizeValue(e,t,s,n,r,i){const o=this.inferSchema(e,t,s);if(!o)return e;const c=n(e,t,s,o,r,i);return this.isSingleSchema||null==c?c:{id:c,schema:this.getSchemaAttribute(e,t,s)}}denormalizeValue(e,s){const n=!this.isSingleSchema&&(t(e)?e.get("schema"):e.schema);if(!this.isSingleSchema&&!n)return[e,!0,!1];return s((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[n])}}const r=([e,,t])=>void 0!==e&&!t;class i extends n{normalize(e,t,s,n,r,i){const o=(e=>Array.isArray(e)?e:Object.keys(e).map((t=>e[t])))(e);return o.map(((e,o)=>this.normalizeValue(e,t,s,n,r,i))).filter((e=>null!=e))}denormalize(e,t){return[e.map?e.map((e=>this.denormalizeValue(e,t))).filter(r).map((([e])=>e)):e,!0,!1]}infer(e,t,s,n){}toJSON(){return[this.schema]}}const o=Symbol("ENTITY WAS DELETED");var c,a=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){e.exports=function(e,t){if(null==e)return{};var s,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)s=i[n],t.indexOf(s)>=0||(r[s]=e[s]);return r},e.exports.__esModule=!0,e.exports.default=e.exports})),h=(c=a)&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c;const u=["pk","schema","key"];function l(e,t={}){class s extends e{static toString(){return this.key}static toJSON(){return{name:this.name,schema:this.schema,key:this.key}}static pk(e,t,s){return this.prototype.pk.call(e,t,s)}static useIncoming(e,t,s,n){return!0}static shouldReorder(e,t,s,n){return t.fetchedAt<e.fetchedAt}static merge(e,t){return Object.assign({},e,t)}static mergeWithStore(e,t,s,n){return this.useIncoming(e,t,s,n)?typeof n!=typeof s?n:this.shouldReorder(e,t,s,n)?this.merge(n,s):this.merge(s,n):s}static fromJS(e={}){const t=new this(e);return Object.assign(t,e),t}static createIfValid(e){if(!this.validate(e))return this.fromJS(e)}static process(e,t,s){return Object.assign({},e)}static normalize(e,t,s,n,r,i){const o=this.process(e,t,s),c=this.pk(o,t,s);if(void 0===c||""===c)return;const a=this.key;if(a in i||(i[a]={}),c in i[a]||(i[a][c]=[]),i[a][c].some((t=>t===e)))return c;return function(e){if(e){const t=new Error(e);throw t.status=400,t}}(this.validate(o)),i[a][c].push(e),Object.keys(this.schema).forEach((e=>{if(Object.hasOwn(o,e)){const t=this.schema[e];o[e]=n(o[e],o,e,t,r,i)}})),r(this,o,c),c}static validate(e){}static infer(e,t,s){if(!e[0])return;if(["string","number"].includes(typeof e[0]))return`${e[0]}`;const n=this.pk(e[0],void 0,"");if(void 0!==n&&""!==n)return n;const r=function(e,t){return t?t.find((t=>Object.hasOwn(e,t))):void 0}(e[0],this.indexes);if(r&&t[this.key]){return t[this.key][r][e[0][r]]}}static expiresAt(e,t){return e.expiresAt}static denormalize(e,t){if("symbol"==typeof e)return[void 0,!0,!0];let s=!1;return Object.keys(this.schema).forEach((n=>{const r=this.schema[n],i=e[n],[o,,c]=t(i,r);c&&this.defaults[n]&&(s=!0),e[n]=o})),[e,!0,s]}static get defaults(){return Object.hasOwn(this,"__defaults")||Object.defineProperty(this,"__defaults",{value:new this,writable:!0,configurable:!0}),this.__defaults}}const n=h(t,u);if(Object.assign(s,n),"schema"in t?s.schema=t.schema:e.schema||(s.schema={}),"pk"in t?"function"==typeof t.pk?s.prototype.pk=function(e,s){return t.pk(this,e,s)}:s.prototype.pk=function(){return this[t.pk]}:"function"!=typeof e.prototype.pk&&(s.prototype.pk=function(){return this.id}),"key"in t)Object.defineProperty(s,"key",{value:t.key,configurable:!0,writable:!0});else if(!("key"in e)){function r(e){Object.defineProperty(this,"key",{value:e,writable:!0,enumerable:!0})}const i="EntityMixin"!==s.name?function(){const t="EntityMixin"===this.name?e.name:this.name;return console.error("Rest Hooks Error: https://resthooks.io/errors/dklj"),Object.defineProperty(this,"key",{get:()=>t,set:r}),this.key}:function(){return"EntityMixin"===this.name?e.name:this.name};Object.defineProperty(s,"key",{get:i,set:r})}return s}var m=Object.freeze({__proto__:null,Union:class extends n{constructor(e,t){if(!t)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');super(e,t)}normalize(e,t,s,n,r,i){return this.normalizeValue(e,t,s,n,r,i)}denormalize(e,t){return this.denormalizeValue(e,t)}infer(e,t,s,n){if(!e[0])return;const r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];return void 0!==i?{id:s(i,e,t,n),schema:r}:void 0}},Values:class extends n{normalize(e,t,s,n,r,i){return Object.keys(e).reduce(((t,s,o)=>{const c=e[s];return null!=c?Object.assign({},t,{[s]:this.normalizeValue(c,e,s,n,r,i)}):t}),{})}denormalize(e,t){let s=!0,n=!1;return[Object.keys(e).reduce(((r,i)=>{const o=e[i],[c,a,h]=this.denormalizeValue(o,t);return a||(s=!1),h&&(n=!0),!a||h?r:Object.assign({},r,{[i]:c})}),{}),s,n]}infer(e,t,s){}},Array:i,All:class extends i{constructor(e,t){super(e,t)}normalize(e,t,s,n,r,i){super.normalize(e,t,s,n,r,i)}infer(e,t,s,n){if(this.isSingleSchema){const e=n[this.schema.key];if(void 0===e)return;return Object.values(e).map((e=>e&&this.schema.pk(e)))}let r=!1;const i=Object.values(this.schema).flatMap((e=>n[e.key]?(r=!0,Object.values(n[e.key]).map((t=>({id:t&&e.pk(t),schema:this.getSchemaAttribute(t,void 0,void 0)})))):[]));if(r)return i}},Object:class{constructor(e){this.schema=void 0,this.define(e)}define(e){this.schema=Object.keys(e).reduce(((t,s)=>{const n=e[s];return Object.assign({},t,{[s]:n})}),this.schema||{})}normalize(...e){return((e,t,s,n,r,i,o)=>{const c=Object.assign({},t);return Object.keys(e).forEach((s=>{const n=e[s],a=r(t[s],t,s,n,i,o);null==a?delete c[s]:c[s]=a})),c})(this.schema,...e)}denormalize(...e){return((e,n,r)=>{if(t(n))return s(e,n,r);const i=Object.assign({},n);let o=!0,c=!1;return Object.keys(e).forEach((t=>{const[s,n,a]=r(i[t],e[t]);void 0!==i[t]&&(i[t]=s),a&&(c=!0),n||(o=!1)})),[i,o,c]})(this.schema,...e)}infer(e,t,s,n){return function(e,t,s,n,r){const i={};return Object.keys(e).forEach((o=>{i[o]=n(e[o],t,s,r)})),i}(this.schema,e,t,s,n)}},Delete:class{constructor(e){this._entity=e}get key(){return this._entity.key}normalize(e,t,s,n,r,i){const c=this._entity.process(e,t,s),a=this._entity.pk(c,t,s);return r(this,o,a),a}infer(e,t,s){}denormalize(e,t){return t(e,this._entity)}_denormalizeNullable(){return[]}_normalizeNullable(){return[]}merge(e,t){return t}useIncoming(e,t,s,n){return e.date<=t.date}},Entity:l});const f=class{};class d extends(l(f)){static useIncoming(e,t,s,n){return e.fetchedAt<=t.fetchedAt}static mergeWithStore(e,t,s,n){return!e||this.useIncoming(e,t,s,n)?typeof n!=typeof s?n:this.merge(s,n):s}static process(e,t,s){return super.process(e,t,s)}static validate(e){return super.validate(e)}static denormalize(e,n){if("symbol"==typeof e)return[void 0,!0,!0];if(t(e)){if(this.validate(e.toJS()))return[void 0,!1,!0];null==n.setLocal||n.setLocal(e);const[t,r,i]=s(this.schema,e,n);return[this.fromJS(t.toObject()),!0,i]}let r;if(e instanceof this)r=e;else{if(this.validate(e))return[void 0,!1,!0];r=this.fromJS(e),null==n.setLocal||n.setLocal(r)}let i=!1;return Object.keys(this.schema).forEach((t=>{const s=this.schema[t],o=e[t],[c,,a]=n(o,s);a&&this.defaults[t]&&(i=!0),e[t]!==c&&this.set(r,t,c)})),[r,!0,i]}static set(e,t,s){e[t]=s}}var p;const y="undefined"!=typeof document;let b=y&&!(null!=(p=document.querySelector("meta[http-equiv='Content-Security-Policy']"))&&p.getAttribute("content"));try{b||Function()}catch(e){b=!0,y&&console.error("Content Security Policy: The previous CSP log can be safely ignored - @rest-hooks/endpoint will use setPrototypeOf instead")}function g(e,t){e.type=e.sideEffect?"mutate":"read",e.options=Object.assign({},t),delete e.options.key,delete e.options.schema,delete e.options.sideEffect,delete e.options.fetch,delete e.options.getFetchKey,delete e.options.options,0===Object.keys(e.options).length&&delete e.options,void 0===e.schema&&(e.schema=null)}class O extends Function{constructor(e,t){let s,n;return b?(s=(...e)=>s.fetch(...e),Object.setPrototypeOf(s,new.target.prototype)):(super("return arguments.callee.fetch.apply(arguments.callee, arguments)"),s=this),s.getFetchKey=e=>s.key(e),e&&(s.fetch=e),t&&"name"in t||!e||!e.name||"anonymous"===e.name||(n=e.name),Object.defineProperty(s,"name",{get(){return n||this.__name},set(e){this.__name=e}}),Object.assign(s,t),g(s,t),s}key(...e){return`${this.name} ${JSON.stringify(e)}`}testKey(e){return e.startsWith(this.name)}bind(e,...t){const s=this.fetch,n=this.key;return this.extend({fetch(){return s.apply(null!=e?e:this,t)},key(){return n.apply(this,t)}})}extend(e){class t extends this.constructor{}Object.assign(t.prototype,this);const s=new t(e.fetch,e);return g(s,Object.assign({},this.options,e)),s}}"runCompat"!==g.name&&(O.prototype.key=function(...e){return console.error("Rest Hooks Error: https://resthooks.io/errors/osid"),`${this.name} ${JSON.stringify(e)}`});const k=O;class j extends Error{}Object.hasOwn=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},e.AbortOptimistic=j,e.DELETED=o,e.Endpoint=O,e.Entity=d,e.ExtendableEndpoint=k,e.Index=class{constructor(e,t){this.getFetchKey=e=>this.key(e),this.schema=e,t&&(this.key=t)}key(e){return JSON.stringify(e)}},e.Query=class{constructor(e,t){this.sideEffect=void 0,this.schema=this.createQuerySchema(e),t?this.process=t:this.process||(this.process=e=>e)}key(...e){return`QUERY ${JSON.stringify(e)}`}createQuerySchema(e){const t=Object.create(e);return t.denormalize=({args:t,input:s},n)=>{if(void 0===s)return[void 0,!1,!0];const[r,i,o]=e.denormalize(s,n);return[i?this.process(r,...t):void 0,i,o]},t.infer=(t,s,n,r)=>({args:t,input:n(e,t,s,r)}),t}},e.schema=m,e.validateRequired=function(e,t){let s="";if(Object.keys(t).some((t=>!Object.hasOwn(e,t)&&(s=t,!0))))return`Missing key ${s}`},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).restHookEndpoint={})}(this,(function(e){"use strict";function t(e){return!("function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function s(e,t,s){let r=!0,n=!1;return[Object.keys(e).reduce(((t,i)=>{const o=`${i}`,[c,a,h]=s(t.get(o),e[o]);return a||(r=!1),h&&(n=!0),t.has(o)?t.set(o,c):t}),t),r,n]}const r=Symbol("ENTITY WAS DELETED"),n=r;class i{constructor(e,t){this.schema=void 0,t&&(this._schemaAttribute="string"==typeof t?e=>e[t]:t),this.define(e)}get isSingleSchema(){return!this._schemaAttribute}define(e){"_schemaAttribute"in e&&!this._schemaAttribute?(this.schema=e.schema,this._schemaAttribute=e._schemaAttribute):this.schema=e}getSchemaAttribute(e,t,s){return!this.isSingleSchema&&this._schemaAttribute(e,t,s)}inferSchema(e,t,s){if(this.isSingleSchema)return this.schema;const r=this.getSchemaAttribute(e,t,s);return this.schema[r]}normalizeValue(e,t,s,r,n,i,o,c){if(!e)return e;const a=this.inferSchema(e,t,s);if(!a)return e;const h=r(e,t,s,a,n,i,o,c);return this.isSingleSchema||null==h?h:{id:h,schema:this.getSchemaAttribute(e,t,s)}}denormalizeValue(e,s){const n=!this.isSingleSchema&&(t(e)?e.get("schema"):e.schema);if(!this.isSingleSchema&&!n)return e;const i=s((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[n]);return Array.isArray(i)&&3===i.length?!0===i[2]?r:i[0]:i}}class o extends i{normalize(e,t,s,r,n,i,o,c){return Object.keys(e).reduce(((t,s,a)=>{const h=e[s];return null!=h?Object.assign({},t,{[s]:this.normalizeValue(h,e,s,r,n,i,o,c)}):t}),{})}denormalize(e,t){return[Object.keys(e).reduce(((s,r)=>{const n=e[r],i=this.denormalizeValue(n,t);return i&&"symbol"!=typeof i?Object.assign({},s,{[r]:i}):s}),{}),!0,!1]}denormalizeOnly(e,t,s){return Object.keys(e).reduce(((t,r)=>{const n=e[r],i=this.denormalizeValue(n,s);return i&&"symbol"!=typeof i?Object.assign({},t,{[r]:i}):t}),{})}infer(e,t,s){}}const c=e=>void 0!==e&&"symbol"!=typeof e;class a extends i{normalize(e,t,s,r,n,i,o,c){const a=(e=>Array.isArray(e)?e:Object.keys(e).map((t=>e[t])))(e);return a.map(((e,a)=>this.normalizeValue(e,t,s,r,n,i,o,c))).filter((e=>null!=e))}denormalize(e,t){return[this.denormalizeOnly(e,[],t),!0,!1]}denormalizeOnly(e,t,s){return e.map?e.map((e=>this.denormalizeValue(e,s))).filter(c):e}infer(e,t,s,r){}toJSON(){return[this.schema]}}function h(e,s,r,n){if(t(s))return function(e,t,s){var r;let n;const i=Object.keys(e).reduce(((t,r)=>{const i=`${r}`,o=s(t.get(i),e[i]);return"symbol"==typeof o&&(n=o),t.has(i)?t.set(i,o):t}),t);return null!=(r=n)?r:i}(e,s,n);const i=Object.assign({},s);for(const t of Object.keys(e)){const s=n(i[t],e[t]);if(void 0!==i[t]&&(i[t]=s),"symbol"==typeof s)return s}return i}class u{constructor(e){this._entity=e}get key(){return this._entity.key}normalize(e,t,s,r,i,o,c,a){const h=this._entity.process(e,t,s),u=this._entity.pk(h,t,s,a);return i(this,n,u),u}merge(e,t){return t}mergeWithStore(e,t,s,r){return this.merge(s,r)}mergeMetaWithStore(e,t,s,r){return t}infer(e,t,s){}denormalizeOnly(e,t,s){return s(e,this._entity)}_denormalizeNullable(){return{}}_normalizeNullable(){return{}}}const l=(e,t)=>[...e,...t],m=(e,t)=>[...t,...e],f=(e,t)=>Object.assign({},e,t),d=e=>[...e],y=e=>Object.assign({},e);const p=(e,t)=>s=>Object.entries(s).every((([s,r])=>s.startsWith("order")||e[s]===r||(null==t?void 0:t[s])===r));function b(e,t,s){const r={merge:{value:t},normalize:{value:O}};return e.schema instanceof a&&(r.createIfValid={value:g},r.denormalizeOnly={value:k}),s&&(r.createCollectionFilter={value:s}),Object.create(e,r)}function O(e,t,s,r,n,i,o,c){const h=this.schema.normalize(this.schema instanceof a&&!Array.isArray(e)?[e]:e,t,s,r,n,i,o,c),u=this.createCollectionFilter(...c);return Object.keys(o[this.key]).forEach((e=>{u(JSON.parse(e))&&n(this,h,e)})),h}function g(e){return Array.isArray(e)?[...e]:Object.assign({},e)}function k(e,t,s){return Array.isArray(e)?this.schema.denormalizeOnly(e,t,s):this.schema.schema.denormalizeOnly(e,t,s)}var j,v=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){e.exports=function(e,t){if(null==e)return{};var s,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)s=i[r],t.indexOf(s)>=0||(n[s]=e[s]);return n},e.exports.__esModule=!0,e.exports.default=e.exports})),S=(j=v)&&j.__esModule&&Object.prototype.hasOwnProperty.call(j,"default")?j.default:j;const z=["pk","schema","key"];function A(e,t={}){class s extends e{static toString(){return this.key}static toJSON(){return{name:this.name,schema:this.schema,key:this.key}}static pk(e,t,s,r){return this.prototype.pk.call(e,t,s,r)}static useIncoming(e,t,s,r){return!0}static shouldReorder(e,t,s,r){return t.fetchedAt<e.fetchedAt}static merge(e,t){return Object.assign({},e,t)}static mergeWithStore(e,t,s,r){return this.useIncoming(e,t,s,r)?typeof r!=typeof s?r:this.shouldReorder(e,t,s,r)?this.merge(r,s):this.merge(s,r):s}static mergeMetaWithStore(e,t,s,r){return this.shouldReorder(e,t,s,r)?e:t}static fromJS(e={}){const t=new this(e);return Object.assign(t,e),t}static createIfValid(e){if(!this.validate(e))return this.fromJS(e)}static process(e,t,s){return Object.assign({},e)}static normalize(e,t,s,r,n,i,o,c){const a=this.process(e,t,s),h=this.pk(a,t,s,c);if(void 0===h||""===h)return;const u=this.key;if(u in i||(i[u]={}),h in i[u]||(i[u][h]=[]),i[u][h].some((t=>t===e)))return h;return function(e){if(e){const t=new Error(e);throw t.status=400,t}}(this.validate(a)),i[u][h].push(e),Object.keys(this.schema).forEach((e=>{if(Object.hasOwn(a,e)){const t=this.schema[e];a[e]=r(a[e],a,e,t,n,i,o,c)}})),n(this,a,h),h}static validate(e){}static infer(e,t,s,r){var n;if(!e[0])return;const i=function(e,t,s){if(["string","number"].includes(typeof t[0]))return`${t[0]}`;const r=e.pk(t[0],void 0,"",t);if(void 0!==r&&""!==r)return r;const n=function(e,t){return t?t.find((t=>Object.hasOwn(e,t))):void 0}(t[0],e.indexes);if(n&&s[e.key]){return s[e.key][n][t[0][n]]}}(this,e,t);return!r||null!=(n=r[this.key])&&n[i]?i:void 0}static denormalize(e,t){if("symbol"==typeof e)return[void 0,!0,!0];let s=!1;return Object.keys(this.schema).forEach((r=>{const n=this.schema[r],i=e[r],[o,,c]=t(i,n);c&&this.defaults[r]&&(s=!0),e[r]=o})),[e,!0,s]}static denormalizeOnly(e,t,s){if("symbol"==typeof e)return e;for(const t of Object.keys(this.schema)){const r=this.schema[t],n=s(e[t],r);if("symbol"==typeof n){if(this.defaults[t])return n;e[t]=void 0}else e[t]=n}return e}static get defaults(){return Object.hasOwn(this,"__defaults")||Object.defineProperty(this,"__defaults",{value:new this,writable:!0,configurable:!0}),this.__defaults}}const r=S(t,z);if(Object.assign(s,r),"schema"in t?s.schema=t.schema:e.schema||(s.schema={}),"pk"in t?"function"==typeof t.pk?s.prototype.pk=function(e,s){return t.pk(this,e,s)}:s.prototype.pk=function(){return this[t.pk]}:"function"!=typeof e.prototype.pk&&(s.prototype.pk=function(){return this.id}),"key"in t)Object.defineProperty(s,"key",{value:t.key,configurable:!0,writable:!0});else if(!("key"in e)){function n(e){Object.defineProperty(this,"key",{value:e,writable:!0,enumerable:!0})}const i="EntityMixin"!==s.name?function(){const t="EntityMixin"===this.name?e.name:this.name;return console.error("Rest Hooks Error: https://resthooks.io/errors/dklj"),Object.defineProperty(this,"key",{get:()=>t,set:n}),this.key}:function(){return"EntityMixin"===this.name?e.name:this.name};Object.defineProperty(s,"key",{get:i,set:n})}return s}var _=Object.freeze({__proto__:null,Union:class extends i{constructor(e,t){if(!t)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');super(e,t)}normalize(e,t,s,r,n,i,o,c){return this.normalizeValue(e,t,s,r,n,i,o,c)}denormalize(e,t){const s=this.denormalizeValue(e,t);return[s,void 0!==s,"symbol"==typeof s]}denormalizeOnly(e,t,s){return this.denormalizeValue(e,s)}infer(e,t,s,r){if(!e[0])return;const n=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[n];return void 0!==i?{id:s(i,e,t,r),schema:n}:void 0}},Values:o,Array:a,All:class extends a{constructor(e,t){super(e,t)}normalize(e,t,s,r,n,i,o,c){super.normalize(e,t,s,r,n,i,o,c)}infer(e,t,s,r){if(this.isSingleSchema){const e=r[this.schema.key];if(void 0===e)return;return Object.values(e).map((e=>e&&this.schema.pk(e)))}let n=!1;const i=Object.values(this.schema).flatMap((e=>r[e.key]?(n=!0,Object.values(r[e.key]).map((t=>({id:t&&e.pk(t),schema:this.getSchemaAttribute(t,void 0,void 0)})))):[]));if(n)return i}},Object:class{constructor(e){this.schema=void 0,this.define(e)}define(e){this.schema=Object.keys(e).reduce(((t,s)=>{const r=e[s];return Object.assign({},t,{[s]:r})}),this.schema||{})}normalize(...e){return((e,t,s,r,n,i,o,c,a)=>{const h=Object.assign({},t);return Object.keys(e).forEach((s=>{const r=e[s],u=n(t[s],t,s,r,i,o,c,a);null==u?delete h[s]:h[s]=u})),h})(this.schema,...e)}denormalize(...e){return((e,r,n)=>{if(t(r))return s(e,r,n);const i=Object.assign({},r);let o=!0,c=!1;return Object.keys(e).forEach((t=>{const[s,r,a]=n(i[t],e[t]);void 0!==i[t]&&(i[t]=s),a&&(c=!0),r||(o=!1)})),[i,o,c]})(this.schema,...e)}denormalizeOnly(e,t,s){return h(this.schema,e,0,s)}infer(e,t,s,r){return function(e,t,s,r,n){const i={};return Object.keys(e).forEach((o=>{i[o]=r(e[o],t,s,n)})),i}(this.schema,e,t,s,r)}},Delete:class extends u{denormalize(e,t){return t(e,this._entity)}},Invalidate:u,Collection:class{addWith(e,t){return b(this,e,t)}constructor(e,t){var s;this.schema=Array.isArray(e)?new a(e[0]):e,"nestKey"in t?this.nestKey=t.nestKey:this.argsKey=t.argsKey,this.createCollectionFilter=null!=(s=t.createCollectionFilter)?s:p,this.schema instanceof a?(this.createIfValid=d,this.push=b(this,l),this.unshift=b(this,m)):e instanceof o&&(this.createIfValid=y,this.assign=b(this,f))}toJSON(){return{name:`Collection(${this.schema.schema.name})`,schema:this.schema.schema,key:this.key}}get key(){return`COLLECT:${this.schema.constructor.name}(${this.schema.schema.key})`}pk(e,t,s,r){return JSON.stringify(this.argsKey?this.argsKey(...r):this.nestKey(t,s))}normalize(e,t,s,r,n,i,o,c){const a=this.schema.normalize(e,t,s,r,n,i,o,c),h=this.pk(a,t,s,c);return n(this,a,h),h}merge(e,t){return t}shouldReorder(e,t,s,r){return t.fetchedAt<e.fetchedAt}mergeWithStore(e,t,s,r){return this.shouldReorder(e,t,s,r)?this.merge(r,s):this.merge(s,r)}mergeMetaWithStore(e,t,s,r){return this.shouldReorder(e,t,s,r)?e:t}infer(e,t,s,r){}denormalizeOnly(e,t,s){return this.schema.denormalizeOnly(e,t,s)}},Entity:A});const x=class{};class E extends(A(x)){static useIncoming(e,t,s,r){return e.fetchedAt<=t.fetchedAt}static mergeWithStore(e,t,s,r){return!e||this.useIncoming(e,t,s,r)?typeof r!=typeof s?r:this.merge(s,r):s}static mergeMetaWithStore(e,t,s,r){return{expiresAt:Math.max(this.expiresAt(t,r),e.expiresAt),date:Math.max(t.date,e.date),fetchedAt:Math.max(t.fetchedAt,e.fetchedAt)}}static process(e,t,s){return super.process(e,t,s)}static validate(e){return super.validate(e)}static denormalize(e,r){if("symbol"==typeof e)return[void 0,!0,!0];if(t(e)){if(this.validate(e.toJS()))return[void 0,!1,!0];null==r.setLocal||r.setLocal(e);const[t,n,i]=s(this.schema,e,r);return[this.fromJS(t.toObject()),!0,i]}let n;if(e instanceof this)n=e;else{if(this.validate(e))return[void 0,!1,!0];n=this.fromJS(e),null==r.setLocal||r.setLocal(n)}let i=!1;return Object.keys(this.schema).forEach((t=>{const s=this.schema[t],o=e[t],[c,,a]=r(o,s);a&&this.defaults[t]&&(i=!0),e[t]!==c&&this.set(n,t,c)})),[n,!0,i]}static set(e,t,s){e[t]=s}}var w;E.expiresAt=function(e,t){return e.expiresAt};const P="undefined"!=typeof document;let V=P&&!(null!=(w=document.querySelector("meta[http-equiv='Content-Security-Policy']"))&&w.getAttribute("content"));try{V||Function()}catch(e){V=!0,P&&console.error("Content Security Policy: The previous CSP log can be safely ignored - @rest-hooks/endpoint will use setPrototypeOf instead")}function I(e,t){e.type=e.sideEffect?"mutate":"read",e.options=Object.assign({},t),delete e.options.key,delete e.options.schema,delete e.options.sideEffect,delete e.options.fetch,delete e.options.getFetchKey,delete e.options.options,0===Object.keys(e.options).length&&delete e.options,void 0===e.schema&&(e.schema=null)}class M extends Function{constructor(e,t){let s,r;return V?(s=(...e)=>s.fetch(...e),Object.setPrototypeOf(s,new.target.prototype)):(super("return arguments.callee.fetch.apply(arguments.callee, arguments)"),s=this),s.getFetchKey=e=>s.key(e),e&&(s.fetch=e),t&&"name"in t||!e||!e.name||"anonymous"===e.name||(r=e.name),Object.defineProperty(s,"name",{get(){return r||this.__name},set(e){this.__name=e}}),Object.assign(s,t),I(s,t),s}key(...e){return`${this.name} ${JSON.stringify(e)}`}testKey(e){return e.startsWith(this.name)}bind(e,...t){const s=this.fetch,r=this.key;return this.extend({fetch(){return s.apply(null!=e?e:this,t)},key(){return r.apply(this,t)}})}extend(e){class t extends this.constructor{}Object.assign(t.prototype,this);const s=new t(e.fetch,e);return I(s,Object.assign({},this.options,e)),s}}"runCompat"!==I.name&&(M.prototype.key=function(...e){return console.error("Rest Hooks Error: https://resthooks.io/errors/osid"),`${this.name} ${JSON.stringify(e)}`});const J=M;class N extends Error{}Object.hasOwn=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},e.AbortOptimistic=N,e.DELETED=r,e.Endpoint=M,e.Entity=E,e.ExtendableEndpoint=J,e.INVALID=n,e.Index=class{constructor(e,t){this.getFetchKey=e=>this.key(e),this.schema=e,t&&(this.key=t)}key(e){return JSON.stringify(e)}},e.Query=class{constructor(e,t){this.sideEffect=void 0,this.schema=this.createQuerySchema(e),t?this.process=t:this.process||(this.process=e=>e)}key(...e){return`QUERY ${JSON.stringify(e)}`}createQuerySchema(e){const t=Object.create(e);return t.denormalize=({args:t,input:s},r)=>{if(void 0===s)return[void 0,!1,!1];const[n,i,o]=e.denormalize(s,r);return[i?this.process(n,...t):void 0,i,o]},e.denormalizeOnly&&(t.denormalizeOnly=({args:t,input:s},r,n)=>{if(void 0===s)return;const i=e.denormalizeOnly(s,t,n);return"symbol"==typeof i?void 0:this.process(i,...t)}),t.infer=(t,s,r,n)=>({args:t,input:r(e,t,s,n)}),t}},e.schema=_,e.validateRequired=function(e,t){let s="";if(Object.keys(t).some((t=>!Object.hasOwn(e,t)&&(s=t,!0))))return`Missing key ${s}`},Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -7,4 +7,4 @@ Object.hasOwn = Object.hasOwn || /* istanbul ignore next */function hasOwn(it, key) { | ||
export { default as Entity } from './schemas/Entity.js'; | ||
export { default as validateRequired } from './schemas/validatRequired.js'; | ||
export { DELETED } from './special.js'; | ||
export { default as validateRequired } from './validateRequired.js'; | ||
export { DELETED, INVALID } from './special.js'; | ||
export { default as Endpoint, ExtendableEndpoint } from './endpoint.js'; | ||
@@ -14,2 +14,2 @@ export * from './indexEndpoint.js'; | ||
export { default as AbortOptimistic } from './AbortOptimistic.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJPYmplY3QiLCJoYXNPd24iLCJpdCIsImtleSIsInByb3RvdHlwZSIsImhhc093blByb3BlcnR5IiwiY2FsbCIsIl9zY2hlbWEiLCJzY2hlbWEiLCJkZWZhdWx0IiwiRW50aXR5IiwidmFsaWRhdGVSZXF1aXJlZCIsIkRFTEVURUQiLCJFbmRwb2ludCIsIkV4dGVuZGFibGVFbmRwb2ludCIsIkFib3J0T3B0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iJ9 |
export * from './SnapshotInterface.js'; | ||
/** Defines a networking endpoint */ | ||
/** To change values on the server */ | ||
/** For retrieval requests */ | ||
export {}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vc3JjL2ludGVyZmFjZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBBYnN0cmFjdEluc3RhbmNlVHlwZSwgRGVub3JtYWxpemUsIEVudGl0eU1hcCB9IGZyb20gJy4vbm9ybWFsLmpzJztcbmltcG9ydCB0eXBlIHsgRW5kcG9pbnRFeHRyYU9wdGlvbnMsIEZldGNoRnVuY3Rpb24gfSBmcm9tICcuL3R5cGVzLmpzJztcblxuZXhwb3J0ICogZnJvbSAnLi9TbmFwc2hvdEludGVyZmFjZS5qcyc7XG5cbmV4cG9ydCB0eXBlIFNjaGVtYSA9XG4gIHwgbnVsbFxuICB8IHN0cmluZ1xuICB8IHsgW0s6IHN0cmluZ106IGFueSB9XG4gIHwgU2NoZW1hW11cbiAgfCBTY2hlbWFTaW1wbGVcbiAgfCBTZXJpYWxpemFibGU7XG5cbmV4cG9ydCB0eXBlIFNlcmlhbGl6YWJsZTxcbiAgVCBleHRlbmRzIHsgdG9KU09OKCk6IHN0cmluZyB9ID0geyB0b0pTT04oKTogc3RyaW5nIH0sXG4+ID0ge1xuICBwcm90b3R5cGU6IFQ7XG59O1xuXG5leHBvcnQgaW50ZXJmYWNlIFNjaGVtYVNpbXBsZTxUID0gYW55PiB7XG4gIG5vcm1hbGl6ZShcbiAgICBpbnB1dDogYW55LFxuICAgIHBhcmVudDogYW55LFxuICAgIGtleTogYW55LFxuICAgIHZpc2l0OiAoLi4uYXJnczogYW55KSA9PiBhbnksXG4gICAgYWRkRW50aXR5OiAoLi4uYXJnczogYW55KSA9PiBhbnksXG4gICAgdmlzaXRlZEVudGl0aWVzOiBSZWNvcmQ8c3RyaW5nLCBhbnk+LFx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cmluZyB8IHVuZGVmaW5lZFxuICA6IFMgZXh0ZW5kcyBSZWNvcmRDbGFzc1xuICA/IE5vcm1hbGl6ZWROdWxsYWJsZU9iamVjdDxTWydzY2hlbWEnXT5cbiAgOiBTIGV4dGVuZHMgU2NoZW1hQ2xhc3NcbiAgPyBOb3JtYWxpemVSZXR1cm5UeXBlPFNbJ19ub3JtYWxpemVOdWxsYWJsZSddPlxuICA6IFMgZXh0ZW5kcyBTZXJpYWxpemFibGU8aW5mZXIgVD5cbiAgPyBUXG4gIDogUyBleHRlbmRzIEFycmF5PGluZmVyIEY+XG4gID8gTm9ybWFsaXplPEY+W10gfCB1bmRlZmluZWRcbiAgOiBTIGV4dGVuZHMgeyBbSzogc3RyaW5nXTogYW55IH1cbiAgPyBOb3JtYWxpemVkTnVsbGFibGVPYmplY3Q8Uz5cbiAgOiBTO1xuXG5leHBvcnQgdHlwZSBOb3JtYWxpemVkU2NoZW1hPEUsIFI+ID0ge1xuICBlbnRpdGllczogRTtcbiAgcmVzdWx0OiBSO1xuICBpbmRleGVzOiBOb3JtYWxpemVkSW5kZXg7XG4gIGVudGl0eU1ldGE6IHtcbiAgICByZWFkb25seSBbZW50aXR5S2V5OiBzdHJpbmddOiB7XG4gICAgICByZWFkb25seSBbcGs6IHN0cmluZ106IHtcbiAgICAgICAgcmVhZG9ubHkgZGF0ZTogbnVtYmVyO1xuICAgICAgICByZWFkb25seSBleHBpcmVzQXQ6IG51bWJlcjtcbiAgICAgICAgcmVhZG9ubHkgZmV0Y2hlZEF0OiBudW1iZXI7XG4gICAgICB9O1xuICAgIH07XG4gIH07XG59O1xuXG5leHBvcnQgaW50ZXJmYWNlIEVudGl0eU1hcDxUID0gYW55PiB7XG4gIHJlYWRvbmx5IFtrOiBzdHJpbmddOiBFbnRpdHlJbnRlcmZhY2U8VD47XG59XG4iXSwibWFwcGluZ3MiOiIifQ== | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1l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XI7XG4gICAgICAgIHJlYWRvbmx5IGV4cGlyZXNBdDogbnVtYmVyO1xuICAgICAgICByZWFkb25seSBmZXRjaGVkQXQ6IG51bWJlcjtcbiAgICAgIH07XG4gICAgfTtcbiAgfTtcbn07XG5cbmV4cG9ydCBpbnRlcmZhY2UgRW50aXR5TWFwPFQgPSBhbnk+IHtcbiAgcmVhZG9ubHkgW2s6IHN0cmluZ106IEVudGl0eUludGVyZmFjZTxUPjtcbn1cbiJdLCJtYXBwaW5ncyI6IiJ9 |
@@ -24,6 +24,14 @@ /** | ||
}, unvisit) => { | ||
if (input === undefined) return [undefined, false, true]; | ||
if (input === undefined) return [undefined, false, false]; | ||
const [value, found, deleted] = schema.denormalize(input, unvisit); | ||
return [found ? this.process(value, ...args) : undefined, found, deleted]; | ||
}; | ||
if (schema.denormalizeOnly) query.denormalizeOnly = ({ | ||
args, | ||
input | ||
}, _, unvisit) => { | ||
if (input === undefined) return undefined; | ||
const value = schema.denormalizeOnly(input, args, unvisit); | ||
return typeof value === 'symbol' ? undefined : this.process(value, ...args); | ||
}; | ||
query.infer = (args, indexes, recurse, entities) => { | ||
@@ -38,2 +46,2 @@ return { | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJRdWVyeSIsImNvbnN0cnVjdG9yIiwic2NoZW1hIiwicHJvY2VzcyIsInNpZGVFZmZlY3QiLCJ1bmRlZmluZWQiLCJjcmVhdGVRdWVyeVNjaGVtYSIsImVudHJpZXMiLCJrZXkiLCJhcmdzIiwiSlNPTiIsInN0cmluZ2lmeSIsInF1ZXJ5IiwiT2JqZWN0IiwiY3JlYXRlIiwiZGVub3JtYWxpemUiLCJpbnB1dCIsInVudmlzaXQiLCJ2YWx1ZSIsImZvdW5kIiwiZGVsZXRlZCIsImluZmVyIiwiaW5kZXhlcyIsInJlY3Vyc2UiLCJlbnRpdGllcyJdLCJzb3VyY2VzIjpbIi4uL3NyYy9xdWVyeU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BQUNTLGVBQWUsR0FBRyxDQUN0QjtNQUFFWixJQUFJO01BQUVPO0lBQStCLENBQUMsRUFDeENNLENBQUksRUFDSkwsT0FBWSxLQUNUO01BQ0gsSUFBSUQsS0FBSyxLQUFLWCxTQUFTLEVBQUUsT0FBT0EsU0FBUztNQUN6QyxNQUFNYSxLQUFLLEdBQUloQixNQUFNLENBQVNtQixlQUFlLENBQUNMLEtBQUssRUFBRVAsSUFBSSxFQUFFUSxPQUFPLENBQUM7TUFDbkUsT0FBTyxPQUFPQyxLQUFLLEtBQUssUUFBUSxHQUM1QmIsU0FBUyxHQUNULElBQUksQ0FBQ0YsT0FBTyxDQUFDZSxLQUFLLEVBQUUsR0FBR1QsSUFBSSxDQUFDO0lBQ2xDLENBQUM7SUFDSEcsS0FBSyxDQUFDVyxLQUFLLEdBQUcsQ0FDWmQsSUFBUyxFQUNUZSxPQUFZLEVBQ1pDLE9BS1EsRUFDUkMsUUFBcUIsS0FDbEI7TUFDSCxPQUFPO1FBQUVqQixJQUFJO1FBQUVPLEtBQUssRUFBRVMsT0FBTyxDQUFDdkIsTUFBTSxFQUFFTyxJQUFJLEVBQUVlLE9BQU8sRUFBRUUsUUFBUTtNQUFFLENBQUM7SUFDbEUsQ0FBQztJQUNELE9BQU9kLEtBQUs7RUFDZDtBQUNGIn0= |
@@ -8,3 +8,5 @@ /* istanbul ignore file */ | ||
export { default as Delete } from './schemas/Delete.js'; | ||
export { default as Invalidate } from './schemas/Invalidate.js'; | ||
export { default as Collection } from './schemas/Collection.js'; | ||
export { default as Entity } from './schemas/EntitySchema.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJkZWZhdWx0IiwiVW5pb24iLCJWYWx1ZXMiLCJBcnJheSIsIkFsbCIsIk9iamVjdCIsIkRlbGV0ZSIsIkVudGl0eSJdLCJzb3VyY2VzIjpbIi4uL3NyYy9zY2hlbWEuanMiXSwic291cmNlc0NvbnRlbn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BUSxxQkFBcUI7QUFDdkQsU0FBU0YsT0FBTyxJQUFJRyxLQUFLLFFBQVEsb0JBQW9CO0FBQ3JELFNBQVNILE9BQU8sSUFBSUksR0FBRyxRQUFRLGtCQUFrQjtBQUNqRCxTQUFTSixPQUFPLElBQUlLLE1BQU0sUUFBUSxxQkFBcUI7QUFDdkQsU0FBU0wsT0FBTyxJQUFJTSxNQUFNLFFBQVEscUJBQXFCO0FBQ3ZELFNBQVNOLE9BQU8sSUFBSU8sVUFBVSxRQUFRLHlCQUF5QjtBQUMvRCxTQUFTUCxPQUFPLElBQUlRLFVBQVUsUUFBUSx5QkFBeUI7QUFDL0QsU0FBU1IsT0FBTyxJQUFJUyxNQUFNLFFBQVEsMkJBQTJCIn0= |
@@ -11,5 +11,5 @@ import ArraySchema from './Array.js'; | ||
} | ||
normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
// we return undefined | ||
super.normalize(input, parent, key, visit, addEntity, visitedEntities); | ||
super.normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args); | ||
} | ||
@@ -36,2 +36,2 @@ infer(args, indexes, recurse, entities) { | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJBcnJheVNjaGVtYSIsIkFsbFNjaGVtYSIsImNvbnN0cnVjdG9yIiwiZGVmaW5pdGlvbiIsInNjaGVtYUF0dHJpYnV0ZSIsIm5vcm1hbGl6ZSIsImlucHV0IiwicGFyZW50Iiwia2V5IiwidmlzaXQiLCJhZGRFbnRpdHkiLCJ2aXNpdGVkRW50aXRpZXMiLCJpbmZlciIsImFyZ3MiLCJpbmRleGVzIiwicmVjdXJzZSIsImVudGl0aWVzIiwiaXNTaW5nbGVTY2hlbWEiLCJlbnRpdGllc0VudHJ5Iiwic2NoZW1hIiwidW5kZWZpbmVkIiwiT2JqZWN0IiwidmFsdWVzIiwibWFwI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FQUFFLE9BQU8sRUFBRTtNQUNwQ21CLEtBQUssR0FBRyxJQUFJO01BQ1osT0FBT0wsTUFBTSxDQUFDQyxNQUFNLENBQUNOLFFBQVEsQ0FBQ0csTUFBTSxDQUFDWixHQUFHLENBQUMsQ0FBd0IsQ0FBQ2dCLEdBQUcsQ0FDbkVDLE1BQU0sS0FBSztRQUNUSyxFQUFFLEVBQUVMLE1BQU0sSUFBSUwsTUFBTSxDQUFDTSxFQUFFLENBQUNELE1BQU0sQ0FBQztRQUMvQkwsTUFBTSxFQUFFLElBQUksQ0FBQ1csa0JBQWtCLENBQUNOLE1BQU0sRUFBRUosU0FBUyxFQUFFQSxTQUFTO01BQzlELENBQUMsQ0FBQyxDQUNIO0lBQ0gsQ0FBQyxDQUNGO0lBQ0Q7SUFDQSxJQUFJLENBQUNNLEtBQUssRUFBRTtJQUNaLE9BQU9DLElBQUk7RUFDYjtBQUNGIn0= |
@@ -9,9 +9,12 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
export default class ArraySchema extends PolymorphicSchema { | ||
normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
const values = getValues(input); | ||
return values.map((value, index) => this.normalizeValue(value, parent, key, visit, addEntity, visitedEntities)).filter(value => value !== undefined && value !== null); | ||
return values.map((value, index) => this.normalizeValue(value, parent, key, visit, addEntity, visitedEntities, storeEntities, args)).filter(value => value !== undefined && value !== null); | ||
} | ||
denormalize(input, unvisit) { | ||
return [input.map ? input.map(entityOrId => this.denormalizeValue(entityOrId, unvisit)).filter(filterEmpty).map(([value]) => value) : input, true, false]; | ||
return [this.denormalizeOnly(input, [], unvisit), true, false]; | ||
} | ||
denormalizeOnly(input, args, unvisit) { | ||
return input.map ? input.map(entityOrId => this.denormalizeValue(entityOrId, unvisit)).filter(filterEmpty) : input; | ||
} | ||
infer(args, indexes, recurse, entities) { | ||
@@ -24,2 +27,2 @@ return undefined; | ||
} | ||
//#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nN0IHZhbHVlcyA9IGdldFZhbHVlcyhpbnB1dCk7XG5cbiAgICByZXR1cm4gdmFsdWVzXG4gICAgICAubWFwKCh2YWx1ZSwgaW5kZXgpID0+XG4gICAgICAgIHRoaXMubm9ybWFsaXplVmFsdWUoXG4gICAgICAgICAgdmFsdWUsXG4gICAgICAgICAgcGFyZW50LFxuICAgICAgICAgIGtleSxcbiAgICAgICAgICB2aXNpdCxcbiAgICAgICAgICBhZGRFbnRpdHksXG4gICAgICAgICAgdmlzaXRlZEVudGl0aWVzLFxuICAgICAgICApLFxuICAgICAgKVxuICAgICAgLmZpbHRlcih2YWx1ZSA9PiB2YWx1ZSAhPT0gdW5kZWZpbmVkICYmIHZhbHVlICE9PSBudWxsKTtcbiAgfVxuXG4gIGRlbm9ybWFsaXplKFxuICAgIGlucHV0OiBhbnksXG4gICAgdW52aXNpdDogYW55LFxuICApOiBbZGVub3JtYWxpemVkOiBhbnksIGZvdW5kOiBib29sZWFuLCBkZWxldGVkOiBib29sZWFuXSB7XG4gICAgcmV0dXJuIFtcbiAgICAgIGlucHV0Lm1hcFxuICAgICAgICA/IGlucHV0XG4gICAgICAgICAgICAubWFwKChlbnRpdHlPcklkOiBhbnkpID0+XG4gICAgICAgICAgICAgIHRoaXMuZGVub3JtYWxpemVWYWx1ZShlbnRpdHlPcklkLCB1bnZpc2l0KSxcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIC5maWx0ZXIoZmlsdGVyRW1wdHkpXG4gICAgICAgICAgICAubWFwKChbdmFsdWVdOiBhbnkpID0+IHZhbHVlKVxuICAgICAgICA6IGlucHV0LFxuICAgICAgdHJ1ZSxcbiAgICAgIGZhbHNlLFxuICAgIF07XG4gIH1cblxuICBpbmZlcihcbiAgICBhcmdzOiB1bmtub3duLFxuICAgIGluZGV4ZXM6IHVua25vd24sXG4gICAgcmVjdXJzZTogdW5rbm93bixcbiAgICBlbnRpdGllczogdW5rbm93bixcbiAgKTogYW55IHtcbiAgICByZXR1cm4gdW5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aWxzLmpzJztcblxuLyoqXG4gKiBSZXByZXNlbnRzIGFycmF5c1xuICogQHNlZSBodHRwczovL3Jlc3Rob29rcy5pby9yZXN0L2FwaS9BcnJheVxuICovXG5leHBvcnQgZGVmYXVsdCBjbGFzcyBBcnJheVNjaGVtYSBleHRlbmRzIFBvbHltb3JwaGljU2NoZW1hIHtcbiAgbm9ybWFsaXplKFxuICAgIGlucHV0OiBhbnksXG4gICAgcGFyZW50OiBhbnksXG4gICAga2V5OiBhbnksXG4gICAgdmlzaXQ6IGFueSxcbiAgICBhZGRFbnRpdHk6IGFueSxcbiAgICB2aXNpdGVkRW50aXRpZXM6IGFueSxcbiAgICBzdG9yZUVudGl0aWVzOiBhbnksXG4gICAgYXJncz86IGFueVtdLFxuICApOiBhbnkge1xuICAgIGNvbnN0IHZhbHVlcyA9IGdldFZhbHVlcyhpbnB1dCk7XG5cbiAgICByZXR1cm4gdmFsdWVzXG4gICAgICAubWFwKCh2YWx1ZSwgaW5kZXgpID0+XG4gICAgICAgIHRoaXMubm9ybWFsaXplVmFsdWUoXG4gICAgICAgICAgdmFsdWUsXG4gICAgICAgICAgcGFyZW50LFxuICAgICAgICAgIGtleSxcbiAgICAgICAgICB2aXNpdCxcbiAgICAgICAgICBhZGRFbnRpdHksXG4gICAgICAgICAgdmlzaXRlZEVudGl0aWVzLFxuICAgICAgICAgIHN0b3JlRW50aXRpZXMsXG4gICAgICAgICAgYXJncyxcbiAgICAgICAgKSxcbiAgICAgIClcbiAgICAgIC5maWx0ZXIodmFsdWUgPT4gdmFsdWUgIT09IHVuZGVmaW5lZCAmJiB2YWx1ZSAhPT0gbnVsbCk7XG4gIH1cblxuICBkZW5vcm1hbGl6ZShcbiAgICBpbnB1dDogYW55LFxuICAgIHVudmlzaXQ6IGFueSxcbiAgKTogW2Rlbm9ybWFsaXplZDogYW55LCBmb3VuZDogYm9vbGVhbiwgZGVsZXRlZDogYm9vbGVhbl0ge1xuICAgIHJldHVybiBbdGhpcy5kZW5vcm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n0= |
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
import { DELETED } from '../special.js'; | ||
import Invalidate from './Invalidate.js'; | ||
// TODO(breaking): mark deprecated | ||
/** | ||
@@ -9,59 +8,7 @@ * Marks entity as deleted. | ||
*/ | ||
export default class Delete { | ||
constructor(entity) { | ||
if (process.env.NODE_ENV !== 'production' && !entity) { | ||
throw new Error('Expected option "entity" not found on DeleteSchema.'); | ||
} | ||
this._entity = entity; | ||
} | ||
get key() { | ||
return this._entity.key; | ||
} | ||
normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
// TODO: what's store needs to be a differing type from fromJS | ||
const processedEntity = this._entity.process(input, parent, key); | ||
const id = this._entity.pk(processedEntity, parent, key); | ||
if (process.env.NODE_ENV !== 'production' && (id === undefined || id === '')) { | ||
var _name; | ||
const error = new Error(`Missing usable primary key when normalizing response. | ||
This is likely due to a malformed response. | ||
Try inspecting the network response or fetch() return value. | ||
Or use debugging tools: https://resthooks.io/docs/guides/debugging | ||
Learn more about schemas: https://resthooks.io/docs/api/schema | ||
Delete(Entity): Delete(${(_name = this._entity.name) != null ? _name : this._entity}) | ||
Value: ${input && JSON.stringify(input, null, 2)} | ||
`); | ||
error.status = 400; | ||
throw error; | ||
} | ||
addEntity(this, DELETED, id); | ||
return id; | ||
} | ||
infer(args, indexes, recurse) { | ||
return undefined; | ||
} | ||
export default class Delete extends Invalidate { | ||
denormalize(id, unvisit) { | ||
return unvisit(id, this._entity); | ||
} | ||
/* istanbul ignore next */ | ||
_denormalizeNullable() { | ||
return []; | ||
} | ||
/* istanbul ignore next */ | ||
_normalizeNullable() { | ||
return []; | ||
} | ||
/* istanbul ignore next */ | ||
merge(existing, incoming) { | ||
return incoming; | ||
} | ||
useIncoming(existingMeta, incomingMeta, existing, incoming) { | ||
return existingMeta.date <= incomingMeta.date; | ||
} | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJERUxFV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xuICBkZW5vcm1hbGl6ZShcbiAgICBpZDogc3RyaW5nLFxuICAgIHVudmlzaXQ6IFVudmlzaXRGdW5jdGlvbixcbiAgKTogW2Rlbm9ybWFsaXplZDogQWJzdHJhY3RJbnN0YW5jZVR5cGU8RT4sIGZvdW5kOiBib29sZWFuLCBzdXNwZW5kOiBib29sZWFuXSB7XG4gICAgcmV0dXJuIHVudmlzaXQoaWQsIHRoaXMuX2VudGl0eSkgYXMgYW55O1xuICB9XG59XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0EsT0FBT0EsVUFBVSxNQUFNLGlCQUFpQjtBQUt4QztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsZUFBZSxNQUFNQyxNQUFNLFNBS2pCRCxVQUFVLENBRXBCO0VBQ0VFLFdBQVdBLENBQ1RDLEVBQVUsRUFDVkMsT0FBd0IsRUFDbUQ7SUFDM0UsT0FBT0EsT0FBTyxDQUFDRCxFQUFFLEVBQUUsSUFBSSxDQUFDRSxPQUFPLENBQUM7RUFDbEM7QUFDRiJ9 |
@@ -19,2 +19,11 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
/** Control how automatic schema validation is handled | ||
* | ||
* `undefined`: Defaults - throw error in worst offense | ||
* 'warn': only ever warn | ||
* 'silent': Don't bother with processing at all | ||
* | ||
* Note: this only applies to non-nested members. | ||
*/ | ||
/** Return true to merge incoming data; false keeps existing entity | ||
@@ -44,2 +53,9 @@ * | ||
} | ||
static mergeMetaWithStore(existingMeta, incomingMeta, existing, incoming) { | ||
return { | ||
expiresAt: Math.max(this.expiresAt(incomingMeta, incoming), existingMeta.expiresAt), | ||
date: Math.max(incomingMeta.date, existingMeta.date), | ||
fetchedAt: Math.max(incomingMeta.fetchedAt, existingMeta.fetchedAt) | ||
}; | ||
} | ||
@@ -51,2 +67,10 @@ /** Factory method to convert from Plain JS Objects. | ||
/** | ||
* A unique identifier for each Entity | ||
* | ||
* @param [value] POJO of the entity or subset used | ||
* @param [parent] When normalizing, the object which included the entity | ||
* @param [key] When normalizing, the key where this entity was found | ||
*/ | ||
/** Do any transformations when first receiving input */ | ||
@@ -201,2 +225,7 @@ static process(input, parent, key) { | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsImRlbm9ybWFsaXplSW1tdXRhYmxlIiwiRW50aXR5IiwiRW50aXR5U2NoZW1hIiwiRW1wdHlCYXNlIiwidXNlSW5jb21pbmciLCJleGlzdGluZ01ldGEiLCJpbmNvbWluZ01ldGEiLCJleGlzdGluZyIsImluY29taW5nIiwiZmV0Y2hlZEF0IiwibWVyZ2VXaXRoU3RvcmUiLCJtZXJnZSIsInByb2Nlc3MiLCJpbnB1dCIsInBhcmVudCIsImtleSIsImVudiIsIk5PREVfRU5WIiwiYXV0b21hdGljVmFsaWRhdGlvbiIsIkFycmF5IiwiaXNBcnJheSIsImVycm9yTWVzc2FnZSIsIm5hbWUiLCJKU09OIiwic3RyaW5naWZ5Iiwic2xpY2UiLCJlcnJvciIsIkVycm9yIiwic3RhdHVzIiwiY29uc29sZSIsIndhcm4iLCJ2YWxpZGF0ZSIsInByb2Nlc3NlZEVudGl0eSIsImtleXNPZlJlY29yZCIsIlNldCIsIk9iamVjdCIsImtleXMiLCJkZWZhdWx0cyIsImtleXNPZlByb3BzIiwiZm91bmQiLCJtaXNzaW5nIiwidW5leHBlY3RlZCIsImtleU9mUHJvcHMiLCJoYXMiLCJwdXNoIiwia2V5T2ZSZWNvcmQiLCJpbmNsdWRlcyIsInNpemUiLCJ0b29NYW55VW5leHBlY3RlZCIsIk1hdGgiLCJtYXgiLCJsZW5ndGgiLCJmb3VuZE5vdGhpbmciLCJtaW4iLCJleHRyYSIsInJlYXNvbiIsImRlbm9ybWFsaXplIiwidW52aXNpdCIsInVuZGVmaW5lZCIsInRvSlMiLCJzZXRMb2NhbCIsImRlbm9ybUVudGl0eSIsImRlbGV0Z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BLE1BQU13RCxTQUFTLEdBQUd4RSxNQUFNLENBQUMrRCxNQUFNO0VBQy9CO0VBQ0E7RUFDQS9ELE1BQU0sQ0FBQytELE1BQU0sR0FBRyxTQUFTQSxNQUFNQSxDQUU3QlUsS0FBd0MsRUFDZjtJQUN6QixJQUFLLElBQUksQ0FBU0MsU0FBUyxDQUFDQyxFQUFFLEtBQUszRSxNQUFNLENBQUMwRSxTQUFTLENBQUNDLEVBQUUsRUFDcEQsTUFBTSxJQUFJakQsS0FBSyxDQUFDLG9DQUFvQyxDQUFDO0lBQ3ZELE9BQU84QyxTQUFTLENBQUNJLElBQUksQ0FBQyxJQUFJLEVBQUVILEtBQUssQ0FBQztFQUNwQyxDQUFDO0FBQ0gifQ== | ||
// we're avoiding this on the type | ||
Entity.expiresAt = function (meta, input) { | ||
return meta.expiresAt; | ||
}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsImRlbm9ybWFsaXplSW1tdXRhYmxlIiwiRW50aXR5IiwiRW50aXR5U2NoZW1hIiwiRW1wdHlCYXNlIiwidXNlSW5jb21pbmciLCJleGlzdGluZ01ldGEiLCJpbmNvbWluZ01ldGEiLCJleGlzdGluZyIsImluY29taW5nIiwiZmV0Y2hlZEF0IiwibWVyZ2VXaXRoU3RvcmUiLCJtZXJnZSIsIm1lcmdlTWV0YVdpdGhTdG9yZSIsImV4cGlyZXNBdCIsIk1hdGgiLCJtYXgiLCJkYXRlIiwicHJvY2VzcyIsImlucHV0IiwicGFyZW50Iiwia2V5IiwiZW52IiwiTk9ERV9FTlYiLCJhdXRvbWF0aWNWYWxpZGF0aW9uIiwiQXJyYXkiLCJpc0FycmF5IiwiZXJyb3JNZXNzYWdlIiwibmFtZSIsIkpTT04iLCJzdHJpbmdpZnkiLCJzbGljZSIsImVycm9yIiwiRXJyb3IiLCJzdGF0dXMiLCJjb25zb2xlIiwid2FybiIsInZhbGlkY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FDQSxNQUFNc0QsU0FBUyxHQUFHM0UsTUFBTSxDQUFDa0UsTUFBTTtFQUMvQjtFQUNBO0VBQ0FsRSxNQUFNLENBQUNrRSxNQUFNLEdBQUcsU0FBU0EsTUFBTUEsQ0FFN0JVLEtBQXdDLEVBQ2Y7SUFDekIsSUFBSyxJQUFJLENBQVNDLFNBQVMsQ0FBQ0MsRUFBRSxLQUFLOUUsTUFBTSxDQUFDNkUsU0FBUyxDQUFDQyxFQUFFLEVBQ3BELE1BQU0sSUFBSS9DLEtBQUssQ0FBQyxvQ0FBb0MsQ0FBQztJQUN2RCxPQUFPNEMsU0FBUyxDQUFDSSxJQUFJLENBQUMsSUFBSSxFQUFFSCxLQUFLLENBQUM7RUFDcEMsQ0FBQztBQUNIOztBQUVBO0FBQ0M1RSxNQUFNLENBQVNZLFNBQVMsR0FBRyxVQUMxQm9FLElBQTRELEVBQzVEL0QsS0FBVSxFQUNGO0VBQ1IsT0FBTytELElBQUksQ0FBQ3BFLFNBQVM7QUFDdkIsQ0FBQyJ9 |
@@ -29,2 +29,14 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; | ||
* | ||
* @param [parent] When normalizing, the object which included the entity | ||
* @param [key] When normalizing, the key where this entity was found | ||
*/ | ||
/** Returns the globally unique identifier for the static Entity */ | ||
// default implementation in class static block at bottom of definition | ||
/** Defines indexes to enable lookup by */ | ||
/** | ||
* A unique identifier for each Entity | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#pk | ||
* @param [value] POJO of the entity or subset used | ||
@@ -34,4 +46,4 @@ * @param [parent] When normalizing, the object which included the entity | ||
*/ | ||
static pk(value, parent, key) { | ||
return this.prototype.pk.call(value, parent, key); | ||
static pk(value, parent, key, args) { | ||
return this.prototype.pk.call(value, parent, key, args); | ||
} | ||
@@ -56,3 +68,6 @@ | ||
/** Creates new instance copying over defined values of arguments */ | ||
/** Creates new instance copying over defined values of arguments | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#merge | ||
*/ | ||
static merge(existing, incoming) { | ||
@@ -62,3 +77,6 @@ return Object.assign({}, existing, incoming); | ||
/** Run when an existing entity is found in the store */ | ||
/** Run when an existing entity is found in the store | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#mergeWithStore | ||
*/ | ||
static mergeWithStore(existingMeta, incomingMeta, existing, incoming) { | ||
@@ -78,2 +96,10 @@ const useIncoming = this.useIncoming(existingMeta, incomingMeta, existing, incoming); | ||
/** Run when an existing entity is found in the store | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#mergeMetaWithStore | ||
*/ | ||
static mergeMetaWithStore(existingMeta, incomingMeta, existing, incoming) { | ||
return this.shouldReorder(existingMeta, incomingMeta, existing, incoming) ? existingMeta : incomingMeta; | ||
} | ||
/** Factory method to convert from Plain JS Objects. | ||
@@ -94,5 +120,6 @@ * | ||
/** Factory method to convert from Plain JS Objects. | ||
/** Called when denormalizing an entity to create an instance when 'valid' | ||
* | ||
* @param [props] Plain Object of properties to assign. | ||
* @see https://resthooks.io/docs/api/schema.Entity#createIfValid | ||
*/ | ||
@@ -108,9 +135,12 @@ static createIfValid( | ||
/** Do any transformations when first receiving input */ | ||
/** Do any transformations when first receiving input | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#process | ||
*/ | ||
static process(input, parent, key) { | ||
return Object.assign({}, input); | ||
} | ||
static normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
static normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
const processedEntity = this.process(input, parent, key); | ||
const id = this.pk(processedEntity, parent, key); | ||
const id = this.pk(processedEntity, parent, key, args); | ||
if (id === undefined || id === '') { | ||
@@ -131,4 +161,4 @@ if (process.env.NODE_ENV !== 'production') { | ||
} else { | ||
// these make the keys get deleted | ||
return undefined; | ||
// these make the keys get deleted; return undefined | ||
return; | ||
} | ||
@@ -152,3 +182,3 @@ } | ||
const schema = this.schema[key]; | ||
processedEntity[key] = visit(processedEntity[key], processedEntity, key, schema, addEntity, visitedEntities); | ||
processedEntity[key] = visit(processedEntity[key], processedEntity, key, schema, addEntity, visitedEntities, storeEntities, args); | ||
} | ||
@@ -178,22 +208,10 @@ }); | ||
} | ||
static infer(args, indexes, recurse) { | ||
static infer(args, indexes, recurse, entities) { | ||
var _entities$this$key; | ||
if (!args[0]) return undefined; | ||
if (['string', 'number'].includes(typeof args[0])) { | ||
return `${args[0]}`; | ||
} | ||
const id = this.pk(args[0], undefined, ''); | ||
// Was able to infer the entity's primary key from params | ||
if (id !== undefined && id !== '') return id; | ||
// now attempt lookup in indexes | ||
const indexName = indexFromParams(args[0], this.indexes); | ||
if (indexName && indexes[this.key]) { | ||
// 'as Record<string, any>': indexName can only be found if params is a string key'd object | ||
const id = indexes[this.key][indexName][args[0][indexName]]; | ||
return id; | ||
} | ||
const id = inferId(this, args, indexes); | ||
// no entity arg is back-compatibility | ||
if (!entities || (_entities$this$key = entities[this.key]) != null && _entities$this$key[id]) return id; | ||
return undefined; | ||
} | ||
static expiresAt(meta, input) { | ||
return meta.expiresAt; | ||
} | ||
static denormalize(input, unvisit) { | ||
@@ -218,3 +236,24 @@ // TODO: remove codecov ignore once denormalize is modified to expect this | ||
} | ||
static denormalizeOnly(input, args, unvisit) { | ||
if (typeof input === 'symbol') { | ||
return input; | ||
} | ||
// note: iteration order must be stable | ||
for (const key of Object.keys(this.schema)) { | ||
const schema = this.schema[key]; | ||
const value = unvisit(input[key], schema); | ||
if (typeof value === 'symbol') { | ||
// if default is not 'fasly', then this is required, so propagate INVALID symbol | ||
if (this.defaults[key]) { | ||
return value; | ||
} | ||
input[key] = undefined; | ||
} else { | ||
input[key] = value; | ||
} | ||
} | ||
return input; | ||
} | ||
/** All instance defaults set */ | ||
@@ -233,2 +272,3 @@ static get defaults() { | ||
pk, | ||
schema, | ||
key | ||
@@ -314,2 +354,17 @@ } = options, | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uI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p1c3QgcmVwbGFjZVxuICAgICAgICBpZiAodHlwZW9mIGluY29taW5nICE9PSB0eXBlb2YgZXhpc3RpbmcpIHtcbiAgICAgICAgICByZXR1cm4gaW5jb21pbmc7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgcmV0dXJuIHRoaXMuc2hvdWxkUmVvcmRlcihcbiAgICAgICAgICAgIGV4aXN0aW5nTWV0YSxcbiAgICAgICAgICAgIGluY29taW5nTWV0YSxcbiAgICAgICAgICAgIGV4aXN0aW5nLFxuICAgICAgICAgICAgaW5jb21pbmcsXG4gICAgICAgICAgKVxuICAgICAgICAgICAgPyB0aGlzLm1lcmdlKGluY29taW5nLCBleGlzdGluZylcbiAgICAgICAgICAgIDogdGhpcy5tZXJnZShleGlzdGluZywgaW5jb21pbmcpO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICByZXR1cm4gZXhpc3Rpbmc7XG4gICAgICB9XG4gICAgfVxuXG4gICAgLyoqIEZhY3RvcnkgbWV0aG9kIHRvIGNvbnZlcnQgZnJvbSBQbGFpbiBKUyBPYmplY3RzLlxuICAgICAqXG4gICAgICogQHBhcmFtIFtwcm9wc10gUGxhaW4gT2JqZWN0IG9mIHByb3BlcnRpZXMgdG8gYXNzaWduLlxuICAgICAqL1xuICAgIHN0YXRpYyBmcm9tSlM8VCBleHRlbmRzIHR5cGVvZiBFbnRpdHlNaXhpbj4oXG4gICAgICB0aGlzOiBULFxuICAgICAgLy8gVE9ETzogdGhpcyBzaG91bGQgb25seSBhY2NlcHQgbWVtYmVycyB0aGF0IGFyZSBub3QgZnVuY3Rpb25zXG4gICAgICBwcm9wczogUGFydGlhbDxBYnN0cmFjdEluc3RhbmNlVHlwZTxUPj4gPSB7fSxcbiAgICApOiBBYnN0cmFjdEluc3RhbmNlVHlwZTxUPiB7XG4gICAgICAvLyB3ZSB0eXBlIGd1YXJkZWQgYWJzdHJhY3QgY2FzZSBhYm92ZSwgc28gb2sgdG8gZm9yY2U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T09ICdFbnRpdHlNaXhpbic7XG4gICAgY29uc3QgZ2V0ID1cbiAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBpZiAqL1xuICAgICAgQ0xBU1NOQU1FTUFOR0xJTkdcbiAgICAgICAgPyAvKiBpc3RhbmJ1bCBpZ25vcmUgbmV4dCAqLyBmdW5jdGlvbiAodGhpczoge1xuICAgICAgICAgICAgbmFtZTogc3RyaW5nO1xuICAgICAgICAgICAga2V5OiBzdHJpbmc7XG4gICAgICAgICAgfSk6IHN0cmluZyB7XG4gICAgICAgICAgICBjb25zdCBuYW1lID0gdGhpcy5uYW1lID09PSAnRW50aXR5TWl4aW4nID8gQmFzZS5uYW1lIDogdGhpcy5uYW1lO1xuICAgICAgICAgICAgY29uc29sZS5lcnJvcignUmVzdCBIb29rcyBFcnJvcjogaHR0cHM6Ly9yZXN0aG9va3MuaW8vZXJyb3JzL2RrbGonKTtcbiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCAna2V5Jywge1xuICAgICAgICAgICAgICBnZXQoKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG5hbWU7XG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIHNldCxcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMua2V5O1xuICAgICAgICAgIH1cbiAgICAgICAgOiBmdW5jdGlvbiAodGhpczogeyBuYW1lOiBzdHJpbmcgfSk6IHN0cmluZyB7XG4gICAgICAgICAgICBjb25zdCBuYW1lID0gdGhpcy5uYW1lID09PSAnRW50aXR5TWl4aW4nID8gQmFzZS5uYW1lIDogdGhpcy5uYW1lO1xuICAgICAgICAgICAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICAgcHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09ICdwcm9kdWN0aW9uJyAmJlxuICAgICAgICAgICAgICAobmFtZSA9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M7SUFFUGUsTUFBTSxDQUFDZ0QsY0FBYyxDQUFDbkUsV0FBVyxFQUFFLEtBQUssRUFBRTtNQUN4QzZFLEdBQUc7TUFDSEg7SUFDRixDQUFDLENBQUM7RUFDSjtFQUVBLE9BQU8xRSxXQUFXO0FBQ3BCO0FBRUEsU0FBUzJELGVBQWVBLENBQ3RCb0IsTUFBd0IsRUFDeEJ4QixPQUF1QixFQUN2QjtFQUNBLElBQUksQ0FBQ0EsT0FBTyxFQUFFLE9BQU81QixTQUFTO0VBQzlCLE9BQU80QixPQUFPLENBQUN5QixJQUFJLENBQUNDLEtBQUssSUFBSTlELE1BQU0sQ0FBQ2dDLE1BQU0sQ0FBQzRCLE1BQU0sRUFBRUUsS0FBSyxDQUFDLENBQUM7QUFDNUQ7O0FBRUE7QUFDQSxTQUFTbEMsb0JBQW9CQSxDQUFDRCxZQUFnQyxFQUFFO0VBQzlELElBQUlBLFlBQVksRUFBRTtJQUNoQixNQUFNUixLQUFLLEdBQUcsSUFBSUMsS0FBSyxDQUFDTyxZQUFZLENBQUM7SUFDcENSLEtBQUssQ0FBU0ksTUFBTSxHQUFHLEdBQUc7SUFDM0IsTUFBTUosS0FBSztFQUNiO0FBQ0YifQ== | ||
function inferId(schema, args, indexes) { | ||
if (['string', 'number'].includes(typeof args[0])) { | ||
return `${args[0]}`; | ||
} | ||
const id = schema.pk(args[0], undefined, '', args); | ||
// Was able to infer the entity's primary key from params | ||
if (id !== undefined && id !== '') return id; | ||
// now attempt lookup in indexes | ||
const indexName = indexFromParams(args[0], schema.indexes); | ||
if (indexName && indexes[schema.key]) { | ||
// 'as Record<string, any>': indexName can only be found if params is a string key'd object | ||
const id = indexes[schema.key][indexName][args[0][indexName]]; | ||
return id; | ||
} | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJFbnRpdHlTY2hlbWEiLCJCYXNlIiwib3B0aW9ucyIsIkVudGl0eU1peGluIiwidG9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mdNZXRhOiB7IGRhdGU6IG51bWJlcjsgZmV0Y2hlZEF0OiBudW1iZXIgfSxcbiAgICAgIGV4aXN0aW5nOiBhbnksXG4gICAgICBpbmNvbWluZzogYW55LFxuICAgICkge1xuICAgICAgY29uc3QgdXNlSW5jb21pbmcgPSB0aGlzLnVzZUluY29taW5nKFxuICAgICAgICBleGlzdGluZ01ldGEsXG4gICAgICAgIGluY29taW5nTWV0YSxcbiAgICAgICAgZXhpc3RpbmcsXG4gICAgICAgIGluY29taW5nLFxuICAgICAgKTtcblxuICAgICAgaWYgKHVzZUluY29taW5nKSB7XG4gICAgICAgIC8vIGRpc3RpbmN0IHR5cGVzIGFyZSBub3QgbWVyZ2VhYmxlIChsaWtlIGRlbGV0ZSBzeW1ib2wpLCBzbyBqdXN0IHJlcGxhY2VcbiAgICAgICAgaWYgKHR5cGVvZiBpbmNvbWluZyAhPT0gdHlwZW9mIGV4aXN0aW5nKSB7XG4gICAgICAgICAgcmV0dXJuIGluY29taW5nO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHJldHVybiB0aGlzLnNob3VsZFJlb3JkZXIoXG4gICAgICAgICAgICBleGlzdGluZ01ldGEsXG4gICAgICAgICAgICBpbmNvbWluZ01ldGEsXG4gICAgICAgICAgICBleGlzdGluZyxcbiAgICAgICAgICAgIGluY29taW5nLFxuICAgICAgICAgIClcbiAgICAgICAgICAgID8gdGhpcy5tZXJnZShpbmNvbWluZywgZXhpc3RpbmcpXG4gICAgICAgICAgICA6IHRoaXMubWVyZ2UoZXhpc3RpbmcsIGluY29taW5nKTtcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgcmV0dXJuIGV4aXN0aW5nO1xuICAgICAgfVxuICAgIH1cblxuICAgIC8qKiBSdW4gd2hlbiBhbiBleGlzdGluZyBlbnRpdHkgaXMgZm91bmQgaW4gdGhlIHN0b3JlXG4gICAgICpcbiAgICAgKiBAc2VlIGh0dHBzOi8vcmVzdGhvb2tzLm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mtleTtcblxuICAgICAgaWYgKCEoZW50aXR5VHlwZSBpbiB2aXNpdGVkRW50aXRpZXMpKSB7XG4gICAgICAgIHZpc2l0ZWRFbnRpdGllc1tlbnRpdHlUeXBlXSA9IHt9O1xuICAgICAgfVxuICAgICAgaWYgKCEoaWQgaW4gdmlzaXRlZEVudGl0aWVzW2VudGl0eVR5cGVdKSkge1xuICAgICAgICB2aXNpdGVkRW50aXRpZXNbZW50aXR5VHlwZV1baWRdID0gW107XG4gICAgICB9XG4gICAgICBpZiAoXG4gICAgICAgIHZpc2l0ZWRFbnRpdGllc1tlbnRpdHlUeXBlXVtpZF0uc29tZSgoZW50aXR5OiBhbnkpID0+IGVudGl0eSA9PT0gaW5wdXQpXG4gICAgICApIHtcbiAgICAgICAgcmV0dXJuIGlkO1xuICAgICAgfVxuICAgICAgY29uc3QgZXJyb3JNZXNzYWdlID0gdGhpcy52YWxpZGF0ZShwcm9jZXNzZWRFbnRpdHkpO1xuICAgICAgdGhyb3dWYWxpZGF0aW9uRXJyb3IoZXJyb3JNZXNzYWdlKTtcblxuICAgICAgdmlzaXRlZEVudGl0aWVzW2VudGl0eVR5cGVdW2lkXS5wdXNoKGlucHV0KTtcblxuICAgICAgT2JqZWN0LmtleXModGhpcy5zY2hlbWEpLmZvckVhY2goa2V5ID0+IHtcbiAgICAgICAgaWYgKE9iamVjdC5oYXNPd24ocHJvY2Vzc2VkRW50aXR5LCBrZXkpKSB7XG4gICAgICAgICAgY29uc3Qgc2NoZW1hID0gdGhpcy5zY2hlbWFba2V5XTtcbiAgICAgICAgICBwcm9jZXNzZWRFbnRpdHlba2V5XSA9IHZpc2l0KFxuICAgICAgICAgICAgcHJvY2Vzc2VkRW50aXR5W2tleV0sXG4gICAgICAgICAgICBwcm9jZXNzZWRFbnRpdHksXG4gICAgICAgICAgICBrZXksXG4gICAgICAgICAgICBzY2hlbWEsXG4gICAgICAgICAgICBhZGRFbnRpdHksXG4gICAgICAgICAgICB2aXNpdGVkRW50aXRpZ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gICAgICB9XG4gICAgfVxuXG4gICAgc3RhdGljIGluZmVyKFxuICAgICAgYXJnczogcmVhZG9ubHkgYW55W10sXG4gICAgICBpbmRleGVzOiBOb3JtYWxpemVkSW5kZXgsXG4gICAgICByZWN1cnNlOiBhbnksXG4gICAgICBlbnRpdGllczogYW55LFxuICAgICk6IGFueSB7XG4gICAgICBpZiAoIWFyZ3NbMF0pIHJldHVybiB1bmRlZmluZWQ7XG4gICAgICBjb25zdCBpZCA9IGluZmVySWQodGhpcywgYXJncywgaW5kZXhlcyk7XG4gICAgICAvLyBubyBlbnRpdHkgYXJnIGlzIGJhY2stY29tcGF0aWJpbGl0eVxuICAgICAgaWYgKCFlbnRpdGllcyB8fCBlbnRpdGllc1t0aGlzLmtleV0/LltpZF0pIHJldHVybiBpZDtcbiAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgfVxuXG4gICAgc3RhdGljIGRlbm9ybWFsaXplPFQgZXh0ZW5kcyB0eXBlb2YgRW50aXR5TWl4aW4+KFxuICAgICAgdGhpczogVCxcbiAgICAgIGlucHV0OiBhbnksXG4gICAgICB1bnZpc2l0OiBVbnZpc2l0RnVuY3Rpb24sXG4gICAgKTogW1xuICAgICAgZGVub3JtYWxpemVkOiBBYnN0cmFjdEluc3RhbmNlVHlwZTxUPixcbiAgICAgIGZvdW5kOiBib29sZWFuLFxuICAgICAgc3VzcGVuZDogYm9vbGVhbixcbiAgICBdIHtcbiAgICAgIC8vIFRPRE86IHJlbW92ZSBjb2RlY292IGlnbm9yZSBvbmNlIGRlbm9ybWFsaXplIGlzIG1vZGlmaWVkIHRvIGV4cGVjdCB0aGlzXG4gICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgaWYgKi9cbiAgICAgIGlmICh0eXBlb2YgaW5wdXQgPT09ICdzeW1ib2wnKSB7XG4gICAgICAgIHJldHVybiBbdW5kZWZpbmVkLCB0cnVlLCB0cnVlXSBhcyBhbnk7XG4gICAgICB9XG5cbiAgICAgIGxldCBkZW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9wdGlvbnMpIHtcbiAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoRW50aXR5TWl4aW4sICdrZXknLCB7XG4gICAgICB2YWx1ZTogb3B0aW9ucy5rZXksXG4gICAgICBjb25maWd1cmFibGU6IHRydWUsXG4gICAgICB3cml0YWJsZTogdHJ1ZSxcbiAgICB9KTtcbiAgfSBlbHNlIGlmICghKCdrZXknIGluIEJhc2UpKSB7XG4gICAgLy8gdGhpcyBhbGxvd3MgYXNzaWdubWVudCBpbiBzdHJpY3QtbW9kZVxuICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1pbm5lci1kZWNsYXJhdGlvbnNcbiAgICBmdW5jdGlvbiBzZXQodGhpczogYW55LCB2YWx1ZTogc3RyaW5nKSB7XG4gICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgJ2tleScsIHtcbiAgICAgICAgdmFsdWUsXG4gICAgICAgIHdyaXRhYmxlOiB0cnVlLFxuICAgICAgICBlbnVtZXJhYmxlOiB0cnVlLFxuICAgICAgfSk7XG4gICAgfVxuICAgIGNvbnN0IENMQVNTTkFNRU1BTkdMSU5HID0gRW50aXR5TWl4aW4ubmFtZSAhPT0gJ0VudGl0eU1peGluJztcbiAgICBjb25zdCBnZXQgPVxuICAgICAgLyogaXN0YW5idWwgaWdub3JlIGlmICovXG4gICAgICBDTEFTU05BTUVNQU5HTElOR1xuICAgICAgICA/IC8qIGlzdGFuYnVsIGlnbm9yZSBuZXh0ICovIGZ1bmN0aW9uICh0aGlzOiB7XG4gICAgICAgICAgICBuYW1lOiBzdHJpbmc7XG4gICAgICAgICAgICBrZXk6IHN0cmluZztcbiAgICAgICAgICB9KTogc3RyaW5nIHtcbiAgICAgICAgICAgIGNvbnN0IG5hbWUgPSB0aGlzLm5hbWUgPT09ICdFbnRpdHlNaXhpbicgPyBCYXNlLm5hbWUgOiB0aGlzLm5hbWU7XG4gICAgICAgICAgICBjb25zb2xlLmVycm9yKCdSZXN0IEhvb2tzIEVycm9yOiBodHRwczovL3Jlc3Rob29rcy5pby9lcnJvcnMvZGtsaicpO1xuICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRoaXMsICdrZXknLCB7XG4gICAgICAgICAgICAgIGdldCgpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbmFtZTtcbiAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgc2V0LFxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICByZXR1cm4gdGhpcy5rZXk7XG4gICAgICAgICAgfVxuICAgICAgICA6IGZ1bmN0aW9uICh0aGlzOiB7IG5hbWU6IHN0cmluZyB9KTogc3RyaW5nIHtcbiAgICAgICAgICAgIGNvbnN0IG5hbWUgPSB0aGlzLm5hbWUgPT09ICdFbnRpdHlNaXhpbicgPyBCYXNlLm5hbWUgOiB0aGlzLm5hbWU7XG4gICAgICAgICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgbmV4dCAqL1xuICAgICAgICAgICAgaWYgKFxuICAgICAgICAgICAgICBwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gJ3Byb2R1Y3Rpb24nICYmXG4gICAgICAgICAgICAgIChuYW1lID09PSAnJyB8fCBuYW1lID09PSAnRW50aXR5TWl4aW4nIHx8IG5hbWUgPT09ICdfdGVtcCcpXG4gICAgICAgICAgICApXG4gICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcbiAgICAgICAgICAgICAgICAnRW50aXR5IGNsYXNzZXMgd2l0aG91dCBhIG5hbWUgbXVzdCBkZWZpbmUgYHN0YXRpYyBrZXlgXFxuU2VlOiBodHRwczovL3Jlc3Rob29rcy5pby9yZXN0L2FwaS9FbnRpdHkja2V5JyxcbiAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgIHJldHVybiBuYW1lO1xuICAgICAgICAgIH07XG5cbiAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoRW50aXR5TWl4aW4sICdrZXknLCB7XG4gICAgICBnZXQsX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BQ0osU0FBUyxDQUFDLEVBQ3JCUixNQUFNLENBQUNRLFNBQVMsQ0FBQyxDQUNsQjtJQUNELElBQUksQ0FBQ0UsU0FBUyxFQUFFO01BQ2RQLEtBQUssR0FBRyxLQUFLO0lBQ2Y7SUFDQSxJQUFJUSxXQUFXLEVBQUU7TUFDZlAsT0FBTyxHQUFHLElBQUk7SUFDaEI7SUFDQSxJQUFJVixNQUFNLENBQUNtQixHQUFHLENBQUNMLFNBQVMsQ0FBQyxFQUFFO01BQ3pCLE9BQU9kLE1BQU0sQ0FBQ29CLEdBQUcsQ0FBQ04sU0FBUyxFQUFFQyxJQUFJLENBQUM7SUFDcEMsQ0FBQyxNQUFNO01BQ0wsT0FBT2YsTUFBTTtJQUNmO0VBQ0YsQ0FBQyxFQUFFTyxLQUFLLENBQUMsRUFDVEUsS0FBSyxFQUNMQyxPQUFPLENBQ1I7QUFDSCJ9 | ||
/** | ||
* Denormalize an immutable entity. | ||
* | ||
* @param {Schema} schema | ||
* @param {Immutable.Map|Immutable.Record} input | ||
* @param {function} unvisit | ||
* @param {function} getDenormalizedEntity | ||
* @return {Immutable.Map|Immutable.Record} | ||
*/ | ||
export function denormalizeOnlyImmutable(schema, input, unvisit) { | ||
var _deleted; | ||
let deleted; | ||
const value = Object.keys(schema).reduce((object, key) => { | ||
// Immutable maps cast keys to strings on write so we need to ensure | ||
// we're accessing them using string keys. | ||
const stringKey = `${key}`; | ||
const item = unvisit(object.get(stringKey), schema[stringKey]); | ||
if (typeof item === 'symbol') { | ||
deleted = item; | ||
} | ||
if (object.has(stringKey)) { | ||
return object.set(stringKey, item); | ||
} else { | ||
return object; | ||
} | ||
}, input); | ||
return (_deleted = deleted) != null ? _deleted : value; | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsIm9iamVjdCIsImhhc093blByb3BlcnR5IiwiT2JqZWN0IiwiY2FsbCIsIl9tYX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FBQ3pCIn0= |
@@ -1,7 +0,7 @@ | ||
import { isImmutable, denormalizeImmutable } from './ImmutableUtils.js'; | ||
export const normalize = (schema, input, parent, key, visit, addEntity, visitedEntities) => { | ||
import { isImmutable, denormalizeImmutable, denormalizeOnlyImmutable } from './ImmutableUtils.js'; | ||
export const normalize = (schema, input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) => { | ||
const object = Object.assign({}, input); | ||
Object.keys(schema).forEach(key => { | ||
const localSchema = schema[key]; | ||
const value = visit(input[key], input, key, localSchema, addEntity, visitedEntities); | ||
const value = visit(input[key], input, key, localSchema, addEntity, visitedEntities, storeEntities, args); | ||
if (value === undefined || value === null) { | ||
@@ -36,2 +36,18 @@ delete object[key]; | ||
}; | ||
export function denormalizeOnly(schema, input, args, unvisit) { | ||
if (isImmutable(input)) { | ||
return denormalizeOnlyImmutable(schema, input, unvisit); | ||
} | ||
const object = Object.assign({}, input); | ||
for (const key of Object.keys(schema)) { | ||
const item = unvisit(object[key], schema[key]); | ||
if (object[key] !== undefined) { | ||
object[key] = item; | ||
} | ||
if (typeof item === 'symbol') { | ||
return item; | ||
} | ||
} | ||
return object; | ||
} | ||
export function infer(schema, args, indexes, recurse, entities) { | ||
@@ -44,3 +60,2 @@ const resultObject = {}; | ||
} | ||
/** | ||
@@ -71,2 +86,5 @@ * Represents objects with statically known members | ||
} | ||
denormalizeOnly(input, args, unvisit) { | ||
return denormalizeOnly(this.schema, input, args, unvisit); | ||
} | ||
infer(args, indexes, recurse, entities) { | ||
@@ -76,2 +94,2 @@ return infer(this.schema, args, indexes, recurse, entities); | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsImRlbm9ybWFsaXplSW1tdXRhYmxlIiwibm9ybWFsaXplIiwic2NoZW1hIiwiaW5wdXQiLCJwYXJlbnQiLCJrZXkiLCJ2aXNpdCIsImFkZEVudGl0eSIsInZpc2l0ZW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appingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsImRlbm9ybWFsaXplSW1tdXRhYmxlIiwiZGVub3JtYWxpemVPbmx5SW1tdXRhYmxlIiwibm9ybWFsaXplIiwic2NoZW1hIiwiaW5wdXQiLCJwYXJlbnQiLCJrZXkiLCJ2aXNpdCIsImFkZEVudGl0eSIsInZpc2l0ZWRFbnRpdGllcyIsInN0b3JlRW50aXRpZXMiLCJhcmdzIiwib2JqZWN0IiwiT2JqZWN0IiwiYXNzaWduIiwia2V5cyIsImZvckVhY2giLCJsb2NhbFNjaGVtYSIsInZhbHVlIiwidW5kZWZpbmVkIiwiZGVub3JtYWxpemUiLCJ1bnZpc2l0IiwiZm91bmQiLCJkZWxldGVkIiwiaXRlbSIsImZvdW5kSXRlbSIsImRlbGV0ZWRJdGVtIiwiZGVub3JtYWxpemVPbmx5IiwiaW5mZXIiLCJpbmRleGVzIiwicmVjdXJzZSIsImVudGl0aWVzIiwicmVzdWx0T2JqZWN0IiwiayIsIk9iamVjdFNjaGVtYSIsImNvbnN0cnVjdG9yIiwiZGVmaW5pdGlvbiIsImRlZmluZSIsInJlZHVjZSIsImVudGl0eVNjaGVtYSJdLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWFzL09iamVjdC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQge1xuICBpc0ltbXV0YWJsZSxcbiAgZGVub3JtYWxpemVJbW11dGFibGUsXG4gIGRlbm9ybWFsaXplT25seUltbXV0YWJsZSxcbn0gZnJvbSAnLi9JbW11dGFibGVVdGlscy5qcyc7XG5cbmV4cG9ydCBjb25zdCBub3JtYWxpemUgPSAoXG4gIHNjaGVtYTogYW55LFxuICBpbnB1dDogYW55LFxuICBwYXJlbnQ6IGFueSxcbiAga2V5OiBhbnksXG4gIHZpc2l0OiBhbnksXG4gIGFkZEVudGl0eTogYW55LFxuICB2aXNpdGVkRW50aX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FPTSxlQUFlLENBQUMsSUFBSSxDQUFDeEIsTUFBTSxFQUFFQyxLQUFLLEVBQUVPLElBQUksRUFBRVUsT0FBTyxDQUFDO0VBQzNEO0VBRUFPLEtBQUtBLENBQUNqQixJQUFTLEVBQUVrQixPQUFZLEVBQUVDLE9BQVksRUFBRUMsUUFBYSxFQUFFO0lBQzFELE9BQU9ILEtBQUssQ0FBQyxJQUFJLENBQUN6QixNQUFNLEVBQUVRLElBQUksRUFBRWtCLE9BQU8sRUFBRUMsT0FBTyxFQUFFQyxRQUFRLENBQUM7RUFDN0Q7QUFDRiJ9 |
import { isImmutable } from './ImmutableUtils.js'; | ||
import { DELETED } from '../special.js'; | ||
export default class PolymorphicSchema { | ||
@@ -14,3 +15,9 @@ constructor(definition, schemaAttribute) { | ||
define(definition) { | ||
this.schema = definition; | ||
// sending Union into another Polymorphic gets hoisted | ||
if ('_schemaAttribute' in definition && !this._schemaAttribute) { | ||
this.schema = definition.schema; | ||
this._schemaAttribute = definition._schemaAttribute; | ||
} else { | ||
this.schema = definition; | ||
} | ||
} | ||
@@ -27,3 +34,4 @@ getSchemaAttribute(input, parent, key) { | ||
} | ||
normalizeValue(value, parent, key, visit, addEntity, visitedEntities) { | ||
normalizeValue(value, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
if (!value) return value; | ||
const schema = this.inferSchema(value, parent, key); | ||
@@ -41,3 +49,3 @@ if (!schema) { | ||
} | ||
const normalizedValue = visit(value, parent, key, schema, addEntity, visitedEntities); | ||
const normalizedValue = visit(value, parent, key, schema, addEntity, visitedEntities, storeEntities, args); | ||
return this.isSingleSchema || normalizedValue === undefined || normalizedValue === null ? normalizedValue : { | ||
@@ -58,9 +66,14 @@ id: normalizedValue, | ||
} | ||
return [value, true, false]; | ||
return value; | ||
} | ||
const id = this.isSingleSchema ? undefined : isImmutable(value) ? value.get('id') : value.id; | ||
const schema = this.isSingleSchema ? this.schema : this.schema[schemaKey]; | ||
return unvisit(id || value, schema); | ||
const ret = unvisit(id || value, schema); | ||
if (Array.isArray(ret) && ret.length === 3) { | ||
if (ret[2] === true) return DELETED; | ||
return ret[0]; | ||
} | ||
return ret; | ||
} | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsIlBvbHltb3JwaGljU2NoZW1hIiwiY29uc3RydWN0b3IiLCJkZWZpbml0aW9uIiwic2NoZW1hQXR0cmlidXRlIiwic2NoZW1hIiwiX3NjaGVtYUF0dHJpYnV0ZSIsImlucHV0IiwiZGVmaW5lIiwiaXNTaW5nbGVTY2hlbWEiLCJnZXRTY2hlbWFBdHRyaWJ1dGUiLCJwYXJlbnQiLCJrZXkiLCJpbmZlclNjaGVtYSIsImF0dHIiLCJub3JtYWxpemVWYWx1ZSIsInZhbHVlIiwidmlzaXQiLCJhZGRFbnRpdHkiLCJ2aXNpdGVkRW50aXRpZXMiLCJwcm9jZXNzIiwiZW52IiwiTk9ERV9FTlYiLCJjb25zb2xlIiwid2FybiIsIkpTT04iLCJzdHJpbmdpZnkiLCJ1bmRlZmluZWQiLCJPYmplY3QiLCJrZXlzIiwibWFwIiwiayIsImpvaW4iLCJub3JtYWxpemVkVmFsdWUiLCJpZCIsImRlbm9ybWFsaXplVmFsdWUiLCJ1bnZpc2l0Iiwic2NoZW1hS2V5IiwiZ2V0IiwibmFtZSJdLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWFzL1BvbHltb3JwaGljLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGlzSW1tdXRhYmxlIH0gZnJvbSAnLi9JbW11dGFibGVVdGlscy5qcyc7XG5cbmV4cG9ydCBkZWZhdWx0IGNsYXNzIFBvbHltb3JwaGljU2NoZW1hIHtcbiAgcHJpdmF0ZSBkZWNsYXJlIF9zY2hlbWFBdHRyaWJ1dGU6IGFueTtcbiAgcHJvdGVjdGVkIHNjaGVtYTogYW55O1xuXG4g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tJQUNBLE1BQU1vQixFQUFFLEdBQUcsSUFBSSxDQUFDM0IsY0FBYyxHQUMxQm9CLFNBQVMsR0FDVDlCLFdBQVcsQ0FBQ2lCLEtBQUssQ0FBQyxHQUNsQkEsS0FBSyxDQUFDd0IsR0FBRyxDQUFDLElBQUksQ0FBQyxHQUNmeEIsS0FBSyxDQUFDb0IsRUFBRTtJQUNaLE1BQU0vQixNQUFNLEdBQUcsSUFBSSxDQUFDSSxjQUFjLEdBQUcsSUFBSSxDQUFDSixNQUFNLEdBQUcsSUFBSSxDQUFDQSxNQUFNLENBQUNrQyxTQUFTLENBQUM7SUFDekUsTUFBTUcsR0FBRyxHQUFHSixPQUFPLENBQUNGLEVBQUUsSUFBSXBCLEtBQUssRUFBRVgsTUFBTSxDQUFDO0lBQ3hDLElBQUlzQyxLQUFLLENBQUNDLE9BQU8sQ0FBQ0YsR0FBRyxDQUFDLElBQUlBLEdBQUcsQ0FBQ0csTUFBTSxLQUFLLENBQUMsRUFBRTtNQUMxQyxJQUFJSCxHQUFHLENBQUMsQ0FBQyxDQUFDLEtBQUssSUFBSSxFQUFFLE9BQU8xQyxPQUFPO01BQ25DLE9BQU8wQyxHQUFHLENBQUMsQ0FBQyxDQUFDO0lBQ2Y7SUFDQSxPQUFPQSxHQUFHO0VBQ1o7QUFDRiJ9 |
@@ -14,4 +14,4 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
} | ||
normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
return this.normalizeValue(input, parent, key, visit, addEntity, visitedEntities); | ||
normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
return this.normalizeValue(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args); | ||
} | ||
@@ -21,2 +21,6 @@ | ||
denormalize(input, unvisit) { | ||
const value = this.denormalizeValue(input, unvisit); | ||
return [value, value !== undefined, typeof value === 'symbol']; | ||
} | ||
denormalizeOnly(input, args, unvisit) { | ||
return this.denormalizeValue(input, unvisit); | ||
@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7SUFDbkQsT0FBTyxDQUFDQyxLQUFLLEVBQUVBLEtBQUssS0FBS0UsU0FBUyxFQUFFLE9BQU9GLEtBQUssS0FBSyxRQUFRLENBQUM7RUFDaEU7RUFFQUcsZUFBZUEsQ0FDYmQsS0FBUyxFQUNUTyxJQUFvQixFQUNwQkcsT0FBeUMsRUFDekM7SUFDQSxPQUFPLElBQUksQ0FBQ0UsZ0JBQWdCLENBQUNaLEtBQUssRUFBRVUsT0FBTyxDQUFDO0VBQzlDO0VBRUFLLEtBQUtBLENBQUNSLElBQVMsRUFBRVMsT0FBWSxFQUFFQyxPQUFZLEVBQUVDLFFBQWEsRUFBRTtJQUMxRCxJQUFJLENBQUNYLElBQUksQ0FBQyxDQUFDLENBQUMsRUFBRSxPQUFPTSxTQUFTO0lBQzlCLE1BQU1NLElBQUksR0FBRyxJQUFJLENBQUNDLGtCQUFrQixDQUFDYixJQUFJLENBQUMsQ0FBQyxDQUFDLEVBQUVNLFNBQVMsRUFBRSxFQUFFLENBQUM7SUFDNUQsTUFBTVEsbUJBQW1CLEdBQUcsSUFBSSxDQUFDQyxNQUFNLENBQUNILElBQUksQ0FBQzs7SUFFN0M7SUFDQSxJQUFJRSxtQkFBbUIsS0FBS1IsU0FBUyxFQUFFLE9BQU9BLFNBQVM7SUFDdkQsT0FBTztNQUNMVSxFQUFFLEVBQUVOLE9BQU8sQ0FBQ0ksbUJBQW1CLEVBQUVkLElBQUksRUFBRVMsT0FBTyxFQUFFRSxRQUFRLENBQUM7TUFDekRJLE1BQU0sRUFBRUg7SUFDVixDQUFDO0VBQ0g7QUFDRiJ9 |
export const getValues = input => Array.isArray(input) ? input : Object.keys(input).map(key => input[key]); | ||
export const filterEmpty = ([item,, deletedItem]) => item !== undefined && !deletedItem; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJnZXRWYWx1ZXMiLCJpbnB1dCIsIkFycmF5IiwiaXNBcnJheSIsIk9iamVjdCIsImtleXMiLCJtYXAiLCJrZXkiLCJmaWx0ZXJFbXB0eSIsIml0ZW0iLCJkZWxldGVkSXRlbSIsInVuZGVmaW5lZCJdLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWFzL3V0aWxzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBnZXRWYWx1ZXMgPSAoaW5wdXQ6IGFueSkgPT5cbiAgQXJyYXkuaXNBcnJheShpbnB1dCkgPyBpbnB1dCA6IE9iamVjdC5rZXlzKGlucHV0KS5tYXAoa2V5ID0+IGlucHV0W2tleV0pO1xuXG5leHBvcnQgY29uc3QgZmlsdGVyRW1wdHkgPSAoW2l0ZW0sICwgZGVsZXRlZEl0ZW1dOiBhbnkpID0+XG4gIGl0ZW0gIT09IHVuZGVmaW5lZCAmJiAhZGVsZXRlZEl0ZW07XG4iXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sTUFBTUEsU0FBUyxHQUFJQyxLQUFVLElBQ2xDQyxLQUFLLENBQUNDLE9BQU8sQ0FBQ0YsS0FBSyxDQUFDLEdBQUdBLEtBQUssR0FBR0csTUFBTSxDQUFDQyxJQUFJLENBQUNKLEtBQUssQ0FBQyxDQUFDSyxHQUFHLENBQUNDLEdBQUcsSUFBSU4sS0FBSyxDQUFDTSxHQUFHLENBQUMsQ0FBQztBQUUxRSxPQUFPLE1BQU1DLFdBQVcsR0FBR0EsQ0FBQyxDQUFDQyxJQUFJLEdBQUlDLFdBQVcsQ0FBTSxLQUNwREQsSUFBSSxLQUFLRSxTQUFTLElBQUksQ0FBQ0QsV0FBVyJ9 | ||
export const filterEmpty = item => item !== undefined && typeof item !== 'symbol'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJnZXRWYWx1ZXMiLCJpbnB1dCIsIkFycmF5IiwiaXNBcnJheSIsIk9iamVjdCIsImtleXMiLCJtYXAiLCJrZXkiLCJmaWx0ZXJFbXB0eSIsIml0ZW0iLCJ1bmRlZmluZWQiXSwic291cmNlcyI6WyIuLi8uLi9zcmMvc2NoZW1hcy91dGlscy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY29uc3QgZ2V0VmFsdWVzID0gKGlucHV0OiBhbnkpID0+XG4gIEFycmF5LmlzQXJyYXkoaW5wdXQpID8gaW5wdXQgOiBPYmplY3Qua2V5cyhpbnB1dCkubWFwKGtleSA9PiBpbnB1dFtrZXldKTtcblxuZXhwb3J0IGNvbnN0IGZpbHRlckVtcHR5ID0gKGl0ZW06IGFueSkgPT5cbiAgaXRlbSAhPT0gdW5kZWZpbmVkICYmIHR5cGVvZiBpdGVtICE9PSAnc3ltYm9sJztcbiJdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxNQUFNQSxTQUFTLEdBQUlDLEtBQVUsSUFDbENDLEtBQUssQ0FBQ0MsT0FBTyxDQUFDRixLQUFLLENBQUMsR0FBR0EsS0FBSyxHQUFHRyxNQUFNLENBQUNDLElBQUksQ0FBQ0osS0FBSyxDQUFDLENBQUNLLEdBQUcsQ0FBQ0MsR0FBRyxJQUFJTixLQUFLLENBQUNNLEdBQUcsQ0FBQyxDQUFDO0FBRTFFLE9BQU8sTUFBTUMsV0FBVyxHQUFJQyxJQUFTLElBQ25DQSxJQUFJLEtBQUtDLFNBQVMsSUFBSSxPQUFPRCxJQUFJLEtBQUssUUFBUSJ9 |
@@ -8,7 +8,7 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
export default class ValuesSchema extends PolymorphicSchema { | ||
normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
return Object.keys(input).reduce((output, key, index) => { | ||
const value = input[key]; | ||
return value !== undefined && value !== null ? Object.assign({}, output, { | ||
[key]: this.normalizeValue(value, input, key, visit, addEntity, visitedEntities) | ||
[key]: this.normalizeValue(value, input, key, visit, addEntity, visitedEntities, storeEntities, args) | ||
}) : output; | ||
@@ -20,19 +20,23 @@ }, {}); | ||
denormalize(input, unvisit) { | ||
let found = true; | ||
let deleted = false; | ||
return [Object.keys(input).reduce((output, key) => { | ||
const entityOrId = input[key]; | ||
const [value, foundItem, deletedItem] = this.denormalizeValue(entityOrId, unvisit); | ||
if (!foundItem) { | ||
found = false; | ||
} | ||
if (deletedItem) { | ||
deleted = true; | ||
} | ||
if (!foundItem || deletedItem) return output; | ||
const value = this.denormalizeValue(entityOrId, unvisit); | ||
if (!value || typeof value === 'symbol') return output; | ||
return Object.assign({}, output, { | ||
[key]: value | ||
}); | ||
}, {}), found, deleted]; | ||
}, {}), true, false]; | ||
} | ||
denormalizeOnly(input, args, unvisit) { | ||
return Object.keys(input).reduce((output, key) => { | ||
const entityOrId = input[key]; | ||
const value = this.denormalizeValue(entityOrId, unvisit); | ||
// remove empty or deleted values | ||
if (!value || typeof value === 'symbol') return output; | ||
return Object.assign({}, output, { | ||
[key]: value | ||
}); | ||
}, {}); | ||
} | ||
infer(args, indexes, recurse) { | ||
@@ -42,2 +46,2 @@ return undefined; | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJQb2x5bW9ycGhpY1NjaGVtYSIsIlZhbHVlc1NjaGVtYSIsIm5vcm1hbGl6ZSIsImlucHV0IiwicGFyZW50Iiwia2V5IiwidmlzaXQiLCJhZGRFbnRpdHkiLCJ2aXNpdGVkRW50aXRpZXMiLCJPYmplY3QiLCJrZXlzIiwicmVkdWNlIiwib3V0cHV0IiwiaW5kZXgiLCJ2YWx1ZSIsInVuZGVmaW5lZCIsImFzc2lnbiIsIm5vcm1hbGl6ZVZhbHVlIiwiZGVub3JtYWxpemUiLCJ1bnZpc2l0IiwiZm91bmQiLCJkZWxldGVkIiwiZW50aXR5T3JJZCIsImZvdW5kSXRlbSIsImRlbGV0ZWRJdGVtIiwiZGVub3JtYWxpemVWYWx1ZSIsImluZmVyIiwiYXJncyIsImluZGV4ZXMiLCJyZWN1cnNlIl0sInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NjaGVtYXMvVmFsdWVzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBQb2x5bW9ycGhpY1NjaGVtYSBmcm9tICcuL1BvbHltb3JwaGljLmpzJztcblxuLyoqXG4gKiBSZXByZXNlbnRzIHZhcmlhYmx5IHNpemVkIG9iamVjdHNcbiAqIEBzZWUgaHR0cHM6Ly9yZXN0aG9va3MuaW8vcmVzdC9hcGkvVmFsdWVzXG4gKi9cbmV4cG9ydCBkZWZhdWx0IGNsYXNzIFZhbHVlc1NjaGVtYSBleHRlbmRzIFBvbHltb3JwaGljU2NoZW1hIHtcbiAgbm9ybWFsaXplKFxuICAgIGlucHV0OiBhbnksXG4gICAgcGFyZW50OiBhbnksXG4gICAga2V5OiBhbnksXG4gICAgdmlzaXQ6IGFueSxcbiAgICBhZGRFbnRpdHk6IGFueSxcbiAgICB2aXNpdGVkRW50aXRpZXM6IGFueSxcbiAgKSB7XG4gICAgcmV0dXJuIE9iamVjdC5rZXlzKGlucHV0KS5yZWR1Y2UoKG91dHB1dCwga2V5LCBpbmRleCkgPT4ge1xuICAgICAgY29uc3QgdmFsdWUgPSBpbnB1dFtrZXldO1xuICAgICAgcmV0dXJuIHZhbHVlICE9PSB1bmRlZmluZWQgJiYgdmFsdWUgIT09IG51bGxcbiAgICAgICAgPyB7XG4gICAgICAgICAgICAuLi5vdXRwdXQsXG4gICAgICAgICAgICBba2V5XTogdGhpcy5ub3JtYWxpemVWYWx1ZShcbiAgICAgICAgICAgICAgdmFsdWUsXG4gICAgICAgICAgICAgIGlucHV0LFxuICAgICAgICAgICAgICBrZXksXG4gICAgICAgICAgICAgIHZpc2l0LFxuICAgICAgICAgICAgICBhZGRFbnRpdHksXG4gICAgICAgICAgICAgIHZpc2l0ZWRFbnRpdGllcyxcbiAgICAgICAgICAgICksXG4gICAgICAgICAgfVxuICAgICAgICA6IG91dHB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uICAgICAgICAgICAgICBhZGRFbnRpdHksXG4gICAgICAgICAgICAgIHZpc2l0ZWRFbnRpdGllcyxcbiAgICAgICAgICAgICAgc3RvcmVFbnRpdGllcyxcbiAgICAgICAgICAgICAgYXJncyxcbiAgICAgICAgICAgICksXG4gICAgICAgICAgfVxuICAgICAgICA6IG91dHB1dDtcbiAgICB9LCB7fSk7XG4gIH1cblxuICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L2Jhbi10eXBlc1xuICBkZW5vcm1hbGl6ZShpbnB1dDoge30sIHVudmlzaXQ6IGFueSkge1xuICAgIHJldHVybiBbXG4gICAgICBPYmplY3Qua2V5cyhpbnB1dCkucmVkdWNlKChvdXRwdXQsIGtleSkgPT4ge1xuICAgICAgICBjb25zdCBlbnRpdHlPcklkID0gKGlucHV0IGFzIGFueSlba2V5XTtcbiAgICAgICAgY29uc3QgdmFsdWUgPSB0aGlzLmRlbm9ybWFsaXplVmFsdWUoZW50aXR5T3JJZCwgdW52aXNpdCk7XG4gICAgICAgIGlmICghdmFsdWUgfHwgdHlwZW9mIHZhbHVlID09PSAnc3ltYm9sJykgcmV0dXJuIG91dHB1dDtcbiAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAuLi5vdXRwdXQsXG4gICAgICAgICAgW2tleV06IHZhbHVlLFxuICAgICAgICB9O1xuICAgICAgfSwge30pLFxuICAgICAgdHJ1ZSxcbiAgICAgIGZhbHNlLFxuICAgIF07XG4gIH1cblxuICBkZW5vcm1hbGl6ZU9ubHkoXG4gICAgaW5wdXQ6IHt9LFxuICAgIGFyZ3M6IHJlYWRvbmx5IGFueVtdLFxuICAgIHVudmlzaXQ6IChpbnB1dDogYW55LCBzY2hlbWE6IGFueSkgPT4gYW55LFxuICApOiBhbnkge1xuICAgIHJldHVybiBPYmplY3Qua2V5cyhpbnB1dCkucmVkdWNlKChvdXRwdXQsIGtleSkgPT4ge1xuICAgICAgY29uc3QgZ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FBSztNQUNoRCxNQUFNaUIsVUFBVSxHQUFJbkIsS0FBSyxDQUFTRSxHQUFHLENBQUM7TUFDdEMsTUFBTVcsS0FBSyxHQUFHLElBQUksQ0FBQ08sZ0JBQWdCLENBQUNELFVBQVUsRUFBRUQsT0FBTyxDQUFDOztNQUV4RDtNQUNBLElBQUksQ0FBQ0wsS0FBSyxJQUFJLE9BQU9BLEtBQUssS0FBSyxRQUFRLEVBQUUsT0FBT0YsTUFBTTtNQUN0RCxPQUFBSCxNQUFBLENBQUFPLE1BQUEsS0FDS0osTUFBTTtRQUNULENBQUNULEdBQUcsR0FBR1c7TUFBSztJQUVoQixDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUM7RUFDUjtFQUVBUyxLQUFLQSxDQUFDZixJQUFTLEVBQUVnQixPQUFZLEVBQUVDLE9BQVksRUFBRTtJQUMzQyxPQUFPVixTQUFTO0VBQ2xCO0FBQ0YifQ== |
export const DELETED = Symbol('ENTITY WAS DELETED'); | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJERUxFVEVEIiwiU3ltYm9sIl0sInNvdXJjZXMiOlsiLi4vc3JjL3NwZWNpYWwudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IERFTEVURUQgPSBTeW1ib2woJ0VOVElUWSBXQVMgREVMRVRFRCcpO1xuIl0sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLE1BQU1BLE9BQU8sR0FBR0MsTUFBTSxDQUFDLG9CQUFvQixDQUFDIn0= | ||
export const INVALID = DELETED; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJERUxFVEVEIiwiU3ltYm9sIiwiSU5WQUxJRCJdLCJzb3VyY2VzIjpbIi4uL3NyYy9zcGVjaWFsLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBERUxFVEVEID0gU3ltYm9sKCdFTlRJVFkgV0FTIERFTEVURUQnKTtcbmV4cG9ydCBjb25zdCBJTlZBTElEID0gREVMRVRFRDtcbiJdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxNQUFNQSxPQUFPLEdBQUdDLE1BQU0sQ0FBQyxvQkFBb0IsQ0FBQztBQUNuRCxPQUFPLE1BQU1DLE9BQU8sR0FBR0YsT0FBTyJ9 |
export * from './utility.js'; | ||
export * from './ErrorTypes.js'; | ||
// This hack is only needed for @rest-hooks/rest@5 or below | ||
/** @deprecated */ | ||
/** @deprecated */ | ||
export {}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vc3JjL3R5cGVzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgU2NoZW1hLCBFbnRpdHlJbnRlcmZhY2UgfSBmcm9tICcuL2ludGVyZmFjZS5qcyc7XG5pbXBvcnQgdHlwZSB7IFNjaGVtYUNsYXNzIH0gZnJvbSAnLi9zY2hlbWEuanMnO1xuaW1wb3J0IHsgU25hcHNob3RJbnRlcmZhY2UgfSBmcm9tICcuL1NuYXBzaG90SW50ZXJmYWNlLmpzJztcbmltcG9ydCB7IFJlc29sdmVUeXBlIH0gZnJvbSAnLi91dGlsaXR5LmpzJztcblxuZXhwb3J0ICogZnJvbSAnLi91dGlsaXR5LmpzJztcbmV4cG9ydCAqIGZyb20gJy4vRXJyb3JUeXBlcy5qcyc7XG5cbmV4cG9ydCB0eXBlIEZldGNoRnVuY3Rpb248QSBleHRlbmRzIHJlYWRvbmx5IGFueVtdID0gYW55LCBSID0gYW55PiA9IChcbiAgLi4uYXJnczogQVxuKSA9PiBQcm9taXNlPFI+O1xuXG4vLyBUaGlzIGhhY2sgaXMgb25seSBuZWVkZWQgZm9yIEByZXN0LWhvb2tzL3Jlc3RANSBvciBiZWxvd1xuLyoqIEBkZXByZWNhdGVkICovXG5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uc2UgKi9cbiAgZ2V0T3B0aW1pc3RpY1Jlc3BvbnNlPyhcbiAgICBzbmFwOiBTbmFwc2hvdEludGVyZmFjZSxcbiAgICAuLi5hcmdzOiBQYXJhbWV0ZXJzPEY+XG4gICk6IFJlc29sdmVUeXBlPEY+O1xuICAvKiogRGV0ZXJtaW5lcyB3aGV0aGVyIHRvIHRocm93IG9yIGZhbGxiYWNrIHRvICovXG4gIGVycm9yUG9saWN5PyhlcnJvcjogYW55KTogJ2hhcmQnIHwgJ3NvZnQnIHwgdW5kZWZpbmVkO1xuICAvKiogVXNlci1sYW5kIGV4dHJhIGRhdGEgdG8gc2VuZCAqL1xuICByZWFkb25seSBleHRyYT86IGFueTtcbn1cbiJdLCJtYXBwaW5ncyI6IkFBS0EsY0FBYyxjQUFjO0FBQzVCLGNBQWMsaUJBQWlCOztBQU0vQjtBQUNBO0FBTUE7QUFBQSJ9 |
@@ -5,4 +5,4 @@ export type { EndpointInterface, ReadEndpoint, MutateEndpoint, } from './interface.js'; | ||
export { default as Entity } from './schemas/Entity.js'; | ||
export { default as validateRequired } from './schemas/validatRequired.js'; | ||
export { DELETED } from './special.js'; | ||
export { default as validateRequired } from './validateRequired.js'; | ||
export { DELETED, INVALID } from './special.js'; | ||
export type { Schema, SnapshotInterface, ExpiryStatusInterface, } from './interface.js'; | ||
@@ -9,0 +9,0 @@ export type { AbstractInstanceType, Normalize, NormalizeNullable, Denormalize, DenormalizeNullable, } from './normal.js'; |
@@ -7,4 +7,4 @@ Object.hasOwn = Object.hasOwn || /* istanbul ignore next */function hasOwn(it, key) { | ||
export { default as Entity } from './schemas/Entity.js'; | ||
export { default as validateRequired } from './schemas/validatRequired.js'; | ||
export { DELETED } from './special.js'; | ||
export { default as validateRequired } from './validateRequired.js'; | ||
export { DELETED, INVALID } from './special.js'; | ||
export { default as Endpoint, ExtendableEndpoint } from './endpoint.js'; | ||
@@ -14,2 +14,2 @@ export * from './indexEndpoint.js'; | ||
export { default as AbortOptimistic } from './AbortOptimistic.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJPYmplY3QiLCJoYXNPd24iLCJpdCIsImtleSIsInByb3RvdHlwZSIsImhhc093blByb3BlcnR5IiwiY2FsbCIsIl9zY2hlbWEiLCJzY2hlbWEiLCJkZWZhdWx0IiwiRW50aXR5IiwidmFsaWRhdGVSZXF1aXJlZCIsIkRFTEVURUQiLCJFbmRwb2ludCIsIkV4dGVuZGFibGVFbmRwb2ludCIsIkFib3J0T3B0aW1pc3RpYyJdLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJPYmplY3QuaGFzT3duID1cbiAgT2JqZWN0Lmhhc093biB8fFxuICAvKiBpc3RhbmJ1bCBpZ25vcmUgbmV4dCAqLyBmdW5jdGlvbiBoYXNPd24oaXQsIGtleSkge1xuICAgIHJldHVybiBPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoaXQsIGtleSk7XG4gIH07XG5cbmV4cG9ydCB0eXBlIHtcbiAgRW5kcG9pbnRJbnRlcmZhY2UsXG4gIFJlYWRFbmRwb2ludCxcbiAgTXV0YXRlRW5kcG9pbnQsXG59IGZyb20gJy4vaW50ZXJmYWNlLmpzJztcbmV4cG9ydCB0eXBlIHtcbiAgRW5kcG9pbnRPcHRpb25zLFxuICBFbmRwb2ludEluc3RhbmNlLFxuICBFbmRwb2ludEluc3RhbmNlSW50ZXJmYWNlLFxuICBFbmRwb2ludEV4dGVuZE9wdGlvbnMsXG59IGZyb20gJy4vZW5kcG9pbnQuanMnO1xuZXhwb3J0ICogYXMgc2NoZW1hIGZyb20gJy4vc2NoZW1hLmpzJztcbmV4cG9ydCB7IGRlZmF1bHQgYXMgRW50aXR5IH0gZnJvbSAnLi9zY2hlbWFzL0VudGl0eS5qcyc7XG5leHBvcnQgeyBkZWZhdWx0IGFzIHZhbGlkYXRlUmVxdWlyZ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BQXFCO0FBQ3ZELFNBQVNELE9BQU8sSUFBSUUsZ0JBQWdCLFFBQVEsdUJBQXVCO0FBQ25FLFNBQVNDLE9BQU8sRUFBRUMsT0FBTyxRQUFRLGNBQWM7QUF5Qi9DLFNBQVNKLE9BQU8sSUFBSUssUUFBUSxFQUFFQyxrQkFBa0IsUUFBUSxlQUFlO0FBRXZFLGNBQWMsb0JBQW9CO0FBQ2xDLGNBQWMsb0JBQW9CO0FBQ2xDLFNBQVNOLE9BQU8sSUFBSU8sZUFBZSxRQUFRLHNCQUFzQiJ9 |
@@ -14,4 +14,5 @@ import type { EndpointExtraOptions, FetchFunction } from './types.js'; | ||
export interface SchemaSimple<T = any> { | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): any; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args: any[]): any; | ||
denormalize(input: {}, unvisit: UnvisitFunction): [denormalized: T, found: boolean, suspend: boolean]; | ||
denormalizeOnly?(input: {}, args: any, unvisit: (input: any, schema: any) => any): T; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any, entities: EntityTable): any; | ||
@@ -25,3 +26,3 @@ } | ||
createIfValid?(props: any): any; | ||
pk(params: any, parent?: any, key?: string): string | undefined; | ||
pk(params: any, parent?: any, key?: string, args?: any[]): string | undefined; | ||
readonly key: string; | ||
@@ -31,2 +32,3 @@ merge(existing: any, incoming: any): any; | ||
mergeWithStore?(existingMeta: any, incomingMeta: any, existing: any, incoming: any): any; | ||
mergeMetaWithStore?(existingMeta: any, incomingMeta: any, existing: any, incoming: any): any; | ||
useIncoming?(existingMeta: any, incomingMeta: any, existing: any, incoming: any): boolean; | ||
@@ -38,3 +40,3 @@ indexes?: any; | ||
export interface UnvisitFunction { | ||
(input: any, schema: any): [any, boolean, boolean]; | ||
(input: any, schema: any): [any, boolean, boolean] | any; | ||
og?: UnvisitFunction; | ||
@@ -41,0 +43,0 @@ setLocal?: (entity: any) => void; |
export * from './SnapshotInterface.js'; | ||
/** Defines a networking endpoint */ | ||
/** To change values on the server */ | ||
/** For retrieval requests */ | ||
export {}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vc3JjL2ludGVyZmFjZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBBYnN0cmFjdEluc3RhbmNlVHlwZSwgRGVub3JtYWxpemUsIEVudGl0eU1hcCB9IGZyb20gJy4vbm9ybWFsLmpzJztcbmltcG9ydCB0eXBlIHsgRW5kcG9pbnRFeHRyYU9wdGlvbnMsIEZldGNoRnVuY3Rpb24gfSBmcm9tICcuL3R5cGVzLmpzJztcblxuZXhwb3J0ICogZnJvbSAnLi9TbmFwc2hvdEludGVyZmFjZS5qcyc7XG5cbmV4cG9ydCB0eXBlIFNjaGVtYSA9XG4gIHwgbnVsbFxuICB8IHN0cmluZ1xuICB8IHsgW0s6IHN0cmluZ106IGFueSB9XG4gIHwgU2NoZW1hW11cbiAgfCBTY2hlbWFTaW1wbGVcbiAgfCBTZXJpYWxpemFibGU7XG5cbmV4cG9ydCB0eXBlIFNlcmlhbGl6YWJsZTxcbiAgVCBleHRlbmRzIHsgdG9KU09OKCk6IHN0cmluZyB9ID0geyB0b0pTT04oKTogc3RyaW5nIH0sXG4+ID0ge1xuICBwcm90b3R5cGU6IFQ7XG59O1xuXG5leHBvcnQgaW50ZXJmYWNlIFNjaGVtYVNpbXBsZTxUID0gYW55PiB7XG4gIG5vcm1hbGl6ZShcbiAgICBpbnB1dDogYW55LFxuICAgIHBhcmVudDogYW55LFxuICAgIGtleTogYW55LFxuICAgIHZpc2l0OiAoLi4uYXJnczogYW55KSA9PiBhbnksXG4gICAgYWRkRW50aXR5OiAoLi4uYXJnczogYW55KSA9PiBhbnksXG4gICAgdmlzaXRl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chemaClass } from './interface.js'; | ||
import type { Schema, Serializable, EntityInterface, NormalizedIndex } from './interface.js'; | ||
export type AbstractInstanceType<T> = T extends new (...args: any) => infer U ? U : T extends { | ||
@@ -37,12 +37,22 @@ prototype: infer U; | ||
export type NormalizeReturnType<T> = T extends (...args: any) => infer R ? R : never; | ||
export type Denormalize<S> = S extends EntityInterface<infer U> ? U : S extends RecordClass ? AbstractInstanceType<S> : S extends SchemaClass ? DenormalizeReturnType<S['denormalize']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Denormalize<F>[] : S extends { | ||
export type Denormalize<S> = S extends EntityInterface<infer U> ? U : S extends RecordClass ? AbstractInstanceType<S> : S extends { | ||
denormalizeOnly: (...args: any) => any; | ||
} ? ReturnType<S['denormalizeOnly']> : S extends { | ||
denormalize: (...args: any) => any; | ||
} ? DenormalizeReturnType<S['denormalize']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Denormalize<F>[] : S extends { | ||
[K: string]: any; | ||
} ? DenormalizeObject<S> : S; | ||
export type DenormalizeNullable<S> = S extends EntityInterface<any> ? DenormalizeNullableNestedSchema<S> | undefined : S extends RecordClass ? DenormalizeNullableNestedSchema<S> : S extends SchemaClass ? DenormalizeReturnType<S['_denormalizeNullable']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Denormalize<F>[] | undefined : S extends { | ||
export type DenormalizeNullable<S> = S extends EntityInterface<any> ? DenormalizeNullableNestedSchema<S> | undefined : S extends RecordClass ? DenormalizeNullableNestedSchema<S> : S extends { | ||
_denormalizeNullable: (...args: any) => any; | ||
} ? DenormalizeReturnType<S['_denormalizeNullable']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Denormalize<F>[] | undefined : S extends { | ||
[K: string]: any; | ||
} ? DenormalizeNullableObject<S> : S; | ||
export type Normalize<S> = S extends EntityInterface ? string : S extends RecordClass ? NormalizeObject<S['schema']> : S extends SchemaClass ? NormalizeReturnType<S['normalize']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Normalize<F>[] : S extends { | ||
export type Normalize<S> = S extends EntityInterface ? string : S extends RecordClass ? NormalizeObject<S['schema']> : S extends { | ||
normalize: (...args: any) => any; | ||
} ? NormalizeReturnType<S['normalize']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Normalize<F>[] : S extends { | ||
[K: string]: any; | ||
} ? NormalizeObject<S> : S; | ||
export type NormalizeNullable<S> = S extends EntityInterface ? string | undefined : S extends RecordClass ? NormalizedNullableObject<S['schema']> : S extends SchemaClass ? NormalizeReturnType<S['_normalizeNullable']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Normalize<F>[] | undefined : S extends { | ||
export type NormalizeNullable<S> = S extends EntityInterface ? string | undefined : S extends RecordClass ? NormalizedNullableObject<S['schema']> : S extends { | ||
_normalizeNullable: (...args: any) => any; | ||
} ? NormalizeReturnType<S['_normalizeNullable']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Normalize<F>[] | undefined : S extends { | ||
[K: string]: any; | ||
@@ -49,0 +59,0 @@ } ? NormalizedNullableObject<S> : S; |
export {}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6W10sInNvdXJjZXMiOlsiLi4vc3JjL25vcm1hbC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7XG4gIFNjaGVtYSxcbiAgU2VyaWFsaXphYmxlLFxuICBFbnRpdHlJbnRlcmZhY2UsXG4gIE5vcm1hbGl6ZWRJbmRleCxcbiAgU2NoZW1hQ2xhc3MsXG59IGZyb20gJy4vaW50ZXJmYWNlLmpzJztcblxuLy8gVHlwZVNjcmlwdCA8NC4yIEluc3RhbmNlVHlwZTw+IGRvZXMgbm90IHdvcmsgb24gYWJzdHJhY3QgY2xhc3Nlc1xuZXhwb3J0IHR5cGUgQWJzdHJhY3RJbnN0YW5jZVR5cGU8VD4gPSBUIGV4dGVuZHMgbmV3ICguLi5hcmdzOiBhbnkpID0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G4gIDogUyBleHRlbmRzIHsgX25vcm1hbGl6ZU51bGxhYmxlOiAoLi4uYXJnczogYW55KSA9PiBhbnkgfVxuICA/IE5vcm1hbGl6ZVJldHVyblR5cGU8U1snX25vcm1hbGl6ZU51bGxhYmxlJ10+XG4gIDogUyBleHRlbmRzIFNlcmlhbGl6YWJsZTxpbmZlciBUPlxuICA/IFRcbiAgOiBTIGV4dGVuZHMgQXJyYXk8aW5mZXIgRj5cbiAgPyBOb3JtYWxpemU8Rj5bXSB8IHVuZGVmaW5lZFxuICA6IFMgZXh0ZW5kcyB7IFtLOiBzdHJpbmddOiBhbnkgfVxuICA/IE5vcm1hbGl6ZWROdWxsYWJsZU9iamVjdDxTPlxuICA6IFM7XG5cbmV4cG9ydCB0eXBlIE5vcm1hbGl6ZWRTY2hlbWE8RSwgUj4gPSB7XG4gIGVudGl0aWVzOiBFO1xuICByZXN1bHQ6IFI7XG4gIGluZGV4ZXM6IE5vcm1hbGl6ZWRJbmRleDtcbiAgZW50aXR5TWV0YToge1xuICAgIHJlYWRvbmx5IFtlbnRpdHlLZXk6IHN0cmluZ106IHtcbiAgICAgIHJlYWRvbmx5IFtwazogc3RyaW5nXToge1xuICAgICAgICByZWFkb25seSBkYXRlOiBudW1iZXI7XG4gICAgICAgIHJlYWRvbmx5IGV4cGlyZXNBdDogbnVtYmVyO1xuICAgICAgICByZWFkb25seSBmZXRjaGVkQXQ6IG51bWJlcjtcbiAgICAgIH07XG4gICAgfTtcbiAgfTtcbn07XG5cbmV4cG9ydCBpbnRlcmZhY2UgRW50aXR5TWFwPFQgPSBhbnk+IHtcbiAgcmVhZG9ubHkgW2s6IHN0cmluZ106IEVudGl0eUludGVyZmFjZTxUPjtcbn1cbiJdLCJtYXBwaW5ncyI6IiJ9 |
@@ -18,4 +18,5 @@ import type { SchemaSimple, UnvisitFunction } from './interface.js'; | ||
_denormalizeNullable(input: {}, unvisit: UnvisitFunction): [denormalized: R | undefined, found: boolean, suspend: boolean]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): R; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=queryEndpoint.d.ts.map |
@@ -24,6 +24,14 @@ /** | ||
}, unvisit) => { | ||
if (input === undefined) return [undefined, false, true]; | ||
if (input === undefined) return [undefined, false, false]; | ||
const [value, found, deleted] = schema.denormalize(input, unvisit); | ||
return [found ? this.process(value, ...args) : undefined, found, deleted]; | ||
}; | ||
if (schema.denormalizeOnly) query.denormalizeOnly = ({ | ||
args, | ||
input | ||
}, _, unvisit) => { | ||
if (input === undefined) return undefined; | ||
const value = schema.denormalizeOnly(input, args, unvisit); | ||
return typeof value === 'symbol' ? undefined : this.process(value, ...args); | ||
}; | ||
query.infer = (args, indexes, recurse, entities) => { | ||
@@ -38,2 +46,2 @@ return { | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJRdWVyeSIsImNvbnN0cnVjdG9yIiwic2NoZW1hIiwicHJvY2VzcyIsInNpZGVFZmZlY3QiLCJ1bmRlZmluZWQiLCJjcmVhdGVRdWVyeVNjaGVtYSIsImVudHJpZXMiLCJrZXkiLCJhcmdzIiwiSlNPTiIsInN0cmluZ2lmeSIsInF1ZXJ5IiwiT2JqZWN0IiwiY3JlYXRlIiwiZGVub3JtYWxpemUiLCJpbnB1dCIsInVudmlzaXQiLCJ2YWx1ZSIsImZvdW5kIiwiZGVsZXRlZCIsImluZmVyIiwiaW5kZXhlcyIsInJlY3Vyc2UiLCJlbnRpdGllcyJdLCJzb3VyY2VzIjpbIi4uL3NyYy9xdWVyeUVuZHBvaW50LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHtcbiAgRW50aXR5VGFibGUsXG4gIE5vcm1hbGl6ZWRJbmRleCxcbiAgU2NoZW1hU2ltcGxlLFxuICBVbnZpc2l0RnVuY3Rpb24sXG59IGZyb20gJy4vaW50ZXJmYWNlLmpzJztcbmltc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NLENBQVNtQixlQUFlLENBQUNMLEtBQUssRUFBRVAsSUFBSSxFQUFFUSxPQUFPLENBQUM7TUFDbkUsT0FBTyxPQUFPQyxLQUFLLEtBQUssUUFBUSxHQUM1QmIsU0FBUyxHQUNULElBQUksQ0FBQ0YsT0FBTyxDQUFDZSxLQUFLLEVBQUUsR0FBR1QsSUFBSSxDQUFDO0lBQ2xDLENBQUM7SUFDSEcsS0FBSyxDQUFDVyxLQUFLLEdBQUcsQ0FDWmQsSUFBUyxFQUNUZSxPQUFZLEVBQ1pDLE9BS1EsRUFDUkMsUUFBcUIsS0FDbEI7TUFDSCxPQUFPO1FBQUVqQixJQUFJO1FBQUVPLEtBQUssRUFBRVMsT0FBTyxDQUFDdkIsTUFBTSxFQUFFTyxJQUFJLEVBQUVlLE9BQU8sRUFBRUUsUUFBUTtNQUFFLENBQUM7SUFDbEUsQ0FBQztJQUNELE9BQU9kLEtBQUs7RUFDZDtBQUNGIn0= |
@@ -21,2 +21,3 @@ import type { | ||
} from './normal.js'; | ||
import { CollectionOptions } from './schemas/Collection.js'; | ||
import { default as Delete } from './schemas/Delete.js'; | ||
@@ -32,4 +33,5 @@ import { | ||
} from './schemas/EntitySchema.js'; | ||
import { default as Invalidate } from './schemas/Invalidate.js'; | ||
export { Delete, EntityMap }; | ||
export { Delete, EntityMap, Invalidate }; | ||
@@ -60,2 +62,4 @@ export { EntityInterface } from './interface.js'; | ||
visitedEntities: Record<string, any>, | ||
storeEntities: any, | ||
args?: any[], | ||
): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]; | ||
@@ -83,2 +87,8 @@ | ||
denormalizeOnly( | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): (S extends EntityMap<infer T> ? T : Denormalize<S>)[]; | ||
infer( | ||
@@ -117,2 +127,4 @@ args: readonly any[], | ||
visitedEntities: Record<string, any>, | ||
storeEntities: any, | ||
args?: any[], | ||
): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]; | ||
@@ -140,2 +152,8 @@ | ||
denormalizeOnly( | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): (S extends EntityMap<infer T> ? T : Denormalize<S>)[]; | ||
infer( | ||
@@ -166,2 +184,4 @@ args: readonly any[], | ||
visitedEntities: Record<string, any>, | ||
storeEntities: any, | ||
args?: any[], | ||
): NormalizeObject<O>; | ||
@@ -179,2 +199,8 @@ | ||
denormalizeOnly( | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): DenormalizeObject<O>; | ||
infer( | ||
@@ -210,2 +236,4 @@ args: readonly any[], | ||
visitedEntities: Record<string, any>, | ||
storeEntities: any, | ||
args?: any[], | ||
): UnionResult<Choices>; | ||
@@ -231,2 +259,8 @@ | ||
denormalizeOnly( | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): AbstractInstanceType<Choices[keyof Choices]>; | ||
infer( | ||
@@ -269,2 +303,4 @@ args: readonly any[], | ||
visitedEntities: Record<string, any>, | ||
storeEntities: any, | ||
args?: any[], | ||
): Record< | ||
@@ -308,2 +344,11 @@ string, | ||
denormalizeOnly( | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): Record< | ||
string, | ||
Choices extends EntityMap<infer T> ? T : Denormalize<Choices> | ||
>; | ||
infer( | ||
@@ -316,2 +361,134 @@ args: readonly any[], | ||
/** | ||
* Entities but for Arrays instead of classes | ||
* @see https://resthooks.io/rest/api/Collection | ||
*/ | ||
export class CollectionSchema< | ||
S extends Array<any> | Values<any> = any, | ||
Parent extends any[] = any, | ||
> { | ||
addWith<P extends any[] = Parent>( | ||
merge: (existing: any, incoming: any) => any, | ||
createCollectionFilter?: ( | ||
...args: P | ||
) => (collectionKey: Record<string, any>) => boolean, | ||
): CollectionSchema<S, P>; | ||
readonly schema: S; | ||
key: string; | ||
pk(value: any, parent: any, key: string, args: any[]): string; | ||
normalize( | ||
input: any, | ||
parent: Parent, | ||
key: string, | ||
visit: (...args: any) => any, | ||
addEntity: (...args: any) => any, | ||
visitedEntities: Record<string, any>, | ||
storeEntities: any, | ||
args: any[], | ||
): string; | ||
merge(existing: any, incoming: any): any; | ||
shouldReorder( | ||
existingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, | ||
incomingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, | ||
existing: any, | ||
incoming: any, | ||
): boolean; | ||
mergeWithStore( | ||
existingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, | ||
incomingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, | ||
existing: any, | ||
incoming: any, | ||
): any; | ||
mergeMetaWithStore( | ||
existingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, | ||
incomingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, | ||
existing: any, | ||
incoming: any, | ||
): { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}; | ||
infer( | ||
args: unknown, | ||
indexes: unknown, | ||
recurse: unknown, | ||
entities: unknown, | ||
): any; | ||
createIfValid: (value: any) => any | undefined; | ||
denormalizeOnly( | ||
input: any, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): ReturnType<S['denormalizeOnly']>; | ||
_denormalizeNullable(): ReturnType<S['_denormalizeNullable']>; | ||
_normalizeNullable(): ReturnType<S['_normalizeNullable']>; | ||
} | ||
export type CollectionType< | ||
S extends any[] | Array<any> | Values<any> = any, | ||
Parent extends any[] = [ | ||
urlParams: Record<string, any>, | ||
body?: Record<string, any>, | ||
], | ||
> = CollectionSchema<S extends any[] ? Array<S[number]> : S> & | ||
(S extends any[] | ||
? { | ||
push: CollectionSchema<Array<S[number]>, Parent>; | ||
unshift: CollectionSchema<Array<S[number]>, Parent>; | ||
} | ||
: S extends Values<any> | ||
? { assign: CollectionSchema<S, Parent> } | ||
: S extends Array<any> | ||
? { | ||
push: CollectionSchema<S, Parent>; | ||
unshift: CollectionSchema<S, Parent>; | ||
} | ||
: never); | ||
export interface CollectionConstructor { | ||
new < | ||
S extends SchemaSimple[] | Array<any> | Values<any> = any, | ||
Parent extends any[] = [ | ||
urlParams: Record<string, any>, | ||
body?: Record<string, any>, | ||
], | ||
>( | ||
schema: S, | ||
options: CollectionOptions, | ||
): CollectionType<S, Parent>; | ||
readonly prototype: CollectionSchema; | ||
} | ||
/** | ||
* Entities but for Arrays instead of classes | ||
* @see https://resthooks.io/rest/api/Collection | ||
*/ | ||
export declare let Collection: CollectionConstructor; | ||
export type StrategyFunction<T> = (value: any, parent: any, key: string) => T; | ||
@@ -342,2 +519,26 @@ export type SchemaFunction<K = string> = ( | ||
export interface SchemaSimpleNew<T = any> { | ||
normalize( | ||
input: any, | ||
parent: any, | ||
key: any, | ||
visit: (...args: any) => any, | ||
addEntity: (...args: any) => any, | ||
visitedEntities: Record<string, any>, | ||
storeEntities: any, | ||
args?: any[], | ||
): any; | ||
denormalizeOnly( | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): T; | ||
infer( | ||
args: readonly any[], | ||
indexes: NormalizedIndex, | ||
recurse: (...args: any) => any, | ||
entities: EntityTable, | ||
): any; | ||
} | ||
// id is in Instance, so we default to that as pk | ||
@@ -344,0 +545,0 @@ /** |
@@ -8,3 +8,5 @@ /* istanbul ignore file */ | ||
export { default as Delete } from './schemas/Delete.js'; | ||
export { default as Invalidate } from './schemas/Invalidate.js'; | ||
export { default as Collection } from './schemas/Collection.js'; | ||
export { default as Entity } from './schemas/EntitySchema.js'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJkZWZhdWx0IiwiVW5pb24iLCJWYWx1ZXMiLCJBcnJheSIsIkFsbCIsIk9iamVjdCIsIkRlbGV0ZSIsIkVudGl0eSJdLCJzb3VyY2VzIjpbIi4uL3NyYy9zY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UFTRCxPQUFPLElBQUlFLE1BQU0sUUFBUSxxQkFBcUI7QUFDdkQsU0FBU0YsT0FBTyxJQUFJRyxLQUFLLFFBQVEsb0JBQW9CO0FBQ3JELFNBQVNILE9BQU8sSUFBSUksR0FBRyxRQUFRLGtCQUFrQjtBQUNqRCxTQUFTSixPQUFPLElBQUlLLE1BQU0sUUFBUSxxQkFBcUI7QUFDdkQsU0FBU0wsT0FBTyxJQUFJTSxNQUFNLFFBQVEscUJBQXFCO0FBQ3ZELFNBQVNOLE9BQU8sSUFBSU8sVUFBVSxRQUFRLHlCQUF5QjtBQUMvRCxTQUFTUCxPQUFPLElBQUlRLFVBQVUsUUFBUSx5QkFBeUI7QUFDL0QsU0FBU1IsT0FBTyxJQUFJUyxNQUFNLFFBQVEsMkJBQTJCIn0= |
@@ -11,5 +11,5 @@ import ArraySchema from './Array.js'; | ||
constructor(definition: S, schemaAttribute?: S extends EntityMap<infer T> ? keyof T | SchemaFunction<keyof S> : undefined); | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): any; | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args?: any[]): any; | ||
infer(args: any, indexes: any, recurse: any, entities: EntityTable): any; | ||
} | ||
//# sourceMappingURL=All.d.ts.map |
@@ -11,5 +11,5 @@ import ArraySchema from './Array.js'; | ||
} | ||
normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
// we return undefined | ||
super.normalize(input, parent, key, visit, addEntity, visitedEntities); | ||
super.normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args); | ||
} | ||
@@ -36,2 +36,2 @@ infer(args, indexes, recurse, entities) { | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJBcnJheVNjaGVtYSIsIkFsbFNjaGVtYSIsImNvbnN0cnVjdG9yIiwiZ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UFDTCxNQUFNLENBQUNNLEVBQUUsQ0FBQ0QsTUFBTSxDQUFDLENBQzNDO0lBQ0g7SUFDQSxJQUFJRSxLQUFLLEdBQUcsS0FBSztJQUNqQixNQUFNQyxJQUFJLEdBQUdOLE1BQU0sQ0FBQ0MsTUFBTSxDQUFDLElBQUksQ0FBQ0gsTUFBTSxDQUF3QixDQUFDUyxPQUFPLENBQ25FVCxNQUF1QixJQUFLO01BQzNCLElBQUksQ0FBQ0gsUUFBUSxDQUFDRyxNQUFNLENBQUNaLEdBQUcsQ0FBQyxFQUFFLE9BQU8sRUFBRTtNQUNwQ21CLEtBQUssR0FBRyxJQUFJO01BQ1osT0FBT0wsTUFBTSxDQUFDQyxNQUFNLENBQUNOLFFBQVEsQ0FBQ0csTUFBTSxDQUFDWixHQUFHLENBQUMsQ0FBd0IsQ0FBQ2dCLEdBQUcsQ0FDbkVDLE1BQU0sS0FBSztRQUNUSyxFQUFFLEVBQUVMLE1BQU0sSUFBSUwsTUFBTSxDQUFDTSxFQUFFLENBQUNELE1BQU0sQ0FBQztRQUMvQkwsTUFBTSxFQUFFLElBQUksQ0FBQ1csa0JBQWtCLENBQUNOLE1BQU0sRUFBRUosU0FBUyxFQUFFQSxTQUFTO01BQzlELENBQUMsQ0FBQyxDQUNIO0lBQ0gsQ0FBQyxDQUNGO0lBQ0Q7SUFDQSxJQUFJLENBQUNNLEtBQUssRUFBRTtJQUNaLE9BQU9DLElBQUk7RUFDYjtBQUNGIn0= |
@@ -7,4 +7,5 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
export default class ArraySchema extends PolymorphicSchema { | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): any; | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args?: any[]): any; | ||
denormalize(input: any, unvisit: any): [denormalized: any, found: boolean, deleted: boolean]; | ||
denormalizeOnly(input: any, args: any[], unvisit: (input: any, schema: any) => any): any; | ||
infer(args: unknown, indexes: unknown, recurse: unknown, entities: unknown): any; | ||
@@ -11,0 +12,0 @@ toJSON(): any[]; |
@@ -9,9 +9,12 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
export default class ArraySchema extends PolymorphicSchema { | ||
normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
const values = getValues(input); | ||
return values.map((value, index) => this.normalizeValue(value, parent, key, visit, addEntity, visitedEntities)).filter(value => value !== undefined && value !== null); | ||
return values.map((value, index) => this.normalizeValue(value, parent, key, visit, addEntity, visitedEntities, storeEntities, args)).filter(value => value !== undefined && value !== null); | ||
} | ||
denormalize(input, unvisit) { | ||
return [input.map ? input.map(entityOrId => this.denormalizeValue(entityOrId, unvisit)).filter(filterEmpty).map(([value]) => value) : input, true, false]; | ||
return [this.denormalizeOnly(input, [], unvisit), true, false]; | ||
} | ||
denormalizeOnly(input, args, unvisit) { | ||
return input.map ? input.map(entityOrId => this.denormalizeValue(entityOrId, unvisit)).filter(filterEmpty) : input; | ||
} | ||
infer(args, indexes, recurse, entities) { | ||
@@ -24,2 +27,2 @@ return undefined; | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJQb2x5bW9ycGhpY1NjaGVtYSIsImZpbHRlckVtcHR5IiwiZ2V0VmFsdWVzIiwiQXJyYXlTY2hlbWEiLCJub3JtYWxpemUiLCJpbnB1dCIsInBhcmVudCIsImtleSIsInZpc2l0IiwiYWRkRW50aXR5IiwidmlzaXRlZEVudGl0aWVzIiwidmFsdWVzIiwibWFwIiwidmFsdWUiLCJpbmRleCIsIm5vcm1hbGl6ZVZhbHVlIiwiZmlsdGVyIiwidW5kZWZpbmVkIiwiZGVub3JtYWxpemUiLCJ1bnZpc2l0IiwiZW50aXR5T3JJZCIsImRlbm9ybWFsaXplVmFsdWUiLCJpbmZlciIsImFyZ3MiLCJpbmRleGVzIiwicmV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QUFDLElBQUksQ0FBQ0MsZUFBZSxDQUFDakIsS0FBSyxFQUFFLEVBQUUsRUFBRWdCLE9BQU8sQ0FBQyxFQUFFLElBQUksRUFBRSxLQUFLLENBQUM7RUFDaEU7RUFFQUMsZUFBZUEsQ0FDYmpCLEtBQVUsRUFDVk8sSUFBVyxFQUNYUyxPQUF5QyxFQUN6QztJQUNBLE9BQU9oQixLQUFLLENBQUNTLEdBQUcsR0FDWlQsS0FBSyxDQUNGUyxHQUFHLENBQUVTLFVBQWUsSUFBSyxJQUFJLENBQUNDLGdCQUFnQixDQUFDRCxVQUFVLEVBQUVGLE9BQU8sQ0FBQyxDQUFDLENBQ3BFSCxNQUFNLENBQUNqQixXQUFXLENBQUMsR0FDdEJJLEtBQUs7RUFDWDtFQUVBb0IsS0FBS0EsQ0FDSGIsSUFBYSxFQUNiYyxPQUFnQixFQUNoQkMsT0FBZ0IsRUFDaEJDLFFBQWlCLEVBQ1o7SUFDTCxPQUFPVCxTQUFTO0VBQ2xCO0VBRUFVLE1BQU1BLENBQUEsRUFBRztJQUNQLE9BQU8sQ0FBQyxJQUFJLENBQUNDLE1BQU0sQ0FBQztFQUN0QjtBQUNGIn0= |
@@ -0,1 +1,2 @@ | ||
import Invalidate from './Invalidate.js'; | ||
import type { EntityInterface } from '../interface.js'; | ||
@@ -10,24 +11,5 @@ import type { AbstractInstanceType } from '../normal.js'; | ||
process: any; | ||
}> implements SchemaClass { | ||
private _entity; | ||
constructor(entity: E); | ||
get key(): string; | ||
normalize(input: any, parent: any, key: string | undefined, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): string | undefined; | ||
infer(args: any, indexes: any, recurse: any): any; | ||
}> extends Invalidate<E> implements SchemaClass { | ||
denormalize(id: string, unvisit: UnvisitFunction): [denormalized: AbstractInstanceType<E>, found: boolean, suspend: boolean]; | ||
_denormalizeNullable(): [ | ||
AbstractInstanceType<E> | undefined, | ||
boolean, | ||
false | ||
]; | ||
_normalizeNullable(): string | undefined; | ||
merge(existing: any, incoming: any): any; | ||
useIncoming(existingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): boolean; | ||
} | ||
//# sourceMappingURL=Delete.d.ts.map |
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
import { DELETED } from '../special.js'; | ||
import Invalidate from './Invalidate.js'; | ||
// TODO(breaking): mark deprecated | ||
/** | ||
@@ -9,59 +8,7 @@ * Marks entity as deleted. | ||
*/ | ||
export default class Delete { | ||
constructor(entity) { | ||
if (process.env.NODE_ENV !== 'production' && !entity) { | ||
throw new Error('Expected option "entity" not found on DeleteSchema.'); | ||
} | ||
this._entity = entity; | ||
} | ||
get key() { | ||
return this._entity.key; | ||
} | ||
normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
// TODO: what's store needs to be a differing type from fromJS | ||
const processedEntity = this._entity.process(input, parent, key); | ||
const id = this._entity.pk(processedEntity, parent, key); | ||
if (process.env.NODE_ENV !== 'production' && (id === undefined || id === '')) { | ||
var _name; | ||
const error = new Error(`Missing usable primary key when normalizing response. | ||
This is likely due to a malformed response. | ||
Try inspecting the network response or fetch() return value. | ||
Or use debugging tools: https://resthooks.io/docs/guides/debugging | ||
Learn more about schemas: https://resthooks.io/docs/api/schema | ||
Delete(Entity): Delete(${(_name = this._entity.name) != null ? _name : this._entity}) | ||
Value: ${input && JSON.stringify(input, null, 2)} | ||
`); | ||
error.status = 400; | ||
throw error; | ||
} | ||
addEntity(this, DELETED, id); | ||
return id; | ||
} | ||
infer(args, indexes, recurse) { | ||
return undefined; | ||
} | ||
export default class Delete extends Invalidate { | ||
denormalize(id, unvisit) { | ||
return unvisit(id, this._entity); | ||
} | ||
/* istanbul ignore next */ | ||
_denormalizeNullable() { | ||
return []; | ||
} | ||
/* istanbul ignore next */ | ||
_normalizeNullable() { | ||
return []; | ||
} | ||
/* istanbul ignore next */ | ||
merge(existing, incoming) { | ||
return incoming; | ||
} | ||
useIncoming(existingMeta, incomingMeta, existing, incoming) { | ||
return existingMeta.date <= incomingMeta.date; | ||
} | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJERUxFVEVEIiwiRGVsZXRlIiwiY29uc3RydWN0b3IiLCJlbnRpdHkiLCJwcm9jZXNzIiwiZW52IiwiTk9ERV9FTlYiLCJFcnJvciIsIl9lbnRpdHkiLCJrZXkiLCJub3JtYWxpemUiLCJpbnB1dCIsInBhcmVudCIsInZpc2l0IiwiYWRkRW50aXR5IiwidmlzaXRlZEVudGl0aWVzIiwicHJvY2Vzc2VkRW50aXR5IiwiaWQiLCJwayIsInVuZGVmaW5lZCIsIl9uYW1lIiwiZXJyb3IiLCJuYW1lIiwiSlNPTiIsInN0cmluZ2lmeSIsInN0YXR1cyIsImluZmVyIiwiYXJncyIsImluZGV4ZXMiLCJyZWN1cnNlIiwiZGVub3JtYWxpemUiLCJ1bnZpc2l0IiwiX2Rlbm9ybWFsaXplTnVsbGFibGUiLCJfbm9ybWFsaXplTnVsbGFibGUiLCJtZXJnZSIsImV4aXN0aW5nIiwiaW5jb21pbmciLCJ1c2VJbmNvbWluZyIsImV4aXN0aW5nTWV0YSIsImluY29taW5nTWV0YSIsImRhdGUiXSwic291cmNlcyI6WyIuLi8uLi9zcmMvc2NoZW1hcy9EZWxldGUudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgQHR5cGVzY3JpcHQtZXNsaW50L2V4cGxpY2l0LW1vZHVsZS1ib3VuZGFyeS10eXBlcyAqL1xuaW1wb3J0IHR5cGUgeyBFbnRpdHlJbnRlcmZhY2UgfSBmcm9tICcuLi9pbnRlcmZhY2UuanMnO1xuaW1wb3J0IHR5cGUgeyBBYnN0cmFjdEluc3RhbmNlVHlwZSB9IGZyb20gJy4uL25vcm1hbC5qcyc7XG5pbXBvcnQgeyBTY2hlbWFDbG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gZXh0ZW5kcyBFbnRpdHlJbnRlcmZhY2UgJiB7XG4gICAgICBwcm9jZXNzOiBhbnk7XG4gICAgfSxcbiAgPlxuICBleHRlbmRzIEludmFsaWRhdGU8RT5cbiAgaW1wbGVtZW50cyBTY2hlbWFDbGFzc1xue1xuICBkZW5vcm1hbGl6ZShcbiAgICBpZDogc3RyaW5nLFxuICAgIHVudmlzaXQ6IFVudmlzaXRGdW5jdGlvbixcbiAgKTogW2Rlbm9ybWFsaXplZDogQWJzdHJhY3RJbnN0YW5jZVR5cGU8RT4sIGZvdW5kOiBib29sZWFuLCBzdXNwZW5kOiBib29sZWFuXSB7XG4gICAgcmV0dXJuIHVudmlzaXQoaWQsIHRoaXMuX2VudGl0eSkgYXMgYW55O1xuICB9XG59XG4iXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0EsT0FBT0EsVUFBVSxNQUFNLGlCQUFpQjtBQUt4QztBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsZUFBZSxNQUFNQyxNQUFNLFNBS2pCRCxVQUFVLENBRXBCO0VBQ0VFLFdBQVdBLENBQ1RDLEVBQVUsRUFDVkMsT0FBd0IsRUFDbUQ7SUFDM0UsT0FBT0EsT0FBTyxDQUFDRCxFQUFFLEVBQUUsSUFBSSxDQUFDRSxPQUFPLENBQUM7RUFDbEM7QUFDRiJ9 |
import type { UnvisitFunction } from '../interface.js'; | ||
import { AbstractInstanceType } from '../normal.js'; | ||
declare const Entity_base: import("./EntitySchema.js").IEntityClass<abstract new (...args: any[]) => { | ||
pk(parent?: any, key?: string | undefined): string | undefined; | ||
pk(parent?: any, key?: string | undefined, args?: readonly any[] | undefined): string | undefined; | ||
}> & (abstract new (...args: any[]) => { | ||
pk(parent?: any, key?: string | undefined): string | undefined; | ||
pk(parent?: any, key?: string | undefined, args?: readonly any[] | undefined): string | undefined; | ||
}); | ||
@@ -19,3 +19,3 @@ /** | ||
*/ | ||
abstract pk(parent?: any, key?: string): string | undefined; | ||
abstract pk(parent?: any, key?: string, args?: readonly any[]): string | undefined; | ||
/** Control how automatic schema validation is handled | ||
@@ -49,2 +49,15 @@ * | ||
}, existing: any, incoming: any): any; | ||
static mergeMetaWithStore(existingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}; | ||
/** Factory method to convert from Plain JS Objects. | ||
@@ -62,3 +75,3 @@ * | ||
*/ | ||
static pk: <T extends typeof Entity>(this: T, value: Partial<AbstractInstanceType<T>>, parent?: any, key?: string) => string | undefined; | ||
static pk: <T extends typeof Entity>(this: T, value: Partial<AbstractInstanceType<T>>, parent?: any, key?: string, args?: any[]) => string | undefined; | ||
/** Do any transformations when first receiving input */ | ||
@@ -65,0 +78,0 @@ static process(input: any, parent: any, key: string | undefined): any; |
@@ -19,2 +19,11 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
/** Control how automatic schema validation is handled | ||
* | ||
* `undefined`: Defaults - throw error in worst offense | ||
* 'warn': only ever warn | ||
* 'silent': Don't bother with processing at all | ||
* | ||
* Note: this only applies to non-nested members. | ||
*/ | ||
/** Return true to merge incoming data; false keeps existing entity | ||
@@ -44,2 +53,9 @@ * | ||
} | ||
static mergeMetaWithStore(existingMeta, incomingMeta, existing, incoming) { | ||
return { | ||
expiresAt: Math.max(this.expiresAt(incomingMeta, incoming), existingMeta.expiresAt), | ||
date: Math.max(incomingMeta.date, existingMeta.date), | ||
fetchedAt: Math.max(incomingMeta.fetchedAt, existingMeta.fetchedAt) | ||
}; | ||
} | ||
@@ -51,2 +67,10 @@ /** Factory method to convert from Plain JS Objects. | ||
/** | ||
* A unique identifier for each Entity | ||
* | ||
* @param [value] POJO of the entity or subset used | ||
* @param [parent] When normalizing, the object which included the entity | ||
* @param [key] When normalizing, the key where this entity was found | ||
*/ | ||
/** Do any transformations when first receiving input */ | ||
@@ -201,2 +225,7 @@ static process(input, parent, key) { | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsImRlbm9ybWFsaXplSW1tdXRhYmxlIiwiRW50aXR5IiwiRW50aXR5U2NoZW1hIiwiRW1wdHlCYXNlIiwidXNlSW5jb21pbmciLCJleGlzdGluZ01ldGEiLCJpbmNvbWluZ01ldGEiLCJleGlzdGluZyIsImluY29taW5nIiwiZmV0Y2hlZEF0IiwibWVyZ2VXaXRoU3RvcmUiLCJtZXJnZSIsInByb2Nlc3MiLCJpbnB1dCIsInBhcmVudCIsImtleSIsImVudiIsIk5PREVfRU5WIiwiYXV0b21hdGljVmFsaWRhdGlvbiIsIkFycmF5IiwiaXNBcnJheSIsImVycm9yTWVzc2FnZSIsIm5hbWUiLCJKU09OIiwic3RyaW5naWZ5Iiwic2xpY2UiLCJlcnJvciIsIkVycm9yIiwic3RhdHVzIiwiY29uc29sZSIsIndhcm4iLCJ2YWxpZGF0ZSIsInByb2Nlc3NlZEVudGl0eSIsImtleXNPZlJlY29yZCIsIlNldCIsIk9iamVjdCIsImtleXMiLCJkZWZhdWx0cyIsImtleXNPZlByb3BzIiwiZm91bmQiLCJtaXNzaW5nIiwidW5leHBlY3RlZCIsImtleU9mUHJvcHMiLCJoYXMiLCJwdXNoIiwia2V5T2ZSZWNvcmQiLCJpbmNsdWRlcyIsInNpemUiLCJ0b29NYW55VW5leHBlY3RlZCIsIk1hdGgiLCJtYXgiLCJsZW5ndGgiLCJmb3VuZE5vdGhpbmciLCJtaW4iLCJleHRyYSIsInJlYXNvbiIsImRlbm9ybWFsaXplIiwidW52aXNpdCIsInVuZGVmaW5lZCIsInRvSlMiLCJzZXRMb2NhbCIsImRlbm9ybUVudGl0eSIsImRlbGV0ZWQiLCJzY2hlbWEiLCJmcm9tSlMiLCJ0b09iamVjdCIsImVudGl0eUNvcHkiLCJ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Q0E7RUFDQS9ELE1BQU0sQ0FBQytELE1BQU0sR0FBRyxTQUFTQSxNQUFNQSxDQUU3QlUsS0FBd0MsRUFDZjtJQUN6QixJQUFLLElBQUksQ0FBU0MsU0FBUyxDQUFDQyxFQUFFLEtBQUszRSxNQUFNLENBQUMwRSxTQUFTLENBQUNDLEVBQUUsRUFDcEQsTUFBTSxJQUFJakQsS0FBSyxDQUFDLG9DQUFvQyxDQUFDO0lBQ3ZELE9BQU84QyxTQUFTLENBQUNJLElBQUksQ0FBQyxJQUFJLEVBQUVILEtBQUssQ0FBQztFQUNwQyxDQUFDO0FBQ0gifQ== | ||
// we're avoiding this on the type | ||
Entity.expiresAt = function (meta, input) { | ||
return meta.expiresAt; | ||
}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsImRlbm9ybWFsaXplSW1tdXRhYmxlIiwiRW50aXR5IiwiRW50aXR5U2NoZW1hIiwiRW1wdHlCYXNlIiwidXNlSW5jb21pbmciLCJleGlzdGluZ01ldGEiLCJpbmNvbWluZ01ldGEiLCJleGlzdGluZyIsImluY29taW5nIiwiZmV0Y2hlZEF0IiwibWVyZ2VXaXRoU3RvcmUiLCJtZXJnZSIsIm1lcmdlTWV0YVdpdGhTdG9yZSIsImV4cGlyZXNBdCIsIk1hdGgiLCJtYXgiLCJkYXRlIiwicHJvY2VzcyIsImlucHV0IiwicGFyZW50Iiwia2V5IiwiZW52IiwiTk9ERV9FTlYiLCJhdXRvbWF0aWNWYWxpZGF0aW9uIiwiQXJyYXkiLCJpc0FycmF5IiwiZXJyb3JNZXNzYWdlIiwibmFtZSIsIkpTT04iLCJzdHJpbmdpZnkiLCJzbGljZSIsImVycm9yIiwiRXJyb3IiLCJzdGF0dXMiLCJjb25zb2xlIiwid2FybiIsInZhbGlkYXRlIiwicHJvY2Vzc2VkRW50aXR5Iiwia2V5c09mUmVjb3JkIiwiU2V0IiwiT2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jtFQUNBO0VBQ0FsRSxNQUFNLENBQUNrRSxNQUFNLEdBQUcsU0FBU0EsTUFBTUEsQ0FFN0JVLEtBQXdDLEVBQ2Y7SUFDekIsSUFBSyxJQUFJLENBQVNDLFNBQVMsQ0FBQ0MsRUFBRSxLQUFLOUUsTUFBTSxDQUFDNkUsU0FBUyxDQUFDQyxFQUFFLEVBQ3BELE1BQU0sSUFBSS9DLEtBQUssQ0FBQyxvQ0FBb0MsQ0FBQztJQUN2RCxPQUFPNEMsU0FBUyxDQUFDSSxJQUFJLENBQUMsSUFBSSxFQUFFSCxLQUFLLENBQUM7RUFDcEMsQ0FBQztBQUNIOztBQUVBO0FBQ0M1RSxNQUFNLENBQVNZLFNBQVMsR0FBRyxVQUMxQm9FLElBQTRELEVBQzVEL0QsS0FBVSxFQUNGO0VBQ1IsT0FBTytELElBQUksQ0FBQ3BFLFNBQVM7QUFDdkIsQ0FBQyJ9 |
@@ -8,3 +8,3 @@ import type { Schema, NormalizedIndex, UnvisitFunction } from '../interface.js'; | ||
export type PKClass = abstract new (...args: any[]) => { | ||
pk(parent?: any, key?: string): string | undefined; | ||
pk(parent?: any, key?: string, args?: readonly any[]): string | undefined; | ||
}; | ||
@@ -33,9 +33,18 @@ type ValidSchemas<TInstance> = { | ||
}; | ||
/** Defines nested entities */ | ||
/** Defines nested entities | ||
* | ||
* @see https://resthooks.io/rest/api/Entity#schema | ||
*/ | ||
schema: { | ||
[k: string]: Schema; | ||
}; | ||
/** Returns the globally unique identifier for the static Entity */ | ||
/** Returns the globally unique identifier for the static Entity | ||
* | ||
* @see https://resthooks.io/docs/api/Entity#key | ||
*/ | ||
key: string; | ||
/** Defines indexes to enable lookup by */ | ||
/** Defines indexes to enable lookup by | ||
* | ||
* @see https://resthooks.io/rest/api/Entity#indexes | ||
*/ | ||
indexes?: readonly string[] | undefined; | ||
@@ -45,2 +54,3 @@ /** | ||
* | ||
* @see https://resthooks.io/docs/api/Entity#pk | ||
* @param [value] POJO of the entity or subset used | ||
@@ -50,3 +60,3 @@ * @param [parent] When normalizing, the object which included the entity | ||
*/ | ||
pk<T extends (abstract new (...args: any[]) => IEntityInstance & InstanceType<TBase>) & IEntityClass & TBase>(this: T, value: Partial<AbstractInstanceType<T>>, parent?: any, key?: string): string | undefined; | ||
pk<T extends (abstract new (...args: any[]) => IEntityInstance & InstanceType<TBase>) & IEntityClass & TBase>(this: T, value: Partial<AbstractInstanceType<T>>, parent?: any, key?: string, args?: any[]): string | undefined; | ||
/** Return true to merge incoming data; false keeps existing entity | ||
@@ -75,5 +85,11 @@ * | ||
}, existing: any, incoming: any): boolean; | ||
/** Creates new instance copying over defined values of arguments */ | ||
/** Creates new instance copying over defined values of arguments | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#merge | ||
*/ | ||
merge(existing: any, incoming: any): any; | ||
/** Run when an existing entity is found in the store */ | ||
/** Run when an existing entity is found in the store | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#mergeWithStore | ||
*/ | ||
mergeWithStore(existingMeta: { | ||
@@ -86,2 +102,19 @@ date: number; | ||
}, existing: any, incoming: any): any; | ||
/** Run when an existing entity is found in the store | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#mergeMetaWithStore | ||
*/ | ||
mergeMetaWithStore(existingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}; | ||
/** Factory method to convert from Plain JS Objects. | ||
@@ -92,18 +125,26 @@ * | ||
fromJS<T extends (abstract new (...args: any[]) => IEntityInstance & InstanceType<TBase>) & IEntityClass & TBase>(this: T, props?: Partial<AbstractInstanceType<T>>): AbstractInstanceType<T>; | ||
/** Factory method to convert from Plain JS Objects. | ||
/** Called when denormalizing an entity to create an instance when 'valid' | ||
* | ||
* @param [props] Plain Object of properties to assign. | ||
* @see https://resthooks.io/docs/api/Entity#createIfValid | ||
*/ | ||
createIfValid<T extends (abstract new (...args: any[]) => IEntityInstance & InstanceType<TBase>) & IEntityClass & TBase>(this: T, props: Partial<AbstractInstanceType<T>>): AbstractInstanceType<T> | undefined; | ||
/** Do any transformations when first receiving input */ | ||
/** Do any transformations when first receiving input | ||
* | ||
* @see https://resthooks.io/docs/api/Entity#process | ||
*/ | ||
process(input: any, parent: any, key: string | undefined): any; | ||
normalize(input: any, parent: any, key: string | undefined, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): any; | ||
/** Do any transformations when first receiving input | ||
* | ||
* @see https://resthooks.io/docs/api/Entity#validate | ||
*/ | ||
validate(processedEntity: any): string | undefined; | ||
/** Attempts to infer results | ||
* | ||
* @see https://resthooks.io/docs/api/Entity#infer | ||
*/ | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: any): any; | ||
expiresAt(meta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, input: any): number; | ||
denormalize<T extends (abstract new (...args: any[]) => IEntityInstance & InstanceType<TBase>) & IEntityClass & TBase>(this: T, input: any, unvisit: UnvisitFunction): [denormalized: AbstractInstanceType<T>, found: boolean, suspend: boolean]; | ||
denormalizeOnly<T extends (abstract new (...args: any[]) => IEntityInstance & InstanceType<TBase>) & IEntityClass & TBase>(this: T, input: any, unvisit: (input: any, schema: any) => any): AbstractInstanceType<T>; | ||
/** All instance defaults set */ | ||
@@ -119,5 +160,5 @@ readonly defaults: any; | ||
*/ | ||
pk(parent?: any, key?: string): string | undefined; | ||
pk(parent?: any, key?: string, args?: readonly any[]): string | undefined; | ||
} | ||
export {}; | ||
//# sourceMappingURL=EntitySchema.d.ts.map |
@@ -27,2 +27,14 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
* | ||
* @param [parent] When normalizing, the object which included the entity | ||
* @param [key] When normalizing, the key where this entity was found | ||
*/ | ||
/** Returns the globally unique identifier for the static Entity */ | ||
// default implementation in class static block at bottom of definition | ||
/** Defines indexes to enable lookup by */ | ||
/** | ||
* A unique identifier for each Entity | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#pk | ||
* @param [value] POJO of the entity or subset used | ||
@@ -32,4 +44,4 @@ * @param [parent] When normalizing, the object which included the entity | ||
*/ | ||
static pk(value, parent, key) { | ||
return this.prototype.pk.call(value, parent, key); | ||
static pk(value, parent, key, args) { | ||
return this.prototype.pk.call(value, parent, key, args); | ||
} | ||
@@ -54,3 +66,6 @@ | ||
/** Creates new instance copying over defined values of arguments */ | ||
/** Creates new instance copying over defined values of arguments | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#merge | ||
*/ | ||
static merge(existing, incoming) { | ||
@@ -63,3 +78,6 @@ return { | ||
/** Run when an existing entity is found in the store */ | ||
/** Run when an existing entity is found in the store | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#mergeWithStore | ||
*/ | ||
static mergeWithStore(existingMeta, incomingMeta, existing, incoming) { | ||
@@ -79,2 +97,10 @@ const useIncoming = this.useIncoming(existingMeta, incomingMeta, existing, incoming); | ||
/** Run when an existing entity is found in the store | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#mergeMetaWithStore | ||
*/ | ||
static mergeMetaWithStore(existingMeta, incomingMeta, existing, incoming) { | ||
return this.shouldReorder(existingMeta, incomingMeta, existing, incoming) ? existingMeta : incomingMeta; | ||
} | ||
/** Factory method to convert from Plain JS Objects. | ||
@@ -95,5 +121,6 @@ * | ||
/** Factory method to convert from Plain JS Objects. | ||
/** Called when denormalizing an entity to create an instance when 'valid' | ||
* | ||
* @param [props] Plain Object of properties to assign. | ||
* @see https://resthooks.io/docs/api/schema.Entity#createIfValid | ||
*/ | ||
@@ -109,3 +136,6 @@ static createIfValid( | ||
/** Do any transformations when first receiving input */ | ||
/** Do any transformations when first receiving input | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#process | ||
*/ | ||
static process(input, parent, key) { | ||
@@ -116,5 +146,5 @@ return { | ||
} | ||
static normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
static normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
const processedEntity = this.process(input, parent, key); | ||
const id = this.pk(processedEntity, parent, key); | ||
const id = this.pk(processedEntity, parent, key, args); | ||
if (id === undefined || id === '') { | ||
@@ -135,4 +165,4 @@ if (process.env.NODE_ENV !== 'production') { | ||
} else { | ||
// these make the keys get deleted | ||
return undefined; | ||
// these make the keys get deleted; return undefined | ||
return; | ||
} | ||
@@ -156,3 +186,3 @@ } | ||
const schema = this.schema[key]; | ||
processedEntity[key] = visit(processedEntity[key], processedEntity, key, schema, addEntity, visitedEntities); | ||
processedEntity[key] = visit(processedEntity[key], processedEntity, key, schema, addEntity, visitedEntities, storeEntities, args); | ||
} | ||
@@ -182,22 +212,10 @@ }); | ||
} | ||
static infer(args, indexes, recurse) { | ||
static infer(args, indexes, recurse, entities) { | ||
var _entities$this$key; | ||
if (!args[0]) return undefined; | ||
if (['string', 'number'].includes(typeof args[0])) { | ||
return `${args[0]}`; | ||
} | ||
const id = this.pk(args[0], undefined, ''); | ||
// Was able to infer the entity's primary key from params | ||
if (id !== undefined && id !== '') return id; | ||
// now attempt lookup in indexes | ||
const indexName = indexFromParams(args[0], this.indexes); | ||
if (indexName && indexes[this.key]) { | ||
// 'as Record<string, any>': indexName can only be found if params is a string key'd object | ||
const id = indexes[this.key][indexName][args[0][indexName]]; | ||
return id; | ||
} | ||
const id = inferId(this, args, indexes); | ||
// no entity arg is back-compatibility | ||
if (!entities || (_entities$this$key = entities[this.key]) != null && _entities$this$key[id]) return id; | ||
return undefined; | ||
} | ||
static expiresAt(meta, input) { | ||
return meta.expiresAt; | ||
} | ||
static denormalize(input, unvisit) { | ||
@@ -222,3 +240,24 @@ // TODO: remove codecov ignore once denormalize is modified to expect this | ||
} | ||
static denormalizeOnly(input, args, unvisit) { | ||
if (typeof input === 'symbol') { | ||
return input; | ||
} | ||
// note: iteration order must be stable | ||
for (const key of Object.keys(this.schema)) { | ||
const schema = this.schema[key]; | ||
const value = unvisit(input[key], schema); | ||
if (typeof value === 'symbol') { | ||
// if default is not 'fasly', then this is required, so propagate INVALID symbol | ||
if (this.defaults[key]) { | ||
return value; | ||
} | ||
input[key] = undefined; | ||
} else { | ||
input[key] = value; | ||
} | ||
} | ||
return input; | ||
} | ||
/** All instance defaults set */ | ||
@@ -318,2 +357,17 @@ static get defaults() { | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJFbnRpdHlTY2hlbWEiLCJCYXNlIiwib3B0aW9ucyIsIkVudGl0eU1peGluIiwidG9TdHJpbmciLCJrZXkiLCJ0b0pTT04iLCJuYW1lIiwic2NoZW1hIiwicGsiLCJ2YWx1ZSIsInBhcmVudCIsInByb3RvdHlwZSIsImNhbGwiLCJ1c2VJbmNvbWluZyIsImV4aXN0aW5nTWV0YSIsImluY29taW5nTWV0YSIsImV4aXN0aW5nIiwiaW5jb21pbmciLCJzaG91bGRSZW9yZGVyIiwiZmV0Y2hlZEF0IiwibWVyZ2UiLCJtZXJnZVdpdGhTdG9yZSIsImZyb21KUyIsInByb3BzIiwiaW5zdGFuY2UiLCJPYmplY3QiLCJhc3NpZ24iLCJjcmVhdGVJZlZhbGlkIiwidmFsaWRhdGUiLCJ1bmRlZmluZWQiLCJwcm9jZXNzIiwiaW5wdXQiLCJub3JtYWxpemUiLCJ2aXNpdCIsImFkZEVudGl0eSIsInZpc2l0ZWRFbnRpdGllcyIsInByb2Nlc3NlZEVudGl0eSIsImlkIiwiZW52IiwiTk9ERV9FTlYiLCJlcnJvciIsIkVycm9yIiwiSlNPTiIsInN0cmluZ2lmeSIsInN0YXR1cyIsImVudGl0eVR5cGUiLCJzb21lIiwiZW50aXR5IiwiZXJyb3JNZXNzYWdlIiwidGhyb3dWYWxpZGF0aW9uRXJyb3IiLCJwdXNoIiwia2V5cyIsImZvckVhY2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IEVudGl0eU1peGluPihcbiAgICAgIHRoaXM6IFQsXG4gICAgICB2YWx1ZTogUGFydGlhbDxBYnN0cmFjdEluc3RhbmNlVHlwZTxUPj4sXG4gICAgICBwYXJlbnQ/OiBhbnksXG4gICAgICBrZXk/OiBzdHJpbmcsXG4gICAgKTogc3RyaW5nIHwgdW5kZWZpbmVkIHtcbiAgICAgIHJldHVybiB0aGlzLnByb3RvdHlwZS5way5jYWxsKHZhbHVlLCBwYXJlbnQsIGtleSk7XG4gICAgfVxuXG4gICAgLyoqIFJldHVybiB0cnVlIHRvIG1lcmdlIGluY29taW5nIGRhdGE7IGZhbHNlIGtlZXBzIGV4aXN0aW5nIGVudGl0eVxuICAgICAqXG4gICAgICogQHNlZSBodHRwczovL3Jlc3Rob29rcy5pby9kb2NzL2FwaS9zY2hlbWEuRW50aXR5I3VzZUluY29taW5nXG4gICAgICovXG4gICAgc3RhdGljIHVzZUluY29taW5nKFxuICAgICAgZXhpc3RpbmdNZXRhOiB7IGRhdGU6IG51bWJlcjsgZmV0Y2hlZEF0OiBudW1iZXIgfSxcbiAgICAgIGluY29taW5nTWV0YTogeyBkYXRlOiBudW1iZXI7IGZldGNoZWRBdDogbnVtYmVyIH0sXG4gICAgICBleGlzdGluZzogYW55LFxuICAgICAgaW5jb21pbmc6IGFueSxcbiAgICApIHtcbiAgICAgIHJldHVybiB0cnVlO1xuICAgIH1cblxuICAgIC8qKiBEZXRlcm1pbmVzIHRoZSBvcmRlciBvZiBpbmNvbWluZyBlbnRpdHkgdnMgZW50aXR5IGFscmVhZHkgaW4gc3RvcmVcXFxuICAgICAqXG4gICAgICogQHNlZSBodHRwczovL3Jlc3Rob29rcy5pby9kb2NzL2FwaS9zY2hlbWEuRW50aXR5I3Nob3VsZFJlb3JkZXJcbiAgICAgKiBAcmV0dXJucyB0cnVlIGlmIGluY29taW5nIGVudGl0eSBzaG91bGQgYmUgZmlyc3QgYXJndW1lbnQgb2YgbWVyZ2UoKVxuICAgICAqL1xuICAgIHN0YXRpYyBzaG91bGRSZW9yZGVyKFxuICAgICAgZXhpc3RpbmdNZXRhOiB7IGRhdGU6IG51bWJlcjsgZmV0Y2hlZEF0OiBudW1iZXIgfSxcbiAgICAgIGluY29taW5nTWV0YTogeyBkYXRlOiBudW1iZXI7IGZldGNoZWRBdDogbnVtYmVyIH0sXG4gICAgICBleGlzdGluZzogYW55LFxuICAgICAgaW5jb21pbmc6IGFueSxcbiAgICApIHtcbiAgICAgIHJldHVybiBpbmNvbWluZ01ldGEuZmV0Y2hlZEF0IDwgZXhpc3RpbmdNZXRhLmZldGNoZWRBdDtcbiAgICB9XG5cbiAgICAvKiogQ3JlYXRlcyBuZXcgaW5zdGFuY2UgY29weWluZyBvdmVyIGRlZmluZWQgdmFsdWVzIG9mIGFyZ3VtZW50cyAqL1xuICAgIHN0YXRpYyBtZXJnZShleGlzdGluZzogYW55LCBpbmNvbWluZzogYW55KSB7XG4gICAgICByZXR1cm4ge1xuICAgICAgICAuLi5leGlzdGluZyxcbiAgICAgICAgLi4uaW5jb21pbmcsXG4gICAgICB9O1xuICAgIH1cblxuICAgIC8qKiBSdW4gd2hlbiBhbiBleGlzdGluZyBlbnRpdHkgaXMgZm91bmQgaW4gdGhlIHN0b3JlICovXG4gICAgc3RhdGljIG1lcmdlV2l0aFN0b3JlKFxuICAgICAgZXhpc3RpbmdNZXRhOiB7XG4gICAgICAgIGRhdGU6IG51bWJlcjtcbiAgICAgICAgZmV0Y2hlZEF0OiBudW1iZXI7XG4gICAgICB9LFxuICAgICAgaW5jb21pbmdNZXRhOiB7IGRhdGU6IG51bWJlcjsgZmV0Y2hlZEF0OiBudW1iZXIgfSxcbiAgICAgIGV4aXN0aW5nOiBhbnksXG4gICAgICBpbmNvbWluZzogYW55LFxuICAgICkge1xuICAgICAgY29uc3QgdXNlSW5jb21pbmcgPSB0aGlzLnVzZUluY29taW5nKFxuICAgICAgICBleGlzdGluZ01ldGEsXG4gICAgICAgIGluY29taW5nTWV0YSxcbiAgICA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OiBzdHJpbmcpIHtcbiAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCAna2V5Jywge1xuICAgICAgICB2YWx1ZSxcbiAgICAgICAgd3JpdGFibGU6IHRydWUsXG4gICAgICAgIGVudW1lcmFibGU6IHRydWUsXG4gICAgICB9KTtcbiAgICB9XG4gICAgY29uc3QgQ0xBU1NOQU1FTUFOR0xJTkcgPSBFbnRpdHlNaXhpbi5uYW1lICE9PSAnRW50aXR5TWl4aW4nO1xuICAgIGNvbnN0IGdldCA9XG4gICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgaWYgKi9cbiAgICAgIENMQVNTTkFNRU1BTkdMSU5HXG4gICAgICAgID8gLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi8gZnVuY3Rpb24gKHRoaXM6IHtcbiAgICAgICAgICAgIG5hbWU6IHN0cmluZztcbiAgICAgICAgICAgIGtleTogc3RyaW5nO1xuICAgICAgICAgIH0pOiBzdHJpbmcge1xuICAgICAgICAgICAgY29uc3QgbmFtZSA9IHRoaXMubmFtZSA9PT0gJ0VudGl0eU1peGluJyA/IEJhc2UubmFtZSA6IHRoaXMubmFtZTtcbiAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IoJ1Jlc3QgSG9va3MgRXJyb3I6IGh0dHBzOi8vcmVzdGhvb2tzLmlvL2Vycm9ycy9ka2xqJyk7XG4gICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkodGhpcywgJ2tleScsIHtcbiAgICAgICAgICAgICAgZ2V0KCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBuYW1lO1xuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICBzZXQsXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIHJldHVybiB0aGlzLmtleTtcbiAgICAgICAgICB9XG4gICAgICAgIDogZnVuY3Rpb24gKHRoaXM6IHsgbmFtZTogc3RyaW5nIH0pOiBzdHJpbmcge1xuICAgICAgICAgICAgY29uc3Q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PLENBQUNRLEdBQUcsQ0FBQ0MsUUFBUSxLQUFLLFlBQVksS0FDcENqQyxJQUFJLEtBQUssRUFBRSxJQUFJQSxJQUFJLEtBQUssYUFBYSxJQUFJQSxJQUFJLEtBQUssT0FBTyxDQUFDLEVBRTNELE1BQU0sSUFBSW1DLEtBQUssQ0FDYix1R0FBdUcsQ0FDeEc7TUFDSCxPQUFPbkMsSUFBSTtJQUNiLENBQUM7SUFFUG1CLE1BQU0sQ0FBQzRDLGNBQWMsQ0FBQ25FLFdBQVcsRUFBRSxLQUFLLEVBQUU7TUFDeEMyRSxHQUFHO01BQ0hIO0lBQ0YsQ0FBQyxDQUFDO0VBQ0o7RUFFQSxPQUFPeEUsV0FBVztBQUNwQjtBQUVBLFNBQVMyRCxlQUFlQSxDQUN0QmtCLE1BQXdCLEVBQ3hCdEIsT0FBdUIsRUFDdkI7RUFDQSxJQUFJLENBQUNBLE9BQU8sRUFBRSxPQUFPNUIsU0FBUztFQUM5QixPQUFPNEIsT0FBTyxDQUFDdUIsSUFBSSxDQUFDQyxLQUFLLElBQUl4RCxNQUFNLENBQUM0QixNQUFNLENBQUMwQixNQUFNLEVBQUVFLEtBQUssQ0FBQyxDQUFDO0FBQzVEOztBQUVBO0FBQ0EsU0FBU2hDLG9CQUFvQkEsQ0FBQ0QsWUFBZ0MsRUFBRTtFQUM5RCxJQUFJQSxZQUFZLEVBQUU7SUFDaEIsTUFBTVIsS0FBSyxHQUFHLElBQUlDLEtBQUssQ0FBQ08sWUFBWSxDQUFDO0lBQ3BDUixLQUFLLENBQVNJLE1BQU0sR0FBRyxHQUFHO0lBQzNCLE1BQU1KLEtBQUs7RUFDYjtBQUNGIn0= | ||
function inferId(schema, args, indexes) { | ||
if (['string', 'number'].includes(typeof args[0])) { | ||
return `${args[0]}`; | ||
} | ||
const id = schema.pk(args[0], undefined, '', args); | ||
// Was able to infer the entity's primary key from params | ||
if (id !== undefined && id !== '') return id; | ||
// now attempt lookup in indexes | ||
const indexName = indexFromParams(args[0], schema.indexes); | ||
if (indexName && indexes[schema.key]) { | ||
// 'as Record<string, any>': indexName can only be found if params is a string key'd object | ||
const id = indexes[schema.key][indexName][args[0][indexName]]; | ||
return id; | ||
} | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJFbnRpdHlTY2hlbWEiLCJCYXNlIiwib3B0aW9ucyIsIkVudGl0eU1peGluIiwidG9TdHJpbmciLCJrZXkiLCJ0b0pTT04iLCJuYW1lIiwic2NoZW1hIiwicGsiLCJ2YWx1ZSIsInBhcmVudCIsImFyZ3MiLCJwcm90b3R5cGUiLCJjYWxsIiwidXNlSW5jb21pbmciLCJleGlzdGluZ01ldGEiLCJpbmNvbWluZ01ldGEiLCJleGlzdGluZyIsImluY29taW5nIiwic2hvdWxkUmVvcmRlciIsImZldGNoZWRBdCIsIm1lcmdlIiwibWVyZ2VXaXRoU3RvcmUiLCJtZXJnZU1ldGFXaXRoU3RvcmUiLCJmcm9tSlMiLCJwcm9wcyIsImluc3RhbmNlIiwiT2JqZWN0IiwiYXNzaWduIiwiY3JlYXRlSWZWYWxpZCIsInZhbGlkYXRlIiwidW5kZWZpbmVkIiwicHJvY2VzcyIsImlucHV0Iiwibm9ybWFsaXplIiwidmlzaXQiLCJhZGRFbnRpdHkiLCJ2aXNpdGVkRW50aXRpZXMiLCJzdG9yZUVudGl0aWVzIiwicHJvY2Vzc2VkRW50aXR5IiwiaWQiLCJlbnYiLCJOT0RFX0VOViIsImVycm9yIiwiRXJyb3IiLCJKU09OIiwic3RyaW5naWZ5Iiwic3RhdHVzIiwiZW50aXR5VHlwZSIsInNvbWUiLCJlbnRpdHkiLCJlcnJvck1lc3NhZ2UiLCJ0aHJvd1ZhbGlkYXRpb25FcnJvciIsInB1c2giLCJrZXlzIiwiZm9yRWFjaCIsImhhc093biIsImRlZmF1bHRzIiwiaW5mZXIiLCJpbmRleGVzIiwicmVjdXJzZSIsImVudGl0aWVz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G9yZVxuICAgICAqL1xuICAgIHN0YXRpYyBtZXJnZVdpdGhTdG9yZShcbiAgICAgIGV4aXN0aW5nTWV0YToge1xuICAgICAgICBkYXRlOiBudW1iZXI7XG4gICAgICAgIGZldGNoZWRBdDogbnVtYmVyO1xuICAgICAgfSxcbiAgICAgIGluY29taW5nTWV0YTogeyBkYXRlOiBudW1iZXI7IGZldGNoZWRBdDogbnVtYmVyIH0sXG4gICAgICBleGlzdGluZzogYW55LFxuICAgICAgaW5jb21pbmc6IGFueSxcbiAgICApIHtcbiAgICAgIGNvbnN0IHVzZUluY29taW5nID0gdGhpcy51c2VJbmNvbWluZyhcbiAgICAgICAgZXhpc3RpbmdNZXRhLFxuICAgICAgICBpbmNvbWluZ01ldGEsXG4gICAgICAgIGV4aXN0aW5nLFxuICAgICAgICBpbmNvbWluZyxcbiAgICAgICk7XG5cbiAgICAgIGlmICh1c2VJbmNvbWluZykge1xuICAgICAgICAvLyBkaXN0aW5jdCB0eXBlcyBhcmUgbm90IG1lcmdlYWJsZSAobGlrZSBkZWxldGUgc3ltYm9sKSwgc28ganVzdCByZXBsYWNlXG4gICAgICAgIGlmICh0eXBlb2YgaW5jb21pbmcgIT09IHR5cGVvZiBleGlzdGluZykge1xuICAgICAgICAgIHJldHVybiBpbmNvbWluZztcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICByZXR1cm4gdGhpcy5zaG91bGRSZW9yZGVyKFxuICAgICAgICAgICAgZXhpc3RpbmdNZXRhLFxuICAgICAgICAgICAgaW5jb21pbmdNZXRhLFxuICAgICAgICAgICAgZXhpc3RpbmcsXG4gICAgICAgICAgICBpbmNvbWluZyxcbiAgICAgICAgICApXG4gICAgICAgICAgICA/IHRoaXMubWVyZ2UoaW5jb21pbmcsIGV4aXN0aW5nKVxuICAgICAgICAgICAgOiB0aGlzLm1lcmdlKGV4aXN0aW5nLCBpbmNvbWluZyk7XG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHJldH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HJpbmc7XG4gICAgICAgICAgfSk6IHN0cmluZyB7XG4gICAgICAgICAgICBjb25zdCBuYW1lID0gdGhpcy5uYW1lID09PSAnRW50aXR5TWl4aW4nID8gQmFzZS5uYW1lIDogdGhpcy5uYW1lO1xuICAgICAgICAgICAgY29uc29sZS5lcnJvcignUmVzdCBIb29rcyBFcnJvcjogaHR0cHM6Ly9yZXN0aG9va3MuaW8vZXJyb3JzL2RrbGonKTtcbiAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCAna2V5Jywge1xuICAgICAgICAgICAgICBnZXQoKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG5hbWU7XG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIHNldCxcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMua2V5O1xuICAgICAgICAgIH1cbiAgICAgICAgOiBmdW5jdGlvbiAodGhpczogeyBuYW1lOiBzdHJpbmcgfSk6IHN0cmluZyB7XG4gICAgICAgICAgICBjb25zdCBuYW1lID0gdGhpcy5uYW1lID09PSAnRW50aXR5TWl4aW4nID8gQmFzZS5uYW1lIDogdGhpcy5uYW1lO1xuICAgICAgICAgICAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICAgcHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09ICdwcm9kdWN0aW9uJyAmJlxuICAgICAgICAgICAgICAobmFtZSA9PT0gJycgfHwgbmFtZSA9PT0gJ0VudGl0eU1peGluJyB8fCBuYW1lID09PSAnX3RlbXAnKVxuICAgICAgICAgICAgKVxuICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXG4gICAgICAgICAgICAgICAgJ0VudGl0eSBjbGFzc2VzIHdpdGhvdXQgYSBuYW1lIG11c3QgZGVmaW5lIGBzdGF0aWMga2V5YFxcblNlZTogaHR0cHM6Ly9yZXN0aG9va3Mu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QUFFb0IsU0FBUyxFQUFFLEVBQUUsRUFBRXBCLElBQUksQ0FBQztFQUNsRDtFQUNBLElBQUk2QixFQUFFLEtBQUtULFNBQVMsSUFBSVMsRUFBRSxLQUFLLEVBQUUsRUFBRSxPQUFPQSxFQUFFO0VBQzVDO0VBQ0EsTUFBTTZDLFNBQVMsR0FBR0wsZUFBZSxDQUFDckUsSUFBSSxDQUFDLENBQUMsQ0FBQyxFQUFFSixNQUFNLENBQUNvRCxPQUFPLENBQUM7RUFDMUQsSUFBSTBCLFNBQVMsSUFBSTFCLE9BQU8sQ0FBQ3BELE1BQU0sQ0FBQ0gsR0FBRyxDQUFDLEVBQUU7SUFDcEM7SUFDQSxNQUFNb0MsRUFBRSxHQUNObUIsT0FBTyxDQUFDcEQsTUFBTSxDQUFDSCxHQUFHLENBQUMsQ0FBQ2lGLFNBQVMsQ0FBQyxDQUMzQjFFLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBeUIwRSxTQUFTLENBQUMsQ0FDNUM7SUFDSCxPQUFPN0MsRUFBRTtFQUNYO0FBQ0YifQ== |
@@ -26,2 +26,12 @@ /** | ||
export declare function denormalizeImmutable(schema: any, input: any, unvisit: any): [denormalized: any, found: boolean, deleted: boolean]; | ||
/** | ||
* Denormalize an immutable entity. | ||
* | ||
* @param {Schema} schema | ||
* @param {Immutable.Map|Immutable.Record} input | ||
* @param {function} unvisit | ||
* @param {function} getDenormalizedEntity | ||
* @return {Immutable.Map|Immutable.Record} | ||
*/ | ||
export declare function denormalizeOnlyImmutable(schema: any, input: any, unvisit: (input: any, schema: any) => any): any; | ||
//# sourceMappingURL=ImmutableUtils.d.ts.map |
@@ -50,2 +50,31 @@ /** | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsIm9iamVjdCIsImhhc093blByb3BlcnR5IiwiT2JqZWN0IiwiY2FsbCIsIl9tYXAiLCJkZW5vcm1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FvQkEsQ0FDbENDLE1BQVcsRUFDWEMsS0FBVSxFQUNWQyxPQUFZLEVBQzJDO0VBQ3ZELElBQUlDLEtBQUssR0FBRyxJQUFJO0VBQ2hCLElBQUlDLE9BQU8sR0FBRyxLQUFLO0VBQ25CLE9BQU8sQ0FDTFIsTUFBTSxDQUFDUyxJQUFJLENBQUNMLE1BQU0sQ0FBQyxDQUFDTSxNQUFNLENBQUMsQ0FBQ1osTUFBTSxFQUFFYSxHQUFHLEtBQUs7SUFDMUM7SUFDQTtJQUNBLE1BQU1DLFNBQVMsR0FBSSxHQUFFRCxHQUFJLEVBQUM7SUFFMUIsTUFBTSxDQUFDRSxJQUFJLEVBQUVDLFNBQVMsRUFBRUMsV0FBVyxDQUFDLEdBQUdULE9BQU8sQ0FDNUNSLE1BQU0sQ0FBQ2tCLEdBQUcsQ0FBQ0osU0FBUyxDQUFDLEVBQ3JCUixNQUFNLENBQUNRLFNBQVMsQ0FBQyxDQUNsQjtJQUNELElBQUksQ0FBQ0UsU0FBUyxFQUFFO01BQ2RQLEtBQUssR0FBRyxLQUFLO0lBQ2Y7SUFDQSxJQUFJUSxXQUFXLEVBQUU7TUFDZlAsT0FBTyxHQUFHLElBQUk7SUFDaEI7SUFDQSxJQUFJVixNQUFNLENBQUNtQixHQUFHLENBQUNMLFNBQVMsQ0FBQyxFQUFFO01BQ3pCLE9BQU9kLE1BQU0sQ0FBQ29CLEdBQUcsQ0FBQ04sU0FBUyxFQUFFQyxJQUFJLENBQUM7SUFDcEMsQ0FBQyxNQUFNO01BQ0wsT0FBT2YsTUFBTTtJQUNmO0VBQ0YsQ0FBQyxFQUFFTyxLQUFLLENBQUMsRUFDVEUsS0FBSyxFQUNMQyxPQUFPLENBQ1I7QUFDSCJ9 | ||
/** | ||
* Denormalize an immutable entity. | ||
* | ||
* @param {Schema} schema | ||
* @param {Immutable.Map|Immutable.Record} input | ||
* @param {function} unvisit | ||
* @param {function} getDenormalizedEntity | ||
* @return {Immutable.Map|Immutable.Record} | ||
*/ | ||
export function denormalizeOnlyImmutable(schema, input, unvisit) { | ||
var _deleted; | ||
let deleted; | ||
const value = Object.keys(schema).reduce((object, key) => { | ||
// Immutable maps cast keys to strings on write so we need to ensure | ||
// we're accessing them using string keys. | ||
const stringKey = `${key}`; | ||
const item = unvisit(object.get(stringKey), schema[stringKey]); | ||
if (typeof item === 'symbol') { | ||
deleted = item; | ||
} | ||
if (object.has(stringKey)) { | ||
return object.set(stringKey, item); | ||
} else { | ||
return object; | ||
} | ||
}, input); | ||
return (_deleted = deleted) != null ? _deleted : value; | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsIm9iamVjdCIsImhhc093blByb3BlcnR5IiwiT2JqZWN0IiwiY2FsbCIsIl9tYXAiLCJkZW5vcm1hbGl6ZUltbXV0YWJsZSIsInNjaGVtYSIsImlucHV0IiwidW52aXNpdCIsImZvdW5kIiwiZGVsZXRlZCIsImtleXMiLCJyZWR1Y2UiLCJrZXkiLCJzdHJpbmdLZXkiLCJpdGVtIiwiZm91bmRJdGVtIiwiZGVsZXRlZEl0ZW0iLCJnZXQiLCJoYXMiLCJzZXQiLCJkZW5vcm1hbGl6ZU9ubHlJbW11dGFibGUiLCJfZGVsZXRlZCIsInZhbHVlIl0sInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NjaGVtYXMvSW1tdXRhYmxlVXRpbHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBIZWxwZXJzIHRvIGVuYWJsZSBJbW11dGFibGUgY29tcGF0aWJpbGl0eSAqd2l0aG91dCogYnJpbmdpbmcgaW5cbiAqIHRoZSAnaW1tdXRhYmxlJyBwYWNrYWdlIGFzIGEgZGVwZW5kZW5jeS5cbiAqL1xuXG4vKipcbiAqIENoZWNrIGlmIGFuIG9iamVjdCBpcyBpbW11dGFibGUgYnkgY2hlY2tpbmcgaWYgaXQgaGFzIG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BQ0osU0FBUyxDQUFDLEVBQUVSLE1BQU0sQ0FBQ1EsU0FBUyxDQUFDLENBQUM7SUFDOUQsSUFBSSxPQUFPQyxJQUFJLEtBQUssUUFBUSxFQUFFO01BQzVCTCxPQUFPLEdBQUdLLElBQUk7SUFDaEI7SUFDQSxJQUFJZixNQUFNLENBQUNtQixHQUFHLENBQUNMLFNBQVMsQ0FBQyxFQUFFO01BQ3pCLE9BQU9kLE1BQU0sQ0FBQ29CLEdBQUcsQ0FBQ04sU0FBUyxFQUFFQyxJQUFJLENBQUM7SUFDcEMsQ0FBQyxNQUFNO01BQ0wsT0FBT2YsTUFBTTtJQUNmO0VBQ0YsQ0FBQyxFQUFFTyxLQUFLLENBQUM7RUFDVCxRQUFBZSxRQUFBLEdBQU9aLE9BQU8sWUFBQVksUUFBQSxHQUFJQyxLQUFLO0FBQ3pCIn0= |
@@ -1,3 +0,4 @@ | ||
export declare const normalize: (schema: any, input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any) => any; | ||
export declare const normalize: (schema: any, input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args: any[]) => any; | ||
export declare const denormalize: (schema: any, input: {}, unvisit: any) => [denormalized: any, found: boolean, deleted: boolean]; | ||
export declare function denormalizeOnly(schema: any, input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): any; | ||
export declare function infer(schema: any, args: readonly any[], indexes: any, recurse: any, entities: any): any; | ||
@@ -18,7 +19,10 @@ /** | ||
addEntity: any, | ||
visitedEntities: any | ||
visitedEntities: any, | ||
storeEntities: any, | ||
args: any[] | ||
]): any; | ||
denormalize(...args: readonly [input: {}, unvisit: any]): [denormalized: any, found: boolean, deleted: boolean]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): any; | ||
infer(args: any, indexes: any, recurse: any, entities: any): any; | ||
} | ||
//# sourceMappingURL=Object.d.ts.map |
@@ -1,3 +0,3 @@ | ||
import { isImmutable, denormalizeImmutable } from './ImmutableUtils.js'; | ||
export const normalize = (schema, input, parent, key, visit, addEntity, visitedEntities) => { | ||
import { isImmutable, denormalizeImmutable, denormalizeOnlyImmutable } from './ImmutableUtils.js'; | ||
export const normalize = (schema, input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) => { | ||
const object = { | ||
@@ -8,3 +8,3 @@ ...input | ||
const localSchema = schema[key]; | ||
const value = visit(input[key], input, key, localSchema, addEntity, visitedEntities); | ||
const value = visit(input[key], input, key, localSchema, addEntity, visitedEntities, storeEntities, args); | ||
if (value === undefined || value === null) { | ||
@@ -41,2 +41,20 @@ delete object[key]; | ||
}; | ||
export function denormalizeOnly(schema, input, args, unvisit) { | ||
if (isImmutable(input)) { | ||
return denormalizeOnlyImmutable(schema, input, unvisit); | ||
} | ||
const object = { | ||
...input | ||
}; | ||
for (const key of Object.keys(schema)) { | ||
const item = unvisit(object[key], schema[key]); | ||
if (object[key] !== undefined) { | ||
object[key] = item; | ||
} | ||
if (typeof item === 'symbol') { | ||
return item; | ||
} | ||
} | ||
return object; | ||
} | ||
export function infer(schema, args, indexes, recurse, entities) { | ||
@@ -49,3 +67,2 @@ const resultObject = {}; | ||
} | ||
/** | ||
@@ -77,2 +94,5 @@ * Represents objects with statically known members | ||
} | ||
denormalizeOnly(input, args, unvisit) { | ||
return denormalizeOnly(this.schema, input, args, unvisit); | ||
} | ||
infer(args, indexes, recurse, entities) { | ||
@@ -82,2 +102,2 @@ return infer(this.schema, args, indexes, recurse, entities); | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsImRlbm9ybWFsaXplSW1tdXRhYmxlIiwibm9ybWFsaXplIiwic2NoZW1hIiwiaW5wdXQiLCJwYXJlbnQiLCJrZXkiLCJ2aXNpdCIsImFkZEVudGl0eSIsInZpc2l0ZWRFbnRpdGllcyIsIm9iamVjdCIsIk9iamVjdCIsImtleXMiLCJmb3JFYWN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0lBQzFELE9BQU9ILEtBQUssQ0FBQyxJQUFJLENBQUN4QixNQUFNLEVBQUVRLElBQUksRUFBRWlCLE9BQU8sRUFBRUMsT0FBTyxFQUFFQyxRQUFRLENBQUM7RUFDN0Q7QUFDRiJ9 |
@@ -9,5 +9,5 @@ export default class PolymorphicSchema { | ||
inferSchema(input: any, parent: any, key: any): any; | ||
normalizeValue(value: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): any; | ||
normalizeValue(value: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args?: any[]): any; | ||
denormalizeValue(value: any, unvisit: any): any; | ||
} | ||
//# sourceMappingURL=Polymorphic.d.ts.map |
import { isImmutable } from './ImmutableUtils.js'; | ||
import { DELETED } from '../special.js'; | ||
export default class PolymorphicSchema { | ||
@@ -14,3 +15,9 @@ constructor(definition, schemaAttribute) { | ||
define(definition) { | ||
this.schema = definition; | ||
// sending Union into another Polymorphic gets hoisted | ||
if ('_schemaAttribute' in definition && !this._schemaAttribute) { | ||
this.schema = definition.schema; | ||
this._schemaAttribute = definition._schemaAttribute; | ||
} else { | ||
this.schema = definition; | ||
} | ||
} | ||
@@ -27,3 +34,4 @@ getSchemaAttribute(input, parent, key) { | ||
} | ||
normalizeValue(value, parent, key, visit, addEntity, visitedEntities) { | ||
normalizeValue(value, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
if (!value) return value; | ||
const schema = this.inferSchema(value, parent, key); | ||
@@ -41,3 +49,3 @@ if (!schema) { | ||
} | ||
const normalizedValue = visit(value, parent, key, schema, addEntity, visitedEntities); | ||
const normalizedValue = visit(value, parent, key, schema, addEntity, visitedEntities, storeEntities, args); | ||
return this.isSingleSchema || normalizedValue === undefined || normalizedValue === null ? normalizedValue : { | ||
@@ -58,9 +66,14 @@ id: normalizedValue, | ||
} | ||
return [value, true, false]; | ||
return value; | ||
} | ||
const id = this.isSingleSchema ? undefined : isImmutable(value) ? value.get('id') : value.id; | ||
const schema = this.isSingleSchema ? this.schema : this.schema[schemaKey]; | ||
return unvisit(id || value, schema); | ||
const ret = unvisit(id || value, schema); | ||
if (Array.isArray(ret) && ret.length === 3) { | ||
if (ret[2] === true) return DELETED; | ||
return ret[0]; | ||
} | ||
return ret; | ||
} | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsIlBvbHltb3JwaGljU2NoZW1hIiwiY29uc3RydWN0b3IiLCJkZWZpbml0aW9uIiwic2NoZW1hQXR0cmlidXRlIiwic2NoZW1hIiwiX3NjaGVtYUF0dHJpYnV0ZSIsImlucHV0IiwiZGVmaW5lIiwiaXNTaW5nbGVTY2hlbWEiLCJnZXRTY2hlbWFBdHRyaWJ1dGUiLCJwYXJlbnQiLCJrZXkiLCJpbmZlclNjaGVtYSIsImF0dHIiLCJub3JtYWxpemVWYWx1ZSIsInZhbHVlIiwidmlzaXQiLCJhZGRFbnRpdHkiLCJ2aXNpdGVkRW50aXRpZXMiLCJwcm9jZXNzIiwiZW52IiwiTk9ERV9FTlYiLCJjb25zb2xlIiwid2FybiIsIkpTT04iLCJzdHJpbmdpZnkiLCJ1bmRlZmluZWQiLCJPYmplY3QiLCJrZXlzIiwibWFwIiwiayIsImpvaW4iLCJub3JtYWxpemVkVmFsdWUiLCJpZCIsImRlbm9ybWFsaXplVmFsdWUiLCJ1bnZpc2l0Iiwic2NoZW1hS2V5IiwiZ2V0IiwibmFtZSJdLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWFzL1BvbHltb3JwaGljLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGlzSW1tdXRhYmxlIH0gZnJvbSAnLi9JbW11dGFibGVVdGlscy5qcyc7XG5cbmV4cG9ydCBkZWZhdWx0IGNsYXNzIFBvbHltb3JwaGljU2NoZW1hIHtcbiAgcHJpdmF0ZSBkZWNsYXJlIF9zY2hlbWFBdHRyaWJ1dG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QUUsQ0FDdEM7TUFDSDtNQUNBLE9BQU9iLEtBQUs7SUFDZDtJQUNBLE1BQU1vQixFQUFFLEdBQUcsSUFBSSxDQUFDM0IsY0FBYyxHQUMxQm9CLFNBQVMsR0FDVDlCLFdBQVcsQ0FBQ2lCLEtBQUssQ0FBQyxHQUNsQkEsS0FBSyxDQUFDd0IsR0FBRyxDQUFDLElBQUksQ0FBQyxHQUNmeEIsS0FBSyxDQUFDb0IsRUFBRTtJQUNaLE1BQU0vQixNQUFNLEdBQUcsSUFBSSxDQUFDSSxjQUFjLEdBQUcsSUFBSSxDQUFDSixNQUFNLEdBQUcsSUFBSSxDQUFDQSxNQUFNLENBQUNrQyxTQUFTLENBQUM7SUFDekUsTUFBTUcsR0FBRyxHQUFHSixPQUFPLENBQUNGLEVBQUUsSUFBSXBCLEtBQUssRUFBRVgsTUFBTSxDQUFDO0lBQ3hDLElBQUlzQyxLQUFLLENBQUNDLE9BQU8sQ0FBQ0YsR0FBRyxDQUFDLElBQUlBLEdBQUcsQ0FBQ0csTUFBTSxLQUFLLENBQUMsRUFBRTtNQUMxQyxJQUFJSCxHQUFHLENBQUMsQ0FBQyxDQUFDLEtBQUssSUFBSSxFQUFFLE9BQU8xQyxPQUFPO01BQ25DLE9BQU8wQyxHQUFHLENBQUMsQ0FBQyxDQUFDO0lBQ2Y7SUFDQSxPQUFPQSxHQUFHO0VBQ1o7QUFDRiJ9 |
@@ -8,4 +8,5 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
constructor(definition: any, schemaAttribute: any); | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): any; | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args: any[]): any; | ||
denormalize(input: {}, unvisit: any): any; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): any; | ||
infer(args: any, indexes: any, recurse: any, entities: any): { | ||
@@ -12,0 +13,0 @@ id: any; |
@@ -14,4 +14,4 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
} | ||
normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
return this.normalizeValue(input, parent, key, visit, addEntity, visitedEntities); | ||
normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
return this.normalizeValue(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args); | ||
} | ||
@@ -21,2 +21,6 @@ | ||
denormalize(input, unvisit) { | ||
const value = this.denormalizeValue(input, unvisit); | ||
return [value, value !== undefined, typeof value === 'symbol']; | ||
} | ||
denormalizeOnly(input, args, unvisit) { | ||
return this.denormalizeValue(input, unvisit); | ||
@@ -37,2 +41,2 @@ } | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJQb2x5bW9ycGhpY1NjaGVtYSIsIlVuaW9uU2NoZW1hIiwiY29uc3RydWN0b3IiLCJkZWZpbml0aW9uIiwic2NoZW1hQXR0cmlidXRlIiwiRXJyb3IiLCJub3JtYWxpemUiLCJpbnB1dCIsInBhcmVudCIsImtleSIsInZpc2l0IiwiYWRkRW50aXR5IiwidmlzaXRlZEVudGl0aWVzIiwibm9ybWFsaXplVmFsdWUiLCJkZW5vcm1hbGl6ZSIsInVudmlzaXQiLCJkZW5vcm1hbGl6ZVZhbHVlIiwiaW5mZXIiLCJhcmdzIiwiaW5kZXhlcyIsInJlY3Vyc2UiLCJlbnRpdGllcyIsInVuZGVmaW5lZCIsImF0dHIiLCJnZXRTY2hlbWFBdHRyaWJ1dGUiLCJkaXNjcmltaW5hdGVkU2NoZW1hIiwic2NoZW1hIiwiaWQiXSwic291cmNlcyI6WyIuLi8uLi9zcmMvc2NoZW1hcy9Vbmlvbi50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUG9seW1vcnBoaWNTY2hlbWEgZnJvbSAnLi9Qb2x5bW9ycGhpYy5qcyc7XG5cbi8qKlxuICogUmVwcmVzZW50cyBwb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EVBQUVOLE9BQU8sQ0FBQ0ksbUJBQW1CLEVBQUVkLElBQUksRUFBRVMsT0FBTyxFQUFFRSxRQUFRLENBQUM7TUFDekRJLE1BQU0sRUFBRUg7SUFDVixDQUFDO0VBQ0g7QUFDRiJ9 |
export declare const getValues: (input: any) => any[]; | ||
export declare const filterEmpty: ([item, , deletedItem]: any) => boolean; | ||
export declare const filterEmpty: (item: any) => boolean; | ||
//# sourceMappingURL=utils.d.ts.map |
export const getValues = input => Array.isArray(input) ? input : Object.keys(input).map(key => input[key]); | ||
export const filterEmpty = ([item,, deletedItem]) => item !== undefined && !deletedItem; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJnZXRWYWx1ZXMiLCJpbnB1dCIsIkFycmF5IiwiaXNBcnJheSIsIk9iamVjdCIsImtleXMiLCJtYXAiLCJrZXkiLCJmaWx0ZXJFbXB0eSIsIml0ZW0iLCJkZWxldGVkSXRlbSIsInVuZGVmaW5lZCJdLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWFzL3V0aWxzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBnZXRWYWx1ZXMgPSAoaW5wdXQ6IGFueSkgPT5cbiAgQXJyYXkuaXNBcnJheShpbnB1dCkgPyBpbnB1dCA6IE9iamVjdC5rZXlzKGlucHV0KS5tYXAoa2V5ID0+IGlucHV0W2tleV0pO1xuXG5leHBvcnQgY29uc3QgZmlsdGVyRW1wdHkgPSAoW2l0ZW0sICwgZGVsZXRlZEl0ZW1dOiBhbnkpID0+XG4gIGl0ZW0gIT09IHVuZGVmaW5lZCAmJiAhZGVsZXRlZEl0ZW07XG4iXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sTUFBTUEsU0FBUyxHQUFJQyxLQUFVLElBQ2xDQyxLQUFLLENBQUNDLE9BQU8sQ0FBQ0YsS0FBSyxDQUFDLEdBQUdBLEtBQUssR0FBR0csTUFBTSxDQUFDQyxJQUFJLENBQUNKLEtBQUssQ0FBQyxDQUFDSyxHQUFHLENBQUNDLEdBQUcsSUFBSU4sS0FBSyxDQUFDTSxHQUFHLENBQUMsQ0FBQztBQUUxRSxPQUFPLE1BQU1DLFdBQVcsR0FBR0EsQ0FBQyxDQUFDQyxJQUFJLEdBQUlDLFdBQVcsQ0FBTSxLQUNwREQsSUFBSSxLQUFLRSxTQUFTLElBQUksQ0FBQ0QsV0FBVyJ9 | ||
export const filterEmpty = item => item !== undefined && typeof item !== 'symbol'; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJnZXRWYWx1ZXMiLCJpbnB1dCIsIkFycmF5IiwiaXNBcnJheSIsIk9iamVjdCIsImtleXMiLCJtYXAiLCJrZXkiLCJmaWx0ZXJFbXB0eSIsIml0ZW0iLCJ1bmRlZmluZWQiXSwic291cmNlcyI6WyIuLi8uLi9zcmMvc2NoZW1hcy91dGlscy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY29uc3QgZ2V0VmFsdWVzID0gKGlucHV0OiBhbnkpID0+XG4gIEFycmF5LmlzQXJyYXkoaW5wdXQpID8gaW5wdXQgOiBPYmplY3Qua2V5cyhpbnB1dCkubWFwKGtleSA9PiBpbnB1dFtrZXldKTtcblxuZXhwb3J0IGNvbnN0IGZpbHRlckVtcHR5ID0gKGl0ZW06IGFueSkgPT5cbiAgaXRlbSAhPT0gdW5kZWZpbmVkICYmIHR5cGVvZiBpdGVtICE9PSAnc3ltYm9sJztcbiJdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxNQUFNQSxTQUFTLEdBQUlDLEtBQVUsSUFDbENDLEtBQUssQ0FBQ0MsT0FBTyxDQUFDRixLQUFLLENBQUMsR0FBR0EsS0FBSyxHQUFHRyxNQUFNLENBQUNDLElBQUksQ0FBQ0osS0FBSyxDQUFDLENBQUNLLEdBQUcsQ0FBQ0MsR0FBRyxJQUFJTixLQUFLLENBQUNNLEdBQUcsQ0FBQyxDQUFDO0FBRTFFLE9BQU8sTUFBTUMsV0FBVyxHQUFJQyxJQUFTLElBQ25DQSxJQUFJLEtBQUtDLFNBQVMsSUFBSSxPQUFPRCxJQUFJLEtBQUssUUFBUSJ9 |
@@ -7,6 +7,7 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
export default class ValuesSchema extends PolymorphicSchema { | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): {}; | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args: any[]): {}; | ||
denormalize(input: {}, unvisit: any): {}[]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): any; | ||
infer(args: any, indexes: any, recurse: any): undefined; | ||
} | ||
//# sourceMappingURL=Values.d.ts.map |
@@ -8,3 +8,3 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
export default class ValuesSchema extends PolymorphicSchema { | ||
normalize(input, parent, key, visit, addEntity, visitedEntities) { | ||
normalize(input, parent, key, visit, addEntity, visitedEntities, storeEntities, args) { | ||
return Object.keys(input).reduce((output, key, index) => { | ||
@@ -14,3 +14,3 @@ const value = input[key]; | ||
...output, | ||
[key]: this.normalizeValue(value, input, key, visit, addEntity, visitedEntities) | ||
[key]: this.normalizeValue(value, input, key, visit, addEntity, visitedEntities, storeEntities, args) | ||
} : output; | ||
@@ -22,14 +22,6 @@ }, {}); | ||
denormalize(input, unvisit) { | ||
let found = true; | ||
let deleted = false; | ||
return [Object.keys(input).reduce((output, key) => { | ||
const entityOrId = input[key]; | ||
const [value, foundItem, deletedItem] = this.denormalizeValue(entityOrId, unvisit); | ||
if (!foundItem) { | ||
found = false; | ||
} | ||
if (deletedItem) { | ||
deleted = true; | ||
} | ||
if (!foundItem || deletedItem) return output; | ||
const value = this.denormalizeValue(entityOrId, unvisit); | ||
if (!value || typeof value === 'symbol') return output; | ||
return { | ||
@@ -39,4 +31,17 @@ ...output, | ||
}; | ||
}, {}), found, deleted]; | ||
}, {}), true, false]; | ||
} | ||
denormalizeOnly(input, args, unvisit) { | ||
return Object.keys(input).reduce((output, key) => { | ||
const entityOrId = input[key]; | ||
const value = this.denormalizeValue(entityOrId, unvisit); | ||
// remove empty or deleted values | ||
if (!value || typeof value === 'symbol') return output; | ||
return { | ||
...output, | ||
[key]: value | ||
}; | ||
}, {}); | ||
} | ||
infer(args, indexes, recurse) { | ||
@@ -46,2 +51,2 @@ return undefined; | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJQb2x5bW9ycGhpY1NjaGVtYSIsIlZhbHVlc1NjaGVtYSIsIm5vcm1hbGl6ZSIsImlucHV0IiwicGFyZW50Iiwia2V5IiwidmlzaXQiLCJhZGRFbnRpdHkiLCJ2aXNpdGVkRW50aXRpZXMiLCJPYmplY3QiLCJrZXlzIiwicmVkdWNlIiwib3V0cHV0IiwiaW5kZXgiLCJ2YWx1ZSIsInVuZGVmaW5lZCIsIm5vcm1hbGl6ZVZhbHVlIiwiZGVub3JtYWxpemUiLCJ1bnZpc2l0IiwiZm91bmQiLCJkZWxldGVkIiwiZW50aXR5T3JJZCIsImZvdW5kSXRlbSIsImRlbGV0ZWRJdGVtIiwiZGVub3JtYWxpemVWYWx1ZSIsImluZmVyIiwiYXJncyIsImluZGV4ZXMiLCJyZWN1cnNlIl0sInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NjaGVtYXMvVmFsdWVzLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBQb2x5bW9ycGhpY1NjaGVtYSBmcm9tICcuL1BvbHltb3JwaGljLmpzJztcblxuLyoqXG4gKiBSZXByZXNlbnRzIHZhcmlhYmx5IHNpemVkIG9iamVjdHNcbiAqIEBzZWUgaHR0cHM6Ly9yZXN0aG9va3MuaW8vcmVzdC9hcGkvVmFsdWVzXG4gKi9cbmV4cG9ydCBkZWZhdWx0IGNsYXNzIFZhbHVlc1NjaGVtYSBleHRlbmRzIFBvbHltb3JwaGljU2NoZW1hIHtcbiAgbm9ybWFsaXplKFxuICAgIGlucHV0OiBhbnksXG4gICAgcGFyZW50OiBhbnksXG4gICAga2V5OiBhbnksXG4gICAgdmlzaXQ6IGFueSxcbiAgICBhZGRFbnRpdHk6IGFueSxcbiAgICB2aXNpdGVkRW50aXRpZXM6IGFueSxcbiAgKSB7XG4gICAgcmV0dXJuIE9iamVjdC5rZXlzKGlucHV0KS5yZWR1Y2UoKG91dHB1dCwga2V5LCBpbmRleCkgPT4ge1xuICAgICAgY29uc3QgdmFsdWUgPSBpbnB1dFtrZXldO1xuICAgICAgcmV0dXJuIHZhbHVlICE9PSB1bmRlZmluZWQgJiYgdmFsdWUgIT09IG51bGxcbiAgICAgICAgPyB7XG4gICAgICAgICAgICAuLi5vdXRwdXQsXG4gICAgICAgICAgICBba2V5XTogdGhpcy5ub3JtYWxpemVWYWx1ZShcbiAgICAgICAgICAgICAgdmFsdWUsXG4gICAgICAgICAgICAgIGlucHV0LFxuICAgICAgICAgICAgICBrZXksXG4gICAgICAgICAgICAgIHZpc2l0LFxuICAgICAgICAgICAgICBhZGRFbnRpdHksXG4gICAgICAgICAgICAgIHZpc2l0ZWRFbnRpdGllcyxcbiAgICAgICAgICAgICksXG4gICAgICAgICAgfVxuICAgICAgICA6IG91dHB1dDtcbiAgICB9LCB7fSk7XG4gIH1cblxuICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L2Jhbi10eXBlc1xuICBkZW5vcm1hbGl6ZShpbnB1dDoge30sIHVudmlzaXQ6IGFueSkge1xuICAgIGxldCBmb3VuZCA9IHRydWU7XG4gICAgbGV0IGRlbGV0ZWQgPSBmYWxzZTtcbiAgICByZXR1cm4gW1xuICAgICAgT2JqZWN0LmtleXMoaW5wdXQpLnJlZHVjZSgob3V0cHV0LCBrZXkpID0+IHtcbiA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b3J0IGRlZmF1bHQgY2xhc3MgVmFsdWVzU2NoZW1hIGV4dGVuZHMgUG9seW1vcnBoaWNTY2hlbWEge1xuICBub3JtYWxpemUoXG4gICAgaW5wdXQ6IGFueSxcbiAgICBwYXJlbnQ6IGFueSxcbiAgICBrZXk6IGFueSxcbiAgICB2aXNpdDogYW55LFxuICAgIGFkZEVudGl0eTogYW55LFxuICAgIHZpc2l0ZWRFbnRpdGllczogYW55LFxuICAgIHN0b3JlRW50aXRpZXM6IGFueSxcbiAgICBhcmdzOiBhbnlbXSxcbiAgKSB7XG4gICAgcmV0dXJuIE9iamVjdC5rZXlzKGlucHV0KS5yZWR1Y2UoKG91dHB1dCwga2V5LCBpbmRleCkgPT4ge1xuICAgICAgY29uc3QgdmFsdWUgPSBpbnB1dFtrZXldO1xuICAgICAgcmV0dXJuIHZhbHVlICE9PSB1bmRlZmluZWQgJiYgdmFsdWUgIT09IG51bGxcbiAgICAgICAgPyB7XG4gICAgICAgICAgICAuLi5vdXRwdXQsXG4gICAgICAgICAgICBba2V5XTogdGhpcy5ub3JtYWxpemVWYWx1ZShcbiAgICAgICAgICAgICAgdmFsdWUsXG4gICAgICAgICAgICAgIGlucHV0LFxuICAgICAgICAgICAgICBrZXksXG4gICAgICAgICAgICAgIHZpc2l0LFxuICAgICAgICAgICAgICBhZGRFbnRpdHksXG4gICAgICAgICAgICAgIHZpc2l0ZWRFbnRpdGllcyxcbiAgICAgICAgICAgICAgc3RvcmVFbnRpdGllcyxcbiAgICAgICAgICAgICAgYXJncyxcbiAgICAgICAgICAgICksXG4gICAgICAgICAgfVxuICAgICAgICA6IG91dHB1dDtcbiAgICB9LCB7fSk7XG4gIH1cblxuICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L2Jhbi10eXBlc1xuICBkZW5vcm1hbGl6ZShpbnB1dDoge30sIHVudmlzaXQ6IGFueSkge1xuICAgIHJldHVybiBbXG4gICAgICBPYmplY3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2QsSUFBUyxFQUFFZSxPQUFZLEVBQUVDLE9BQVksRUFBRTtJQUMzQyxPQUFPVCxTQUFTO0VBQ2xCO0FBQ0YifQ== |
export declare const DELETED: unique symbol; | ||
export declare const INVALID: symbol; | ||
//# sourceMappingURL=special.d.ts.map |
export const DELETED = Symbol('ENTITY WAS DELETED'); | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJERUxFVEVEIiwiU3ltYm9sIl0sInNvdXJjZXMiOlsiLi4vc3JjL3NwZWNpYWwudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IERFTEVURUQgPSBTeW1ib2woJ0VOVElUWSBXQVMgREVMRVRFRCcpO1xuIl0sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLE1BQU1BLE9BQU8sR0FBR0MsTUFBTSxDQUFDLG9CQUFvQixDQUFDIn0= | ||
export const INVALID = DELETED; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJERUxFVEVEIiwiU3ltYm9sIiwiSU5WQUxJRCJdLCJzb3VyY2VzIjpbIi4uL3NyYy9zcGVjaWFsLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBERUxFVEVEID0gU3ltYm9sKCdFTlRJVFkgV0FTIERFTEVURUQnKTtcbmV4cG9ydCBjb25zdCBJTlZBTElEID0gREVMRVRFRDtcbiJdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxNQUFNQSxPQUFPLEdBQUdDLE1BQU0sQ0FBQyxvQkFBb0IsQ0FBQztBQUNuRCxPQUFPLE1BQU1DLE9BQU8sR0FBR0YsT0FBTyJ9 |
export * from './utility.js'; | ||
export * from './ErrorTypes.js'; | ||
// This hack is only needed for @rest-hooks/rest@5 or below | ||
/** @deprecated */ | ||
/** @deprecated */ | ||
export {}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64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qL1xuICByZWFkb25seSBleHRyYT86IGFueTtcbn1cbiJdLCJtYXBwaW5ncyI6IkFBS0EsY0FBYyxjQUFjO0FBQzVCLGNBQWMsaUJBQWlCOztBQU0vQjtBQUNBO0FBTUE7QUFBQSJ9 |
{ | ||
"name": "@rest-hooks/endpoint", | ||
"version": "3.7.4", | ||
"version": "3.8.0-next.0", | ||
"description": "Declarative Network Interface Definitions", | ||
@@ -71,16 +71,15 @@ "sideEffects": false, | ||
"scripts": { | ||
"build:lib": "NODE_ENV=production BROWSERSLIST_ENV='2020' babel --root-mode upward src --out-dir lib --extensions '.ts,.tsx,.js' --ignore '**/__tests__/**' --ignore '**/*.d.ts'", | ||
"build:legacy:lib": "NODE_ENV=production BROWSERSLIST_ENV='2018' babel --root-mode upward src --out-dir legacy --extensions '.ts,.tsx,.js' --ignore '**/__tests__/**' --ignore '**/*.d.ts'", | ||
"build:js:node": "BROWSERSLIST_ENV=node12 rollup -c && echo '{\"type\":\"commonjs\"}' > dist/package.json", | ||
"build:js:browser": "BROWSERSLIST_ENV=legacy rollup -c", | ||
"build:bundle": "run-s build:js:\\*", | ||
"build:clean": "rimraf lib dist legacy ts3.4 ts4.0 ts4.2 *.tsbuildinfo", | ||
"build": "yarn run build:lib && yarn run build:legacy:lib && yarn run build:bundle", | ||
"build:legacy-types": "yarn run downlevel-dts lib ts3.4 && yarn run downlevel-dts lib ts4.0 --to=4.0 && yarn run downlevel-dts lib ts4.2 --to=4.2 && copyfiles --up 1 ./src-4.2-types/**/*.d.ts ./ts4.0/ && copyfiles --up 1 ./src-4.2-types/**/*.d.ts ./ts4.2 && copyfiles --up 1 ./src-4.0-types/**/*.d.ts ./ts3.4/ && copyfiles --up 1 ./src-4.0-types/**/*.d.ts ./ts4.0 && copyfiles --up 1 ./src-legacy-types/**/*.d.ts ./ts3.4/", | ||
"dev": "yarn run build:lib -w", | ||
"prepare": "yarn run build:lib", | ||
"prepack": "yarn prepare", | ||
"prepublishOnly": "yarn run build:bundle && yarn run build:legacy:lib", | ||
"tsc:ci": "tsc --project tsconfig.test.json", | ||
"typecheck": "yarn run tsc:ci" | ||
"build:lib": "NODE_ENV=production BROWSERSLIST_ENV='2020' yarn g:babel --out-dir lib --ignore 'src/schemas-3.7'", | ||
"build:legacy:lib": "NODE_ENV=production BROWSERSLIST_ENV='2018' yarn g:babel --out-dir legacy --ignore 'src/schemas-3.7'", | ||
"build:js:node": "BROWSERSLIST_ENV=node12 yarn g:rollup && echo '{\"type\":\"commonjs\"}' > dist/package.json", | ||
"build:js:browser": "BROWSERSLIST_ENV=legacy yarn g:rollup", | ||
"build:bundle": "yarn g:runs build:js:\\*", | ||
"build:clean": "yarn g:clean ts4.0 ts4.2", | ||
"build": "run build:lib && run build:legacy:lib && run build:bundle", | ||
"build:legacy-types": "yarn g:downtypes lib ts3.4 && yarn g:downtypes lib ts4.0 --to=4.0 && yarn g:downtypes lib ts4.2 --to=4.2 && yarn g:copy --up 1 ./src-4.2-types/**/*.d.ts ./ts4.0/ && yarn g:copy --up 1 ./src-4.2-types/**/*.d.ts ./ts4.2 && yarn g:copy --up 1 ./src-4.0-types/**/*.d.ts ./ts3.4/ && yarn g:copy --up 1 ./src-4.0-types/**/*.d.ts ./ts4.0 && yarn g:copy --up 1 ./src-legacy-types/**/*.d.ts ./ts3.4/", | ||
"dev": "run build:lib -w", | ||
"prepare": "run build:lib", | ||
"prepack": "run prepare && run build:bundle && run build:legacy:lib", | ||
"tsc:ci": "yarn g:tsc --project tsconfig.test.json", | ||
"typecheck": "run tsc:ci" | ||
}, | ||
@@ -124,18 +123,5 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/cli": "7.21.0", | ||
"@babel/core": "7.21.3", | ||
"@types/babel__core": "^7", | ||
"downlevel-dts": "^0.10.0", | ||
"npm-run-all": "^4.1.5", | ||
"rollup": "2.79.1", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-filesize": "^9.1.2", | ||
"rollup-plugin-json": "^4.0.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-replace": "^2.2.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"typescript": "5.0.2" | ||
}, | ||
"gitHead": "37f056da08be038bc1c6ffabcbad140cd42c6346" | ||
"@anansi/browserslist-config": "^1.4.2", | ||
"@types/node": "^18.15.10" | ||
} | ||
} |
@@ -17,28 +17,68 @@ # TypeScript Standard Endpoints | ||
### 1) Define the function | ||
## Usage | ||
### 1) Take any class and async functions | ||
```typescript | ||
import { Endpoint } from '@rest-hooks/endpoint'; | ||
export class Todo { | ||
id = 0; | ||
userId = 0; | ||
title = ''; | ||
completed = false; | ||
} | ||
const fetchUser = ({ id }) ⇒ fetch(`/users/${id}`).then(res => res.json()); | ||
const UserDetail = new Endpoint(fetchUser); | ||
export const getTodo = (id: string) => | ||
fetch(`https://jsonplaceholder.typicode.com/todos/${id}`).then(res => res.json()); | ||
export const getTodoList = () => | ||
fetch('https://jsonplaceholder.typicode.com/todos').then(res => res.json()); | ||
export const updateTodo = (id: string, body: Partial<Todo>) => | ||
fetch(`https://jsonplaceholder.typicode.com/todos/${id}`, { | ||
method: 'PUT', | ||
body: JSON.stringify(body), | ||
}).then(res => res.json()); | ||
``` | ||
### 2) Reuse with different hooks | ||
### 2) Turn them into Resources | ||
```typescript | ||
import { schema, Endpoint } from '@rest-hooks/endpoint'; | ||
import { Todo, getTodoList, updateTodo } from './existing'; | ||
export const TodoEntity = schema.Entity(Todo, { key: 'Todo' }); | ||
export const TodoResource = { | ||
get: new Endpoint(getTodo, { | ||
schema: TodoEntity, | ||
}), | ||
getList: new Endpoint(getTodoList, { | ||
schema: [TodoEntity], | ||
}), | ||
update: new Endpoint(updateTodo, { | ||
schema: TodoEntity, | ||
sideEffect: true, | ||
}), | ||
}; | ||
``` | ||
### 3) Reuse with different hooks | ||
```tsx | ||
function UserProfile() { | ||
const user = useSuspense(UserDetail, { id }); | ||
import { useSuspense, useController } from '@rest-hooks/react'; | ||
function TodoEdit() { | ||
const todo = useSuspense(TodoResource.get, '5'); | ||
const ctrl = useController(); | ||
const updateUser = (data) => ctrl.fetch(UserDetail, { id }, data); | ||
const updateTodo = (data) => ctrl.fetch(TodoResource.update, id, data); | ||
return <UserForm user={user} onSubmit={updateUser} /> | ||
return <TodoForm todo={todo} onSubmit={updateTodo} /> | ||
} | ||
``` | ||
### 3) Or call directly | ||
### 4) Or call directly in node | ||
```typescript | ||
const user = await UserDetail({ id: '5' }); | ||
console.log(user); | ||
const todo = await TodoResource.get('5') | ||
console.log(todo); | ||
``` | ||
@@ -45,0 +85,0 @@ |
@@ -20,4 +20,4 @@ Object.hasOwn = | ||
export { default as Entity } from './schemas/Entity.js'; | ||
export { default as validateRequired } from './schemas/validatRequired.js'; | ||
export { DELETED } from './special.js'; | ||
export { default as validateRequired } from './validateRequired.js'; | ||
export { DELETED, INVALID } from './special.js'; | ||
export type { | ||
@@ -24,0 +24,0 @@ Schema, |
@@ -28,2 +28,4 @@ import { AbstractInstanceType, Denormalize, EntityMap } from './normal.js'; | ||
visitedEntities: Record<string, any>, | ||
storeEntities: any, | ||
args: any[], | ||
): any; | ||
@@ -35,2 +37,7 @@ denormalize( | ||
): [denormalized: T, found: boolean, suspend: boolean]; | ||
denormalizeOnly?( | ||
input: {}, | ||
args: any, | ||
unvisit: (input: any, schema: any) => any, | ||
): T; | ||
infer( | ||
@@ -54,3 +61,3 @@ args: readonly any[], | ||
createIfValid?(props: any): any; | ||
pk(params: any, parent?: any, key?: string): string | undefined; | ||
pk(params: any, parent?: any, key?: string, args?: any[]): string | undefined; | ||
readonly key: string; | ||
@@ -65,2 +72,8 @@ merge(existing: any, incoming: any): any; | ||
): any; | ||
mergeMetaWithStore?( | ||
existingMeta: any, | ||
incomingMeta: any, | ||
existing: any, | ||
incoming: any, | ||
): any; | ||
// TODO(breaking): deprecate this | ||
@@ -79,3 +92,3 @@ useIncoming?( | ||
export interface UnvisitFunction { | ||
(input: any, schema: any): [any, boolean, boolean]; | ||
(input: any, schema: any): [any, boolean, boolean] | any; | ||
og?: UnvisitFunction; | ||
@@ -82,0 +95,0 @@ setLocal?: (entity: any) => void; |
@@ -71,3 +71,5 @@ import type { | ||
? AbstractInstanceType<S> | ||
: S extends SchemaClass | ||
: S extends { denormalizeOnly: (...args: any) => any } | ||
? ReturnType<S['denormalizeOnly']> | ||
: S extends { denormalize: (...args: any) => any } | ||
? DenormalizeReturnType<S['denormalize']> | ||
@@ -86,3 +88,3 @@ : S extends Serializable<infer T> | ||
? DenormalizeNullableNestedSchema<S> | ||
: S extends SchemaClass | ||
: S extends { _denormalizeNullable: (...args: any) => any } | ||
? DenormalizeReturnType<S['_denormalizeNullable']> | ||
@@ -101,3 +103,3 @@ : S extends Serializable<infer T> | ||
? NormalizeObject<S['schema']> | ||
: S extends SchemaClass | ||
: S extends { normalize: (...args: any) => any } | ||
? NormalizeReturnType<S['normalize']> | ||
@@ -116,3 +118,3 @@ : S extends Serializable<infer T> | ||
? NormalizedNullableObject<S['schema']> | ||
: S extends SchemaClass | ||
: S extends { _normalizeNullable: (...args: any) => any } | ||
? NormalizeReturnType<S['_normalizeNullable']> | ||
@@ -119,0 +121,0 @@ : S extends Serializable<infer T> |
@@ -42,6 +42,18 @@ import type { | ||
) => { | ||
if (input === undefined) return [undefined, false, true]; | ||
if (input === undefined) return [undefined, false, false]; | ||
const [value, found, deleted] = schema.denormalize(input, unvisit); | ||
return [found ? this.process(value, ...args) : undefined, found, deleted]; | ||
}; | ||
if (schema.denormalizeOnly) | ||
query.denormalizeOnly = ( | ||
{ args, input }: { args: P; input: any }, | ||
_: P, | ||
unvisit: any, | ||
) => { | ||
if (input === undefined) return undefined; | ||
const value = (schema as any).denormalizeOnly(input, args, unvisit); | ||
return typeof value === 'symbol' | ||
? undefined | ||
: this.process(value, ...args); | ||
}; | ||
query.infer = ( | ||
@@ -76,2 +88,7 @@ args: any, | ||
): [denormalized: R | undefined, found: boolean, suspend: boolean]; | ||
denormalizeOnly( | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): R; | ||
}; |
@@ -21,2 +21,3 @@ import type { | ||
} from './normal.js'; | ||
import { CollectionOptions } from './schemas/Collection.js'; | ||
import { default as Delete } from './schemas/Delete.js'; | ||
@@ -32,4 +33,5 @@ import { | ||
} from './schemas/EntitySchema.js'; | ||
import { default as Invalidate } from './schemas/Invalidate.js'; | ||
export { Delete, EntityMap }; | ||
export { Delete, EntityMap, Invalidate }; | ||
@@ -60,2 +62,4 @@ export { EntityInterface } from './interface.js'; | ||
visitedEntities: Record<string, any>, | ||
storeEntities: any, | ||
args?: any[], | ||
): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]; | ||
@@ -83,2 +87,8 @@ | ||
denormalizeOnly( | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): (S extends EntityMap<infer T> ? T : Denormalize<S>)[]; | ||
infer( | ||
@@ -117,2 +127,4 @@ args: readonly any[], | ||
visitedEntities: Record<string, any>, | ||
storeEntities: any, | ||
args?: any[], | ||
): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]; | ||
@@ -140,2 +152,8 @@ | ||
denormalizeOnly( | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): (S extends EntityMap<infer T> ? T : Denormalize<S>)[]; | ||
infer( | ||
@@ -166,2 +184,4 @@ args: readonly any[], | ||
visitedEntities: Record<string, any>, | ||
storeEntities: any, | ||
args?: any[], | ||
): NormalizeObject<O>; | ||
@@ -179,2 +199,8 @@ | ||
denormalizeOnly( | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): DenormalizeObject<O>; | ||
infer( | ||
@@ -210,2 +236,4 @@ args: readonly any[], | ||
visitedEntities: Record<string, any>, | ||
storeEntities: any, | ||
args?: any[], | ||
): UnionResult<Choices>; | ||
@@ -231,2 +259,8 @@ | ||
denormalizeOnly( | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): AbstractInstanceType<Choices[keyof Choices]>; | ||
infer( | ||
@@ -269,2 +303,4 @@ args: readonly any[], | ||
visitedEntities: Record<string, any>, | ||
storeEntities: any, | ||
args?: any[], | ||
): Record< | ||
@@ -308,2 +344,11 @@ string, | ||
denormalizeOnly( | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): Record< | ||
string, | ||
Choices extends EntityMap<infer T> ? T : Denormalize<Choices> | ||
>; | ||
infer( | ||
@@ -316,2 +361,134 @@ args: readonly any[], | ||
/** | ||
* Entities but for Arrays instead of classes | ||
* @see https://resthooks.io/rest/api/Collection | ||
*/ | ||
export class CollectionSchema< | ||
S extends Array<any> | Values<any> = any, | ||
Parent extends any[] = any, | ||
> { | ||
addWith<P extends any[] = Parent>( | ||
merge: (existing: any, incoming: any) => any, | ||
createCollectionFilter?: ( | ||
...args: P | ||
) => (collectionKey: Record<string, any>) => boolean, | ||
): CollectionSchema<S, P>; | ||
readonly schema: S; | ||
key: string; | ||
pk(value: any, parent: any, key: string, args: any[]): string; | ||
normalize( | ||
input: any, | ||
parent: Parent, | ||
key: string, | ||
visit: (...args: any) => any, | ||
addEntity: (...args: any) => any, | ||
visitedEntities: Record<string, any>, | ||
storeEntities: any, | ||
args: any[], | ||
): string; | ||
merge(existing: any, incoming: any): any; | ||
shouldReorder( | ||
existingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, | ||
incomingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, | ||
existing: any, | ||
incoming: any, | ||
): boolean; | ||
mergeWithStore( | ||
existingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, | ||
incomingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, | ||
existing: any, | ||
incoming: any, | ||
): any; | ||
mergeMetaWithStore( | ||
existingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, | ||
incomingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, | ||
existing: any, | ||
incoming: any, | ||
): { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}; | ||
infer( | ||
args: unknown, | ||
indexes: unknown, | ||
recurse: unknown, | ||
entities: unknown, | ||
): any; | ||
createIfValid: (value: any) => any | undefined; | ||
denormalizeOnly( | ||
input: any, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): ReturnType<S['denormalizeOnly']>; | ||
_denormalizeNullable(): ReturnType<S['_denormalizeNullable']>; | ||
_normalizeNullable(): ReturnType<S['_normalizeNullable']>; | ||
} | ||
export type CollectionType< | ||
S extends any[] | Array<any> | Values<any> = any, | ||
Parent extends any[] = [ | ||
urlParams: Record<string, any>, | ||
body?: Record<string, any>, | ||
], | ||
> = CollectionSchema<S extends any[] ? Array<S[number]> : S> & | ||
(S extends any[] | ||
? { | ||
push: CollectionSchema<Array<S[number]>, Parent>; | ||
unshift: CollectionSchema<Array<S[number]>, Parent>; | ||
} | ||
: S extends Values<any> | ||
? { assign: CollectionSchema<S, Parent> } | ||
: S extends Array<any> | ||
? { | ||
push: CollectionSchema<S, Parent>; | ||
unshift: CollectionSchema<S, Parent>; | ||
} | ||
: never); | ||
export interface CollectionConstructor { | ||
new < | ||
S extends SchemaSimple[] | Array<any> | Values<any> = any, | ||
Parent extends any[] = [ | ||
urlParams: Record<string, any>, | ||
body?: Record<string, any>, | ||
], | ||
>( | ||
schema: S, | ||
options: CollectionOptions, | ||
): CollectionType<S, Parent>; | ||
readonly prototype: CollectionSchema; | ||
} | ||
/** | ||
* Entities but for Arrays instead of classes | ||
* @see https://resthooks.io/rest/api/Collection | ||
*/ | ||
export declare let Collection: CollectionConstructor; | ||
export type StrategyFunction<T> = (value: any, parent: any, key: string) => T; | ||
@@ -342,2 +519,26 @@ export type SchemaFunction<K = string> = ( | ||
export interface SchemaSimpleNew<T = any> { | ||
normalize( | ||
input: any, | ||
parent: any, | ||
key: any, | ||
visit: (...args: any) => any, | ||
addEntity: (...args: any) => any, | ||
visitedEntities: Record<string, any>, | ||
storeEntities: any, | ||
args?: any[], | ||
): any; | ||
denormalizeOnly( | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): T; | ||
infer( | ||
args: readonly any[], | ||
indexes: NormalizedIndex, | ||
recurse: (...args: any) => any, | ||
entities: EntityTable, | ||
): any; | ||
} | ||
// id is in Instance, so we default to that as pk | ||
@@ -344,0 +545,0 @@ /** |
@@ -8,2 +8,4 @@ /* istanbul ignore file */ | ||
export { default as Delete } from './schemas/Delete.js'; | ||
export { default as Invalidate } from './schemas/Invalidate.js'; | ||
export { default as Collection } from './schemas/Collection.js'; | ||
export { default as Entity } from './schemas/EntitySchema.js'; |
@@ -159,12 +159,8 @@ // eslint-env jest | ||
const input = inferResults(catSchema, [], {}, entities); | ||
let [value, found] = denormalize(input, catSchema, createInput(entities)); | ||
let value = denormalize(input, catSchema, createInput(entities)); | ||
expect(value).not.toEqual(expect.any(Symbol)); | ||
if (typeof value === 'symbol') return; | ||
expect(createOutput(value.results)).toMatchSnapshot(); | ||
expect(found).toBe(true); | ||
[value, found] = denormalize( | ||
createInput(input), | ||
catSchema, | ||
createInput(entities), | ||
); | ||
value = denormalize(createInput(input), catSchema, createInput(entities)); | ||
expect(createOutput(value)).toMatchSnapshot(); | ||
expect(found).toBe(true); | ||
}); | ||
@@ -184,13 +180,9 @@ | ||
const input = inferResults(catSchema, [], {}, entities); | ||
let [value, found] = denormalize(input, catSchema, createInput(entities)); | ||
let value = denormalize(input, catSchema, createInput(entities)); | ||
expect(value).not.toEqual(expect.any(Symbol)); | ||
if (typeof value === 'symbol') return; | ||
expect(createOutput(value.results).length).toBe(2); | ||
expect(createOutput(value.results)).toMatchSnapshot(); | ||
expect(found).toBe(true); | ||
[value, found] = denormalize( | ||
createInput(input), | ||
catSchema, | ||
createInput(entities), | ||
); | ||
value = denormalize(createInput(input), catSchema, createInput(entities)); | ||
expect(createOutput(value)).toMatchSnapshot(); | ||
expect(found).toBe(true); | ||
}); | ||
@@ -211,3 +203,3 @@ | ||
const resultCache = new WeakEntityMap(); | ||
const [value, found] = denormalize( | ||
const value = denormalize( | ||
input, | ||
@@ -222,4 +214,3 @@ catSchema, | ||
expect(createOutput(value).results).toMatchSnapshot(); | ||
expect(found).toBe(true); | ||
const [value2, found2] = denormalize( | ||
const value2 = denormalize( | ||
input, | ||
@@ -235,3 +226,2 @@ catSchema, | ||
expect(value).toBe(value2); | ||
expect(found).toBe(found2); | ||
@@ -246,3 +236,3 @@ entities = { | ||
const input3 = createInput(inferResults(catSchema, [], {}, entities)); | ||
const [value3, found3] = denormalize( | ||
const value3 = denormalize( | ||
input3, | ||
@@ -265,3 +255,3 @@ catSchema, | ||
test('denormalizes should not be found when no entities are present', () => { | ||
test('denormalizes should be invalid when no entities are present', () => { | ||
class Cat extends IDEntity {} | ||
@@ -277,3 +267,3 @@ const catSchema = { results: new schema.All(Cat) }; | ||
const [value, found] = denormalize( | ||
const value = denormalize( | ||
createInput(input), | ||
@@ -283,5 +273,4 @@ catSchema, | ||
); | ||
expect(found).toBe(false); | ||
expect(createOutput(value)).toEqual({ results: undefined }); | ||
expect(createOutput(value)).toEqual(expect.any(Symbol)); | ||
}); | ||
@@ -315,3 +304,3 @@ | ||
const input = inferResults(listSchema, [], {}, entities); | ||
const [value, found] = denormalize( | ||
const value = denormalize( | ||
createInput(input), | ||
@@ -321,3 +310,2 @@ listSchema, | ||
); | ||
expect(found).toBe(false); | ||
@@ -382,9 +370,5 @@ expect(createOutput(value)).toEqual(undefined); | ||
const input = inferResults(listSchema, [], {}, entities); | ||
const [value, found, deleted] = denormalize( | ||
input, | ||
listSchema, | ||
createInput(entities), | ||
); | ||
expect(found).toBe(true); | ||
expect(deleted).toBe(false); | ||
const value = denormalize(input, listSchema, createInput(entities)); | ||
expect(value).not.toEqual(expect.any(Symbol)); | ||
if (typeof value === 'symbol') return; | ||
expect(value).toMatchSnapshot(); | ||
@@ -391,0 +375,0 @@ const first = value && value[0]; |
@@ -6,3 +6,3 @@ // eslint-env jest | ||
import denormalize from './denormalize'; | ||
import { denormalizeSimple, denormalizeLegacy } from './denormalize'; | ||
import { schema } from '../../'; | ||
@@ -34,7 +34,7 @@ | ||
['plain', sch => [sch]], | ||
])(`${schema.Array.name} normalization (%s)`, (_, createArray) => { | ||
])(`${schema.Array.name} normalization (%s)`, (_, createSchema) => { | ||
describe('Object', () => { | ||
test('should throw a custom error if data loads with string unexpected value', () => { | ||
class User extends IDEntity {} | ||
const sch = createArray(User); | ||
const sch = createSchema(User); | ||
function normalizeBad() { | ||
@@ -48,3 +48,3 @@ normalize('abc', sch); | ||
class User extends IDEntity {} | ||
const sch = createArray(User); | ||
const sch = createSchema(User); | ||
function normalizeBad() { | ||
@@ -73,3 +73,3 @@ normalize('[{"id":5}]', sch); | ||
static schema = { | ||
children: createArray(Child), | ||
children: createSchema(Child), | ||
}; | ||
@@ -93,3 +93,3 @@ } | ||
expect( | ||
normalize({ foo: { id: '1' }, bar: { id: '2' } }, createArray(User)), | ||
normalize({ foo: { id: '1' }, bar: { id: '2' } }, createSchema(User)), | ||
).toMatchSnapshot(); | ||
@@ -102,3 +102,3 @@ }); | ||
test('normalizes a single entity', () => { | ||
const listSchema = createArray(Cats); | ||
const listSchema = createSchema(Cats); | ||
expect( | ||
@@ -136,3 +136,3 @@ normalize([{ id: '1' }, { id: '2' }], listSchema), | ||
class User extends IDEntity {} | ||
const users = createArray(User); | ||
const users = createSchema(User); | ||
expect( | ||
@@ -145,3 +145,3 @@ normalize({ foo: { id: '1' }, bar: { id: '2' } }, users), | ||
class User extends IDEntity {} | ||
const users = createArray(User); | ||
const users = createSchema(User); | ||
expect( | ||
@@ -155,10 +155,39 @@ normalize([undefined, { id: '123' }, null], users), | ||
describe.each([ | ||
['class, direct', sch => new schema.Array(sch), data => data], | ||
['object, direct', sch => [sch], data => data], | ||
['class, immutable', sch => new schema.Array(sch), fromJS], | ||
['object, immutable', sch => [sch], fromJS], | ||
])( | ||
`${schema.Array.name} denormalization (%s)`, | ||
(_, createSchema, createInput) => { | ||
describe('Object', () => { | ||
['direct', data => data], | ||
['immutable', fromJS], | ||
])(`input (%s)`, (_, createInput) => { | ||
test('denormalizes plain arrays with nothing inside', () => { | ||
class User extends IDEntity {} | ||
const entities = { | ||
User: { | ||
1: { id: '1', name: 'Jane' }, | ||
}, | ||
}; | ||
const sch = new schema.Object({ user: User, tacos: [] }); | ||
expect( | ||
denormalizeSimple({ user: '1' }, sch, createInput(entities)), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalizeSimple(createInput({ user: '1' }), sch, createInput(entities)), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalizeSimple({ user: '1', tacos: [] }, sch, createInput(entities)), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalizeSimple( | ||
createInput({ user: '1', tacos: [] }), | ||
sch, | ||
createInput(entities), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
describe.each([ | ||
['class', sch => new schema.Array(sch), denormalizeSimple], | ||
['class, legacy', sch => new schema.Array(sch), denormalizeLegacy], | ||
['object, direct', sch => [sch], denormalizeSimple], | ||
])( | ||
`${schema.Array.name} denormalization (%s)`, | ||
(_, createSchema, denormalize) => { | ||
test('denormalizes a single entity', () => { | ||
@@ -194,40 +223,2 @@ class Cat extends IDEntity {} | ||
test('denormalizes plain arrays with nothing inside', () => { | ||
class User extends IDEntity {} | ||
const entities = { | ||
User: { | ||
1: { id: '1', name: 'Jane' }, | ||
}, | ||
}; | ||
expect( | ||
denormalize( | ||
{ user: '1' }, | ||
{ user: User, tacos: [] }, | ||
createInput(entities), | ||
), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize( | ||
createInput({ user: '1' }), | ||
{ user: User, tacos: [] }, | ||
createInput(entities), | ||
), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize( | ||
{ user: '1', tacos: [] }, | ||
{ user: User, tacos: [] }, | ||
createInput(entities), | ||
), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize( | ||
createInput({ user: '1', tacos: [] }), | ||
{ user: User, tacos: [] }, | ||
createInput(entities), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
test('denormalizes plain arrays with plain object inside', () => { | ||
@@ -240,3 +231,6 @@ class User extends IDEntity {} | ||
}; | ||
const sch = { user: User, tacos: createSchema({ next: '' }) }; | ||
const sch = new schema.Object({ | ||
user: User, | ||
tacos: createSchema({ next: '' }), | ||
}); | ||
expect( | ||
@@ -263,3 +257,3 @@ denormalize({ user: '1' }, sch, createInput(entities)), | ||
class Cat extends IDEntity {} | ||
const catSchema = { results: createSchema(Cat) }; | ||
const catSchema = new schema.Object({ results: createSchema(Cat) }); | ||
const entities = { | ||
@@ -282,3 +276,6 @@ Cat: { | ||
class Cat extends IDEntity {} | ||
const catSchema = { results: createSchema(Cat), nextPage: '' }; | ||
const catSchema = new schema.Object({ | ||
results: createSchema(Cat), | ||
nextPage: '', | ||
}); | ||
const entities = { | ||
@@ -290,3 +287,3 @@ Cat: { | ||
}; | ||
let [value, found] = denormalize( | ||
let value = denormalize( | ||
{ results: ['1', '2'] }, | ||
@@ -297,4 +294,3 @@ catSchema, | ||
expect(value).toMatchSnapshot(); | ||
expect(found).toBe(true); | ||
[value, found] = denormalize( | ||
value = denormalize( | ||
createInput({ results: ['1', '2'] }), | ||
@@ -305,3 +301,2 @@ catSchema, | ||
expect(value).toMatchSnapshot(); | ||
expect(found).toBe(true); | ||
}); | ||
@@ -311,3 +306,6 @@ | ||
class Cat extends IDEntity {} | ||
const catSchema = { results: createSchema(Cat), nextPage: '' }; | ||
const catSchema = new schema.Object({ | ||
results: createSchema(Cat), | ||
nextPage: '', | ||
}); | ||
const entities = { | ||
@@ -319,3 +317,3 @@ Cat: { | ||
}; | ||
let [value, found] = denormalize( | ||
let value = denormalize( | ||
createInput({ results: ['1', undefined, '2'] }), | ||
@@ -326,4 +324,3 @@ catSchema, | ||
expect(value).toMatchSnapshot(); | ||
expect(found).toBe(true); | ||
[value, found] = denormalize( | ||
value = denormalize( | ||
{ results: ['1', '2'] }, | ||
@@ -334,3 +331,2 @@ catSchema, | ||
expect(value).toMatchSnapshot(); | ||
expect(found).toBe(true); | ||
}); | ||
@@ -340,3 +336,3 @@ | ||
class Cat extends IDEntity {} | ||
const catSchema = { results: createSchema(Cat) }; | ||
const catSchema = new schema.Object({ results: createSchema(Cat) }); | ||
const entities = { | ||
@@ -348,3 +344,3 @@ Cat: { | ||
}; | ||
let [value, found] = denormalize( | ||
let value = denormalize( | ||
createInput({ results: undefined }), | ||
@@ -355,3 +351,2 @@ catSchema, | ||
expect(value).toMatchSnapshot(); | ||
expect(found).toBe(false); | ||
}); | ||
@@ -367,9 +362,8 @@ | ||
}; | ||
let [value, foundEntities] = denormalize( | ||
let value = denormalize( | ||
createInput([{ data: '1' }, { data: '2' }, { data: '3' }]), | ||
createSchema({ data: Cat }), | ||
createSchema(new schema.Object({ data: Cat })), | ||
createInput(entities), | ||
); | ||
expect(value).toMatchSnapshot(); | ||
expect(foundEntities).toBe(true); | ||
}); | ||
@@ -406,3 +400,3 @@ | ||
Cat: Cat, | ||
dogs: {}, | ||
dogs: new schema.Object({}), | ||
people: Person, | ||
@@ -439,3 +433,3 @@ }, | ||
const [value, found, deleted] = denormalize( | ||
const value = denormalize( | ||
createInput(input), | ||
@@ -445,4 +439,2 @@ listSchema, | ||
); | ||
expect(found).toBe(true); | ||
expect(deleted).toBe(false); | ||
expect(value).toMatchSnapshot(); | ||
@@ -463,10 +455,8 @@ }); | ||
expect(output).toMatchSnapshot(); | ||
expect(denormalize(output.result, catList, output.entities)).toEqual([ | ||
expect(denormalize(output.result, catList, output.entities)).toEqual( | ||
input, | ||
true, | ||
false, | ||
]); | ||
); | ||
}); | ||
}); | ||
}, | ||
); | ||
}, | ||
); | ||
}); |
// eslint-env jest | ||
import { normalize } from '@rest-hooks/normalizr'; | ||
import { Schema, normalize } from '@rest-hooks/normalizr'; | ||
import { IDEntity } from '__tests__/new'; | ||
import { fromJS } from 'immutable'; | ||
import denormalize from './denormalize'; | ||
import { denormalizeSimple, denormalizeLegacy } from './denormalize'; | ||
import { schema } from '../../'; | ||
@@ -79,78 +79,106 @@ import { DELETED } from '../../special'; | ||
test('denormalizes an object in the same manner as the Entity', () => { | ||
const [user, ready, deleted] = denormalize( | ||
'1', | ||
new schema.Delete(User), | ||
entities, | ||
); | ||
const user = denormalizeSimple('1', new schema.Delete(User), entities); | ||
expect(user).not.toEqual(expect.any(Symbol)); | ||
if (typeof user === 'symbol') return; | ||
expect(user).toBeDefined(); | ||
expect(user).toBeInstanceOf(User); | ||
expect(user?.username).toBe('Janey'); | ||
expect(ready).toBe(true); | ||
expect(deleted).toBe(false); | ||
}); | ||
test.each([ | ||
['direct', (data: any) => data], | ||
describe.each([ | ||
['direct', <T>(data: T) => data], | ||
['immutable', fromJS], | ||
] as const)( | ||
`denormalizes deleted entities as undefined (%s)`, | ||
(_, createInput) => { | ||
const [user, ready, deleted] = denormalize('1', new schema.Delete(User), { | ||
User: { '1': DELETED }, | ||
}); | ||
expect(user).toBe(undefined); | ||
expect(ready).toBe(true); | ||
expect(deleted).toBe(true); | ||
])(`input (%s)`, (_, createInput) => { | ||
describe.each([ | ||
[ | ||
'class', | ||
<T extends Schema>(sch: T) => new schema.Array(sch), | ||
<T extends Record<string, any>>(sch: T) => new schema.Object(sch), | ||
denormalizeSimple, | ||
], | ||
[ | ||
'class, legacy', | ||
<T extends Schema>(sch: T) => new schema.Array(sch), | ||
<T extends Record<string, any>>(sch: T) => new schema.Object(sch), | ||
denormalizeLegacy, | ||
], | ||
[ | ||
'object, direct', | ||
<T extends Schema>(sch: T) => [sch], | ||
<T extends Record<string, any>>(sch: T) => sch, | ||
denormalizeSimple, | ||
], | ||
])( | ||
`schema construction (%s)`, | ||
(_, createArray, createObject, denormalize) => { | ||
test('denormalizes deleted entities as symbol', () => { | ||
const user = denormalize( | ||
'1', | ||
new schema.Delete(User), | ||
createInput({ | ||
User: { '1': DELETED }, | ||
}), | ||
); | ||
expect(user).toEqual(expect.any(Symbol)); | ||
expect( | ||
denormalize( | ||
createInput([{ data: '1' }]), | ||
new schema.Array( | ||
new schema.Object({ data: new schema.Delete(User) }), | ||
), | ||
createInput([{ User: { '1': DELETED } }]), | ||
), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize( | ||
createInput({ data: '1' }), | ||
createObject({ data: new schema.Delete(User) }), | ||
createInput({ | ||
User: { '1': DELETED }, | ||
}), | ||
), | ||
).toEqual(expect.any(Symbol)); | ||
}); | ||
expect( | ||
denormalize( | ||
createInput([{ data: '1' }]), | ||
[{ data: new schema.Delete(User) }], | ||
createInput([{ User: { '1': DELETED } }]), | ||
), | ||
).toMatchSnapshot(); | ||
test('denormalize removes deleted entries in array', () => { | ||
expect( | ||
denormalize( | ||
createInput([{ data: '1' }]), | ||
createArray(createObject({ data: new schema.Delete(User) })), | ||
createInput({ | ||
User: { '1': DELETED }, | ||
}), | ||
), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize( | ||
createInput([{ data: '1' }]), | ||
createArray(createObject({ data: User })), | ||
createInput({ | ||
User: { '1': DELETED }, | ||
}), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
expect( | ||
denormalize( | ||
createInput([{ data: '1' }]), | ||
new schema.Array(new schema.Object({ data: User })), | ||
createInput([{ User: { '1': DELETED } }]), | ||
), | ||
).toMatchSnapshot(); | ||
test('denormalize sets undefined entities that are not present', () => { | ||
expect( | ||
denormalize( | ||
createInput([{ data: '1' }]), | ||
createArray(createObject({ data: new schema.Delete(User) })), | ||
createInput([{}]), | ||
), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize( | ||
createInput([{ data: '1' }]), | ||
[{ data: User }], | ||
createInput([{ User: { '1': DELETED } }]), | ||
), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize( | ||
createInput([{ data: '1' }]), | ||
createArray(createObject({ data: User })), | ||
createInput([{}]), | ||
), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize( | ||
createInput({ data: '1' }), | ||
new schema.Object({ data: User }), | ||
createInput({ User: { '1': DELETED } }), | ||
), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize( | ||
createInput({ data: '1' }), | ||
{ data: User }, | ||
createInput({ User: { '1': DELETED } }), | ||
), | ||
).toMatchSnapshot(); | ||
}, | ||
); | ||
expect( | ||
denormalize( | ||
createInput({ data: '1' }), | ||
createObject({ data: User }), | ||
createInput({}), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
}, | ||
); | ||
}); | ||
}); |
import { | ||
denormalize as denormalizeCore, | ||
denormalizeCached as denormalizeCore, | ||
Schema, | ||
@@ -8,4 +8,9 @@ DenormalizeCache, | ||
DenormalizeNullable, | ||
INVALID, | ||
} from '@rest-hooks/normalizr'; | ||
import { denormalize as legacyDenormalize } from './legacy-compat/denormalize'; | ||
import { denormalize as legacyDenormalize10 } from './legacy-compat/denormalize-v10.1/denormalizeCached'; | ||
import WeakListMap from './legacy-compat/WeakListMap'; | ||
export const denormalizeSimple = <S extends Schema>( | ||
@@ -17,13 +22,45 @@ input: any, | ||
resultCache: DenormalizeCache['results'][string] = new WeakEntityMap(), | ||
): | ||
| [denormalized: Denormalize<S>, found: true, deleted: false] | ||
| [denormalized: DenormalizeNullable<S>, found: boolean, deleted: true] | ||
| [denormalized: DenormalizeNullable<S>, found: false, deleted: boolean] => | ||
denormalizeCore(input, schema, entities, entityCache, resultCache).slice( | ||
0, | ||
3, | ||
) as any; | ||
args: any[] = [], | ||
): Denormalize<S> | DenormalizeNullable<S> | symbol => | ||
denormalizeCore(input, schema, entities, entityCache, resultCache, args) | ||
.data as any; | ||
export default denormalizeSimple; | ||
it('should', () => {}); | ||
export const denormalizeLegacy = <S extends Schema>( | ||
input: unknown, | ||
schema: S | undefined, | ||
entities: any, | ||
entityCache: any = {}, | ||
resultCache: WeakListMap<object, any> = new WeakListMap(), | ||
) => { | ||
const [value, found, deleted] = legacyDenormalize( | ||
input, | ||
schema, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
if (deleted) return INVALID; | ||
return value; | ||
}; | ||
export const denormalize10 = <S extends Schema>( | ||
input: unknown, | ||
schema: S | undefined, | ||
entities: any, | ||
entityCache: any = {}, | ||
resultCache: WeakEntityMap<object, any> = new WeakEntityMap(), | ||
) => { | ||
const [value, found, deleted] = legacyDenormalize10( | ||
input, | ||
schema, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
if (deleted) return INVALID; | ||
return value; | ||
}; | ||
it('[helper file in test folder]', () => {}); |
// eslint-env jest | ||
import { normalize, WeakEntityMap } from '@rest-hooks/normalizr'; | ||
import { inferResults, normalize, WeakEntityMap } from '@rest-hooks/normalizr'; | ||
import { DELETED } from '@rest-hooks/normalizr'; | ||
@@ -7,3 +7,4 @@ import { IDEntity } from '__tests__/new'; | ||
import denormalize from './denormalize'; | ||
import { denormalizeSimple, denormalizeLegacy } from './denormalize'; | ||
import WeakListMap from './legacy-compat/WeakListMap'; | ||
import { AbstractInstanceType } from '../../'; | ||
@@ -104,2 +105,3 @@ import { schema } from '../../'; | ||
MyEntity, | ||
[], | ||
entities, | ||
@@ -659,3 +661,5 @@ {}, | ||
); | ||
const [final] = denormalize(result, ProcessTaco, entities); | ||
const final = denormalizeSimple(result, ProcessTaco, entities); | ||
expect(final).not.toEqual(expect.any(Symbol)); | ||
if (typeof final === 'symbol') return; | ||
expect(final?.slug).toEqual('thing-1'); | ||
@@ -694,3 +698,5 @@ expect(final).toMatchSnapshot(); | ||
); | ||
const [final] = denormalize(result, ParentEntity, entities); | ||
const final = denormalizeSimple(result, ParentEntity, entities); | ||
expect(final).not.toEqual(expect.any(Symbol)); | ||
if (typeof final === 'symbol') return; | ||
expect(final?.child?.parentId).toEqual('1'); | ||
@@ -721,3 +727,5 @@ expect(final).toMatchSnapshot(); | ||
); | ||
const [final] = denormalize(result, EntriesEntity, entities); | ||
const final = denormalizeSimple(result, EntriesEntity, entities); | ||
expect(final).not.toEqual(expect.any(Symbol)); | ||
if (typeof final === 'symbol') return; | ||
expect(final?.type).toEqual('message'); | ||
@@ -729,545 +737,504 @@ expect(final).toMatchSnapshot(); | ||
describe(`${Entity.name} denormalization`, () => { | ||
test('denormalizes an entity', () => { | ||
const entities = { | ||
Tacos: { | ||
'1': { id: '1', name: 'foo' }, | ||
}, | ||
}; | ||
expect(denormalize('1', Tacos, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Tacos, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
describe.each([ | ||
['current', denormalizeSimple, () => new WeakEntityMap()], | ||
['legacy', denormalizeLegacy, () => new WeakListMap()], | ||
] as const)( | ||
`${Entity.name} denormalization (%s)`, | ||
(_, denormalize, createResultCache) => { | ||
test('denormalizes an entity', () => { | ||
const entities = { | ||
Tacos: { | ||
'1': { id: '1', name: 'foo' }, | ||
}, | ||
}; | ||
expect(denormalize('1', Tacos, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Tacos, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
class Food extends IDEntity {} | ||
class Menu extends IDEntity { | ||
readonly food: Food = Food.fromJS(); | ||
class Food extends IDEntity {} | ||
class Menu extends IDEntity { | ||
readonly food: Food = Food.fromJS(); | ||
static schema = { food: Food }; | ||
} | ||
static schema = { food: Food }; | ||
} | ||
test('denormalizes deep entities', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: '1' }, | ||
'2': { id: '2' }, | ||
}, | ||
Food: { | ||
'1': { id: '1' }, | ||
}, | ||
}; | ||
test('denormalizes deep entities', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: '1' }, | ||
'2': { id: '2' }, | ||
}, | ||
Food: { | ||
'1': { id: '1' }, | ||
}, | ||
}; | ||
const de1 = denormalize('1', Menu, entities); | ||
expect(de1).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toEqual(de1); | ||
const de1 = denormalize('1', Menu, entities); | ||
expect(de1).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toEqual(de1); | ||
const de2 = denormalize('2', Menu, entities); | ||
expect(de2).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toEqual(de2); | ||
}); | ||
const de2 = denormalize('2', Menu, entities); | ||
expect(de2).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toEqual(de2); | ||
}); | ||
test('denormalizes deep entities while maintaining referential equality', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: '1' }, | ||
'2': { id: '2' }, | ||
}, | ||
Food: { | ||
'1': { id: '1' }, | ||
}, | ||
}; | ||
const entityCache = {}; | ||
const resultCache = new WeakEntityMap(); | ||
test('denormalizes deep entities while maintaining referential equality', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: '1' }, | ||
'2': { id: '2' }, | ||
}, | ||
Food: { | ||
'1': { id: '1' }, | ||
}, | ||
}; | ||
const entityCache = {}; | ||
const resultCache = createResultCache(); | ||
const [first] = denormalize('1', Menu, entities, entityCache, resultCache); | ||
const [second] = denormalize('1', Menu, entities, entityCache, resultCache); | ||
expect(first).toBe(second); | ||
expect(first?.food).toBe(second?.food); | ||
}); | ||
const first = denormalize('1', Menu, entities, entityCache, resultCache); | ||
const second = denormalize('1', Menu, entities, entityCache, resultCache); | ||
expect(first).not.toEqual(expect.any(Symbol)); | ||
if (typeof first === 'symbol') return; | ||
expect(second).not.toEqual(expect.any(Symbol)); | ||
if (typeof second === 'symbol') return; | ||
expect(first).toBe(second); | ||
expect(first?.food).toBe(second?.food); | ||
}); | ||
test('denormalizes to undefined when validate() returns string', () => { | ||
class MyTacos extends Tacos { | ||
static validate(entity) { | ||
if (!Object.hasOwn(entity, 'name')) return 'no name'; | ||
test('denormalizes to undefined when validate() returns string', () => { | ||
class MyTacos extends Tacos { | ||
static validate(entity) { | ||
if (!Object.hasOwn(entity, 'name')) return 'no name'; | ||
} | ||
} | ||
} | ||
const entities = { | ||
MyTacos: { | ||
'1': { id: '1' }, | ||
}, | ||
}; | ||
expect(denormalize('1', MyTacos, entities)).toStrictEqual([ | ||
undefined, | ||
false, | ||
true, | ||
]); | ||
expect(denormalize('1', MyTacos, fromJS(entities))).toStrictEqual([ | ||
undefined, | ||
false, | ||
true, | ||
]); | ||
}); | ||
const entities = { | ||
MyTacos: { | ||
'1': { id: '1' }, | ||
}, | ||
}; | ||
expect(denormalize('1', MyTacos, entities)).toEqual(expect.any(Symbol)); | ||
expect(denormalize('1', MyTacos, fromJS(entities))).toEqual( | ||
expect.any(Symbol), | ||
); | ||
}); | ||
test('denormalizes to undefined for missing data', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: '2' }, | ||
}, | ||
Food: { | ||
'1': { id: '1' }, | ||
}, | ||
}; | ||
test('denormalizes to undefined for missing data', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: '2' }, | ||
}, | ||
Food: { | ||
'1': { id: '1' }, | ||
}, | ||
}; | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
expect(denormalize('2', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
it('should handle optional schema entries Entity', () => { | ||
class MyEntity extends Entity { | ||
readonly name: string = ''; | ||
readonly secondthing: string = ''; | ||
readonly blarb: Date | undefined = undefined; | ||
pk() { | ||
return this.name; | ||
it('should handle optional schema entries Entity', () => { | ||
class MyEntity extends Entity { | ||
readonly name: string = ''; | ||
readonly secondthing: string = ''; | ||
readonly blarb: Date | undefined = undefined; | ||
pk() { | ||
return this.name; | ||
} | ||
static schema = { | ||
blarb: Date, | ||
}; | ||
} | ||
const schema = MyEntity; | ||
static schema = { | ||
blarb: Date, | ||
}; | ||
} | ||
const schema = MyEntity; | ||
expect( | ||
denormalize('bob', schema, { | ||
MyEntity: { bob: { name: 'bob', secondthing: 'hi' } }, | ||
}), | ||
).toMatchInlineSnapshot(` | ||
[ | ||
MyEntity { | ||
"blarb": undefined, | ||
"name": "bob", | ||
"secondthing": "hi", | ||
}, | ||
true, | ||
false, | ||
] | ||
expect( | ||
denormalize('bob', schema, { | ||
MyEntity: { bob: { name: 'bob', secondthing: 'hi' } }, | ||
}), | ||
).toMatchInlineSnapshot(` | ||
MyEntity { | ||
"blarb": undefined, | ||
"name": "bob", | ||
"secondthing": "hi", | ||
} | ||
`); | ||
}); | ||
}); | ||
it('should handle null schema entries Entity', () => { | ||
class MyEntity extends Entity { | ||
readonly name: string = ''; | ||
readonly secondthing: string = ''; | ||
readonly blarb: Date | null = null; | ||
pk() { | ||
return this.name; | ||
it('should handle null schema entries Entity', () => { | ||
class MyEntity extends Entity { | ||
readonly name: string = ''; | ||
readonly secondthing: string = ''; | ||
readonly blarb: Date | null = null; | ||
pk() { | ||
return this.name; | ||
} | ||
static schema = { | ||
blarb: Date, | ||
}; | ||
} | ||
const schema = MyEntity; | ||
static schema = { | ||
blarb: Date, | ||
}; | ||
} | ||
const schema = MyEntity; | ||
expect( | ||
denormalize('bob', schema, { | ||
MyEntity: { bob: { name: 'bob', secondthing: 'hi', blarb: null } }, | ||
}), | ||
).toMatchInlineSnapshot(` | ||
MyEntity { | ||
"blarb": null, | ||
"name": "bob", | ||
"secondthing": "hi", | ||
} | ||
`); | ||
}); | ||
expect( | ||
denormalize('bob', schema, { | ||
MyEntity: { bob: { name: 'bob', secondthing: 'hi', blarb: null } }, | ||
}), | ||
).toMatchInlineSnapshot(` | ||
[ | ||
MyEntity { | ||
"blarb": null, | ||
"name": "bob", | ||
"secondthing": "hi", | ||
test('denormalizes to undefined for deleted data', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: '2' }, | ||
'2': DELETED, | ||
}, | ||
true, | ||
false, | ||
] | ||
`); | ||
}); | ||
Food: { | ||
'1': { id: '1' }, | ||
'2': DELETED, | ||
}, | ||
}; | ||
test('denormalizes to undefined for deleted data', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: '2' }, | ||
'2': DELETED, | ||
}, | ||
Food: { | ||
'1': { id: '1' }, | ||
'2': DELETED, | ||
}, | ||
}; | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
test('denormalizes deep entities with records', () => { | ||
const Food = Record<{ id: null | string }>({ id: null }); | ||
const MenuR = Record<{ id: null | string; food: null | string }>({ | ||
id: null, | ||
food: null, | ||
expect(denormalize('2', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
const entities = { | ||
Menu: { | ||
'1': new MenuR({ id: '1', food: '1' }), | ||
'2': new MenuR({ id: '2' }), | ||
}, | ||
Food: { | ||
'1': new Food({ id: '1' }), | ||
}, | ||
}; | ||
test('denormalizes deep entities with records', () => { | ||
const Food = Record<{ id: null | string }>({ id: null }); | ||
const MenuR = Record<{ id: null | string; food: null | string }>({ | ||
id: null, | ||
food: null, | ||
}); | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
const entities = { | ||
Menu: { | ||
'1': new MenuR({ id: '1', food: '1' }), | ||
'2': new MenuR({ id: '2' }), | ||
}, | ||
Food: { | ||
'1': new Food({ id: '1' }), | ||
}, | ||
}; | ||
expect(denormalize('2', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
test('can denormalize already partially denormalized data', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: { id: '1' } }, | ||
}, | ||
Food: { | ||
// TODO: BREAKING CHANGE: Update this to use main entity and only return nested as 'fallback' in case main entity is not set | ||
'1': { id: '1', extra: 'hi' }, | ||
}, | ||
}; | ||
expect(denormalize('2', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
test('can denormalize already partially denormalized data', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: { id: '1' } }, | ||
}, | ||
Food: { | ||
// TODO: BREAKING CHANGE: Update this to use main entity and only return nested as 'fallback' in case main entity is not set | ||
'1': { id: '1', extra: 'hi' }, | ||
}, | ||
}; | ||
class User extends IDEntity { | ||
readonly role = ''; | ||
readonly reports: Report[] = []; | ||
} | ||
class Report extends IDEntity { | ||
readonly title: string = ''; | ||
readonly draftedBy: User = User.fromJS(); | ||
readonly publishedBy: User = User.fromJS(); | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
static schema = { | ||
draftedBy: User, | ||
publishedBy: User, | ||
}; | ||
} | ||
User.schema = { | ||
reports: [Report], | ||
}; | ||
class Comment extends IDEntity { | ||
readonly body: string = ''; | ||
readonly author: User = User.fromJS(); | ||
class User extends IDEntity { | ||
readonly role = ''; | ||
readonly reports: Report[] = []; | ||
} | ||
class Report extends IDEntity { | ||
readonly title: string = ''; | ||
readonly draftedBy: User = User.fromJS(); | ||
readonly publishedBy: User = User.fromJS(); | ||
static schema = { | ||
author: User, | ||
static schema = { | ||
draftedBy: User, | ||
publishedBy: User, | ||
}; | ||
} | ||
User.schema = { | ||
reports: new schema.Array(Report), | ||
}; | ||
} | ||
class Comment extends IDEntity { | ||
readonly body: string = ''; | ||
readonly author: User = User.fromJS(); | ||
test('denormalizes recursive dependencies', () => { | ||
const entities = { | ||
Report: { | ||
'123': { | ||
id: '123', | ||
title: 'Weekly report', | ||
draftedBy: '456', | ||
publishedBy: '456', | ||
static schema = { | ||
author: User, | ||
}; | ||
} | ||
test('denormalizes recursive dependencies', () => { | ||
const entities = { | ||
Report: { | ||
'123': { | ||
id: '123', | ||
title: 'Weekly report', | ||
draftedBy: '456', | ||
publishedBy: '456', | ||
}, | ||
}, | ||
}, | ||
User: { | ||
'456': { | ||
id: '456', | ||
role: 'manager', | ||
reports: ['123'], | ||
User: { | ||
'456': { | ||
id: '456', | ||
role: 'manager', | ||
reports: ['123'], | ||
}, | ||
}, | ||
}, | ||
}; | ||
}; | ||
expect(denormalize('123', Report, entities)[0]).toMatchSnapshot(); | ||
expect(denormalize('123', Report, fromJS(entities))[0]).toMatchSnapshot(); | ||
expect(denormalize('123', Report, entities)).toMatchSnapshot(); | ||
expect(denormalize('123', Report, fromJS(entities))).toMatchSnapshot(); | ||
expect(denormalize('456', User, entities)[0]).toMatchSnapshot(); | ||
expect(denormalize('456', User, fromJS(entities))[0]).toMatchSnapshot(); | ||
}); | ||
expect(denormalize('456', User, entities)).toMatchSnapshot(); | ||
expect(denormalize('456', User, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
test('denormalizes recursive entities with referential equality', () => { | ||
const entities = { | ||
Report: { | ||
'123': { | ||
id: '123', | ||
title: 'Weekly report', | ||
draftedBy: '456', | ||
publishedBy: '456', | ||
test('denormalizes recursive entities with referential equality', () => { | ||
const entities = { | ||
Report: { | ||
'123': { | ||
id: '123', | ||
title: 'Weekly report', | ||
draftedBy: '456', | ||
publishedBy: '456', | ||
}, | ||
}, | ||
}, | ||
Comment: { | ||
'999': { | ||
id: '999', | ||
body: 'Good morning', | ||
author: '456', | ||
Comment: { | ||
'999': { | ||
id: '999', | ||
body: 'Good morning', | ||
author: '456', | ||
}, | ||
}, | ||
}, | ||
User: { | ||
'456': { | ||
id: '456', | ||
role: 'manager', | ||
reports: ['123'], | ||
User: { | ||
'456': { | ||
id: '456', | ||
role: 'manager', | ||
reports: ['123'], | ||
}, | ||
'457': { | ||
id: '457', | ||
role: 'servant', | ||
reports: ['123'], | ||
}, | ||
}, | ||
'457': { | ||
id: '457', | ||
role: 'servant', | ||
reports: ['123'], | ||
}, | ||
}, | ||
}; | ||
const entityCache: any = {}; | ||
const resultCache = new WeakEntityMap(); | ||
}; | ||
const entityCache: any = {}; | ||
const resultCache = createResultCache(); | ||
const [denormalizedReport] = denormalize( | ||
'123', | ||
Report, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
const denormalizedReport = denormalize( | ||
'123', | ||
Report, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
expect(denormalizedReport).not.toEqual(expect.any(Symbol)); | ||
if (typeof denormalizedReport === 'symbol') return; | ||
expect(denormalizedReport).toBeDefined(); | ||
// This is just for TypeScript, the above line actually determines this | ||
if (!denormalizedReport) throw new Error('expected to be defined'); | ||
expect(denormalizedReport).toBe(denormalizedReport.draftedBy?.reports[0]); | ||
expect(denormalizedReport.publishedBy).toBe(denormalizedReport.draftedBy); | ||
expect(denormalizedReport.draftedBy?.reports[0].draftedBy).toBe( | ||
denormalizedReport.draftedBy, | ||
); | ||
expect(denormalizedReport).toBeDefined(); | ||
// This is just for TypeScript, the above line actually determines this | ||
if (!denormalizedReport) throw new Error('expected to be defined'); | ||
expect(denormalizedReport).toBe(denormalizedReport.draftedBy?.reports[0]); | ||
expect(denormalizedReport.publishedBy).toBe(denormalizedReport.draftedBy); | ||
expect(denormalizedReport.draftedBy?.reports[0].draftedBy).toBe( | ||
denormalizedReport.draftedBy, | ||
); | ||
const [denormalizedReport2] = denormalize( | ||
'123', | ||
Report, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
const denormalizedReport2 = denormalize( | ||
'123', | ||
Report, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
expect(denormalizedReport2).toStrictEqual(denormalizedReport); | ||
expect(denormalizedReport2).toBe(denormalizedReport); | ||
// NOTE: Given how immutable data works, referential equality can't be | ||
// maintained with nested denormalization. | ||
}); | ||
expect(denormalizedReport2).toStrictEqual(denormalizedReport); | ||
expect(denormalizedReport2).toBe(denormalizedReport); | ||
// NOTE: Given how immutable data works, referential equality can't be | ||
// maintained with nested denormalization. | ||
}); | ||
test('denormalizes maintain referential equality when appropriate', () => { | ||
const entities = { | ||
Report: { | ||
'123': { | ||
id: '123', | ||
title: 'Weekly report', | ||
draftedBy: '456', | ||
publishedBy: '456', | ||
test('denormalizes maintain referential equality when appropriate', () => { | ||
const entities = { | ||
Report: { | ||
'123': { | ||
id: '123', | ||
title: 'Weekly report', | ||
draftedBy: '456', | ||
publishedBy: '456', | ||
}, | ||
}, | ||
}, | ||
Comment: { | ||
'999': { | ||
id: '999', | ||
body: 'Good morning', | ||
author: '456', | ||
Comment: { | ||
'999': { | ||
id: '999', | ||
body: 'Good morning', | ||
author: '456', | ||
}, | ||
}, | ||
}, | ||
User: { | ||
'456': { | ||
id: '456', | ||
role: 'manager', | ||
reports: ['123'], | ||
User: { | ||
'456': { | ||
id: '456', | ||
role: 'manager', | ||
reports: ['123'], | ||
}, | ||
'457': { | ||
id: '457', | ||
role: 'servant', | ||
reports: ['123'], | ||
}, | ||
}, | ||
'457': { | ||
id: '457', | ||
role: 'servant', | ||
reports: ['123'], | ||
}, | ||
}, | ||
}; | ||
const entityCache: any = {}; | ||
const resultCache = new WeakEntityMap(); | ||
}; | ||
const entityCache: any = {}; | ||
const resultCache = createResultCache(); | ||
const input = { report: '123', comment: '999' }; | ||
const schema = { | ||
report: Report, | ||
comment: Comment, | ||
}; | ||
const input = { report: '123', comment: '999' }; | ||
const sch = new schema.Object({ | ||
report: Report, | ||
comment: Comment, | ||
}); | ||
const [denormalizedReport] = denormalize( | ||
input, | ||
schema, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
const denormalizedReport = denormalize( | ||
input, | ||
sch, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
expect(denormalizedReport).not.toEqual(expect.any(Symbol)); | ||
if (typeof denormalizedReport === 'symbol') return; | ||
expect(denormalizedReport.report).toBeDefined(); | ||
expect(denormalizedReport.comment).toBeDefined(); | ||
// This is just for TypeScript, the above line actually determines this | ||
if (!denormalizedReport.report || !denormalizedReport.comment) | ||
throw new Error('expected to be defined'); | ||
expect(denormalizedReport.report.publishedBy).toBe( | ||
denormalizedReport.comment.author, | ||
); | ||
expect(denormalizedReport.report).toBeDefined(); | ||
expect(denormalizedReport.comment).toBeDefined(); | ||
// This is just for TypeScript, the above line actually determines this | ||
if (!denormalizedReport.report || !denormalizedReport.comment) | ||
throw new Error('expected to be defined'); | ||
expect(denormalizedReport.report.publishedBy).toBe( | ||
denormalizedReport.comment.author, | ||
); | ||
const [denormalizedReport2] = denormalize( | ||
input, | ||
schema, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
const denormalizedReport2 = denormalize( | ||
input, | ||
sch, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
expect(denormalizedReport2).not.toEqual(expect.any(Symbol)); | ||
if (typeof denormalizedReport2 === 'symbol') return; | ||
expect(denormalizedReport2).toStrictEqual(denormalizedReport); | ||
expect(denormalizedReport2).toBe(denormalizedReport); | ||
expect(denormalizedReport2).toStrictEqual(denormalizedReport); | ||
expect(denormalizedReport2).toBe(denormalizedReport); | ||
// should update all uses of user | ||
const nextEntities = { | ||
...entities, | ||
User: { | ||
...entities.User, | ||
'456': { | ||
...entities.User[456], | ||
role: 'supervisor', | ||
// should update all uses of user | ||
const nextEntities = { | ||
...entities, | ||
User: { | ||
...entities.User, | ||
'456': { | ||
...entities.User[456], | ||
role: 'supervisor', | ||
}, | ||
}, | ||
}, | ||
}; | ||
}; | ||
const [denormalizedReport3] = denormalize( | ||
input, | ||
schema, | ||
nextEntities, | ||
entityCache, | ||
resultCache, | ||
); | ||
const denormalizedReport3 = denormalize( | ||
input, | ||
sch, | ||
nextEntities, | ||
entityCache, | ||
resultCache, | ||
); | ||
expect(denormalizedReport3).not.toEqual(expect.any(Symbol)); | ||
if (typeof denormalizedReport3 === 'symbol') return; | ||
expect(denormalizedReport3.comment?.author?.role).toBe('supervisor'); | ||
expect(denormalizedReport3.report?.draftedBy?.role).toBe('supervisor'); | ||
// NOTE: Given how immutable data works, referential equality can't be | ||
// maintained with nested denormalization. | ||
}); | ||
expect(denormalizedReport3.comment?.author?.role).toBe('supervisor'); | ||
expect(denormalizedReport3.report?.draftedBy?.role).toBe('supervisor'); | ||
// NOTE: Given how immutable data works, referential equality can't be | ||
// maintained with nested denormalization. | ||
}); | ||
describe('optional entities', () => { | ||
it('should be marked as found even when optional is not there', () => { | ||
const [denormalized, found] = denormalize('abc', WithOptional, { | ||
[WithOptional.key]: { | ||
abc: { | ||
id: 'abc', | ||
// this is typed because we're actually sending wrong data to it | ||
requiredArticle: '5' as any, | ||
nextPage: 'blob', | ||
describe('optional entities', () => { | ||
it('should be marked as found even when optional is not there', () => { | ||
const denormalized = denormalize('abc', WithOptional, { | ||
[WithOptional.key]: { | ||
abc: { | ||
id: 'abc', | ||
// this is typed because we're actually sending wrong data to it | ||
requiredArticle: '5' as any, | ||
nextPage: 'blob', | ||
}, | ||
}, | ||
}, | ||
[ArticleEntity.key]: { | ||
['5']: { id: '5' }, | ||
}, | ||
[ArticleEntity.key]: { | ||
['5']: { id: '5' }, | ||
}, | ||
}); | ||
const response = denormalized; | ||
expect(response).toBeDefined(); | ||
expect(response).toBeInstanceOf(WithOptional); | ||
expect(response).toEqual({ | ||
id: 'abc', | ||
article: null, | ||
requiredArticle: ArticleEntity.fromJS({ id: '5' }), | ||
nextPage: 'blob', | ||
}); | ||
}); | ||
expect(found).toBe(true); | ||
const response = denormalized; | ||
expect(response).toBeDefined(); | ||
expect(response).toBeInstanceOf(WithOptional); | ||
expect(response).toEqual({ | ||
id: 'abc', | ||
article: null, | ||
requiredArticle: ArticleEntity.fromJS({ id: '5' }), | ||
nextPage: 'blob', | ||
}); | ||
}); | ||
it('should be marked as found when nested entity is missing', () => { | ||
const [denormalized, found, deleted] = denormalize('abc', WithOptional, { | ||
[WithOptional.key]: { | ||
abc: WithOptional.fromJS({ | ||
id: 'abc', | ||
// this is typed because we're actually sending wrong data to it | ||
article: '5' as any, | ||
nextPage: 'blob', | ||
}), | ||
}, | ||
[ArticleEntity.key]: { | ||
['5']: ArticleEntity.fromJS({ id: '5' }), | ||
}, | ||
it('should be marked as found when nested entity is missing', () => { | ||
const denormalized = denormalize('abc', WithOptional, { | ||
[WithOptional.key]: { | ||
abc: WithOptional.fromJS({ | ||
id: 'abc', | ||
// this is typed because we're actually sending wrong data to it | ||
article: '5' as any, | ||
nextPage: 'blob', | ||
}), | ||
}, | ||
[ArticleEntity.key]: { | ||
['5']: ArticleEntity.fromJS({ id: '5' }), | ||
}, | ||
}); | ||
expect(denormalized).not.toEqual(expect.any(Symbol)); | ||
const response = denormalized; | ||
expect(response).toBeDefined(); | ||
expect(response).toBeInstanceOf(WithOptional); | ||
expect(response).toEqual({ | ||
id: 'abc', | ||
article: ArticleEntity.fromJS({ id: '5' }), | ||
requiredArticle: ArticleEntity.fromJS(), | ||
nextPage: 'blob', | ||
}); | ||
}); | ||
expect(found).toBe(true); | ||
expect(deleted).toBe(false); | ||
const response = denormalized; | ||
expect(response).toBeDefined(); | ||
expect(response).toBeInstanceOf(WithOptional); | ||
expect(response).toEqual({ | ||
id: 'abc', | ||
article: ArticleEntity.fromJS({ id: '5' }), | ||
requiredArticle: ArticleEntity.fromJS(), | ||
nextPage: 'blob', | ||
}); | ||
}); | ||
it('should be marked as deleted when required entity is deleted symbol', () => { | ||
const [denormalized, found, deleted] = denormalize('abc', WithOptional, { | ||
[WithOptional.key]: { | ||
abc: { | ||
id: 'abc', | ||
// this is typed because we're actually sending wrong data to it | ||
requiredArticle: '5' as any, | ||
nextPage: 'blob', | ||
it('should be marked as deleted when required entity is deleted symbol', () => { | ||
const denormalized = denormalize('abc', WithOptional, { | ||
[WithOptional.key]: { | ||
abc: { | ||
id: 'abc', | ||
// this is typed because we're actually sending wrong data to it | ||
requiredArticle: '5' as any, | ||
nextPage: 'blob', | ||
}, | ||
}, | ||
}, | ||
[ArticleEntity.key]: { | ||
['5']: DELETED, | ||
}, | ||
[ArticleEntity.key]: { | ||
['5']: DELETED, | ||
}, | ||
}); | ||
expect(denormalized).toEqual(expect.any(Symbol)); | ||
}); | ||
expect(found).toBe(true); | ||
expect(deleted).toBe(true); | ||
const response = denormalized; | ||
expect(response).toBeDefined(); | ||
expect(response).toBeInstanceOf(WithOptional); | ||
expect(response).toEqual({ | ||
id: 'abc', | ||
article: null, | ||
requiredArticle: undefined, | ||
nextPage: 'blob', | ||
}); | ||
}); | ||
it('should be non-required deleted members should not result in deleted indicator', () => { | ||
const [denormalized, found, deleted] = denormalize('abc', WithOptional, { | ||
[WithOptional.key]: { | ||
abc: WithOptional.fromJS({ | ||
id: 'abc', | ||
// this is typed because we're actually sending wrong data to it | ||
article: '5' as any, | ||
requiredArticle: '6' as any, | ||
nextPage: 'blob', | ||
}), | ||
}, | ||
[ArticleEntity.key]: { | ||
['5']: DELETED, | ||
['6']: ArticleEntity.fromJS({ id: '6' }), | ||
}, | ||
}); | ||
expect(found).toBe(true); | ||
expect(deleted).toBe(false); | ||
const response = denormalized; | ||
expect(response).toBeDefined(); | ||
expect(response).toBeInstanceOf(WithOptional); | ||
expect(response).toEqual({ | ||
id: 'abc', | ||
article: undefined, | ||
requiredArticle: ArticleEntity.fromJS({ id: '6' }), | ||
nextPage: 'blob', | ||
}); | ||
}); | ||
it('should be both deleted and not found when both are true in different parts of schema', () => { | ||
const [denormalized, found, deleted] = denormalize( | ||
{ data: 'abc' }, | ||
{ data: WithOptional, other: ArticleEntity }, | ||
{ | ||
it('should be non-required deleted members should not result in deleted indicator', () => { | ||
const denormalized = denormalize('abc', WithOptional, { | ||
[WithOptional.key]: { | ||
@@ -1277,4 +1244,4 @@ abc: WithOptional.fromJS({ | ||
// this is typed because we're actually sending wrong data to it | ||
article: '6' as any, | ||
requiredArticle: '5' as any, | ||
article: '5' as any, | ||
requiredArticle: '6' as any, | ||
nextPage: 'blob', | ||
@@ -1287,7 +1254,37 @@ }), | ||
}, | ||
}, | ||
); | ||
expect(found).toBe(false); | ||
expect(deleted).toBe(true); | ||
const response = denormalized; | ||
}); | ||
expect(denormalized).not.toEqual(expect.any(Symbol)); | ||
const response = denormalized; | ||
expect(response).toBeDefined(); | ||
expect(response).toBeInstanceOf(WithOptional); | ||
expect(response).toEqual({ | ||
id: 'abc', | ||
article: undefined, | ||
requiredArticle: ArticleEntity.fromJS({ id: '6' }), | ||
nextPage: 'blob', | ||
}); | ||
}); | ||
it('should be deleted when both are true in different parts of schema', () => { | ||
const denormalized = denormalize( | ||
{ data: 'abc' }, | ||
new schema.Object({ data: WithOptional, other: ArticleEntity }), | ||
{ | ||
[WithOptional.key]: { | ||
abc: WithOptional.fromJS({ | ||
id: 'abc', | ||
// this is typed because we're actually sending wrong data to it | ||
article: '6' as any, | ||
requiredArticle: '5' as any, | ||
nextPage: 'blob', | ||
}), | ||
}, | ||
[ArticleEntity.key]: { | ||
['5']: DELETED, | ||
['6']: ArticleEntity.fromJS({ id: '6' }), | ||
}, | ||
}, | ||
); | ||
expect(denormalized).toEqual(expect.any(Symbol)); | ||
/*const response = denormalized; | ||
expect(response).toBeDefined(); | ||
@@ -1302,5 +1299,8 @@ expect(response).toEqual({ | ||
}); | ||
deleted symbol replaces whole denorm value | ||
*/ | ||
}); | ||
}); | ||
}); | ||
}); | ||
}, | ||
); | ||
@@ -1307,0 +1307,0 @@ describe('Entity.defaults', () => { |
@@ -6,3 +6,4 @@ // eslint-env jest | ||
import denormalize from './denormalize'; | ||
import { denormalizeSimple, denormalize10 } from './denormalize'; | ||
import WeakListMap from './legacy-compat/WeakListMap'; | ||
import { schema } from '../..'; | ||
@@ -349,2 +350,3 @@ | ||
MyEntity, | ||
[], | ||
entities, | ||
@@ -679,3 +681,5 @@ {}, | ||
); | ||
const [final] = denormalize(result, ProcessTaco, entities); | ||
const final = denormalizeSimple(result, ProcessTaco, entities); | ||
expect(final).not.toEqual(expect.any(Symbol)); | ||
if (typeof final === 'symbol') return; | ||
expect(final?.slug).toEqual('thing-1'); | ||
@@ -718,3 +722,5 @@ expect(final).toMatchSnapshot(); | ||
); | ||
const [final] = denormalize(result, ParentEntity, entities); | ||
const final = denormalizeSimple(result, ParentEntity, entities); | ||
expect(final).not.toEqual(expect.any(Symbol)); | ||
if (typeof final === 'symbol') return; | ||
expect(final?.child?.parentId).toEqual('1'); | ||
@@ -767,3 +773,5 @@ expect(final).toMatchSnapshot(); | ||
); | ||
const [final] = denormalize(result, EntriesEntity, entities); | ||
const final = denormalizeSimple(result, EntriesEntity, entities); | ||
expect(final).not.toEqual(expect.any(Symbol)); | ||
if (typeof final === 'symbol') return; | ||
expect(final?.type).toEqual('message'); | ||
@@ -777,120 +785,122 @@ expect(final).toMatchSnapshot(); | ||
describe(`${schema.Entity.name} denormalization`, () => { | ||
test('denormalizes an entity', () => { | ||
const entities = { | ||
Tacos: { | ||
'1': { id: '1', name: 'foo' }, | ||
describe.each([ | ||
['current', denormalizeSimple, () => new WeakEntityMap()], | ||
['legacy', denormalize10, () => new WeakEntityMap()], | ||
] as const)( | ||
`${schema.Entity.name} denormalization (%s)`, | ||
(_, denormalize, createResultCache) => { | ||
test('denormalizes an entity', () => { | ||
const entities = { | ||
Tacos: { | ||
'1': { id: '1', name: 'foo' }, | ||
}, | ||
}; | ||
expect(denormalize('1', Tacos, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Tacos, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
class Food extends schema.Entity( | ||
class { | ||
id = ''; | ||
}, | ||
}; | ||
expect(denormalize('1', Tacos, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Tacos, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
class Food extends schema.Entity( | ||
class { | ||
) {} | ||
class MenuData { | ||
id = ''; | ||
}, | ||
) {} | ||
class MenuData { | ||
id = ''; | ||
readonly food: Food = Food.fromJS(); | ||
} | ||
class Menu extends schema.Entity(MenuData, { schema: { food: Food } }) {} | ||
readonly food: Food = Food.fromJS(); | ||
} | ||
class Menu extends schema.Entity(MenuData, { schema: { food: Food } }) {} | ||
test('denormalizes deep entities', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: '1' }, | ||
'2': { id: '2' }, | ||
}, | ||
Food: { | ||
'1': { id: '1' }, | ||
}, | ||
}; | ||
test('denormalizes deep entities', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: '1' }, | ||
'2': { id: '2' }, | ||
}, | ||
Food: { | ||
'1': { id: '1' }, | ||
}, | ||
}; | ||
const de1 = denormalize('1', Menu, entities); | ||
expect(de1).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toEqual(de1); | ||
const de1 = denormalize('1', Menu, entities); | ||
expect(de1).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toEqual(de1); | ||
const de2 = denormalize('2', Menu, entities); | ||
expect(de2).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toEqual(de2); | ||
}); | ||
const de2 = denormalize('2', Menu, entities); | ||
expect(de2).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toEqual(de2); | ||
}); | ||
test('denormalizes deep entities while maintaining referential equality', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: '1' }, | ||
'2': { id: '2' }, | ||
}, | ||
Food: { | ||
'1': { id: '1' }, | ||
}, | ||
}; | ||
const entityCache = {}; | ||
const resultCache = new WeakEntityMap(); | ||
test('denormalizes deep entities while maintaining referential equality', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: '1' }, | ||
'2': { id: '2' }, | ||
}, | ||
Food: { | ||
'1': { id: '1' }, | ||
}, | ||
}; | ||
const entityCache = {}; | ||
const resultCache = createResultCache(); | ||
const [first] = denormalize('1', Menu, entities, entityCache, resultCache); | ||
const [second] = denormalize('1', Menu, entities, entityCache, resultCache); | ||
expect(first).toBe(second); | ||
expect(first?.food).toBe(second?.food); | ||
}); | ||
const first = denormalize('1', Menu, entities, entityCache, resultCache); | ||
const second = denormalize('1', Menu, entities, entityCache, resultCache); | ||
expect(first).not.toEqual(expect.any(Symbol)); | ||
if (typeof first === 'symbol') return; | ||
expect(second).not.toEqual(expect.any(Symbol)); | ||
if (typeof second === 'symbol') return; | ||
expect(first).toBe(second); | ||
expect(first?.food).toBe(second?.food); | ||
}); | ||
test('denormalizes to undefined when validate() returns string', () => { | ||
class MyTacos extends Tacos { | ||
static validate(entity) { | ||
if (!Object.hasOwn(entity, 'name')) return 'no name'; | ||
test('denormalizes to undefined when validate() returns string', () => { | ||
class MyTacos extends Tacos { | ||
static validate(entity) { | ||
if (!Object.hasOwn(entity, 'name')) return 'no name'; | ||
} | ||
} | ||
} | ||
const entities = { | ||
MyTacos: { | ||
'1': { id: '1' }, | ||
}, | ||
}; | ||
expect(denormalize('1', MyTacos, entities)).toStrictEqual([ | ||
undefined, | ||
false, | ||
true, | ||
]); | ||
expect(denormalize('1', MyTacos, fromJS(entities))).toStrictEqual([ | ||
undefined, | ||
false, | ||
true, | ||
]); | ||
}); | ||
const entities = { | ||
MyTacos: { | ||
'1': { id: '1' }, | ||
}, | ||
}; | ||
expect(denormalize('1', MyTacos, entities)).toEqual(expect.any(Symbol)); | ||
expect(denormalize('1', MyTacos, fromJS(entities))).toEqual( | ||
expect.any(Symbol), | ||
); | ||
}); | ||
test('denormalizes to undefined for missing data', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: '2' }, | ||
}, | ||
Food: { | ||
'1': { id: '1' }, | ||
}, | ||
}; | ||
test('denormalizes to undefined for missing data', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: '2' }, | ||
}, | ||
Food: { | ||
'1': { id: '1' }, | ||
}, | ||
}; | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
expect(denormalize('2', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
it('should handle optional schema entries Entity', () => { | ||
class MyData { | ||
readonly name: string = ''; | ||
readonly secondthing: string = ''; | ||
readonly blarb: Date | undefined = undefined; | ||
} | ||
class MyEntity extends schema.Entity(MyData, { | ||
pk: 'name', | ||
schema: { blarb: Date }, | ||
}) {} | ||
it('should handle optional schema entries Entity', () => { | ||
class MyData { | ||
readonly name: string = ''; | ||
readonly secondthing: string = ''; | ||
readonly blarb: Date | undefined = undefined; | ||
} | ||
class MyEntity extends schema.Entity(MyData, { | ||
pk: 'name', | ||
schema: { blarb: Date }, | ||
}) {} | ||
expect( | ||
denormalize('bob', MyEntity, { | ||
MyEntity: { bob: { name: 'bob', secondthing: 'hi' } }, | ||
}), | ||
).toMatchInlineSnapshot(` | ||
[ | ||
expect( | ||
denormalize('bob', MyEntity, { | ||
MyEntity: { bob: { name: 'bob', secondthing: 'hi' } }, | ||
}), | ||
).toMatchInlineSnapshot(` | ||
MyEntity { | ||
@@ -900,26 +910,22 @@ "blarb": undefined, | ||
"secondthing": "hi", | ||
}, | ||
true, | ||
false, | ||
] | ||
`); | ||
}); | ||
} | ||
`); | ||
}); | ||
it('should handle null schema entries Entity', () => { | ||
class MyData { | ||
readonly name: string = ''; | ||
readonly secondthing: string = ''; | ||
readonly blarb: Date | null = null; | ||
} | ||
class MyEntity extends schema.Entity(MyData, { | ||
pk: 'name', | ||
schema: { blarb: Date }, | ||
}) {} | ||
it('should handle null schema entries Entity', () => { | ||
class MyData { | ||
readonly name: string = ''; | ||
readonly secondthing: string = ''; | ||
readonly blarb: Date | null = null; | ||
} | ||
class MyEntity extends schema.Entity(MyData, { | ||
pk: 'name', | ||
schema: { blarb: Date }, | ||
}) {} | ||
expect( | ||
denormalize('bob', MyEntity, { | ||
MyEntity: { bob: { name: 'bob', secondthing: 'hi', blarb: null } }, | ||
}), | ||
).toMatchInlineSnapshot(` | ||
[ | ||
expect( | ||
denormalize('bob', MyEntity, { | ||
MyEntity: { bob: { name: 'bob', secondthing: 'hi', blarb: null } }, | ||
}), | ||
).toMatchInlineSnapshot(` | ||
MyEntity { | ||
@@ -929,313 +935,320 @@ "blarb": null, | ||
"secondthing": "hi", | ||
} | ||
`); | ||
}); | ||
test('denormalizes to undefined for deleted data', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: '2' }, | ||
'2': DELETED, | ||
}, | ||
true, | ||
false, | ||
] | ||
`); | ||
}); | ||
Food: { | ||
'1': { id: '1' }, | ||
'2': DELETED, | ||
}, | ||
}; | ||
test('denormalizes to undefined for deleted data', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: '2' }, | ||
'2': DELETED, | ||
}, | ||
Food: { | ||
'1': { id: '1' }, | ||
'2': DELETED, | ||
}, | ||
}; | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
test('denormalizes deep entities with records', () => { | ||
const Food = Record<{ id: null | string }>({ id: null }); | ||
const MenuR = Record<{ id: null | string; food: null | string }>({ | ||
id: null, | ||
food: null, | ||
expect(denormalize('2', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
const entities = { | ||
Menu: { | ||
'1': new MenuR({ id: '1', food: '1' }), | ||
'2': new MenuR({ id: '2' }), | ||
}, | ||
Food: { | ||
'1': new Food({ id: '1' }), | ||
}, | ||
}; | ||
test('denormalizes deep entities with records', () => { | ||
const Food = Record<{ id: null | string }>({ id: null }); | ||
const MenuR = Record<{ id: null | string; food: null | string }>({ | ||
id: null, | ||
food: null, | ||
}); | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
const entities = { | ||
Menu: { | ||
'1': new MenuR({ id: '1', food: '1' }), | ||
'2': new MenuR({ id: '2' }), | ||
}, | ||
Food: { | ||
'1': new Food({ id: '1' }), | ||
}, | ||
}; | ||
expect(denormalize('2', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
test('can denormalize already partially denormalized data', () => { | ||
const entities = { | ||
Menu: { | ||
'1': { id: '1', food: { id: '1' } }, | ||
}, | ||
Food: { | ||
// TODO: BREAKING CHANGE: Update this to use main entity and only return nested as 'fallback' in case main entity is not set | ||
'1': { id: '1', extra: 'hi' }, | ||
}, | ||
}; | ||
expect(denormalize('2', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('2', Menu, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
describe('nesting', () => { | ||
class UserData { | ||
id = ''; | ||
readonly role = ''; | ||
readonly reports: Report[] = []; | ||
} | ||
class User extends schema.Entity(UserData) {} | ||
class ReportData { | ||
id = ''; | ||
readonly title: string = ''; | ||
readonly draftedBy: User = User.fromJS(); | ||
readonly publishedBy: User = User.fromJS(); | ||
} | ||
class Report extends schema.Entity(ReportData, { | ||
schema: { | ||
draftedBy: User, | ||
publishedBy: User, | ||
}, | ||
}) {} | ||
User.schema = { | ||
reports: [Report], | ||
}; | ||
class CommentData { | ||
id = ''; | ||
readonly body: string = ''; | ||
readonly author: User = User.fromJS(); | ||
} | ||
class Comment extends schema.Entity(CommentData, { | ||
schema: { author: User }, | ||
}) {} | ||
test('denormalizes recursive dependencies', () => { | ||
test('can denormalize already partially denormalized data', () => { | ||
const entities = { | ||
Report: { | ||
'123': { | ||
id: '123', | ||
title: 'Weekly report', | ||
draftedBy: '456', | ||
publishedBy: '456', | ||
}, | ||
Menu: { | ||
'1': { id: '1', food: { id: '1' } }, | ||
}, | ||
User: { | ||
'456': { | ||
id: '456', | ||
role: 'manager', | ||
reports: ['123'], | ||
}, | ||
Food: { | ||
// TODO: BREAKING CHANGE: Update this to use main entity and only return nested as 'fallback' in case main entity is not set | ||
'1': { id: '1', extra: 'hi' }, | ||
}, | ||
}; | ||
expect(denormalize('123', Report, entities)[0]).toMatchSnapshot(); | ||
expect(denormalize('123', Report, fromJS(entities))[0]).toMatchSnapshot(); | ||
expect(denormalize('456', User, entities)[0]).toMatchSnapshot(); | ||
expect(denormalize('456', User, fromJS(entities))[0]).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', Menu, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
test('denormalizes recursive entities with referential equality', () => { | ||
const entities = { | ||
Report: { | ||
'123': { | ||
id: '123', | ||
title: 'Weekly report', | ||
draftedBy: '456', | ||
publishedBy: '456', | ||
}, | ||
describe('nesting', () => { | ||
class UserData { | ||
id = ''; | ||
readonly role = ''; | ||
readonly reports: Report[] = []; | ||
} | ||
class User extends schema.Entity(UserData) {} | ||
class ReportData { | ||
id = ''; | ||
readonly title: string = ''; | ||
readonly draftedBy: User = User.fromJS(); | ||
readonly publishedBy: User = User.fromJS(); | ||
} | ||
class Report extends schema.Entity(ReportData, { | ||
schema: { | ||
draftedBy: User, | ||
publishedBy: User, | ||
}, | ||
Comment: { | ||
'999': { | ||
id: '999', | ||
body: 'Good morning', | ||
author: '456', | ||
}) {} | ||
User.schema = { | ||
reports: new schema.Array(Report), | ||
}; | ||
class CommentData { | ||
id = ''; | ||
readonly body: string = ''; | ||
readonly author: User = User.fromJS(); | ||
} | ||
class Comment extends schema.Entity(CommentData, { | ||
schema: { author: User }, | ||
}) {} | ||
test('denormalizes recursive dependencies', () => { | ||
const entities = { | ||
Report: { | ||
'123': { | ||
id: '123', | ||
title: 'Weekly report', | ||
draftedBy: '456', | ||
publishedBy: '456', | ||
}, | ||
}, | ||
}, | ||
User: { | ||
'456': { | ||
id: '456', | ||
role: 'manager', | ||
reports: ['123'], | ||
User: { | ||
'456': { | ||
id: '456', | ||
role: 'manager', | ||
reports: ['123'], | ||
}, | ||
}, | ||
'457': { | ||
id: '457', | ||
role: 'servant', | ||
reports: ['123'], | ||
}; | ||
expect(denormalize('123', Report, entities)).toMatchSnapshot(); | ||
expect(denormalize('123', Report, fromJS(entities))).toMatchSnapshot(); | ||
expect(denormalize('456', User, entities)).toMatchSnapshot(); | ||
expect(denormalize('456', User, fromJS(entities))).toMatchSnapshot(); | ||
}); | ||
test('denormalizes recursive entities with referential equality', () => { | ||
const entities = { | ||
Report: { | ||
'123': { | ||
id: '123', | ||
title: 'Weekly report', | ||
draftedBy: '456', | ||
publishedBy: '456', | ||
}, | ||
}, | ||
}, | ||
}; | ||
const entityCache: any = {}; | ||
const resultCache = new WeakEntityMap(); | ||
Comment: { | ||
'999': { | ||
id: '999', | ||
body: 'Good morning', | ||
author: '456', | ||
}, | ||
}, | ||
User: { | ||
'456': { | ||
id: '456', | ||
role: 'manager', | ||
reports: ['123'], | ||
}, | ||
'457': { | ||
id: '457', | ||
role: 'servant', | ||
reports: ['123'], | ||
}, | ||
}, | ||
}; | ||
const entityCache: any = {}; | ||
const resultCache = createResultCache(); | ||
const [denormalizedReport] = denormalize( | ||
'123', | ||
Report, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
const denormalizedReport = denormalize( | ||
'123', | ||
Report, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
expect(denormalizedReport).not.toEqual(expect.any(Symbol)); | ||
if (typeof denormalizedReport === 'symbol') return; | ||
expect(denormalizedReport).toBeDefined(); | ||
// This is just for TypeScript, the above line actually determines this | ||
if (!denormalizedReport) throw new Error('expected to be defined'); | ||
expect(denormalizedReport).toBe(denormalizedReport.draftedBy?.reports[0]); | ||
expect(denormalizedReport.publishedBy).toBe(denormalizedReport.draftedBy); | ||
expect(denormalizedReport.draftedBy?.reports[0].draftedBy).toBe( | ||
denormalizedReport.draftedBy, | ||
); | ||
expect(denormalizedReport).toBeDefined(); | ||
// This is just for TypeScript, the above line actually determines this | ||
if (!denormalizedReport) throw new Error('expected to be defined'); | ||
expect(denormalizedReport).toBe( | ||
denormalizedReport.draftedBy?.reports[0], | ||
); | ||
expect(denormalizedReport.publishedBy).toBe( | ||
denormalizedReport.draftedBy, | ||
); | ||
expect(denormalizedReport.draftedBy?.reports[0].draftedBy).toBe( | ||
denormalizedReport.draftedBy, | ||
); | ||
const [denormalizedReport2] = denormalize( | ||
'123', | ||
Report, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
const denormalizedReport2 = denormalize( | ||
'123', | ||
Report, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
expect(denormalizedReport2).not.toEqual(expect.any(Symbol)); | ||
if (typeof denormalizedReport2 === 'symbol') return; | ||
expect(denormalizedReport2).toStrictEqual(denormalizedReport); | ||
expect(denormalizedReport2).toBe(denormalizedReport); | ||
// NOTE: Given how immutable data works, referential equality can't be | ||
// maintained with nested denormalization. | ||
}); | ||
expect(denormalizedReport2).toStrictEqual(denormalizedReport); | ||
expect(denormalizedReport2).toBe(denormalizedReport); | ||
// NOTE: Given how immutable data works, referential equality can't be | ||
// maintained with nested denormalization. | ||
}); | ||
test('denormalizes maintain referential equality when appropriate', () => { | ||
const entities = { | ||
Report: { | ||
'123': { | ||
id: '123', | ||
title: 'Weekly report', | ||
draftedBy: '456', | ||
publishedBy: '456', | ||
test('denormalizes maintain referential equality when appropriate', () => { | ||
const entities = { | ||
Report: { | ||
'123': { | ||
id: '123', | ||
title: 'Weekly report', | ||
draftedBy: '456', | ||
publishedBy: '456', | ||
}, | ||
}, | ||
}, | ||
Comment: { | ||
'999': { | ||
id: '999', | ||
body: 'Good morning', | ||
author: '456', | ||
Comment: { | ||
'999': { | ||
id: '999', | ||
body: 'Good morning', | ||
author: '456', | ||
}, | ||
}, | ||
}, | ||
User: { | ||
'456': { | ||
id: '456', | ||
role: 'manager', | ||
reports: ['123'], | ||
User: { | ||
'456': { | ||
id: '456', | ||
role: 'manager', | ||
reports: ['123'], | ||
}, | ||
'457': { | ||
id: '457', | ||
role: 'servant', | ||
reports: ['123'], | ||
}, | ||
}, | ||
'457': { | ||
id: '457', | ||
role: 'servant', | ||
reports: ['123'], | ||
}, | ||
}, | ||
}; | ||
const entityCache: any = {}; | ||
const resultCache = new WeakEntityMap(); | ||
}; | ||
const entityCache: any = {}; | ||
const resultCache = createResultCache(); | ||
const input = { report: '123', comment: '999' }; | ||
const schema = { | ||
report: Report, | ||
comment: Comment, | ||
}; | ||
const input = { report: '123', comment: '999' }; | ||
const sch = new schema.Object({ | ||
report: Report, | ||
comment: Comment, | ||
}); | ||
const [denormalizedReport] = denormalize( | ||
input, | ||
schema, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
const denormalizedReport = denormalize( | ||
input, | ||
sch, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
expect(denormalizedReport).not.toEqual(expect.any(Symbol)); | ||
if (typeof denormalizedReport === 'symbol') return; | ||
expect(denormalizedReport.report).toBeDefined(); | ||
expect(denormalizedReport.comment).toBeDefined(); | ||
// This is just for TypeScript, the above line actually determines this | ||
if (!denormalizedReport.report || !denormalizedReport.comment) | ||
throw new Error('expected to be defined'); | ||
expect(denormalizedReport.report.publishedBy).toBe( | ||
denormalizedReport.comment.author, | ||
); | ||
expect(denormalizedReport.report).toBeDefined(); | ||
expect(denormalizedReport.comment).toBeDefined(); | ||
// This is just for TypeScript, the above line actually determines this | ||
if (!denormalizedReport.report || !denormalizedReport.comment) | ||
throw new Error('expected to be defined'); | ||
expect(denormalizedReport.report.publishedBy).toBe( | ||
denormalizedReport.comment.author, | ||
); | ||
const [denormalizedReport2] = denormalize( | ||
input, | ||
schema, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
const denormalizedReport2 = denormalize( | ||
input, | ||
sch, | ||
entities, | ||
entityCache, | ||
resultCache, | ||
); | ||
expect(denormalizedReport2).not.toEqual(expect.any(Symbol)); | ||
if (typeof denormalizedReport2 === 'symbol') return; | ||
expect(denormalizedReport2).toStrictEqual(denormalizedReport); | ||
expect(denormalizedReport2).toBe(denormalizedReport); | ||
expect(denormalizedReport2).toStrictEqual(denormalizedReport); | ||
expect(denormalizedReport2).toBe(denormalizedReport); | ||
// should update all uses of user | ||
const nextEntities = { | ||
...entities, | ||
User: { | ||
...entities.User, | ||
'456': { | ||
...entities.User[456], | ||
role: 'supervisor', | ||
// should update all uses of user | ||
const nextEntities = { | ||
...entities, | ||
User: { | ||
...entities.User, | ||
'456': { | ||
...entities.User[456], | ||
role: 'supervisor', | ||
}, | ||
}, | ||
}, | ||
}; | ||
}; | ||
const [denormalizedReport3] = denormalize( | ||
input, | ||
schema, | ||
nextEntities, | ||
entityCache, | ||
resultCache, | ||
); | ||
const denormalizedReport3 = denormalize( | ||
input, | ||
sch, | ||
nextEntities, | ||
entityCache, | ||
resultCache, | ||
); | ||
expect(denormalizedReport3).not.toEqual(expect.any(Symbol)); | ||
if (typeof denormalizedReport3 === 'symbol') return; | ||
expect(denormalizedReport3.comment?.author?.role).toBe('supervisor'); | ||
expect(denormalizedReport3.report?.draftedBy?.role).toBe('supervisor'); | ||
// NOTE: Given how immutable data works, referential equality can't be | ||
// maintained with nested denormalization. | ||
}); | ||
expect(denormalizedReport3.comment?.author?.role).toBe('supervisor'); | ||
expect(denormalizedReport3.report?.draftedBy?.role).toBe('supervisor'); | ||
// NOTE: Given how immutable data works, referential equality can't be | ||
// maintained with nested denormalization. | ||
}); | ||
describe('optional entities', () => { | ||
it('should be marked as found even when optional is not there', () => { | ||
const [denormalized, found] = denormalize('abc', WithOptional, { | ||
[WithOptional.key]: { | ||
abc: { | ||
id: 'abc', | ||
// this is typed because we're actually sending wrong data to it | ||
requiredArticle: '5' as any, | ||
nextPage: 'blob', | ||
describe('optional entities', () => { | ||
it('should be marked as found even when optional is not there', () => { | ||
const denormalized = denormalize('abc', WithOptional, { | ||
[WithOptional.key]: { | ||
abc: { | ||
id: 'abc', | ||
// this is typed because we're actually sending wrong data to it | ||
requiredArticle: '5' as any, | ||
nextPage: 'blob', | ||
}, | ||
}, | ||
}, | ||
[ArticleEntity.key]: { | ||
['5']: { id: '5' }, | ||
}, | ||
[ArticleEntity.key]: { | ||
['5']: { id: '5' }, | ||
}, | ||
}); | ||
const response = denormalized; | ||
expect(response).toBeDefined(); | ||
expect(response).toBeInstanceOf(WithOptional); | ||
expect(response).toEqual({ | ||
id: 'abc', | ||
article: null, | ||
requiredArticle: ArticleEntity.fromJS({ id: '5' }), | ||
nextPage: 'blob', | ||
}); | ||
}); | ||
expect(found).toBe(true); | ||
const response = denormalized; | ||
expect(response).toBeDefined(); | ||
expect(response).toBeInstanceOf(WithOptional); | ||
expect(response).toEqual({ | ||
id: 'abc', | ||
article: null, | ||
requiredArticle: ArticleEntity.fromJS({ id: '5' }), | ||
nextPage: 'blob', | ||
}); | ||
}); | ||
it('should be marked as found when nested entity is missing', () => { | ||
const [denormalized, found, deleted] = denormalize( | ||
'abc', | ||
WithOptional, | ||
{ | ||
it('should be marked as found when nested entity is missing', () => { | ||
const denormalized = denormalize('abc', WithOptional, { | ||
[WithOptional.key]: { | ||
@@ -1252,22 +1265,19 @@ abc: WithOptional.fromJS({ | ||
}, | ||
}, | ||
); | ||
expect(found).toBe(true); | ||
expect(deleted).toBe(false); | ||
const response = denormalized; | ||
expect(response).toBeDefined(); | ||
expect(response).toBeInstanceOf(WithOptional); | ||
expect(response).toEqual({ | ||
id: 'abc', | ||
article: ArticleEntity.fromJS({ id: '5' }), | ||
requiredArticle: ArticleEntity.fromJS(), | ||
nextPage: 'blob', | ||
}); | ||
expect(denormalized).not.toEqual(expect.any(Symbol)); | ||
if (typeof denormalized === 'symbol') return; | ||
const response = denormalized; | ||
expect(response).toBeDefined(); | ||
expect(response).toBeInstanceOf(WithOptional); | ||
expect(response).toEqual({ | ||
id: 'abc', | ||
article: ArticleEntity.fromJS({ id: '5' }), | ||
requiredArticle: ArticleEntity.fromJS(), | ||
nextPage: 'blob', | ||
}); | ||
}); | ||
}); | ||
it('should be marked as deleted when required entity is deleted symbol', () => { | ||
const [denormalized, found, deleted] = denormalize( | ||
'abc', | ||
WithOptional, | ||
{ | ||
it('should be marked as deleted when required entity is deleted symbol', () => { | ||
const denormalized = denormalize('abc', WithOptional, { | ||
[WithOptional.key]: { | ||
@@ -1284,22 +1294,8 @@ abc: { | ||
}, | ||
}, | ||
); | ||
expect(found).toBe(true); | ||
expect(deleted).toBe(true); | ||
const response = denormalized; | ||
expect(response).toBeDefined(); | ||
expect(response).toBeInstanceOf(WithOptional); | ||
expect(response).toEqual({ | ||
id: 'abc', | ||
article: null, | ||
requiredArticle: undefined, | ||
nextPage: 'blob', | ||
}); | ||
expect(denormalized).toEqual(expect.any(Symbol)); | ||
}); | ||
}); | ||
it('should be non-required deleted members should not result in deleted indicator', () => { | ||
const [denormalized, found, deleted] = denormalize( | ||
'abc', | ||
WithOptional, | ||
{ | ||
it('should be non-required deleted members should not result in deleted indicator', () => { | ||
const denormalized = denormalize('abc', WithOptional, { | ||
[WithOptional.key]: { | ||
@@ -1318,53 +1314,42 @@ abc: WithOptional.fromJS({ | ||
}, | ||
}, | ||
); | ||
expect(found).toBe(true); | ||
expect(deleted).toBe(false); | ||
const response = denormalized; | ||
expect(response).toBeDefined(); | ||
expect(response).toBeInstanceOf(WithOptional); | ||
expect(response).toEqual({ | ||
id: 'abc', | ||
article: undefined, | ||
requiredArticle: ArticleEntity.fromJS({ id: '6' }), | ||
nextPage: 'blob', | ||
}); | ||
expect(denormalized).not.toEqual(expect.any(Symbol)); | ||
if (typeof denormalized === 'symbol') return; | ||
const response = denormalized; | ||
expect(response).toBeDefined(); | ||
expect(response).toBeInstanceOf(WithOptional); | ||
expect(response).toEqual({ | ||
id: 'abc', | ||
article: undefined, | ||
requiredArticle: ArticleEntity.fromJS({ id: '6' }), | ||
nextPage: 'blob', | ||
}); | ||
}); | ||
}); | ||
it('should be both deleted and not found when both are true in different parts of schema', () => { | ||
const [denormalized, found, deleted] = denormalize( | ||
{ data: 'abc' }, | ||
{ data: WithOptional, other: ArticleEntity }, | ||
{ | ||
[WithOptional.key]: { | ||
abc: WithOptional.fromJS({ | ||
id: 'abc', | ||
// this is typed because we're actually sending wrong data to it | ||
article: '6' as any, | ||
requiredArticle: '5' as any, | ||
nextPage: 'blob', | ||
}), | ||
it('should be both deleted and not found when both are true in different parts of schema', () => { | ||
const denormalized = denormalize( | ||
{ data: 'abc' }, | ||
new schema.Object({ data: WithOptional, other: ArticleEntity }), | ||
{ | ||
[WithOptional.key]: { | ||
abc: WithOptional.fromJS({ | ||
id: 'abc', | ||
// this is typed because we're actually sending wrong data to it | ||
article: '6' as any, | ||
requiredArticle: '5' as any, | ||
nextPage: 'blob', | ||
}), | ||
}, | ||
[ArticleEntity.key]: { | ||
['5']: DELETED, | ||
['6']: ArticleEntity.fromJS({ id: '6' }), | ||
}, | ||
}, | ||
[ArticleEntity.key]: { | ||
['5']: DELETED, | ||
['6']: ArticleEntity.fromJS({ id: '6' }), | ||
}, | ||
}, | ||
); | ||
expect(found).toBe(false); | ||
expect(deleted).toBe(true); | ||
const response = denormalized; | ||
expect(response).toBeDefined(); | ||
expect(response).toEqual({ | ||
data: { | ||
id: 'abc', | ||
article: ArticleEntity.fromJS({ id: '6' }), | ||
requiredArticle: undefined, | ||
nextPage: 'blob', | ||
}, | ||
); | ||
expect(denormalized).toEqual(expect.any(Symbol)); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}, | ||
); | ||
@@ -1371,0 +1356,0 @@ describe('Entity.defaults', () => { |
@@ -77,3 +77,3 @@ /** | ||
// { [DRAFT] } means we are still processing - which if found indicates a cycle | ||
wrappedUnvisit.setLocal = entityCopy => | ||
(wrappedUnvisit as any).setLocal = (entityCopy: any) => | ||
(localCache[schema.key][pk] = { [DRAFT]: entityCopy, i: trackingIndex }); | ||
@@ -159,3 +159,4 @@ | ||
input, | ||
schema, | ||
// this casting is ok because the interface was never exposed to users | ||
schema as any, | ||
unvisit, | ||
@@ -300,3 +301,3 @@ getEntity, | ||
// this is due to only needed the next level of nested entities for lookup | ||
const originalUnvisit = unvisit.og || unvisit; | ||
const originalUnvisit = (unvisit as any).og || unvisit; | ||
const wrappedUnvisit = (input: any, schema: any) => | ||
@@ -307,2 +308,2 @@ originalUnvisit(input, schema); | ||
} | ||
it('should', () => {}); | ||
it('[helper file in test folder]', () => {}); |
@@ -71,2 +71,2 @@ /** Link in a chain */ | ||
} | ||
it('should', () => {}); | ||
it('[helper file in test folder]', () => {}); |
@@ -131,5 +131,5 @@ // eslint-env jest | ||
const object = new schema.Object({ | ||
item: { | ||
item: new schema.Object({ | ||
user: User, | ||
}, | ||
}), | ||
}); | ||
@@ -141,15 +141,8 @@ const entities = { | ||
}; | ||
let [value, found] = denormalize({ item: null }, object, entities); | ||
let value = denormalize({ item: null }, object, entities); | ||
expect(value).toMatchSnapshot(); | ||
expect(found).toBe(true); | ||
[value, found] = denormalize({ item: null }, object, fromJS(entities)); | ||
value = denormalize({ item: null }, object, fromJS(entities)); | ||
expect(value).toMatchSnapshot(); | ||
expect(found).toBe(true); | ||
[value, found] = denormalize( | ||
fromJS({ item: null }), | ||
object, | ||
fromJS(entities), | ||
); | ||
value = denormalize(fromJS({ item: null }), object, fromJS(entities)); | ||
expect(value).toMatchSnapshot(); | ||
expect(found).toBe(true); | ||
}); | ||
@@ -156,0 +149,0 @@ |
// eslint-env jest | ||
import { inferResults } from '@rest-hooks/normalizr'; | ||
import { WeakEntityMap, inferResults } from '@rest-hooks/normalizr'; | ||
import { IDEntity } from '__tests__/new'; | ||
import { fromJS } from 'immutable'; | ||
import denormalize from './denormalize'; | ||
import { denormalizeSimple, denormalize10 } from './denormalize'; | ||
import { schema, Query, Denormalize, DenormalizeNullable } from '../..'; | ||
@@ -27,100 +27,108 @@ | ||
], | ||
])( | ||
`${schema.Array.name} denormalization (%s)`, | ||
(_, createInput, createOutput) => { | ||
class User extends IDEntity { | ||
name = ''; | ||
isAdmin = false; | ||
} | ||
const sortedUsers = new Query( | ||
new schema.Object({ results: new schema.All(User) }), | ||
({ results }, { asc } = { asc: false }) => { | ||
const sorted = [...results].sort((a, b) => | ||
a.name.localeCompare(b.name), | ||
); | ||
if (asc) return sorted; | ||
return sorted.reverse(); | ||
}, | ||
); | ||
test('denormalize sorts', () => { | ||
const entities = { | ||
User: { | ||
1: { id: '1', name: 'Milo' }, | ||
2: { id: '2', name: 'Jake' }, | ||
3: { id: '3', name: 'Zeta' }, | ||
4: { id: '4', name: 'Alpha' }, | ||
])(`input (%s)`, (_, createInput, createOutput) => { | ||
describe.each([ | ||
['current', denormalizeSimple, () => new WeakEntityMap()], | ||
['legacy', denormalize10, () => new WeakEntityMap()], | ||
] as const)( | ||
`${Query.name} denormalization (%s)`, | ||
(_, denormalize, createResultCache) => { | ||
class User extends IDEntity { | ||
name = ''; | ||
isAdmin = false; | ||
} | ||
const sortedUsers = new Query( | ||
new schema.Object({ results: new schema.All(User) }), | ||
({ results }, { asc } = { asc: false }) => { | ||
const sorted = [...results].sort((a, b) => | ||
a.name.localeCompare(b.name), | ||
); | ||
if (asc) return sorted; | ||
return sorted.reverse(); | ||
}, | ||
}; | ||
const users: DenormalizeNullable<typeof sortedUsers.schema> = denormalize( | ||
inferResults(sortedUsers.schema, [], {}, entities), | ||
sortedUsers.schema, | ||
createInput(entities), | ||
)[0]; | ||
expect(users && users[0].name).toBe('Zeta'); | ||
expect(users).toMatchSnapshot(); | ||
}); | ||
); | ||
test('denormalize sorts with arg', () => { | ||
const entities = { | ||
User: { | ||
1: { id: '1', name: 'Milo' }, | ||
2: { id: '2', name: 'Jake' }, | ||
3: { id: '3', name: 'Zeta' }, | ||
4: { id: '4', name: 'Alpha' }, | ||
}, | ||
}; | ||
expect( | ||
denormalize( | ||
inferResults(sortedUsers.schema, [{ asc: true }], {}, entities), | ||
test('denormalize sorts', () => { | ||
const entities = { | ||
User: { | ||
1: { id: '1', name: 'Milo' }, | ||
2: { id: '2', name: 'Jake' }, | ||
3: { id: '3', name: 'Zeta' }, | ||
4: { id: '4', name: 'Alpha' }, | ||
}, | ||
}; | ||
const users: DenormalizeNullable<typeof sortedUsers.schema> | symbol = | ||
denormalize( | ||
inferResults(sortedUsers.schema, [], {}, entities), | ||
sortedUsers.schema, | ||
createInput(entities), | ||
); | ||
expect(users).not.toEqual(expect.any(Symbol)); | ||
if (typeof users === 'symbol') return; | ||
expect(users && users[0].name).toBe('Zeta'); | ||
expect(users).toMatchSnapshot(); | ||
}); | ||
test('denormalize sorts with arg', () => { | ||
const entities = { | ||
User: { | ||
1: { id: '1', name: 'Milo' }, | ||
2: { id: '2', name: 'Jake' }, | ||
3: { id: '3', name: 'Zeta' }, | ||
4: { id: '4', name: 'Alpha' }, | ||
}, | ||
}; | ||
expect( | ||
denormalize( | ||
inferResults(sortedUsers.schema, [{ asc: true }], {}, entities), | ||
sortedUsers.schema, | ||
createInput(entities), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
test('denormalizes should not be found when no entities are present', () => { | ||
const entities = { | ||
DOG: { | ||
1: { id: '1', name: 'Milo' }, | ||
2: { id: '2', name: 'Jake' }, | ||
}, | ||
}; | ||
const input = inferResults(sortedUsers.schema, [], {}, entities); | ||
const value = denormalize( | ||
createInput(input), | ||
sortedUsers.schema, | ||
createInput(entities), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
); | ||
test('denormalizes should not be found when no entities are present', () => { | ||
const entities = { | ||
DOG: { | ||
1: { id: '1', name: 'Milo' }, | ||
2: { id: '2', name: 'Jake' }, | ||
}, | ||
}; | ||
const input = inferResults(sortedUsers.schema, [], {}, entities); | ||
expect(createOutput(value)).toEqual(undefined); | ||
}); | ||
const [value, found] = denormalize( | ||
createInput(input), | ||
sortedUsers.schema, | ||
createInput(entities), | ||
); | ||
expect(found).toBe(false); | ||
expect(createOutput(value)).toEqual(undefined); | ||
}); | ||
test('denormalize aggregates', () => { | ||
const userCountByAdmin = new Query( | ||
new schema.Object({ results: new schema.All(User) }), | ||
({ results }, { isAdmin }: { isAdmin?: boolean } = {}) => { | ||
if (isAdmin === undefined) return results.length; | ||
return results.filter(user => user.isAdmin === isAdmin).length; | ||
}, | ||
); | ||
const entities = { | ||
User: { | ||
1: { id: '1', name: 'Milo' }, | ||
2: { id: '2', name: 'Jake', isAdmin: true }, | ||
3: { id: '3', name: 'Zeta' }, | ||
4: { id: '4', name: 'Alpha' }, | ||
}, | ||
}; | ||
const totalCount: DenormalizeNullable<typeof userCountByAdmin.schema> = | ||
denormalize( | ||
test('denormalize aggregates', () => { | ||
const userCountByAdmin = new Query( | ||
new schema.Object({ results: new schema.All(User) }), | ||
({ results }, { isAdmin }: { isAdmin?: boolean } = {}) => { | ||
if (isAdmin === undefined) return results.length; | ||
return results.filter(user => user.isAdmin === isAdmin).length; | ||
}, | ||
); | ||
const entities = { | ||
User: { | ||
1: { id: '1', name: 'Milo' }, | ||
2: { id: '2', name: 'Jake', isAdmin: true }, | ||
3: { id: '3', name: 'Zeta' }, | ||
4: { id: '4', name: 'Alpha' }, | ||
}, | ||
}; | ||
const totalCount: | ||
| DenormalizeNullable<typeof userCountByAdmin.schema> | ||
| symbol = denormalize( | ||
inferResults(userCountByAdmin.schema, [], {}, entities), | ||
userCountByAdmin.schema, | ||
createInput(entities), | ||
)[0]; | ||
expect(totalCount).toBe(4); | ||
const nonAdminCount: DenormalizeNullable<typeof userCountByAdmin.schema> = | ||
denormalize( | ||
); | ||
expect(totalCount).toBe(4); | ||
const nonAdminCount: | ||
| DenormalizeNullable<typeof userCountByAdmin.schema> | ||
| symbol = denormalize( | ||
inferResults( | ||
@@ -134,6 +142,7 @@ userCountByAdmin.schema, | ||
createInput(entities), | ||
)[0]; | ||
expect(nonAdminCount).toBe(3); | ||
const adminCount: DenormalizeNullable<typeof userCountByAdmin.schema> = | ||
denormalize( | ||
); | ||
expect(nonAdminCount).toBe(3); | ||
const adminCount: | ||
| DenormalizeNullable<typeof userCountByAdmin.schema> | ||
| symbol = denormalize( | ||
inferResults( | ||
@@ -147,11 +156,13 @@ userCountByAdmin.schema, | ||
createInput(entities), | ||
)[0]; | ||
expect(adminCount).toBe(1); | ||
); | ||
expect(adminCount).toBe(1); | ||
if (typeof totalCount === 'symbol') return; | ||
// typecheck | ||
totalCount !== undefined && totalCount + 5; | ||
// @ts-expect-error | ||
totalCount?.bob; | ||
}); | ||
}, | ||
); | ||
// typecheck | ||
totalCount !== undefined && totalCount + 5; | ||
// @ts-expect-error | ||
totalCount?.bob; | ||
}); | ||
}, | ||
); | ||
}); |
@@ -77,3 +77,3 @@ // eslint-env jest | ||
}; | ||
const [response, found] = denormalize( | ||
const response = denormalize( | ||
{ | ||
@@ -87,2 +87,4 @@ user: '1', | ||
); | ||
expect(response).not.toEqual(expect.any(Symbol)); | ||
if (typeof response === 'symbol') return; | ||
expect(response.anotherItem).toBeInstanceOf(Other); | ||
@@ -93,3 +95,2 @@ expect(response.time.getTime()).toBe(response.time.getTime()); | ||
); | ||
expect(found).toBe(true); | ||
expect(response).toMatchSnapshot(); | ||
@@ -108,3 +109,3 @@ }); | ||
}; | ||
const [response, found] = denormalize( | ||
const response = denormalize( | ||
{ | ||
@@ -118,2 +119,4 @@ user: '1', | ||
); | ||
expect(response).not.toEqual(expect.any(Symbol)); | ||
if (typeof response === 'symbol') return; | ||
expect(response.anotherItem).toBeInstanceOf(Other); | ||
@@ -124,5 +127,4 @@ expect(response.time.getTime()).toBe(response.time.getTime()); | ||
); | ||
expect(found).toBe(true); | ||
expect(response).toMatchSnapshot(); | ||
}); | ||
}); |
@@ -7,3 +7,3 @@ // eslint-env jest | ||
import denormalize from './denormalize'; | ||
import { denormalizeSimple, denormalizeLegacy } from './denormalize'; | ||
import { schema } from '../../'; | ||
@@ -241,3 +241,3 @@ | ||
expect( | ||
denormalize(denorm.result, waterfallSchema, denorm.entities), | ||
denormalizeSimple(denorm.result, waterfallSchema, denorm.entities), | ||
).toMatchSnapshot(); | ||
@@ -247,110 +247,104 @@ }); | ||
describe(`${schema.Union.name} denormalization`, () => { | ||
class User extends IDEntity {} | ||
class Group extends IDEntity {} | ||
const entities = { | ||
User: { | ||
1: { id: '1', username: 'Janey', type: 'users' }, | ||
}, | ||
Group: { | ||
2: { id: '2', groupname: 'People', type: 'groups' }, | ||
}, | ||
}; | ||
class User extends IDEntity {} | ||
class Group extends IDEntity {} | ||
const entities = { | ||
User: { | ||
1: { id: '1', username: 'Janey', type: 'users' }, | ||
}, | ||
Group: { | ||
2: { id: '2', groupname: 'People', type: 'groups' }, | ||
}, | ||
}; | ||
describe.each([ | ||
['direct', data => data], | ||
['immutable', fromJS], | ||
])(`input (%s)`, (_, createInput) => { | ||
describe.each([ | ||
['current', denormalizeSimple], | ||
['legacy', denormalizeLegacy], | ||
])(`${schema.Union.name} denormalization (%s)`, (_, denormalize) => { | ||
test('denormalizes an object using string schemaAttribute', () => { | ||
const union = new schema.Union( | ||
{ | ||
users: User, | ||
groups: Group, | ||
}, | ||
'type', | ||
); | ||
test('denormalizes an object using string schemaAttribute', () => { | ||
const union = new schema.Union( | ||
{ | ||
users: User, | ||
groups: Group, | ||
}, | ||
'type', | ||
); | ||
expect( | ||
denormalize( | ||
createInput({ id: '1', schema: 'users' }), | ||
union, | ||
createInput(entities), | ||
), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize({ id: '1', schema: 'users' }, union, entities), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize( | ||
fromJS({ id: '1', schema: 'users' }), | ||
union, | ||
fromJS(entities), | ||
), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize( | ||
createInput({ id: '2', schema: 'groups' }), | ||
union, | ||
createInput(entities), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
expect( | ||
denormalize({ id: '2', schema: 'groups' }, union, entities), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize( | ||
fromJS({ id: '2', schema: 'groups' }), | ||
union, | ||
fromJS(entities), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
test('denormalizes an array of multiple entities using a function to infer the schemaAttribute', () => { | ||
const union = new schema.Union( | ||
{ | ||
users: User, | ||
groups: Group, | ||
}, | ||
input => { | ||
return input.username ? 'users' : 'groups'; | ||
}, | ||
); | ||
test('denormalizes an array of multiple entities using a function to infer the schemaAttribute', () => { | ||
const union = new schema.Union( | ||
{ | ||
users: User, | ||
groups: Group, | ||
}, | ||
input => { | ||
return input.username ? 'users' : 'groups'; | ||
}, | ||
); | ||
expect( | ||
denormalize( | ||
createInput({ id: '1', schema: 'users' }), | ||
union, | ||
createInput(entities), | ||
), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize({ id: '1', schema: 'users' }, union, entities), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize( | ||
fromJS({ id: '1', schema: 'users' }), | ||
union, | ||
fromJS(entities), | ||
), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize( | ||
createInput({ id: '2', schema: 'groups' }), | ||
union, | ||
createInput(entities), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
expect( | ||
denormalize({ id: '2', schema: 'groups' }, union, entities), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize( | ||
fromJS({ id: '2', schema: 'groups' }), | ||
union, | ||
fromJS(entities), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
test('returns the original value when no schema is given', () => { | ||
const union = new schema.Union( | ||
{ | ||
users: User, | ||
groups: Group, | ||
}, | ||
input => { | ||
return input.username ? 'users' : 'groups'; | ||
}, | ||
); | ||
test('returns the original value when no schema is given', () => { | ||
const union = new schema.Union( | ||
{ | ||
users: User, | ||
groups: Group, | ||
}, | ||
input => { | ||
return input.username ? 'users' : 'groups'; | ||
}, | ||
); | ||
expect( | ||
denormalize(createInput({ id: '1' }), union, createInput(entities)), | ||
).toMatchSnapshot(); | ||
}); | ||
expect(denormalize({ id: '1' }, union, entities)).toMatchSnapshot(); | ||
expect( | ||
denormalize(fromJS({ id: '1' }), union, fromJS(entities)), | ||
).toMatchSnapshot(); | ||
}); | ||
test('returns the original value when string is given', () => { | ||
const union = new schema.Union( | ||
{ | ||
users: User, | ||
groups: Group, | ||
}, | ||
input => { | ||
return input.username ? 'users' : 'groups'; | ||
}, | ||
); | ||
test('returns the original value when string is given', () => { | ||
const union = new schema.Union( | ||
{ | ||
users: User, | ||
groups: Group, | ||
}, | ||
input => { | ||
return input.username ? 'users' : 'groups'; | ||
}, | ||
); | ||
expect(denormalize('1', union, entities)).toMatchSnapshot(); | ||
expect(denormalize('1', union, createInput(entities))).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
@@ -6,3 +6,3 @@ // eslint-env jest | ||
import denormalize from './denormalize'; | ||
import { denormalizeSimple, denormalizeLegacy } from './denormalize'; | ||
import { schema } from '../../'; | ||
@@ -202,233 +202,210 @@ import { DELETED } from '../../special'; | ||
describe(`${schema.Values.name} denormalization`, () => { | ||
test('denormalizes without schemaAttribute', () => { | ||
class MyEntity extends IDEntity { | ||
name = ''; | ||
} | ||
const valuesSchema = new schema.Values(MyEntity); | ||
describe.each([ | ||
['direct', data => data], | ||
['immutable', fromJS], | ||
])(`input (%s)`, (_, createInput) => { | ||
describe.each([ | ||
['current', denormalizeSimple], | ||
['legacy', denormalizeLegacy], | ||
])(`${schema.Values.name} denormalization (%s)`, (_, denormalize) => { | ||
test('denormalizes without schemaAttribute', () => { | ||
class MyEntity extends IDEntity { | ||
name = ''; | ||
} | ||
const valuesSchema = new schema.Values(MyEntity); | ||
const entities = { | ||
MyEntity: { | ||
1: { | ||
id: '1', | ||
name: 'first thing', | ||
const entities = { | ||
MyEntity: { | ||
1: { | ||
id: '1', | ||
name: 'first thing', | ||
}, | ||
2: { | ||
id: '2', | ||
name: 'second thing', | ||
}, | ||
}, | ||
2: { | ||
id: '2', | ||
name: 'second thing', | ||
}, | ||
}, | ||
}; | ||
}; | ||
expect( | ||
denormalize( | ||
expect( | ||
denormalize( | ||
{ | ||
first: '1', | ||
second: '2', | ||
}, | ||
valuesSchema, | ||
createInput(entities), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
test('denormalizes the values of an object with the given schema', () => { | ||
const valuesSchema = new schema.Values( | ||
{ | ||
first: '1', | ||
second: '2', | ||
dogs: Dog, | ||
cats: Cat, | ||
}, | ||
valuesSchema, | ||
entities, | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
entity => entity.type, | ||
); | ||
test('denormalizes the values of an object with the given schema', () => { | ||
const valuesSchema = new schema.Values( | ||
{ | ||
dogs: Dog, | ||
cats: Cat, | ||
}, | ||
entity => entity.type, | ||
); | ||
const entities = { | ||
Cat: { 1: { id: '1', type: 'cats' } }, | ||
Dog: { 1: { id: '1', type: 'dogs' } }, | ||
}; | ||
const entities = { | ||
Cat: { 1: { id: '1', type: 'cats' } }, | ||
Dog: { 1: { id: '1', type: 'dogs' } }, | ||
}; | ||
expect( | ||
denormalize( | ||
{ | ||
fido: { id: '1', schema: 'dogs' }, | ||
fluffy: { id: '1', schema: 'cats' }, | ||
}, | ||
valuesSchema, | ||
createInput(entities), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
expect( | ||
denormalize( | ||
test('denormalizes with missing entity should have false second value', () => { | ||
const valuesSchema = new schema.Values( | ||
{ | ||
fido: { id: '1', schema: 'dogs' }, | ||
fluffy: { id: '1', schema: 'cats' }, | ||
dogs: Dog, | ||
cats: Cat, | ||
}, | ||
valuesSchema, | ||
entities, | ||
), | ||
).toMatchSnapshot(); | ||
entity => entity.type, | ||
); | ||
expect( | ||
denormalize( | ||
{ | ||
fido: { id: '1', schema: 'dogs' }, | ||
fluffy: { id: '1', schema: 'cats' }, | ||
}, | ||
valuesSchema, | ||
fromJS(entities), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
const entities = { | ||
Cat: { 1: { id: '1', type: 'cats' } }, | ||
Dog: { 1: { id: '1', type: 'dogs' } }, | ||
}; | ||
test('denormalizes with missing entity should have false second value', () => { | ||
const valuesSchema = new schema.Values( | ||
{ | ||
dogs: Dog, | ||
cats: Cat, | ||
}, | ||
entity => entity.type, | ||
); | ||
expect( | ||
denormalize( | ||
{ | ||
fido: { id: '1', schema: 'dogs' }, | ||
fluffy: { id: '1', schema: 'cats' }, | ||
prancy: { id: '5', schema: 'cats' }, | ||
}, | ||
valuesSchema, | ||
createInput(entities), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
const entities = { | ||
Cat: { 1: { id: '1', type: 'cats' } }, | ||
Dog: { 1: { id: '1', type: 'dogs' } }, | ||
}; | ||
expect( | ||
denormalize( | ||
test('denormalizes with deleted entity should just remove them', () => { | ||
const valuesSchema = new schema.Values( | ||
{ | ||
fido: { id: '1', schema: 'dogs' }, | ||
fluffy: { id: '1', schema: 'cats' }, | ||
prancy: { id: '5', schema: 'cats' }, | ||
dogs: Dog, | ||
cats: Cat, | ||
}, | ||
valuesSchema, | ||
entities, | ||
), | ||
).toMatchSnapshot(); | ||
entity => entity.type, | ||
); | ||
expect( | ||
denormalize( | ||
{ | ||
fido: { id: '1', schema: 'dogs' }, | ||
fluffy: { id: '1', schema: 'cats' }, | ||
prancy: { id: '5', schema: 'cats' }, | ||
}, | ||
valuesSchema, | ||
fromJS(entities), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
const entities = { | ||
Cat: { 1: { id: '1', type: 'cats' }, 5: DELETED }, | ||
Dog: { 1: { id: '1', type: 'dogs' } }, | ||
}; | ||
test('denormalizes with deleted entity should have false third value', () => { | ||
const valuesSchema = new schema.Values( | ||
{ | ||
dogs: Dog, | ||
cats: Cat, | ||
}, | ||
entity => entity.type, | ||
); | ||
expect( | ||
denormalize( | ||
{ | ||
fido: { id: '1', schema: 'dogs' }, | ||
fluffy: { id: '1', schema: 'cats' }, | ||
prancy: { id: '5', schema: 'cats' }, | ||
}, | ||
valuesSchema, | ||
createInput(entities), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
const entities = { | ||
Cat: { 1: { id: '1', type: 'cats' }, 5: DELETED }, | ||
Dog: { 1: { id: '1', type: 'dogs' } }, | ||
}; | ||
expect( | ||
denormalize( | ||
{ | ||
fido: { id: '1', schema: 'dogs' }, | ||
fluffy: { id: '1', schema: 'cats' }, | ||
prancy: { id: '5', schema: 'cats' }, | ||
}, | ||
valuesSchema, | ||
entities, | ||
), | ||
).toMatchSnapshot(); | ||
expect( | ||
denormalize( | ||
{ | ||
fido: { id: '1', schema: 'dogs' }, | ||
fluffy: { id: '1', schema: 'cats' }, | ||
prancy: { id: '5', schema: 'cats' }, | ||
}, | ||
valuesSchema, | ||
fromJS(entities), | ||
), | ||
).toMatchSnapshot(); | ||
}); | ||
test('works on complex object', () => { | ||
class Estimate extends Entity { | ||
pk() { | ||
return this.fee.currency; | ||
test('works on complex object', () => { | ||
class Estimate extends Entity { | ||
pk() { | ||
return this.fee.currency; | ||
} | ||
} | ||
} | ||
const response = { | ||
data: { | ||
estimates: { | ||
BTC: { | ||
confirmation_duration: 900, | ||
exchange: { | ||
rate: '6820.07', | ||
local: 'USD', | ||
crypto: 'BTC', | ||
const response = { | ||
data: { | ||
estimates: { | ||
BTC: { | ||
confirmation_duration: 900, | ||
exchange: { | ||
rate: '6820.07', | ||
local: 'USD', | ||
crypto: 'BTC', | ||
}, | ||
fee_per_kb: { | ||
amount: '0.00016566', | ||
currency: 'BTC', | ||
}, | ||
fee: { | ||
amount: '0.00002270', | ||
currency: 'BTC', | ||
}, | ||
priority: 'fast', | ||
recipient_value: { | ||
amount: '0.00054147', | ||
currency: 'BTC', | ||
}, | ||
exchange_to_proceeds: { | ||
rate: '6820.07', | ||
local: 'EUR', | ||
crypto: 'BTC', | ||
}, | ||
min_order_size: { | ||
amount: '0.001', | ||
currency: 'BTC', | ||
}, | ||
coinbase_fees: { | ||
amount: '0.00002270', | ||
currency: 'BTC', | ||
}, | ||
}, | ||
fee_per_kb: { | ||
amount: '0.00016566', | ||
currency: 'BTC', | ||
ETH: { | ||
confirmation_duration: 900, | ||
exchange: { | ||
rate: '197.07', | ||
local: 'USD', | ||
crypto: 'ETH', | ||
}, | ||
fee_per_kb: { | ||
amount: '0.00086', | ||
currency: 'ETH', | ||
}, | ||
fee: { | ||
amount: '0.03795', | ||
currency: 'ETH', | ||
}, | ||
priority: 'fast', | ||
recipient_value: { | ||
amount: '2.53', | ||
currency: 'ETH', | ||
}, | ||
exchange_to_proceeds: { | ||
rate: '6820.07', | ||
local: 'EUR', | ||
crypto: 'BTC', | ||
}, | ||
min_order_size: { | ||
amount: '0.001', | ||
currency: 'BTC', | ||
}, | ||
coinbase_fees: { | ||
amount: '0.00002270', | ||
currency: 'BTC', | ||
}, | ||
}, | ||
fee: { | ||
amount: '0.00002270', | ||
currency: 'BTC', | ||
}, | ||
priority: 'fast', | ||
recipient_value: { | ||
amount: '0.00054147', | ||
currency: 'BTC', | ||
}, | ||
exchange_to_proceeds: { | ||
rate: '6820.07', | ||
local: 'EUR', | ||
crypto: 'BTC', | ||
}, | ||
min_order_size: { | ||
amount: '0.001', | ||
currency: 'BTC', | ||
}, | ||
coinbase_fees: { | ||
amount: '0.00002270', | ||
currency: 'BTC', | ||
}, | ||
}, | ||
ETH: { | ||
confirmation_duration: 900, | ||
exchange: { | ||
rate: '197.07', | ||
local: 'USD', | ||
crypto: 'ETH', | ||
}, | ||
fee_per_kb: { | ||
amount: '0.00086', | ||
currency: 'ETH', | ||
}, | ||
fee: { | ||
amount: '0.03795', | ||
currency: 'ETH', | ||
}, | ||
priority: 'fast', | ||
recipient_value: { | ||
amount: '2.53', | ||
currency: 'ETH', | ||
}, | ||
exchange_to_proceeds: { | ||
rate: '6820.07', | ||
local: 'EUR', | ||
crypto: 'BTC', | ||
}, | ||
min_order_size: { | ||
amount: '0.001', | ||
currency: 'BTC', | ||
}, | ||
coinbase_fees: { | ||
amount: '0.00002270', | ||
currency: 'BTC', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
const shape = { data: { estimates: new schema.Values(Estimate) } }; | ||
const { result, entities } = normalize(response, shape); | ||
expect(denormalize(result, shape, entities)[0]).toMatchSnapshot(); | ||
}; | ||
const shape = new schema.Object({ | ||
data: new schema.Object({ estimates: new schema.Values(Estimate) }), | ||
}); | ||
const { result, entities } = normalize(response, shape); | ||
expect( | ||
denormalize(result, shape, createInput(entities)), | ||
).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
@@ -29,5 +29,16 @@ import ArraySchema from './Array.js'; | ||
visitedEntities: any, | ||
storeEntities: any, | ||
args?: any[], | ||
): any { | ||
// we return undefined | ||
super.normalize(input, parent, key, visit, addEntity, visitedEntities); | ||
super.normalize( | ||
input, | ||
parent, | ||
key, | ||
visit, | ||
addEntity, | ||
visitedEntities, | ||
storeEntities, | ||
args, | ||
); | ||
} | ||
@@ -34,0 +45,0 @@ |
@@ -16,2 +16,4 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
visitedEntities: any, | ||
storeEntities: any, | ||
args?: any[], | ||
): any { | ||
@@ -29,2 +31,4 @@ const values = getValues(input); | ||
visitedEntities, | ||
storeEntities, | ||
args, | ||
), | ||
@@ -39,16 +43,17 @@ ) | ||
): [denormalized: any, found: boolean, deleted: boolean] { | ||
return [ | ||
input.map | ||
? input | ||
.map((entityOrId: any) => | ||
this.denormalizeValue(entityOrId, unvisit), | ||
) | ||
.filter(filterEmpty) | ||
.map(([value]: any) => value) | ||
: input, | ||
true, | ||
false, | ||
]; | ||
return [this.denormalizeOnly(input, [], unvisit), true, false]; | ||
} | ||
denormalizeOnly( | ||
input: any, | ||
args: any[], | ||
unvisit: (input: any, schema: any) => any, | ||
) { | ||
return input.map | ||
? input | ||
.map((entityOrId: any) => this.denormalizeValue(entityOrId, unvisit)) | ||
.filter(filterEmpty) | ||
: input; | ||
} | ||
infer( | ||
@@ -55,0 +60,0 @@ args: unknown, |
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
import Invalidate from './Invalidate.js'; | ||
import type { EntityInterface } from '../interface.js'; | ||
import type { AbstractInstanceType } from '../normal.js'; | ||
import { SchemaClass, UnvisitFunction } from '../schema.js'; | ||
import { DELETED } from '../special.js'; | ||
// TODO(breaking): mark deprecated | ||
/** | ||
@@ -11,57 +12,10 @@ * Marks entity as deleted. | ||
*/ | ||
export default class Delete<E extends EntityInterface & { process: any }> | ||
export default class Delete< | ||
E extends EntityInterface & { | ||
process: any; | ||
}, | ||
> | ||
extends Invalidate<E> | ||
implements SchemaClass | ||
{ | ||
private declare _entity: E; | ||
constructor(entity: E) { | ||
if (process.env.NODE_ENV !== 'production' && !entity) { | ||
throw new Error('Expected option "entity" not found on DeleteSchema.'); | ||
} | ||
this._entity = entity; | ||
} | ||
get key() { | ||
return this._entity.key; | ||
} | ||
normalize( | ||
input: any, | ||
parent: any, | ||
key: string | undefined, | ||
visit: (...args: any) => any, | ||
addEntity: (...args: any) => any, | ||
visitedEntities: Record<string, any>, | ||
): string | undefined { | ||
// TODO: what's store needs to be a differing type from fromJS | ||
const processedEntity = this._entity.process(input, parent, key); | ||
const id = this._entity.pk(processedEntity, parent, key); | ||
if ( | ||
process.env.NODE_ENV !== 'production' && | ||
(id === undefined || id === '') | ||
) { | ||
const error = new Error( | ||
`Missing usable primary key when normalizing response. | ||
This is likely due to a malformed response. | ||
Try inspecting the network response or fetch() return value. | ||
Or use debugging tools: https://resthooks.io/docs/guides/debugging | ||
Learn more about schemas: https://resthooks.io/docs/api/schema | ||
Delete(Entity): Delete(${(this._entity as any).name ?? this._entity}) | ||
Value: ${input && JSON.stringify(input, null, 2)} | ||
`, | ||
); | ||
(error as any).status = 400; | ||
throw error; | ||
} | ||
addEntity(this, DELETED, id); | ||
return id; | ||
} | ||
infer(args: any, indexes: any, recurse: any): any { | ||
return undefined; | ||
} | ||
denormalize( | ||
@@ -73,30 +27,2 @@ id: string, | ||
} | ||
/* istanbul ignore next */ | ||
_denormalizeNullable(): [ | ||
AbstractInstanceType<E> | undefined, | ||
boolean, | ||
false, | ||
] { | ||
return [] as any; | ||
} | ||
/* istanbul ignore next */ | ||
_normalizeNullable(): string | undefined { | ||
return [] as any; | ||
} | ||
/* istanbul ignore next */ | ||
merge(existing: any, incoming: any) { | ||
return incoming; | ||
} | ||
useIncoming( | ||
existingMeta: { date: number; fetchedAt: number }, | ||
incomingMeta: { date: number; fetchedAt: number }, | ||
existing: any, | ||
incoming: any, | ||
) { | ||
return existingMeta.date <= incomingMeta.date; | ||
} | ||
} |
@@ -9,3 +9,3 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
const EmptyBase = class {} as any as abstract new (...args: any[]) => { | ||
pk(parent?: any, key?: string): string | undefined; | ||
pk(parent?: any, key?: string, args?: readonly any[]): string | undefined; | ||
}; | ||
@@ -24,3 +24,7 @@ | ||
*/ | ||
abstract pk(parent?: any, key?: string): string | undefined; | ||
abstract pk( | ||
parent?: any, | ||
key?: string, | ||
args?: readonly any[], | ||
): string | undefined; | ||
@@ -79,2 +83,22 @@ /** Control how automatic schema validation is handled | ||
static mergeMetaWithStore( | ||
existingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, | ||
incomingMeta: { expiresAt: number; date: number; fetchedAt: number }, | ||
existing: any, | ||
incoming: any, | ||
) { | ||
return { | ||
expiresAt: Math.max( | ||
(this as any).expiresAt(incomingMeta, incoming), | ||
existingMeta.expiresAt, | ||
), | ||
date: Math.max(incomingMeta.date, existingMeta.date), | ||
fetchedAt: Math.max(incomingMeta.fetchedAt, existingMeta.fetchedAt), | ||
}; | ||
} | ||
/** Factory method to convert from Plain JS Objects. | ||
@@ -102,2 +126,3 @@ * | ||
key?: string, | ||
args?: any[], | ||
) => string | undefined; | ||
@@ -291,1 +316,9 @@ | ||
} | ||
// we're avoiding this on the type | ||
(Entity as any).expiresAt = function ( | ||
meta: { expiresAt: number; date: number; fetchedAt: number }, | ||
input: any, | ||
): number { | ||
return meta.expiresAt; | ||
}; |
@@ -10,3 +10,3 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
export type PKClass = abstract new (...args: any[]) => { | ||
pk(parent?: any, key?: string): string | undefined; | ||
pk(parent?: any, key?: string, args?: readonly any[]): string | undefined; | ||
}; | ||
@@ -74,3 +74,7 @@ | ||
*/ | ||
abstract pk(parent?: any, key?: string): string | undefined; | ||
abstract pk( | ||
parent?: any, | ||
key?: string, | ||
args?: readonly any[], | ||
): string | undefined; | ||
@@ -87,2 +91,3 @@ /** Returns the globally unique identifier for the static Entity */ | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#pk | ||
* @param [value] POJO of the entity or subset used | ||
@@ -97,4 +102,5 @@ * @param [parent] When normalizing, the object which included the entity | ||
key?: string, | ||
args?: readonly any[], | ||
): string | undefined { | ||
return this.prototype.pk.call(value, parent, key); | ||
return this.prototype.pk.call(value, parent, key, args); | ||
} | ||
@@ -129,3 +135,6 @@ | ||
/** Creates new instance copying over defined values of arguments */ | ||
/** Creates new instance copying over defined values of arguments | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#merge | ||
*/ | ||
static merge(existing: any, incoming: any) { | ||
@@ -138,3 +147,6 @@ return { | ||
/** Run when an existing entity is found in the store */ | ||
/** Run when an existing entity is found in the store | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#mergeWithStore | ||
*/ | ||
static mergeWithStore( | ||
@@ -175,2 +187,21 @@ existingMeta: { | ||
/** Run when an existing entity is found in the store | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#mergeMetaWithStore | ||
*/ | ||
static mergeMetaWithStore( | ||
existingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, | ||
incomingMeta: { expiresAt: number; date: number; fetchedAt: number }, | ||
existing: any, | ||
incoming: any, | ||
) { | ||
return this.shouldReorder(existingMeta, incomingMeta, existing, incoming) | ||
? existingMeta | ||
: incomingMeta; | ||
} | ||
/** Factory method to convert from Plain JS Objects. | ||
@@ -193,5 +224,6 @@ * | ||
/** Factory method to convert from Plain JS Objects. | ||
/** Called when denormalizing an entity to create an instance when 'valid' | ||
* | ||
* @param [props] Plain Object of properties to assign. | ||
* @see https://resthooks.io/docs/api/schema.Entity#createIfValid | ||
*/ | ||
@@ -209,3 +241,6 @@ static createIfValid<T extends typeof EntityMixin>( | ||
/** Do any transformations when first receiving input */ | ||
/** Do any transformations when first receiving input | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#process | ||
*/ | ||
static process(input: any, parent: any, key: string | undefined): any { | ||
@@ -222,5 +257,7 @@ return { ...input }; | ||
visitedEntities: Record<string, any>, | ||
storeEntities: any, | ||
args?: readonly any[], | ||
): any { | ||
const processedEntity = this.process(input, parent, key); | ||
const id = this.pk(processedEntity, parent, key); | ||
const id = this.pk(processedEntity, parent, key, args); | ||
if (id === undefined || id === '') { | ||
@@ -245,4 +282,4 @@ if (process.env.NODE_ENV !== 'production') { | ||
} else { | ||
// these make the keys get deleted | ||
return undefined; | ||
// these make the keys get deleted; return undefined | ||
return; | ||
} | ||
@@ -278,2 +315,4 @@ } | ||
visitedEntities, | ||
storeEntities, | ||
args, | ||
); | ||
@@ -311,30 +350,11 @@ } | ||
recurse: any, | ||
entities: any, | ||
): any { | ||
if (!args[0]) return undefined; | ||
if (['string', 'number'].includes(typeof args[0])) { | ||
return `${args[0]}`; | ||
} | ||
const id = this.pk(args[0], undefined, ''); | ||
// Was able to infer the entity's primary key from params | ||
if (id !== undefined && id !== '') return id; | ||
// now attempt lookup in indexes | ||
const indexName = indexFromParams(args[0], this.indexes); | ||
if (indexName && indexes[this.key]) { | ||
// 'as Record<string, any>': indexName can only be found if params is a string key'd object | ||
const id = | ||
indexes[this.key][indexName][ | ||
(args[0] as Record<string, any>)[indexName] | ||
]; | ||
return id; | ||
} | ||
const id = inferId(this, args, indexes); | ||
// no entity arg is back-compatibility | ||
if (!entities || entities[this.key]?.[id]) return id; | ||
return undefined; | ||
} | ||
static expiresAt( | ||
meta: { expiresAt: number; date: number; fetchedAt: number }, | ||
input: any, | ||
): number { | ||
return meta.expiresAt; | ||
} | ||
static denormalize<T extends typeof EntityMixin>( | ||
@@ -371,2 +391,30 @@ this: T, | ||
static denormalizeOnly<T extends typeof EntityMixin>( | ||
this: T, | ||
input: any, | ||
args: any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): AbstractInstanceType<T> { | ||
if (typeof input === 'symbol') { | ||
return input as any; | ||
} | ||
// note: iteration order must be stable | ||
for (const key of Object.keys(this.schema)) { | ||
const schema = this.schema[key]; | ||
const value = unvisit(input[key], schema); | ||
if (typeof value === 'symbol') { | ||
// if default is not 'fasly', then this is required, so propagate INVALID symbol | ||
if (this.defaults[key]) { | ||
return value as any; | ||
} | ||
input[key] = undefined; | ||
} else { | ||
input[key] = value; | ||
} | ||
} | ||
return input; | ||
} | ||
/** All instance defaults set */ | ||
@@ -491,9 +539,18 @@ static get defaults() { | ||
}; | ||
/** Defines nested entities */ | ||
/** Defines nested entities | ||
* | ||
* @see https://resthooks.io/rest/api/Entity#schema | ||
*/ | ||
schema: { | ||
[k: string]: Schema; | ||
}; | ||
/** Returns the globally unique identifier for the static Entity */ | ||
/** Returns the globally unique identifier for the static Entity | ||
* | ||
* @see https://resthooks.io/docs/api/Entity#key | ||
*/ | ||
key: string; | ||
/** Defines indexes to enable lookup by */ | ||
/** Defines indexes to enable lookup by | ||
* | ||
* @see https://resthooks.io/rest/api/Entity#indexes | ||
*/ | ||
indexes?: readonly string[] | undefined; | ||
@@ -503,2 +560,3 @@ /** | ||
* | ||
* @see https://resthooks.io/docs/api/Entity#pk | ||
* @param [value] POJO of the entity or subset used | ||
@@ -518,2 +576,3 @@ * @param [parent] When normalizing, the object which included the entity | ||
key?: string, | ||
args?: any[], | ||
): string | undefined; | ||
@@ -547,5 +606,11 @@ /** Return true to merge incoming data; false keeps existing entity | ||
): boolean; | ||
/** Creates new instance copying over defined values of arguments */ | ||
/** Creates new instance copying over defined values of arguments | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#merge | ||
*/ | ||
merge(existing: any, incoming: any): any; | ||
/** Run when an existing entity is found in the store */ | ||
/** Run when an existing entity is found in the store | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#mergeWithStore | ||
*/ | ||
mergeWithStore( | ||
@@ -563,2 +628,20 @@ existingMeta: { | ||
): any; | ||
/** Run when an existing entity is found in the store | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#mergeMetaWithStore | ||
*/ | ||
mergeMetaWithStore( | ||
existingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, | ||
incomingMeta: { expiresAt: number; date: number; fetchedAt: number }, | ||
existing: any, | ||
incoming: any, | ||
): { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}; | ||
/** Factory method to convert from Plain JS Objects. | ||
@@ -577,5 +660,6 @@ * | ||
): AbstractInstanceType<T>; | ||
/** Factory method to convert from Plain JS Objects. | ||
/** Called when denormalizing an entity to create an instance when 'valid' | ||
* | ||
* @param [props] Plain Object of properties to assign. | ||
* @see https://resthooks.io/docs/api/Entity#createIfValid | ||
*/ | ||
@@ -591,3 +675,6 @@ createIfValid< | ||
): AbstractInstanceType<T> | undefined; | ||
/** Do any transformations when first receiving input */ | ||
/** Do any transformations when first receiving input | ||
* | ||
* @see https://resthooks.io/docs/api/Entity#process | ||
*/ | ||
process(input: any, parent: any, key: string | undefined): any; | ||
@@ -602,12 +689,13 @@ normalize( | ||
): any; | ||
/** Do any transformations when first receiving input | ||
* | ||
* @see https://resthooks.io/docs/api/Entity#validate | ||
*/ | ||
validate(processedEntity: any): string | undefined; | ||
/** Attempts to infer results | ||
* | ||
* @see https://resthooks.io/docs/api/Entity#infer | ||
*/ | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: any): any; | ||
expiresAt( | ||
meta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, | ||
input: any, | ||
): number; | ||
denormalize< | ||
@@ -623,2 +711,12 @@ T extends (abstract new (...args: any[]) => IEntityInstance & | ||
): [denormalized: AbstractInstanceType<T>, found: boolean, suspend: boolean]; | ||
denormalizeOnly< | ||
T extends (abstract new (...args: any[]) => IEntityInstance & | ||
InstanceType<TBase>) & | ||
IEntityClass & | ||
TBase, | ||
>( | ||
this: T, | ||
input: any, | ||
unvisit: (input: any, schema: any) => any, | ||
): AbstractInstanceType<T>; | ||
/** All instance defaults set */ | ||
@@ -635,3 +733,22 @@ readonly defaults: any; | ||
*/ | ||
pk(parent?: any, key?: string): string | undefined; | ||
pk(parent?: any, key?: string, args?: readonly any[]): string | undefined; | ||
} | ||
function inferId(schema: any, args: readonly any[], indexes: NormalizedIndex) { | ||
if (['string', 'number'].includes(typeof args[0])) { | ||
return `${args[0]}`; | ||
} | ||
const id = schema.pk(args[0], undefined, '', args); | ||
// Was able to infer the entity's primary key from params | ||
if (id !== undefined && id !== '') return id; | ||
// now attempt lookup in indexes | ||
const indexName = indexFromParams(args[0], schema.indexes); | ||
if (indexName && indexes[schema.key]) { | ||
// 'as Record<string, any>': indexName can only be found if params is a string key'd object | ||
const id = | ||
indexes[schema.key][indexName][ | ||
(args[0] as Record<string, any>)[indexName] | ||
]; | ||
return id; | ||
} | ||
} |
@@ -68,1 +68,34 @@ /** | ||
} | ||
/** | ||
* Denormalize an immutable entity. | ||
* | ||
* @param {Schema} schema | ||
* @param {Immutable.Map|Immutable.Record} input | ||
* @param {function} unvisit | ||
* @param {function} getDenormalizedEntity | ||
* @return {Immutable.Map|Immutable.Record} | ||
*/ | ||
export function denormalizeOnlyImmutable( | ||
schema: any, | ||
input: any, | ||
unvisit: (input: any, schema: any) => any, | ||
): any { | ||
let deleted; | ||
const value = Object.keys(schema).reduce((object, key) => { | ||
// Immutable maps cast keys to strings on write so we need to ensure | ||
// we're accessing them using string keys. | ||
const stringKey = `${key}`; | ||
const item = unvisit(object.get(stringKey), schema[stringKey]); | ||
if (typeof item === 'symbol') { | ||
deleted = item; | ||
} | ||
if (object.has(stringKey)) { | ||
return object.set(stringKey, item); | ||
} else { | ||
return object; | ||
} | ||
}, input); | ||
return deleted ?? value; | ||
} |
@@ -1,2 +0,6 @@ | ||
import { isImmutable, denormalizeImmutable } from './ImmutableUtils.js'; | ||
import { | ||
isImmutable, | ||
denormalizeImmutable, | ||
denormalizeOnlyImmutable, | ||
} from './ImmutableUtils.js'; | ||
@@ -11,2 +15,4 @@ export const normalize = ( | ||
visitedEntities: any, | ||
storeEntities: any, | ||
args: any[], | ||
) => { | ||
@@ -23,2 +29,4 @@ const object = { ...input }; | ||
visitedEntities, | ||
storeEntities, | ||
args, | ||
); | ||
@@ -62,2 +70,26 @@ if (value === undefined || value === null) { | ||
export function denormalizeOnly( | ||
schema: any, | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): any { | ||
if (isImmutable(input)) { | ||
return denormalizeOnlyImmutable(schema, input, unvisit); | ||
} | ||
const object: Record<string, any> = { ...input }; | ||
for (const key of Object.keys(schema)) { | ||
const item = unvisit(object[key], schema[key]); | ||
if (object[key] !== undefined) { | ||
object[key] = item; | ||
} | ||
if (typeof item === 'symbol') { | ||
return item; | ||
} | ||
} | ||
return object; | ||
} | ||
export function infer( | ||
@@ -76,3 +108,2 @@ schema: any, | ||
} | ||
/** | ||
@@ -104,2 +135,4 @@ * Represents objects with statically known members | ||
visitedEntities: any, | ||
storeEntities: any, | ||
args: any[], | ||
] | ||
@@ -115,2 +148,10 @@ ) { | ||
denormalizeOnly( | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): any { | ||
return denormalizeOnly(this.schema, input, args, unvisit); | ||
} | ||
infer(args: any, indexes: any, recurse: any, entities: any) { | ||
@@ -117,0 +158,0 @@ return infer(this.schema, args, indexes, recurse, entities); |
import { isImmutable } from './ImmutableUtils.js'; | ||
import { DELETED } from '../special.js'; | ||
@@ -25,3 +26,9 @@ export default class PolymorphicSchema { | ||
define(definition: any) { | ||
this.schema = definition; | ||
// sending Union into another Polymorphic gets hoisted | ||
if ('_schemaAttribute' in definition && !this._schemaAttribute) { | ||
this.schema = definition.schema; | ||
this._schemaAttribute = definition._schemaAttribute; | ||
} else { | ||
this.schema = definition; | ||
} | ||
} | ||
@@ -49,3 +56,6 @@ | ||
visitedEntities: any, | ||
storeEntities: any, | ||
args?: any[], | ||
) { | ||
if (!value) return value; | ||
const schema = this.inferSchema(value, parent, key); | ||
@@ -78,2 +88,4 @@ if (!schema) { | ||
visitedEntities, | ||
storeEntities, | ||
args, | ||
); | ||
@@ -103,3 +115,3 @@ return this.isSingleSchema || | ||
} | ||
return [value, true, false]; | ||
return value; | ||
} | ||
@@ -112,4 +124,9 @@ const id = this.isSingleSchema | ||
const schema = this.isSingleSchema ? this.schema : this.schema[schemaKey]; | ||
return unvisit(id || value, schema); | ||
const ret = unvisit(id || value, schema); | ||
if (Array.isArray(ret) && ret.length === 3) { | ||
if (ret[2] === true) return DELETED; | ||
return ret[0]; | ||
} | ||
return ret; | ||
} | ||
} |
@@ -24,2 +24,4 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
visitedEntities: any, | ||
storeEntities: any, | ||
args: any[], | ||
) { | ||
@@ -33,2 +35,4 @@ return this.normalizeValue( | ||
visitedEntities, | ||
storeEntities, | ||
args, | ||
); | ||
@@ -38,3 +42,12 @@ } | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
denormalize(input: {}, unvisit: any) { | ||
denormalize(input: {}, unvisit: any): any { | ||
const value = this.denormalizeValue(input, unvisit); | ||
return [value, value !== undefined, typeof value === 'symbol']; | ||
} | ||
denormalizeOnly( | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
) { | ||
return this.denormalizeValue(input, unvisit); | ||
@@ -41,0 +54,0 @@ } |
export const getValues = (input: any) => | ||
Array.isArray(input) ? input : Object.keys(input).map(key => input[key]); | ||
export const filterEmpty = ([item, , deletedItem]: any) => | ||
item !== undefined && !deletedItem; | ||
export const filterEmpty = (item: any) => | ||
item !== undefined && typeof item !== 'symbol'; |
@@ -15,2 +15,4 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
visitedEntities: any, | ||
storeEntities: any, | ||
args: any[], | ||
) { | ||
@@ -29,2 +31,4 @@ return Object.keys(input).reduce((output, key, index) => { | ||
visitedEntities, | ||
storeEntities, | ||
args, | ||
), | ||
@@ -38,18 +42,7 @@ } | ||
denormalize(input: {}, unvisit: any) { | ||
let found = true; | ||
let deleted = false; | ||
return [ | ||
Object.keys(input).reduce((output, key) => { | ||
const entityOrId = (input as any)[key]; | ||
const [value, foundItem, deletedItem] = this.denormalizeValue( | ||
entityOrId, | ||
unvisit, | ||
); | ||
if (!foundItem) { | ||
found = false; | ||
} | ||
if (deletedItem) { | ||
deleted = true; | ||
} | ||
if (!foundItem || deletedItem) return output; | ||
const value = this.denormalizeValue(entityOrId, unvisit); | ||
if (!value || typeof value === 'symbol') return output; | ||
return { | ||
@@ -60,7 +53,25 @@ ...output, | ||
}, {}), | ||
found, | ||
deleted, | ||
true, | ||
false, | ||
]; | ||
} | ||
denormalizeOnly( | ||
input: {}, | ||
args: readonly any[], | ||
unvisit: (input: any, schema: any) => any, | ||
): any { | ||
return Object.keys(input).reduce((output, key) => { | ||
const entityOrId = (input as any)[key]; | ||
const value = this.denormalizeValue(entityOrId, unvisit); | ||
// remove empty or deleted values | ||
if (!value || typeof value === 'symbol') return output; | ||
return { | ||
...output, | ||
[key]: value, | ||
}; | ||
}, {}); | ||
} | ||
infer(args: any, indexes: any, recurse: any) { | ||
@@ -67,0 +78,0 @@ return undefined; |
export const DELETED = Symbol('ENTITY WAS DELETED'); | ||
export const INVALID = DELETED; |
@@ -6,4 +6,4 @@ export { EndpointInterface, ReadEndpoint, MutateEndpoint, } from './interface.js'; | ||
export { default as Entity } from './schemas/Entity.js'; | ||
export { default as validateRequired } from './schemas/validatRequired.js'; | ||
export { DELETED } from './special.js'; | ||
export { default as validateRequired } from './validateRequired.js'; | ||
export { DELETED, INVALID } from './special.js'; | ||
export { Schema, SnapshotInterface, ExpiryStatusInterface, } from './interface.js'; | ||
@@ -10,0 +10,0 @@ export { AbstractInstanceType, Normalize, NormalizeNullable, Denormalize, DenormalizeNullable, } from './normal.js'; |
@@ -14,3 +14,3 @@ import { EndpointExtraOptions, FetchFunction } from './types.js'; | ||
export interface SchemaSimple<T = any> { | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): any; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args: any[]): any; | ||
denormalize(input: {}, unvisit: UnvisitFunction): [ | ||
@@ -21,2 +21,3 @@ /*denormalized*/ T, | ||
]; | ||
denormalizeOnly?(input: {}, args: any, unvisit: (input: any, schema: any) => any): T; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any, entities: EntityTable): any; | ||
@@ -34,3 +35,3 @@ } | ||
createIfValid?(props: any): any; | ||
pk(params: any, parent?: any, key?: string): string | undefined; | ||
pk(params: any, parent?: any, key?: string, args?: any[]): string | undefined; | ||
readonly key: string; | ||
@@ -40,2 +41,3 @@ merge(existing: any, incoming: any): any; | ||
mergeWithStore?(existingMeta: any, incomingMeta: any, existing: any, incoming: any): any; | ||
mergeMetaWithStore?(existingMeta: any, incomingMeta: any, existing: any, incoming: any): any; | ||
useIncoming?(existingMeta: any, incomingMeta: any, existing: any, incoming: any): boolean; | ||
@@ -51,3 +53,3 @@ indexes?: any; | ||
boolean | ||
]; | ||
] | any; | ||
og?: UnvisitFunction; | ||
@@ -54,0 +56,0 @@ setLocal?: (entity: any) => void; |
@@ -1,2 +0,2 @@ | ||
import { Schema, Serializable, EntityInterface, NormalizedIndex, SchemaClass } from './interface.js'; | ||
import { Schema, Serializable, EntityInterface, NormalizedIndex } from './interface.js'; | ||
export type AbstractInstanceType<T> = T extends new (...args: any) => infer U ? U : T extends { | ||
@@ -41,12 +41,22 @@ prototype: infer U; | ||
export type NormalizeReturnType<T> = T extends (...args: any) => infer R ? R : never; | ||
export type Denormalize<S> = S extends EntityInterface<infer U> ? U : S extends RecordClass ? AbstractInstanceType<S> : S extends SchemaClass ? DenormalizeReturnType<S['denormalize']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Denormalize<F>[] : S extends { | ||
export type Denormalize<S> = S extends EntityInterface<infer U> ? U : S extends RecordClass ? AbstractInstanceType<S> : S extends { | ||
denormalizeOnly: (...args: any) => any; | ||
} ? ReturnType<S['denormalizeOnly']> : S extends { | ||
denormalize: (...args: any) => any; | ||
} ? DenormalizeReturnType<S['denormalize']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Denormalize<F>[] : S extends { | ||
[K: string]: any; | ||
} ? DenormalizeObject<S> : S; | ||
export type DenormalizeNullable<S> = S extends EntityInterface<any> ? DenormalizeNullableNestedSchema<S> | undefined : S extends RecordClass ? DenormalizeNullableNestedSchema<S> : S extends SchemaClass ? DenormalizeReturnType<S['_denormalizeNullable']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Denormalize<F>[] | undefined : S extends { | ||
export type DenormalizeNullable<S> = S extends EntityInterface<any> ? DenormalizeNullableNestedSchema<S> | undefined : S extends RecordClass ? DenormalizeNullableNestedSchema<S> : S extends { | ||
_denormalizeNullable: (...args: any) => any; | ||
} ? DenormalizeReturnType<S['_denormalizeNullable']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Denormalize<F>[] | undefined : S extends { | ||
[K: string]: any; | ||
} ? DenormalizeNullableObject<S> : S; | ||
export type Normalize<S> = S extends EntityInterface ? string : S extends RecordClass ? NormalizeObject<S['schema']> : S extends SchemaClass ? NormalizeReturnType<S['normalize']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Normalize<F>[] : S extends { | ||
export type Normalize<S> = S extends EntityInterface ? string : S extends RecordClass ? NormalizeObject<S['schema']> : S extends { | ||
normalize: (...args: any) => any; | ||
} ? NormalizeReturnType<S['normalize']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Normalize<F>[] : S extends { | ||
[K: string]: any; | ||
} ? NormalizeObject<S> : S; | ||
export type NormalizeNullable<S> = S extends EntityInterface ? string | undefined : S extends RecordClass ? NormalizedNullableObject<S['schema']> : S extends SchemaClass ? NormalizeReturnType<S['_normalizeNullable']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Normalize<F>[] | undefined : S extends { | ||
export type NormalizeNullable<S> = S extends EntityInterface ? string | undefined : S extends RecordClass ? NormalizedNullableObject<S['schema']> : S extends { | ||
_normalizeNullable: (...args: any) => any; | ||
} ? NormalizeReturnType<S['_normalizeNullable']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Normalize<F>[] | undefined : S extends { | ||
[K: string]: any; | ||
@@ -53,0 +63,0 @@ } ? NormalizedNullableObject<S> : S; |
@@ -27,4 +27,5 @@ import { SchemaSimple, UnvisitFunction } from './interface.js'; | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): R; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=queryEndpoint.d.ts.map |
import { SchemaSimple, Schema, UnvisitFunction, NormalizedIndex, EntityTable, EntityInterface, } from './interface.js'; | ||
import { AbstractInstanceType, Normalize, NormalizeNullable, Denormalize, DenormalizeNullable, DenormalizeObject, DenormalizeNullableObject, NormalizeObject, NormalizedNullableObject, EntityMap, } from './normal.js'; | ||
import { CollectionOptions } from './schemas/Collection.js'; | ||
import { default as Delete } from './schemas/Delete.js'; | ||
import { EntityOptions, IEntityClass, IEntityInstance, RequiredPKOptions, IDClass, Constructor, PKClass, } from './schemas/EntitySchema.js'; | ||
export { Delete, EntityMap }; | ||
import { default as Invalidate } from './schemas/Invalidate.js'; | ||
export { Delete, EntityMap, Invalidate }; | ||
export { EntityInterface } from './interface.js'; | ||
@@ -16,3 +18,3 @@ /** | ||
readonly schema: S; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]; | ||
_normalizeNullable(): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[] | undefined; | ||
@@ -31,2 +33,3 @@ denormalize( | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): (S extends EntityMap<infer T> ? T : Denormalize<S>)[]; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any): any; | ||
@@ -44,3 +47,3 @@ } | ||
readonly schema: S; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]; | ||
_normalizeNullable(): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[] | undefined; | ||
@@ -59,2 +62,3 @@ denormalize( | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): (S extends EntityMap<infer T> ? T : Denormalize<S>)[]; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any, entities: EntityTable): any; | ||
@@ -70,3 +74,3 @@ } | ||
readonly schema: O; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): NormalizeObject<O>; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): NormalizeObject<O>; | ||
_normalizeNullable(): NormalizedNullableObject<O>; | ||
@@ -85,2 +89,3 @@ denormalize( | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): DenormalizeObject<O>; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any): any; | ||
@@ -98,3 +103,3 @@ } | ||
readonly schema: Choices; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): UnionResult<Choices>; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): UnionResult<Choices>; | ||
_normalizeNullable(): UnionResult<Choices> | undefined; | ||
@@ -113,2 +118,3 @@ denormalize( | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): AbstractInstanceType<Choices[keyof Choices]>; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any): any; | ||
@@ -127,3 +133,3 @@ } | ||
readonly schema: Choices; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): Record<string, Choices extends EntityMap ? UnionResult<Choices> : Normalize<Choices>>; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): Record<string, Choices extends EntityMap ? UnionResult<Choices> : Normalize<Choices>>; | ||
_normalizeNullable(): Record<string, Choices extends EntityMap ? UnionResult<Choices> : NormalizeNullable<Choices>> | undefined; | ||
@@ -142,4 +148,73 @@ denormalize( | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): Record<string, Choices extends EntityMap<infer T> ? T : Denormalize<Choices>>; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any): any; | ||
} | ||
/** | ||
* Entities but for Arrays instead of classes | ||
* @see https://resthooks.io/rest/api/Collection | ||
*/ | ||
export class CollectionSchema<S extends Array<any> | Values<any> = any, Parent extends any[] = any> { | ||
addWith<P extends any[] = Parent>(merge: (existing: any, incoming: any) => any, createCollectionFilter?: (...args: P) => (collectionKey: Record<string, any>) => boolean): CollectionSchema<S, P>; | ||
readonly schema: S; | ||
key: string; | ||
pk(value: any, parent: any, key: string, args: any[]): string; | ||
normalize(input: any, parent: Parent, key: string, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args: any[]): string; | ||
merge(existing: any, incoming: any): any; | ||
shouldReorder(existingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): boolean; | ||
mergeWithStore(existingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): any; | ||
mergeMetaWithStore(existingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}; | ||
infer(args: unknown, indexes: unknown, recurse: unknown, entities: unknown): any; | ||
createIfValid: (value: any) => any | undefined; | ||
denormalizeOnly(input: any, args: readonly any[], unvisit: (input: any, schema: any) => any): ReturnType<S['denormalizeOnly']>; | ||
_denormalizeNullable(): ReturnType<S['_denormalizeNullable']>; | ||
_normalizeNullable(): ReturnType<S['_normalizeNullable']>; | ||
} | ||
export type CollectionType<S extends any[] | Array<any> | Values<any> = any, Parent extends any[] = [ | ||
urlParams: Record<string, any>, | ||
body?: Record<string, any> | ||
]> = CollectionSchema<S extends any[] ? Array<S[number]> : S> & (S extends any[] ? { | ||
push: CollectionSchema<Array<S[number]>, Parent>; | ||
unshift: CollectionSchema<Array<S[number]>, Parent>; | ||
} : S extends Values<any> ? { | ||
assign: CollectionSchema<S, Parent>; | ||
} : S extends Array<any> ? { | ||
push: CollectionSchema<S, Parent>; | ||
unshift: CollectionSchema<S, Parent>; | ||
} : never); | ||
export interface CollectionConstructor { | ||
new <S extends SchemaSimple[] | Array<any> | Values<any> = any, Parent extends any[] = [ | ||
urlParams: Record<string, any>, | ||
body?: Record<string, any> | ||
]>(schema: S, options: CollectionOptions): CollectionType<S, Parent>; | ||
readonly prototype: CollectionSchema; | ||
} | ||
/** | ||
* Entities but for Arrays instead of classes | ||
* @see https://resthooks.io/rest/api/Collection | ||
*/ | ||
export declare let Collection: CollectionConstructor; | ||
export type StrategyFunction<T> = (value: any, parent: any, key: string) => T; | ||
@@ -164,2 +239,7 @@ export type SchemaFunction<K = string> = (value: any, parent: any, key: string) => K; | ||
} | ||
export interface SchemaSimpleNew<T = any> { | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): any; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): T; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any, entities: EntityTable): any; | ||
} | ||
// id is in Instance, so we default to that as pk | ||
@@ -166,0 +246,0 @@ /** |
@@ -11,5 +11,5 @@ import ArraySchema from './Array.js'; | ||
constructor(definition: S, schemaAttribute?: S extends EntityMap<infer T> ? keyof T | SchemaFunction<keyof S> : undefined); | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): any; | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args?: any[]): any; | ||
infer(args: any, indexes: any, recurse: any, entities: EntityTable): any; | ||
} | ||
//# sourceMappingURL=All.d.ts.map |
@@ -7,3 +7,3 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
export default class ArraySchema extends PolymorphicSchema { | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): any; | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args?: any[]): any; | ||
denormalize(input: any, unvisit: any): [ | ||
@@ -14,2 +14,3 @@ /*denormalized*/ any, | ||
]; | ||
denormalizeOnly(input: any, args: any[], unvisit: (input: any, schema: any) => any): any; | ||
infer(args: unknown, indexes: unknown, recurse: unknown, entities: unknown): any; | ||
@@ -16,0 +17,0 @@ toJSON(): any[]; |
@@ -0,1 +1,2 @@ | ||
import Invalidate from './Invalidate.js'; | ||
import { EntityInterface } from '../interface.js'; | ||
@@ -10,8 +11,3 @@ import { AbstractInstanceType } from '../normal.js'; | ||
process: any; | ||
}> implements SchemaClass { | ||
private _entity; | ||
constructor(entity: E); | ||
readonly key: string; | ||
normalize(input: any, parent: any, key: string | undefined, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): string | undefined; | ||
infer(args: any, indexes: any, recurse: any): any; | ||
}> extends Invalidate<E> implements SchemaClass { | ||
denormalize(id: string, unvisit: UnvisitFunction): [ | ||
@@ -22,17 +18,3 @@ /*denormalized*/ AbstractInstanceType<E>, | ||
]; | ||
_denormalizeNullable(): [ | ||
AbstractInstanceType<E> | undefined, | ||
boolean, | ||
false | ||
]; | ||
_normalizeNullable(): string | undefined; | ||
merge(existing: any, incoming: any): any; | ||
useIncoming(existingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): boolean; | ||
} | ||
//# sourceMappingURL=Delete.d.ts.map |
@@ -30,2 +30,12 @@ /** | ||
]; | ||
/** | ||
* Denormalize an immutable entity. | ||
* | ||
* @param {Schema} schema | ||
* @param {Immutable.Map|Immutable.Record} input | ||
* @param {function} unvisit | ||
* @param {function} getDenormalizedEntity | ||
* @return {Immutable.Map|Immutable.Record} | ||
*/ | ||
export declare function denormalizeOnlyImmutable(schema: any, input: any, unvisit: (input: any, schema: any) => any): any; | ||
//# sourceMappingURL=ImmutableUtils.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare const normalize: (schema: any, input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any) => any; | ||
export declare const normalize: (schema: any, input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args: any[]) => any; | ||
export declare const denormalize: (schema: any, input: {}, unvisit: any) => [ | ||
@@ -7,2 +7,3 @@ /*denormalized*/ any, | ||
]; | ||
export declare function denormalizeOnly(schema: any, input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): any; | ||
export declare function infer(schema: any, args: readonly any[], indexes: any, recurse: any, entities: any): any; | ||
@@ -23,3 +24,5 @@ /** | ||
/*addEntity*/ any, | ||
/*visitedEntities*/ any | ||
/*visitedEntities*/ any, | ||
/*storeEntities*/ any, | ||
/*args*/ any[] | ||
]): any; | ||
@@ -34,4 +37,5 @@ denormalize(...args: readonly [ | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): any; | ||
infer(args: any, indexes: any, recurse: any, entities: any): any; | ||
} | ||
//# sourceMappingURL=Object.d.ts.map |
@@ -9,5 +9,5 @@ export default class PolymorphicSchema { | ||
inferSchema(input: any, parent: any, key: any): any; | ||
normalizeValue(value: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): any; | ||
normalizeValue(value: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args?: any[]): any; | ||
denormalizeValue(value: any, unvisit: any): any; | ||
} | ||
//# sourceMappingURL=Polymorphic.d.ts.map |
@@ -8,4 +8,5 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
constructor(definition: any, schemaAttribute: any); | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): any; | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args: any[]): any; | ||
denormalize(input: {}, unvisit: any): any; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): any; | ||
infer(args: any, indexes: any, recurse: any, entities: any): { | ||
@@ -12,0 +13,0 @@ id: any; |
export declare const getValues: (input: any) => any[]; | ||
export declare const filterEmpty: ([item, , deletedItem]: any) => boolean; | ||
export declare const filterEmpty: (item: any) => boolean; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -7,6 +7,7 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
export default class ValuesSchema extends PolymorphicSchema { | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): {}; | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args: any[]): {}; | ||
denormalize(input: {}, unvisit: any): {}[]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): any; | ||
infer(args: any, indexes: any, recurse: any): undefined; | ||
} | ||
//# sourceMappingURL=Values.d.ts.map |
export declare const DELETED: unique symbol; | ||
export declare const INVALID: symbol; | ||
//# sourceMappingURL=special.d.ts.map |
@@ -5,4 +5,4 @@ export type { EndpointInterface, ReadEndpoint, MutateEndpoint, } from './interface.js'; | ||
export { default as Entity } from './schemas/Entity.js'; | ||
export { default as validateRequired } from './schemas/validatRequired.js'; | ||
export { DELETED } from './special.js'; | ||
export { default as validateRequired } from './validateRequired.js'; | ||
export { DELETED, INVALID } from './special.js'; | ||
export type { Schema, SnapshotInterface, ExpiryStatusInterface, } from './interface.js'; | ||
@@ -9,0 +9,0 @@ export type { AbstractInstanceType, Normalize, NormalizeNullable, Denormalize, DenormalizeNullable, } from './normal.js'; |
@@ -14,3 +14,3 @@ import type { EndpointExtraOptions, FetchFunction } from './types.js'; | ||
export interface SchemaSimple<T = any> { | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): any; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args: any[]): any; | ||
denormalize(input: {}, unvisit: UnvisitFunction): [ | ||
@@ -21,2 +21,3 @@ denormalized: T, | ||
]; | ||
denormalizeOnly?(input: {}, args: any, unvisit: (input: any, schema: any) => any): T; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any, entities: EntityTable): any; | ||
@@ -34,3 +35,3 @@ } | ||
createIfValid?(props: any): any; | ||
pk(params: any, parent?: any, key?: string): string | undefined; | ||
pk(params: any, parent?: any, key?: string, args?: any[]): string | undefined; | ||
readonly key: string; | ||
@@ -40,2 +41,3 @@ merge(existing: any, incoming: any): any; | ||
mergeWithStore?(existingMeta: any, incomingMeta: any, existing: any, incoming: any): any; | ||
mergeMetaWithStore?(existingMeta: any, incomingMeta: any, existing: any, incoming: any): any; | ||
useIncoming?(existingMeta: any, incomingMeta: any, existing: any, incoming: any): boolean; | ||
@@ -51,3 +53,3 @@ indexes?: any; | ||
boolean | ||
]; | ||
] | any; | ||
og?: UnvisitFunction; | ||
@@ -54,0 +56,0 @@ setLocal?: (entity: any) => void; |
@@ -1,2 +0,2 @@ | ||
import type { Schema, Serializable, EntityInterface, NormalizedIndex, SchemaClass } from './interface.js'; | ||
import type { Schema, Serializable, EntityInterface, NormalizedIndex } from './interface.js'; | ||
export type AbstractInstanceType<T> = T extends new (...args: any) => infer U ? U : T extends { | ||
@@ -41,12 +41,22 @@ prototype: infer U; | ||
export type NormalizeReturnType<T> = T extends (...args: any) => infer R ? R : never; | ||
export type Denormalize<S> = S extends EntityInterface<infer U> ? U : S extends RecordClass ? AbstractInstanceType<S> : S extends SchemaClass ? DenormalizeReturnType<S['denormalize']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Denormalize<F>[] : S extends { | ||
export type Denormalize<S> = S extends EntityInterface<infer U> ? U : S extends RecordClass ? AbstractInstanceType<S> : S extends { | ||
denormalizeOnly: (...args: any) => any; | ||
} ? ReturnType<S['denormalizeOnly']> : S extends { | ||
denormalize: (...args: any) => any; | ||
} ? DenormalizeReturnType<S['denormalize']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Denormalize<F>[] : S extends { | ||
[K: string]: any; | ||
} ? DenormalizeObject<S> : S; | ||
export type DenormalizeNullable<S> = S extends EntityInterface<any> ? DenormalizeNullableNestedSchema<S> | undefined : S extends RecordClass ? DenormalizeNullableNestedSchema<S> : S extends SchemaClass ? DenormalizeReturnType<S['_denormalizeNullable']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Denormalize<F>[] | undefined : S extends { | ||
export type DenormalizeNullable<S> = S extends EntityInterface<any> ? DenormalizeNullableNestedSchema<S> | undefined : S extends RecordClass ? DenormalizeNullableNestedSchema<S> : S extends { | ||
_denormalizeNullable: (...args: any) => any; | ||
} ? DenormalizeReturnType<S['_denormalizeNullable']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Denormalize<F>[] | undefined : S extends { | ||
[K: string]: any; | ||
} ? DenormalizeNullableObject<S> : S; | ||
export type Normalize<S> = S extends EntityInterface ? string : S extends RecordClass ? NormalizeObject<S['schema']> : S extends SchemaClass ? NormalizeReturnType<S['normalize']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Normalize<F>[] : S extends { | ||
export type Normalize<S> = S extends EntityInterface ? string : S extends RecordClass ? NormalizeObject<S['schema']> : S extends { | ||
normalize: (...args: any) => any; | ||
} ? NormalizeReturnType<S['normalize']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Normalize<F>[] : S extends { | ||
[K: string]: any; | ||
} ? NormalizeObject<S> : S; | ||
export type NormalizeNullable<S> = S extends EntityInterface ? string | undefined : S extends RecordClass ? NormalizedNullableObject<S['schema']> : S extends SchemaClass ? NormalizeReturnType<S['_normalizeNullable']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Normalize<F>[] | undefined : S extends { | ||
export type NormalizeNullable<S> = S extends EntityInterface ? string | undefined : S extends RecordClass ? NormalizedNullableObject<S['schema']> : S extends { | ||
_normalizeNullable: (...args: any) => any; | ||
} ? NormalizeReturnType<S['_normalizeNullable']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Normalize<F>[] | undefined : S extends { | ||
[K: string]: any; | ||
@@ -53,0 +63,0 @@ } ? NormalizedNullableObject<S> : S; |
@@ -27,4 +27,5 @@ import type { SchemaSimple, UnvisitFunction } from './interface.js'; | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): R; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=queryEndpoint.d.ts.map |
import type { SchemaSimple, Schema, UnvisitFunction, NormalizedIndex, EntityTable, EntityInterface, } from './interface.js'; | ||
import type { AbstractInstanceType, Normalize, NormalizeNullable, Denormalize, DenormalizeNullable, DenormalizeObject, DenormalizeNullableObject, NormalizeObject, NormalizedNullableObject, EntityMap, } from './normal.js'; | ||
import { CollectionOptions } from './schemas/Collection.js'; | ||
import { default as Delete } from './schemas/Delete.js'; | ||
import { EntityOptions, IEntityClass, IEntityInstance, RequiredPKOptions, IDClass, Constructor, PKClass, } from './schemas/EntitySchema.js'; | ||
export { Delete, EntityMap }; | ||
import { default as Invalidate } from './schemas/Invalidate.js'; | ||
export { Delete, EntityMap, Invalidate }; | ||
export { EntityInterface } from './interface.js'; | ||
@@ -16,3 +18,3 @@ /** | ||
readonly schema: S; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]; | ||
_normalizeNullable(): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[] | undefined; | ||
@@ -31,2 +33,3 @@ denormalize( | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): (S extends EntityMap<infer T> ? T : Denormalize<S>)[]; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any): any; | ||
@@ -44,3 +47,3 @@ } | ||
readonly schema: S; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]; | ||
_normalizeNullable(): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[] | undefined; | ||
@@ -59,2 +62,3 @@ denormalize( | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): (S extends EntityMap<infer T> ? T : Denormalize<S>)[]; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any, entities: EntityTable): any; | ||
@@ -70,3 +74,3 @@ } | ||
readonly schema: O; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): NormalizeObject<O>; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): NormalizeObject<O>; | ||
_normalizeNullable(): NormalizedNullableObject<O>; | ||
@@ -85,2 +89,3 @@ denormalize( | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): DenormalizeObject<O>; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any): any; | ||
@@ -98,3 +103,3 @@ } | ||
readonly schema: Choices; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): UnionResult<Choices>; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): UnionResult<Choices>; | ||
_normalizeNullable(): UnionResult<Choices> | undefined; | ||
@@ -113,2 +118,3 @@ denormalize( | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): AbstractInstanceType<Choices[keyof Choices]>; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any): any; | ||
@@ -127,3 +133,3 @@ } | ||
readonly schema: Choices; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): Record<string, Choices extends EntityMap ? UnionResult<Choices> : Normalize<Choices>>; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): Record<string, Choices extends EntityMap ? UnionResult<Choices> : Normalize<Choices>>; | ||
_normalizeNullable(): Record<string, Choices extends EntityMap ? UnionResult<Choices> : NormalizeNullable<Choices>> | undefined; | ||
@@ -142,4 +148,73 @@ denormalize( | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): Record<string, Choices extends EntityMap<infer T> ? T : Denormalize<Choices>>; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any): any; | ||
} | ||
/** | ||
* Entities but for Arrays instead of classes | ||
* @see https://resthooks.io/rest/api/Collection | ||
*/ | ||
export class CollectionSchema<S extends Array<any> | Values<any> = any, Parent extends any[] = any> { | ||
addWith<P extends any[] = Parent>(merge: (existing: any, incoming: any) => any, createCollectionFilter?: (...args: P) => (collectionKey: Record<string, any>) => boolean): CollectionSchema<S, P>; | ||
readonly schema: S; | ||
key: string; | ||
pk(value: any, parent: any, key: string, args: any[]): string; | ||
normalize(input: any, parent: Parent, key: string, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args: any[]): string; | ||
merge(existing: any, incoming: any): any; | ||
shouldReorder(existingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): boolean; | ||
mergeWithStore(existingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): any; | ||
mergeMetaWithStore(existingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}; | ||
infer(args: unknown, indexes: unknown, recurse: unknown, entities: unknown): any; | ||
createIfValid: (value: any) => any | undefined; | ||
denormalizeOnly(input: any, args: readonly any[], unvisit: (input: any, schema: any) => any): ReturnType<S['denormalizeOnly']>; | ||
_denormalizeNullable(): ReturnType<S['_denormalizeNullable']>; | ||
_normalizeNullable(): ReturnType<S['_normalizeNullable']>; | ||
} | ||
export type CollectionType<S extends any[] | Array<any> | Values<any> = any, Parent extends any[] = [ | ||
urlParams: Record<string, any>, | ||
body?: Record<string, any> | ||
]> = CollectionSchema<S extends any[] ? Array<S[number]> : S> & (S extends any[] ? { | ||
push: CollectionSchema<Array<S[number]>, Parent>; | ||
unshift: CollectionSchema<Array<S[number]>, Parent>; | ||
} : S extends Values<any> ? { | ||
assign: CollectionSchema<S, Parent>; | ||
} : S extends Array<any> ? { | ||
push: CollectionSchema<S, Parent>; | ||
unshift: CollectionSchema<S, Parent>; | ||
} : never); | ||
export interface CollectionConstructor { | ||
new <S extends SchemaSimple[] | Array<any> | Values<any> = any, Parent extends any[] = [ | ||
urlParams: Record<string, any>, | ||
body?: Record<string, any> | ||
]>(schema: S, options: CollectionOptions): CollectionType<S, Parent>; | ||
readonly prototype: CollectionSchema; | ||
} | ||
/** | ||
* Entities but for Arrays instead of classes | ||
* @see https://resthooks.io/rest/api/Collection | ||
*/ | ||
export declare let Collection: CollectionConstructor; | ||
export type StrategyFunction<T> = (value: any, parent: any, key: string) => T; | ||
@@ -164,2 +239,7 @@ export type SchemaFunction<K = string> = (value: any, parent: any, key: string) => K; | ||
} | ||
export interface SchemaSimpleNew<T = any> { | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): any; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): T; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any, entities: EntityTable): any; | ||
} | ||
// id is in Instance, so we default to that as pk | ||
@@ -166,0 +246,0 @@ /** |
@@ -11,5 +11,5 @@ import ArraySchema from './Array.js'; | ||
constructor(definition: S, schemaAttribute?: S extends EntityMap<infer T> ? keyof T | SchemaFunction<keyof S> : undefined); | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): any; | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args?: any[]): any; | ||
infer(args: any, indexes: any, recurse: any, entities: EntityTable): any; | ||
} | ||
//# sourceMappingURL=All.d.ts.map |
@@ -7,3 +7,3 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
export default class ArraySchema extends PolymorphicSchema { | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): any; | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args?: any[]): any; | ||
denormalize(input: any, unvisit: any): [ | ||
@@ -14,2 +14,3 @@ denormalized: any, | ||
]; | ||
denormalizeOnly(input: any, args: any[], unvisit: (input: any, schema: any) => any): any; | ||
infer(args: unknown, indexes: unknown, recurse: unknown, entities: unknown): any; | ||
@@ -16,0 +17,0 @@ toJSON(): any[]; |
@@ -0,1 +1,2 @@ | ||
import Invalidate from './Invalidate.js'; | ||
import type { EntityInterface } from '../interface.js'; | ||
@@ -10,8 +11,3 @@ import type { AbstractInstanceType } from '../normal.js'; | ||
process: any; | ||
}> implements SchemaClass { | ||
private _entity; | ||
constructor(entity: E); | ||
get key(): string; | ||
normalize(input: any, parent: any, key: string | undefined, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): string | undefined; | ||
infer(args: any, indexes: any, recurse: any): any; | ||
}> extends Invalidate<E> implements SchemaClass { | ||
denormalize(id: string, unvisit: UnvisitFunction): [ | ||
@@ -22,17 +18,3 @@ denormalized: AbstractInstanceType<E>, | ||
]; | ||
_denormalizeNullable(): [ | ||
AbstractInstanceType<E> | undefined, | ||
boolean, | ||
false | ||
]; | ||
_normalizeNullable(): string | undefined; | ||
merge(existing: any, incoming: any): any; | ||
useIncoming(existingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): boolean; | ||
} | ||
//# sourceMappingURL=Delete.d.ts.map |
@@ -30,2 +30,12 @@ /** | ||
]; | ||
/** | ||
* Denormalize an immutable entity. | ||
* | ||
* @param {Schema} schema | ||
* @param {Immutable.Map|Immutable.Record} input | ||
* @param {function} unvisit | ||
* @param {function} getDenormalizedEntity | ||
* @return {Immutable.Map|Immutable.Record} | ||
*/ | ||
export declare function denormalizeOnlyImmutable(schema: any, input: any, unvisit: (input: any, schema: any) => any): any; | ||
//# sourceMappingURL=ImmutableUtils.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare const normalize: (schema: any, input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any) => any; | ||
export declare const normalize: (schema: any, input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args: any[]) => any; | ||
export declare const denormalize: (schema: any, input: {}, unvisit: any) => [ | ||
@@ -7,2 +7,3 @@ denormalized: any, | ||
]; | ||
export declare function denormalizeOnly(schema: any, input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): any; | ||
export declare function infer(schema: any, args: readonly any[], indexes: any, recurse: any, entities: any): any; | ||
@@ -23,3 +24,5 @@ /** | ||
addEntity: any, | ||
visitedEntities: any | ||
visitedEntities: any, | ||
storeEntities: any, | ||
args: any[] | ||
]): any; | ||
@@ -34,4 +37,5 @@ denormalize(...args: readonly [ | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): any; | ||
infer(args: any, indexes: any, recurse: any, entities: any): any; | ||
} | ||
//# sourceMappingURL=Object.d.ts.map |
@@ -9,5 +9,5 @@ export default class PolymorphicSchema { | ||
inferSchema(input: any, parent: any, key: any): any; | ||
normalizeValue(value: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): any; | ||
normalizeValue(value: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args?: any[]): any; | ||
denormalizeValue(value: any, unvisit: any): any; | ||
} | ||
//# sourceMappingURL=Polymorphic.d.ts.map |
@@ -8,4 +8,5 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
constructor(definition: any, schemaAttribute: any); | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): any; | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args: any[]): any; | ||
denormalize(input: {}, unvisit: any): any; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): any; | ||
infer(args: any, indexes: any, recurse: any, entities: any): { | ||
@@ -12,0 +13,0 @@ id: any; |
export declare const getValues: (input: any) => any[]; | ||
export declare const filterEmpty: ([item, , deletedItem]: any) => boolean; | ||
export declare const filterEmpty: (item: any) => boolean; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -7,6 +7,7 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
export default class ValuesSchema extends PolymorphicSchema { | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): {}; | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args: any[]): {}; | ||
denormalize(input: {}, unvisit: any): {}[]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): any; | ||
infer(args: any, indexes: any, recurse: any): undefined; | ||
} | ||
//# sourceMappingURL=Values.d.ts.map |
export declare const DELETED: unique symbol; | ||
export declare const INVALID: symbol; | ||
//# sourceMappingURL=special.d.ts.map |
@@ -5,4 +5,4 @@ export type { EndpointInterface, ReadEndpoint, MutateEndpoint, } from './interface.js'; | ||
export { default as Entity } from './schemas/Entity.js'; | ||
export { default as validateRequired } from './schemas/validatRequired.js'; | ||
export { DELETED } from './special.js'; | ||
export { default as validateRequired } from './validateRequired.js'; | ||
export { DELETED, INVALID } from './special.js'; | ||
export type { Schema, SnapshotInterface, ExpiryStatusInterface, } from './interface.js'; | ||
@@ -9,0 +9,0 @@ export type { AbstractInstanceType, Normalize, NormalizeNullable, Denormalize, DenormalizeNullable, } from './normal.js'; |
@@ -14,3 +14,3 @@ import type { EndpointExtraOptions, FetchFunction } from './types.js'; | ||
export interface SchemaSimple<T = any> { | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): any; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args: any[]): any; | ||
denormalize(input: {}, unvisit: UnvisitFunction): [ | ||
@@ -21,2 +21,3 @@ denormalized: T, | ||
]; | ||
denormalizeOnly?(input: {}, args: any, unvisit: (input: any, schema: any) => any): T; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any, entities: EntityTable): any; | ||
@@ -34,3 +35,3 @@ } | ||
createIfValid?(props: any): any; | ||
pk(params: any, parent?: any, key?: string): string | undefined; | ||
pk(params: any, parent?: any, key?: string, args?: any[]): string | undefined; | ||
readonly key: string; | ||
@@ -40,2 +41,3 @@ merge(existing: any, incoming: any): any; | ||
mergeWithStore?(existingMeta: any, incomingMeta: any, existing: any, incoming: any): any; | ||
mergeMetaWithStore?(existingMeta: any, incomingMeta: any, existing: any, incoming: any): any; | ||
useIncoming?(existingMeta: any, incomingMeta: any, existing: any, incoming: any): boolean; | ||
@@ -51,3 +53,3 @@ indexes?: any; | ||
boolean | ||
]; | ||
] | any; | ||
og?: UnvisitFunction; | ||
@@ -54,0 +56,0 @@ setLocal?: (entity: any) => void; |
@@ -1,2 +0,2 @@ | ||
import type { Schema, Serializable, EntityInterface, NormalizedIndex, SchemaClass } from './interface.js'; | ||
import type { Schema, Serializable, EntityInterface, NormalizedIndex } from './interface.js'; | ||
export type AbstractInstanceType<T> = T extends new (...args: any) => infer U ? U : T extends { | ||
@@ -41,12 +41,22 @@ prototype: infer U; | ||
export type NormalizeReturnType<T> = T extends (...args: any) => infer R ? R : never; | ||
export type Denormalize<S> = S extends EntityInterface<infer U> ? U : S extends RecordClass ? AbstractInstanceType<S> : S extends SchemaClass ? DenormalizeReturnType<S['denormalize']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Denormalize<F>[] : S extends { | ||
export type Denormalize<S> = S extends EntityInterface<infer U> ? U : S extends RecordClass ? AbstractInstanceType<S> : S extends { | ||
denormalizeOnly: (...args: any) => any; | ||
} ? ReturnType<S['denormalizeOnly']> : S extends { | ||
denormalize: (...args: any) => any; | ||
} ? DenormalizeReturnType<S['denormalize']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Denormalize<F>[] : S extends { | ||
[K: string]: any; | ||
} ? DenormalizeObject<S> : S; | ||
export type DenormalizeNullable<S> = S extends EntityInterface<any> ? DenormalizeNullableNestedSchema<S> | undefined : S extends RecordClass ? DenormalizeNullableNestedSchema<S> : S extends SchemaClass ? DenormalizeReturnType<S['_denormalizeNullable']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Denormalize<F>[] | undefined : S extends { | ||
export type DenormalizeNullable<S> = S extends EntityInterface<any> ? DenormalizeNullableNestedSchema<S> | undefined : S extends RecordClass ? DenormalizeNullableNestedSchema<S> : S extends { | ||
_denormalizeNullable: (...args: any) => any; | ||
} ? DenormalizeReturnType<S['_denormalizeNullable']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Denormalize<F>[] | undefined : S extends { | ||
[K: string]: any; | ||
} ? DenormalizeNullableObject<S> : S; | ||
export type Normalize<S> = S extends EntityInterface ? string : S extends RecordClass ? NormalizeObject<S['schema']> : S extends SchemaClass ? NormalizeReturnType<S['normalize']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Normalize<F>[] : S extends { | ||
export type Normalize<S> = S extends EntityInterface ? string : S extends RecordClass ? NormalizeObject<S['schema']> : S extends { | ||
normalize: (...args: any) => any; | ||
} ? NormalizeReturnType<S['normalize']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Normalize<F>[] : S extends { | ||
[K: string]: any; | ||
} ? NormalizeObject<S> : S; | ||
export type NormalizeNullable<S> = S extends EntityInterface ? string | undefined : S extends RecordClass ? NormalizedNullableObject<S['schema']> : S extends SchemaClass ? NormalizeReturnType<S['_normalizeNullable']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Normalize<F>[] | undefined : S extends { | ||
export type NormalizeNullable<S> = S extends EntityInterface ? string | undefined : S extends RecordClass ? NormalizedNullableObject<S['schema']> : S extends { | ||
_normalizeNullable: (...args: any) => any; | ||
} ? NormalizeReturnType<S['_normalizeNullable']> : S extends Serializable<infer T> ? T : S extends Array<infer F> ? Normalize<F>[] | undefined : S extends { | ||
[K: string]: any; | ||
@@ -53,0 +63,0 @@ } ? NormalizedNullableObject<S> : S; |
@@ -27,4 +27,5 @@ import type { SchemaSimple, UnvisitFunction } from './interface.js'; | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): R; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=queryEndpoint.d.ts.map |
import type { SchemaSimple, Schema, UnvisitFunction, NormalizedIndex, EntityTable, EntityInterface, } from './interface.js'; | ||
import type { AbstractInstanceType, Normalize, NormalizeNullable, Denormalize, DenormalizeNullable, DenormalizeObject, DenormalizeNullableObject, NormalizeObject, NormalizedNullableObject, EntityMap, } from './normal.js'; | ||
import { CollectionOptions } from './schemas/Collection.js'; | ||
import { default as Delete } from './schemas/Delete.js'; | ||
import { EntityOptions, IEntityClass, IEntityInstance, RequiredPKOptions, IDClass, Constructor, PKClass, } from './schemas/EntitySchema.js'; | ||
export { Delete, EntityMap }; | ||
import { default as Invalidate } from './schemas/Invalidate.js'; | ||
export { Delete, EntityMap, Invalidate }; | ||
export { EntityInterface } from './interface.js'; | ||
@@ -16,3 +18,3 @@ /** | ||
readonly schema: S; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]; | ||
_normalizeNullable(): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[] | undefined; | ||
@@ -31,2 +33,3 @@ denormalize( | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): (S extends EntityMap<infer T> ? T : Denormalize<S>)[]; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any): any; | ||
@@ -44,3 +47,3 @@ } | ||
readonly schema: S; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[]; | ||
_normalizeNullable(): (S extends EntityMap ? UnionResult<S> : Normalize<S>)[] | undefined; | ||
@@ -59,2 +62,3 @@ denormalize( | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): (S extends EntityMap<infer T> ? T : Denormalize<S>)[]; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any, entities: EntityTable): any; | ||
@@ -70,3 +74,3 @@ } | ||
readonly schema: O; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): NormalizeObject<O>; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): NormalizeObject<O>; | ||
_normalizeNullable(): NormalizedNullableObject<O>; | ||
@@ -85,2 +89,3 @@ denormalize( | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): DenormalizeObject<O>; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any): any; | ||
@@ -98,3 +103,3 @@ } | ||
readonly schema: Choices; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): UnionResult<Choices>; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): UnionResult<Choices>; | ||
_normalizeNullable(): UnionResult<Choices> | undefined; | ||
@@ -113,2 +118,3 @@ denormalize( | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): AbstractInstanceType<Choices[keyof Choices]>; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any): any; | ||
@@ -127,3 +133,3 @@ } | ||
readonly schema: Choices; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): Record<string, Choices extends EntityMap ? UnionResult<Choices> : Normalize<Choices>>; | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): Record<string, Choices extends EntityMap ? UnionResult<Choices> : Normalize<Choices>>; | ||
_normalizeNullable(): Record<string, Choices extends EntityMap ? UnionResult<Choices> : NormalizeNullable<Choices>> | undefined; | ||
@@ -142,4 +148,73 @@ denormalize( | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): Record<string, Choices extends EntityMap<infer T> ? T : Denormalize<Choices>>; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any): any; | ||
} | ||
/** | ||
* Entities but for Arrays instead of classes | ||
* @see https://resthooks.io/rest/api/Collection | ||
*/ | ||
export class CollectionSchema<S extends Array<any> | Values<any> = any, Parent extends any[] = any> { | ||
addWith<P extends any[] = Parent>(merge: (existing: any, incoming: any) => any, createCollectionFilter?: (...args: P) => (collectionKey: Record<string, any>) => boolean): CollectionSchema<S, P>; | ||
readonly schema: S; | ||
key: string; | ||
pk(value: any, parent: any, key: string, args: any[]): string; | ||
normalize(input: any, parent: Parent, key: string, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args: any[]): string; | ||
merge(existing: any, incoming: any): any; | ||
shouldReorder(existingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): boolean; | ||
mergeWithStore(existingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): any; | ||
mergeMetaWithStore(existingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}; | ||
infer(args: unknown, indexes: unknown, recurse: unknown, entities: unknown): any; | ||
createIfValid: (value: any) => any | undefined; | ||
denormalizeOnly(input: any, args: readonly any[], unvisit: (input: any, schema: any) => any): ReturnType<S['denormalizeOnly']>; | ||
_denormalizeNullable(): ReturnType<S['_denormalizeNullable']>; | ||
_normalizeNullable(): ReturnType<S['_normalizeNullable']>; | ||
} | ||
export type CollectionType<S extends any[] | Array<any> | Values<any> = any, Parent extends any[] = [ | ||
urlParams: Record<string, any>, | ||
body?: Record<string, any> | ||
]> = CollectionSchema<S extends any[] ? Array<S[number]> : S> & (S extends any[] ? { | ||
push: CollectionSchema<Array<S[number]>, Parent>; | ||
unshift: CollectionSchema<Array<S[number]>, Parent>; | ||
} : S extends Values<any> ? { | ||
assign: CollectionSchema<S, Parent>; | ||
} : S extends Array<any> ? { | ||
push: CollectionSchema<S, Parent>; | ||
unshift: CollectionSchema<S, Parent>; | ||
} : never); | ||
export interface CollectionConstructor { | ||
new <S extends SchemaSimple[] | Array<any> | Values<any> = any, Parent extends any[] = [ | ||
urlParams: Record<string, any>, | ||
body?: Record<string, any> | ||
]>(schema: S, options: CollectionOptions): CollectionType<S, Parent>; | ||
readonly prototype: CollectionSchema; | ||
} | ||
/** | ||
* Entities but for Arrays instead of classes | ||
* @see https://resthooks.io/rest/api/Collection | ||
*/ | ||
export declare let Collection: CollectionConstructor; | ||
export type StrategyFunction<T> = (value: any, parent: any, key: string) => T; | ||
@@ -164,2 +239,7 @@ export type SchemaFunction<K = string> = (value: any, parent: any, key: string) => K; | ||
} | ||
export interface SchemaSimpleNew<T = any> { | ||
normalize(input: any, parent: any, key: any, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>, storeEntities: any, args?: any[]): any; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): T; | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: (...args: any) => any, entities: EntityTable): any; | ||
} | ||
// id is in Instance, so we default to that as pk | ||
@@ -166,0 +246,0 @@ /** |
@@ -11,5 +11,5 @@ import ArraySchema from './Array.js'; | ||
constructor(definition: S, schemaAttribute?: S extends EntityMap<infer T> ? keyof T | SchemaFunction<keyof S> : undefined); | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): any; | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args?: any[]): any; | ||
infer(args: any, indexes: any, recurse: any, entities: EntityTable): any; | ||
} | ||
//# sourceMappingURL=All.d.ts.map |
@@ -7,3 +7,3 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
export default class ArraySchema extends PolymorphicSchema { | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): any; | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args?: any[]): any; | ||
denormalize(input: any, unvisit: any): [ | ||
@@ -14,2 +14,3 @@ denormalized: any, | ||
]; | ||
denormalizeOnly(input: any, args: any[], unvisit: (input: any, schema: any) => any): any; | ||
infer(args: unknown, indexes: unknown, recurse: unknown, entities: unknown): any; | ||
@@ -16,0 +17,0 @@ toJSON(): any[]; |
@@ -0,1 +1,2 @@ | ||
import Invalidate from './Invalidate.js'; | ||
import type { EntityInterface } from '../interface.js'; | ||
@@ -10,8 +11,3 @@ import type { AbstractInstanceType } from '../normal.js'; | ||
process: any; | ||
}> implements SchemaClass { | ||
private _entity; | ||
constructor(entity: E); | ||
get key(): string; | ||
normalize(input: any, parent: any, key: string | undefined, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): string | undefined; | ||
infer(args: any, indexes: any, recurse: any): any; | ||
}> extends Invalidate<E> implements SchemaClass { | ||
denormalize(id: string, unvisit: UnvisitFunction): [ | ||
@@ -22,17 +18,3 @@ denormalized: AbstractInstanceType<E>, | ||
]; | ||
_denormalizeNullable(): [ | ||
AbstractInstanceType<E> | undefined, | ||
boolean, | ||
false | ||
]; | ||
_normalizeNullable(): string | undefined; | ||
merge(existing: any, incoming: any): any; | ||
useIncoming(existingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): boolean; | ||
} | ||
//# sourceMappingURL=Delete.d.ts.map |
import type { UnvisitFunction } from '../interface.js'; | ||
import { AbstractInstanceType } from '../normal.js'; | ||
declare const Entity_base: import("./EntitySchema.js").IEntityClass<abstract new (...args: any[]) => { | ||
pk(parent?: any, key?: string | undefined): string | undefined; | ||
pk(parent?: any, key?: string | undefined, args?: readonly any[] | undefined): string | undefined; | ||
}> & (abstract new (...args: any[]) => { | ||
pk(parent?: any, key?: string | undefined): string | undefined; | ||
pk(parent?: any, key?: string | undefined, args?: readonly any[] | undefined): string | undefined; | ||
}); | ||
@@ -19,3 +19,3 @@ /** | ||
*/ | ||
abstract pk(parent?: any, key?: string): string | undefined; | ||
abstract pk(parent?: any, key?: string, args?: readonly any[]): string | undefined; | ||
/** Control how automatic schema validation is handled | ||
@@ -49,2 +49,15 @@ * | ||
}, existing: any, incoming: any): any; | ||
static mergeMetaWithStore(existingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}; | ||
/** Factory method to convert from Plain JS Objects. | ||
@@ -62,3 +75,3 @@ * | ||
*/ | ||
static pk: <T extends typeof Entity>(this: T, value: Partial<AbstractInstanceType<T>>, parent?: any, key?: string) => string | undefined; | ||
static pk: <T extends typeof Entity>(this: T, value: Partial<AbstractInstanceType<T>>, parent?: any, key?: string, args?: any[]) => string | undefined; | ||
/** Do any transformations when first receiving input */ | ||
@@ -65,0 +78,0 @@ static process(input: any, parent: any, key: string | undefined): any; |
@@ -8,3 +8,3 @@ import type { Schema, NormalizedIndex, UnvisitFunction } from '../interface.js'; | ||
export type PKClass = abstract new (...args: any[]) => { | ||
pk(parent?: any, key?: string): string | undefined; | ||
pk(parent?: any, key?: string, args?: readonly any[]): string | undefined; | ||
}; | ||
@@ -33,9 +33,18 @@ type ValidSchemas<TInstance> = { | ||
}; | ||
/** Defines nested entities */ | ||
/** Defines nested entities | ||
* | ||
* @see https://resthooks.io/rest/api/Entity#schema | ||
*/ | ||
schema: { | ||
[k: string]: Schema; | ||
}; | ||
/** Returns the globally unique identifier for the static Entity */ | ||
/** Returns the globally unique identifier for the static Entity | ||
* | ||
* @see https://resthooks.io/docs/api/Entity#key | ||
*/ | ||
key: string; | ||
/** Defines indexes to enable lookup by */ | ||
/** Defines indexes to enable lookup by | ||
* | ||
* @see https://resthooks.io/rest/api/Entity#indexes | ||
*/ | ||
indexes?: readonly string[] | undefined; | ||
@@ -45,2 +54,3 @@ /** | ||
* | ||
* @see https://resthooks.io/docs/api/Entity#pk | ||
* @param [value] POJO of the entity or subset used | ||
@@ -50,3 +60,3 @@ * @param [parent] When normalizing, the object which included the entity | ||
*/ | ||
pk<T extends (abstract new (...args: any[]) => IEntityInstance & InstanceType<TBase>) & IEntityClass & TBase>(this: T, value: Partial<AbstractInstanceType<T>>, parent?: any, key?: string): string | undefined; | ||
pk<T extends (abstract new (...args: any[]) => IEntityInstance & InstanceType<TBase>) & IEntityClass & TBase>(this: T, value: Partial<AbstractInstanceType<T>>, parent?: any, key?: string, args?: any[]): string | undefined; | ||
/** Return true to merge incoming data; false keeps existing entity | ||
@@ -75,5 +85,11 @@ * | ||
}, existing: any, incoming: any): boolean; | ||
/** Creates new instance copying over defined values of arguments */ | ||
/** Creates new instance copying over defined values of arguments | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#merge | ||
*/ | ||
merge(existing: any, incoming: any): any; | ||
/** Run when an existing entity is found in the store */ | ||
/** Run when an existing entity is found in the store | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#mergeWithStore | ||
*/ | ||
mergeWithStore(existingMeta: { | ||
@@ -86,2 +102,19 @@ date: number; | ||
}, existing: any, incoming: any): any; | ||
/** Run when an existing entity is found in the store | ||
* | ||
* @see https://resthooks.io/docs/api/schema.Entity#mergeMetaWithStore | ||
*/ | ||
mergeMetaWithStore(existingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, incomingMeta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, existing: any, incoming: any): { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}; | ||
/** Factory method to convert from Plain JS Objects. | ||
@@ -92,17 +125,24 @@ * | ||
fromJS<T extends (abstract new (...args: any[]) => IEntityInstance & InstanceType<TBase>) & IEntityClass & TBase>(this: T, props?: Partial<AbstractInstanceType<T>>): AbstractInstanceType<T>; | ||
/** Factory method to convert from Plain JS Objects. | ||
/** Called when denormalizing an entity to create an instance when 'valid' | ||
* | ||
* @param [props] Plain Object of properties to assign. | ||
* @see https://resthooks.io/docs/api/Entity#createIfValid | ||
*/ | ||
createIfValid<T extends (abstract new (...args: any[]) => IEntityInstance & InstanceType<TBase>) & IEntityClass & TBase>(this: T, props: Partial<AbstractInstanceType<T>>): AbstractInstanceType<T> | undefined; | ||
/** Do any transformations when first receiving input */ | ||
/** Do any transformations when first receiving input | ||
* | ||
* @see https://resthooks.io/docs/api/Entity#process | ||
*/ | ||
process(input: any, parent: any, key: string | undefined): any; | ||
normalize(input: any, parent: any, key: string | undefined, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): any; | ||
/** Do any transformations when first receiving input | ||
* | ||
* @see https://resthooks.io/docs/api/Entity#validate | ||
*/ | ||
validate(processedEntity: any): string | undefined; | ||
/** Attempts to infer results | ||
* | ||
* @see https://resthooks.io/docs/api/Entity#infer | ||
*/ | ||
infer(args: readonly any[], indexes: NormalizedIndex, recurse: any): any; | ||
expiresAt(meta: { | ||
expiresAt: number; | ||
date: number; | ||
fetchedAt: number; | ||
}, input: any): number; | ||
denormalize<T extends (abstract new (...args: any[]) => IEntityInstance & InstanceType<TBase>) & IEntityClass & TBase>(this: T, input: any, unvisit: UnvisitFunction): [ | ||
@@ -113,2 +153,3 @@ denormalized: AbstractInstanceType<T>, | ||
]; | ||
denormalizeOnly<T extends (abstract new (...args: any[]) => IEntityInstance & InstanceType<TBase>) & IEntityClass & TBase>(this: T, input: any, unvisit: (input: any, schema: any) => any): AbstractInstanceType<T>; | ||
/** All instance defaults set */ | ||
@@ -124,5 +165,5 @@ readonly defaults: any; | ||
*/ | ||
pk(parent?: any, key?: string): string | undefined; | ||
pk(parent?: any, key?: string, args?: readonly any[]): string | undefined; | ||
} | ||
export {}; | ||
//# sourceMappingURL=EntitySchema.d.ts.map |
@@ -30,2 +30,12 @@ /** | ||
]; | ||
/** | ||
* Denormalize an immutable entity. | ||
* | ||
* @param {Schema} schema | ||
* @param {Immutable.Map|Immutable.Record} input | ||
* @param {function} unvisit | ||
* @param {function} getDenormalizedEntity | ||
* @return {Immutable.Map|Immutable.Record} | ||
*/ | ||
export declare function denormalizeOnlyImmutable(schema: any, input: any, unvisit: (input: any, schema: any) => any): any; | ||
//# sourceMappingURL=ImmutableUtils.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare const normalize: (schema: any, input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any) => any; | ||
export declare const normalize: (schema: any, input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args: any[]) => any; | ||
export declare const denormalize: (schema: any, input: {}, unvisit: any) => [ | ||
@@ -7,2 +7,3 @@ denormalized: any, | ||
]; | ||
export declare function denormalizeOnly(schema: any, input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): any; | ||
export declare function infer(schema: any, args: readonly any[], indexes: any, recurse: any, entities: any): any; | ||
@@ -23,3 +24,5 @@ /** | ||
addEntity: any, | ||
visitedEntities: any | ||
visitedEntities: any, | ||
storeEntities: any, | ||
args: any[] | ||
]): any; | ||
@@ -34,4 +37,5 @@ denormalize(...args: readonly [ | ||
]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): any; | ||
infer(args: any, indexes: any, recurse: any, entities: any): any; | ||
} | ||
//# sourceMappingURL=Object.d.ts.map |
@@ -9,5 +9,5 @@ export default class PolymorphicSchema { | ||
inferSchema(input: any, parent: any, key: any): any; | ||
normalizeValue(value: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): any; | ||
normalizeValue(value: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args?: any[]): any; | ||
denormalizeValue(value: any, unvisit: any): any; | ||
} | ||
//# sourceMappingURL=Polymorphic.d.ts.map |
@@ -8,4 +8,5 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
constructor(definition: any, schemaAttribute: any); | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): any; | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args: any[]): any; | ||
denormalize(input: {}, unvisit: any): any; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): any; | ||
infer(args: any, indexes: any, recurse: any, entities: any): { | ||
@@ -12,0 +13,0 @@ id: any; |
export declare const getValues: (input: any) => any[]; | ||
export declare const filterEmpty: ([item, , deletedItem]: any) => boolean; | ||
export declare const filterEmpty: (item: any) => boolean; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -7,6 +7,7 @@ import PolymorphicSchema from './Polymorphic.js'; | ||
export default class ValuesSchema extends PolymorphicSchema { | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any): {}; | ||
normalize(input: any, parent: any, key: any, visit: any, addEntity: any, visitedEntities: any, storeEntities: any, args: any[]): {}; | ||
denormalize(input: {}, unvisit: any): {}[]; | ||
denormalizeOnly(input: {}, args: readonly any[], unvisit: (input: any, schema: any) => any): any; | ||
infer(args: any, indexes: any, recurse: any): undefined; | ||
} | ||
//# sourceMappingURL=Values.d.ts.map |
export declare const DELETED: unique symbol; | ||
export declare const INVALID: symbol; | ||
//# sourceMappingURL=special.d.ts.map |
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
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
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
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
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
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
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
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
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1700644
2
368
29131
234
1
30