VersionableMixin

Hierarchy

  • VersionableMixin

Index

Properties

Methods

Properties

Optional schemaVersion

schemaVersion? : number

Methods

getLegacyTransformer

getLegacyTransformer(schemaVersion: number): Hook

Returns legacy transformer for schema version.

throws {LegacyTransformerNotFoundError} Thrown if transformer for schema version can't be found.

Parameters:

NameTypeDescription
schemaVersionnumberSchema version.

Returns: Hook

Legacy transformer for schema version.


getLegacyTransformers

getLegacyTransformers(): LegacyTransformers

Returns all available legacy transformers.

Returns: LegacyTransformers

Map instance of all registered legacy transformers with number version as a key and transformer function as a value.


getSchemaVersion

getSchemaVersion(): number | undefined

Returns current instance schema version.

Returns: number | undefined

Schema version as a number, else undefined.


hasLegacyTransformer

hasLegacyTransformer(schemaVersion: number): boolean

Evaluates is there is registered legacy transformer for schema version.

Parameters:

NameTypeDescription
schemaVersionnumberSchema version.

Returns: boolean

Returns true if legacy transformer for schema version is registered, else false.


overrideLegacyTransformer

overrideLegacyTransformer(schemaVersion: number, transformer: Hook): void

Overrides registered transformer by schema version or registers a new one.

throws {InvalidSchemaVersionError} Thrown if the the schema version argument is not a number.

Parameters:

NameTypeDescription
schemaVersionnumberSchema version.
transformerHookTransformer function.

Returns: void


registerLegacyTransformer

registerLegacyTransformer(schemaVersion: number, transformer: Hook, shouldOverride?: boolean): void

Registers legacy transformer for version.

throws {InvalidSchemaVersionError} Thrown if the the schema version argument is not a number.

throws {LegacyTransformerAlreadyExistsError} Thrown if transformer for version would overridden without explicit call.

Parameters:

NameTypeDescription
schemaVersionnumberSchema version.
transformerHookTransformer function.
shouldOverride?booleanFlag indicating that transformer should be overridden if exist.

Returns: void


transformLegacyProps

transformLegacyProps(props: Props): Props

Registrable hook for transforming legacy schema.

Parameters:

NameTypeDescription
propsPropsProperties object to be transformed.

Returns: Props

Transformed legacy properties or their unchanged state if up to date.