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