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

Decorator local() ​

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

Call Signature ​

sincev5.9.0
ts
function local(target: object, key: string): void;

Defined in: fields/local.ts:57

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 } }
]

Call Signature ​

sincev5.9.0
ts
function local(options: LocalOptions): (target: object, key: string) => void;

Defined in: fields/local.ts:58

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: object, key: string) => 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 } }
]

Released under the MIT License.