StoreSchema
See source codeTable of contents
class StoreSchema<R extends UnknownRecord, P = unknown> {}Properties
migrations
readonly
readonly migrations: Record<string, MigrationSequence>sortedMigrations
readonly
readonly sortedMigrations: readonly Migration[]types
readonly
readonly types: {
  [Record in R as Record['typeName']]: RecordType<R, any>
}Methods
create()
static
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>getMigrationsSince()
getMigrationsSince(
  persistedSchema: SerializedSchema
): Result<Migration[], string>Parameters
| Name | Description | 
|---|---|
| 
 | 
Returns
Result<Migration[], string>migratePersistedRecord()
migratePersistedRecord(
  record: R,
  persistedSchema: SerializedSchema,
  direction?: 'down' | 'up'
): MigrationResult<R>Parameters
| Name | Description | 
|---|---|
| 
 |  | 
| 
 | |
| 
 |  | 
Returns
migrateStoreSnapshot()
migrateStoreSnapshot(
  snapshot: StoreSnapshot<R>
): MigrationResult<SerializedStore<R>>Parameters
| Name | Description | 
|---|---|
| 
 | 
Returns
serialize()
serialize(): SerializedSchemaV2serializeEarliestVersion()
Deprecated: This is only here for legacy reasons, don't use it unless you have david's blessing!
serializeEarliestVersion(): SerializedSchemavalidateRecord()
validateRecord(
  store: Store<R>,
  record: R,
  phase: 'createRecord' | 'initialize' | 'tests' | 'updateRecord',
  recordBefore: null | R
): RParameters
| Name | Description | 
|---|---|
| 
 |  | 
| 
 |  | 
| 
 |  | 
| 
 |  | 
Returns
RPrev
StoreQueriesNext
StoreSideEffects