Skip to content

@jimka/typescript-ui / data / Proxy

Class: abstract Proxy

Defined in: src/typescript/lib/data/proxy/Proxy.ts:33

Abstract base class for all data proxies. Defines the four CRUD operations that every proxy implementation must provide.

Remarks

AbstractStore calls these methods during load() and sync(). Each method receives or returns plain data objects so that the proxy layer remains decoupled from the store's record management logic.

Extended by

Constructors

new Proxy()

ts
new Proxy(): Proxy

Returns

Proxy

Methods

create()

ts
abstract create(record: ModelRecord): Promise<Record<string, any>>

Defined in: src/typescript/lib/data/proxy/Proxy.ts:53

Persists a new record to the data source.

Parameters

record

ModelRecord

The new ModelRecord to create.

Returns

Promise<Record<string, any>>

A promise that resolves to the server-side representation of the created record, which may include server-assigned values such as a generated primary key.


destroy()

ts
abstract destroy(record: ModelRecord): Promise<void>

Defined in: src/typescript/lib/data/proxy/Proxy.ts:71

Removes a record from the data source.

Parameters

record

ModelRecord

The ModelRecord to delete.

Returns

Promise<void>

A promise that resolves when the deletion is complete.


getLastTotalCount()

ts
getLastTotalCount(): undefined | number

Defined in: src/typescript/lib/data/proxy/Proxy.ts:84

Returns the total record count reported by the most recent paginated read.

Returns

undefined | number

The total count from the last paginated response, or undefined if the proxy does not support pagination or no paginated read has occurred.

Remarks

Default implementation returns undefined. Pagination-aware proxies (such as AjaxProxy) override this to return the total value parsed from the server envelope.


read()

ts
abstract read(params?: ReadParams): Promise<any[]>

Defined in: src/typescript/lib/data/proxy/Proxy.ts:43

Fetches records from the data source.

Parameters

params?

ReadParams

Optional. Pagination parameters from the store. Proxies that do not support pagination may ignore this argument.

Returns

Promise<any[]>

A promise that resolves to an array of raw data objects.


update()

ts
abstract update(record: ModelRecord): Promise<Record<string, any>>

Defined in: src/typescript/lib/data/proxy/Proxy.ts:62

Updates an existing record in the data source.

Parameters

record

ModelRecord

The dirty ModelRecord to persist.

Returns

Promise<Record<string, any>>

A promise that resolves to the server-side representation of the updated record.