Skip to main content
Version: 0.17

Class: RecordSchema

A Schema defines the models allowed in a source, including their keys, attributes, and relationships. A single schema may be shared across multiple sources.

Hierarchy

Constructors

constructor

new RecordSchema(settings?)

Parameters

NameType
settingsRecordSchemaSettings

Inherited from

Evented<RecordSchemaEvent>.constructor

Defined in

packages/@orbit/records/src/record-schema.ts:123

Accessors

models

get models(): Dict<ModelDefinition>

Returns

Dict<ModelDefinition>

Defined in

packages/@orbit/records/src/record-schema.ts:231


version

get version(): number

Version

Returns

number

Defined in

packages/@orbit/records/src/record-schema.ts:138

Methods

_deprecateRelationshipModel

_deprecateRelationshipModel(models): void

Parameters

NameType
modelsDict<ModelDefinition>

Returns

void

Defined in

packages/@orbit/records/src/record-schema.ts:323


eachAttribute

eachAttribute(type, callbackFn): void

Parameters

NameType
typestring
callbackFn(name: string, attribute: AttributeDefinition) => void

Returns

void

Defined in

packages/@orbit/records/src/record-schema.ts:290


eachKey

eachKey(type, callbackFn): void

Parameters

NameType
typestring
callbackFn(name: string, key: KeyDefinition) => void

Returns

void

Defined in

packages/@orbit/records/src/record-schema.ts:301


eachRelationship

eachRelationship(type, callbackFn): void

Parameters

NameType
typestring
callbackFn(name: string, relationship: RelationshipDefinition) => void

Returns

void

Defined in

packages/@orbit/records/src/record-schema.ts:312


emit

emit(event, ...args): void

Parameters

NameType
eventEvent
...argsunknown[]

Returns

void

Inherited from

Evented.emit

Defined in

packages/@orbit/core/dist/modules/evented.d.ts:23


generateId

generateId(type?): string

Generate an id for a given model type.

Parameters

NameType
type?string

Returns

string

Defined in

packages/@orbit/records/src/record-schema.ts:192


getAttribute

getAttribute(type, attribute): AttributeDefinition

Parameters

NameType
typestring
attributestring

Returns

AttributeDefinition

Defined in

packages/@orbit/records/src/record-schema.ts:244


getKey

getKey(type, key): KeyDefinition

Parameters

NameType
typestring
keystring

Returns

KeyDefinition

Defined in

packages/@orbit/records/src/record-schema.ts:254


getModel

getModel(type): ModelDefinition

Parameters

NameType
typestring

Returns

ModelDefinition

Defined in

packages/@orbit/records/src/record-schema.ts:235


getRelationship

getRelationship(type, relationship): RelationshipDefinition

Parameters

NameType
typestring
relationshipstring

Returns

RelationshipDefinition

Defined in

packages/@orbit/records/src/record-schema.ts:264


hasAttribute

hasAttribute(type, attribute): boolean

Parameters

NameType
typestring
attributestring

Returns

boolean

Defined in

packages/@orbit/records/src/record-schema.ts:278


hasKey

hasKey(type, key): boolean

Parameters

NameType
typestring
keystring

Returns

boolean

Defined in

packages/@orbit/records/src/record-schema.ts:282


hasModel

hasModel(type): boolean

Parameters

NameType
typestring

Returns

boolean

Defined in

packages/@orbit/records/src/record-schema.ts:274


hasRelationship

hasRelationship(type, relationship): boolean

Parameters

NameType
typestring
relationshipstring

Returns

boolean

Defined in

packages/@orbit/records/src/record-schema.ts:286


listeners

listeners(event): Listener[]

Parameters

NameType
eventEvent

Returns

Listener[]

Inherited from

Evented.listeners

Defined in

packages/@orbit/core/dist/modules/evented.d.ts:24


off

off(event, listener?): void

Parameters

NameType
eventEvent
listener?Listener

Returns

void

Inherited from

Evented.off

Defined in

packages/@orbit/core/dist/modules/evented.d.ts:21


on

on(event, listener): () => void

Parameters

NameType
eventEvent
listenerListener

Returns

fn

▸ (): void

Returns

void

Inherited from

Evented.on

Defined in

packages/@orbit/core/dist/modules/evented.d.ts:20


one

one(event, listener): () => void

Parameters

NameType
eventEvent
listenerListener

Returns

fn

▸ (): void

Returns

void

Inherited from

Evented.one

Defined in

packages/@orbit/core/dist/modules/evented.d.ts:22


pluralize

pluralize(word): string

A naive pluralization method.

Deprecated in favor of inflectors now in @orbit/serializers

deprecated since v0.17, remove in v0.18

Parameters

NameType
wordstring

Returns

string

Defined in

packages/@orbit/records/src/record-schema.ts:203


singularize

singularize(word): string

A naive singularization method.

Deprecated in favor of inflectors now in @orbit/serializers

deprecated since v0.17, remove in v0.18

Parameters

NameType
wordstring

Returns

string

Defined in

packages/@orbit/records/src/record-schema.ts:217


upgrade

upgrade(settings?): Promise<void>

Upgrades Schema to a new version with new settings.

Emits the upgrade event to cue sources to upgrade their data.

Parameters

NameType
settingsRecordSchemaSettings

Returns

Promise<void>

Defined in

packages/@orbit/records/src/record-schema.ts:147