Skip to content
module@warp-drive/core/types/schema/fields

Interface HashField ​

Defined in: warp-drive-packages/core/src/types/schema/fields.ts:360

Represents a specialized field whose computed value will be used as the primary key of a schema-object for serializability and comparison purposes.

This field functions similarly to derived fields in that it is non-settable, derived state but differs in that it is only able to compute off of cache state and is given no access to a record instance.

This means that if a hashing function wants to compute its value taking into account transformations and derivations it must perform those itself.

A schema-array can declare its "key" value to be @hash if the schema-objects it contains have such a field.

Only one hash field is permittable per schema-object, and it should be placed in the ResourceSchema's @id field in place of an IdentityField.

Properties ​

kind ​

ts
kind: "@hash";

Defined in: warp-drive-packages/core/src/types/schema/fields.ts:366

The kind of field this is.


name ​

ts
name: string | null;

Defined in: warp-drive-packages/core/src/types/schema/fields.ts:377

The name of the field that serves as the hash for the resource.

Only required if access to this value by the UI is desired, it can be null otherwise.


options? ​

ts
optional options?: ObjectValue;

Defined in: warp-drive-packages/core/src/types/schema/fields.ts:394

Any options that should be provided to the hash function.


type ​

ts
type: string;

Defined in: warp-drive-packages/core/src/types/schema/fields.ts:386

The name of a function to run to compute the hash. The function will only have access to the cached data for the record.

Released under the MIT License.