Skip to content

Documentation / @warp-drive/schema-record / SchemaRecord

Defined in: record.ts:87

A class that uses a the ResourceSchema for a ResourceType and a ResouceKey to transform data from the cache into a rich, reactive object.

This class is not directly instantiable. To use it, you should configure the store's instantiateRecord and teardownRecord hooks with the matching hooks provided by this package.

Properties

[toStringTag]

ts
[toStringTag]: `SchemaRecord<${string}>`;

Defined in: record.ts:102

Methods

___(unique) Symbol(Checkout)()

ts
___(unique) Symbol(Checkout)(): Promise<SchemaRecord>;

Defined in: record.ts:798

Create an editable copy of the record

SchemaRecord instances are not editable by default. This method creates an editable copy of the record. To use, import the Checkout symbol from @warp-drive/schema-record and call it on the record.

ts
import { Checkout } from '@warp-drive/schema-record';

const record = store.peekRecord('user', '1');
const editableRecord = await record[Checkout]();

Returns

Promise<SchemaRecord>

a promise that resolves to the editable record

Throws

if the record is already editable or if the record is embedded

Released under the MIT License.