Skip to content

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

Class: SchemaRecord

Defined in: record.d.ts:5

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.

Methods

___(unique) Symbol(Checkout)()

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

Defined in: record.d.ts:32

Create an editable copy of the record

ReactiveResource 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]();

Type Parameters

T

T

Returns

Promise<T>

a promise that resolves to the editable record

Throws

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

Properties

[toStringTag]

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

Defined in: record.d.ts:6

Released under the MIT License.