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​
Evented
<RecordSchemaEvent
>↳
RecordSchema
Constructors​
constructor​
• new RecordSchema(settings?
)
Parameters​
Name | Type |
---|---|
settings | RecordSchemaSettings |
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​
Name | Type |
---|---|
models | Dict <ModelDefinition > |
Returns​
void
Defined in​
packages/@orbit/records/src/record-schema.ts:323
eachAttribute​
â–¸ eachAttribute(type
, callbackFn
): void
Parameters​
Name | Type |
---|---|
type | string |
callbackFn | (name : string , attribute : AttributeDefinition ) => void |
Returns​
void
Defined in​
packages/@orbit/records/src/record-schema.ts:290
eachKey​
â–¸ eachKey(type
, callbackFn
): void
Parameters​
Name | Type |
---|---|
type | string |
callbackFn | (name : string , key : KeyDefinition ) => void |
Returns​
void
Defined in​
packages/@orbit/records/src/record-schema.ts:301
eachRelationship​
â–¸ eachRelationship(type
, callbackFn
): void
Parameters​
Name | Type |
---|---|
type | string |
callbackFn | (name : string , relationship : RelationshipDefinition ) => void |
Returns​
void
Defined in​
packages/@orbit/records/src/record-schema.ts:312
emit​
â–¸ emit(event
, ...args
): void
Parameters​
Name | Type |
---|---|
event | Event |
...args | unknown [] |
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​
Name | Type |
---|---|
type? | string |
Returns​
string
Defined in​
packages/@orbit/records/src/record-schema.ts:192
getAttribute​
â–¸ getAttribute(type
, attribute
): AttributeDefinition
Parameters​
Name | Type |
---|---|
type | string |
attribute | string |
Returns​
Defined in​
packages/@orbit/records/src/record-schema.ts:244
getKey​
â–¸ getKey(type
, key
): KeyDefinition
Parameters​
Name | Type |
---|---|
type | string |
key | string |
Returns​
Defined in​
packages/@orbit/records/src/record-schema.ts:254
getModel​
â–¸ getModel(type
): ModelDefinition
Parameters​
Name | Type |
---|---|
type | string |
Returns​
Defined in​
packages/@orbit/records/src/record-schema.ts:235
getRelationship​
â–¸ getRelationship(type
, relationship
): RelationshipDefinition
Parameters​
Name | Type |
---|---|
type | string |
relationship | string |
Returns​
Defined in​
packages/@orbit/records/src/record-schema.ts:264
hasAttribute​
â–¸ hasAttribute(type
, attribute
): boolean
Parameters​
Name | Type |
---|---|
type | string |
attribute | string |
Returns​
boolean
Defined in​
packages/@orbit/records/src/record-schema.ts:278
hasKey​
â–¸ hasKey(type
, key
): boolean
Parameters​
Name | Type |
---|---|
type | string |
key | string |
Returns​
boolean
Defined in​
packages/@orbit/records/src/record-schema.ts:282
hasModel​
â–¸ hasModel(type
): boolean
Parameters​
Name | Type |
---|---|
type | string |
Returns​
boolean
Defined in​
packages/@orbit/records/src/record-schema.ts:274
hasRelationship​
â–¸ hasRelationship(type
, relationship
): boolean
Parameters​
Name | Type |
---|---|
type | string |
relationship | string |
Returns​
boolean
Defined in​
packages/@orbit/records/src/record-schema.ts:286
listeners​
â–¸ listeners(event
): Listener
[]
Parameters​
Name | Type |
---|---|
event | Event |
Returns​
Listener
[]
Inherited from​
Evented.listeners
Defined in​
packages/@orbit/core/dist/modules/evented.d.ts:24
off​
â–¸ off(event
, listener?
): void
Parameters​
Name | Type |
---|---|
event | Event |
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​
Name | Type |
---|---|
event | Event |
listener | Listener |
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​
Name | Type |
---|---|
event | Event |
listener | Listener |
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​
Name | Type |
---|---|
word | string |
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​
Name | Type |
---|---|
word | string |
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​
Name | Type |
---|---|
settings | RecordSchemaSettings |
Returns​
Promise
<void
>