• Public
  • Public/Protected
  • All

Interface IEntityConfigBase<TEntity, TRawData, TId>

Type parameters




Optional entityConstructor

entityConstructor: DataEntityType<TEntity, TRawData, TId>

Optional getDefaultValue

getDefaultValue: function

Type declaration

    • (): TEntity
    • Returns TEntity

Optional getValueById

getValueById: function

Type declaration

Optional hasValue

hasValue: function

Tests whether the entity contains a hard-coded value with the specified ID (in the entities values configuration).


Type declaration

Optional idProperty

idProperty: keyof TRawData

The property in the raw data used for the Entity's ID.

Optional modelWith

modelWith: function

Optional function to supply the model type to construct, given the raw data. Useful for APIs that can return multiple entity types, with a common discriminator to differentiate them.

GET /things
{ "kind": "one", "id": 1 },
{ "kind": "two", "id": 2 },
modelWith: rawData => rawData.kind === 'one' : One ? Two
class Base { }

class One extends Base {}

class Two extends Base {}

paris.getItemById<One | Two>(Base, 1)
.subscribe(item =>
console.log(item instanceof One) // true

paris.getRepository(Base).query().subscribe(dataSet => {
const [ one, two ] = dataSet.items;

console.log(one instanceof One) // true
console.log(two instanceof Two) // true

Type declaration

Optional parseSaveItemsQuery

parseSaveItemsQuery: function

Type declaration


pluralName: string

Human-readable name for the Entity type, plural. e.g 'Users', 'To do items', 'Movies', 'Comments', etc. Used internally for error messages, for example, or can be used in reflection.

Optional readonly

readonly: boolean

If readonly is set to true, all models of this entity type will be immutable - frozen with Object.freeze. Readonly models don't have a $parent property.



Optional serializeItem

serializeItem: function

Type declaration

    • (item: Partial<TEntity>, serializedItem?: any, entity?: IEntityConfigBase<TEntity, TRawData, TId>, config?: ParisConfig, serializationData?: any): TRawData
    • Parameters

      • item: Partial<TEntity>
      • Optional serializedItem: any
      • Optional entity: IEntityConfigBase<TEntity, TRawData, TId>
      • Optional config: ParisConfig
      • Optional serializationData: any

      Returns TRawData


singularName: string

Human-readable name for the Entity type, singular. e.g 'User', 'To do item', 'Movie', 'Comment', etc. Used internally for error messages, for example, or can be used in reflection.

Optional supportedEntityGetMethods

supportedEntityGetMethods: Array<EntityGetMethod>

Optional values

values: Array<TEntity>

Hard-coded items for this Entity. When values are specified, no endpoint is required, and items are always returned from these values, instead of backend.

Hard-coding values for an Entity:

singularName: "Status",
pluralName: "Statuses",
values: [
{ id: 1, name: 'Open' },
{ id: 2, name: 'In progress' },
{ id: 3, name: 'Done' }
export class Status extends EntityModelBase<number>{
name: string;

Then when requesting an item for Status, either directly (with getValue or getItemById) or when sub-modeling, the hard-coded values are used:

// Async:
paris.getItemById(Status, 1).subscribe(status => console.log('Status with ID 1: ', status);

// Sync:
console.log('Status with ID 1: ', paris.getValue(Status, 1));

Generated using TypeDoc