Skip to content
module@warp-drive/schema-dsl

Call Signature

ts
function local(target, key): void;

Defined in: fields/local.ts:54

Decorator

Marks a property as a LocalField — state that lives only on the record instance, is never read from or written to the cache, and is never sent to the server.

Parameters

target

object

key

string

Returns

void

Example

ts
import { Resource, field, local } from '@warp-drive/schema-dsl';

@Resource
export class User {
  @field declare name: string;
  @local declare isEditing: boolean;
  @local({ defaultValue: 0 }) declare dirtyCount: number;
}
json
[
  { "kind": "@local", "name": "isEditing" },
  { "kind": "@local", "name": "dirtyCount", "options": { "defaultValue": 0 } }
]

Since

5.9.0

Call Signature

ts
function local(options): (target, key) => void;

Defined in: fields/local.ts:55

Decorator

Marks a property as a LocalField — state that lives only on the record instance, is never read from or written to the cache, and is never sent to the server.

Parameters

options

LocalOptions

Returns

(target, key) => void

Example

ts
import { Resource, field, local } from '@warp-drive/schema-dsl';

@Resource
export class User {
  @field declare name: string;
  @local declare isEditing: boolean;
  @local({ defaultValue: 0 }) declare dirtyCount: number;
}
json
[
  { "kind": "@local", "name": "isEditing" },
  { "kind": "@local", "name": "dirtyCount", "options": { "defaultValue": 0 } }
]

Since

5.9.0

Released under the MIT License.