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

Interface GenericField ​

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

A generic "field" that can be used to define primitive value fields.

Replaces "attribute" for primitive value fields. Can also be used to eject from deep-tracking of objects or arrays.

A major difference between "field" and "attribute" is that "type" points to a legacy transform on "attribute" that a serializer might use, while "type" points to a new-style transform on "field" that a record implmentation must use.

Properties ​

kind ​

ts
kind: "field";

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

The kind of field this is.


name ​

ts
name: string;

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

The name of the field.


options? ​

ts
optional options?: ObjectValue;

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

Options to pass to the transform, if any

Must comply to the specific transform's options schema.


sourceKey? ​

ts
optional sourceKey?: string;

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

The name of the field as returned by the API and inserted into the Cache if it differs from GenericField.name

For instance, if the API returns:

ts
{
  attributes: {
    'first-name': 'Chris'
  }
}

But the app desires to use record.firstName; // 'Chris'

Then name would be set to 'firstName' and sourceKey would be set to 'first-name'.

This option is only needed when the value differs from name.


type? ​

ts
optional type?: string;

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

the name of the Transformation to use, if any

Released under the MIT License.