StoreSchema
Table of contents
Public class
Signature
class StoreSchema<R extends UnknownRecord, P = unknown> {}
References
Source
packages/store/src/lib/StoreSchema.ts
Properties
currentStoreVersion
Public readonly property
Signature
get currentStoreVersion(): number
types
Public readonly property
Signature
readonly types: {
[Record in R as Record['typeName']]: RecordType<R, any>
}
References
Methods
create()
Public static method
Signature
static create<R extends UnknownRecord, P = unknown>(
types: {
[TypeName in R['typeName']]: {
createId: any
}
},
options?: StoreSchemaOptions<R, P>
): StoreSchema<R, P>
Parameters
Name | Description |
---|---|
|
|
|
|
Returns
StoreSchema<R, P>
References
UnknownRecord, StoreSchemaOptions, StoreSchema
migratePersistedRecord()
Public method
Signature
migratePersistedRecord(
record: R,
persistedSchema: SerializedSchema,
direction?: 'down' | 'up'
): MigrationResult<R>
Parameters
Name | Description |
---|---|
|
|
|
|
|
|
Returns
MigrationResult<R>
References
SerializedSchema, MigrationResult
migrateStoreSnapshot()
Public method
Signature
migrateStoreSnapshot(
snapshot: StoreSnapshot<R>
): MigrationResult<SerializedStore<R>>
Parameters
Name | Description |
---|---|
|
|
Returns
MigrationResult<SerializedStore<R>>
References
StoreSnapshot, MigrationResult, SerializedStore
serialize()
Public method
Signature
serialize(): SerializedSchema
References
serializeEarliestVersion()
Public method
Signature
serializeEarliestVersion(): SerializedSchema
References
validateRecord()
Public method
Signature
validateRecord(
store: Store<R>,
record: R,
phase: 'createRecord' | 'initialize' | 'tests' | 'updateRecord',
recordBefore: null | R
): R
Parameters
Name | Description |
---|---|
|
|
|
|
|
|
|
|
Returns
R
References