StoreSchema
Table of contents
Public class
Signature
class StoreSchema<R extends UnknownRecord, P = unknown> {}
References
Source
packages/store/src/lib/StoreSchema.ts
Properties
migrations
Public readonly property
Signature
readonly migrations: Record<string, MigrationSequence>
References
sortedMigrations
Public readonly property
Signature
readonly sortedMigrations: readonly Migration[]
References
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
getMigrationsSince()
Public method
Signature
getMigrationsSince(
persistedSchema: SerializedSchema
): Result<Migration[], string>
Parameters
Name | Description |
---|---|
|
|
Returns
Result<Migration[], string>
References
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(): SerializedSchemaV2
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