Skip to content

config/objectCrud

Interfaces

CreateArgsRaw

Raw arguments for an object create operation before additional CRUD arguments are merged in.

Properties

isCancelled

isCancelled: Readonly<Ref<boolean, boolean>>

A readonly ref that becomes true once the request is cancelled.

object

object: object

The new object to create; it carries no primary key yet.

Index Signature

[key: string]: any

params

params: object

Your listing or retrieval arguments, passed through to the crud handlers.

Index Signature

[key: string]: any

pkKey

pkKey: string

The key name of the primary key.

target

target: TargetArgs

The arguments to be passed to the crud handlers.


DeleteArgsRaw

Raw arguments for an object delete operation before additional CRUD arguments are merged in.

Properties

isCancelled

isCancelled: Readonly<Ref<boolean, boolean>>

A readonly ref that becomes true once the request is cancelled.

pk

pk: string

The pk of the object to be acted upon.

pkKey

pkKey: string

The key name of the primary key.

target

target: TargetArgs

The arguments to be passed to the crud handlers.


ObjectCrudHandlers

Defines the CRUD-related handlers and additional utilities provided by the object instance.

Properties

create?

optional create?: CrudCreateFn

A function to be used instead of the default crud create function.

delete?

optional delete?: CrudDeleteFn

A function to be used instead of the default crud delete function.

executeAction?

optional executeAction?: CrudObjectExecuteActionFn

The function to execute a certain action on an object.

patch?

optional patch?: CrudPatchFn

A function to be used instead of the default crud patch function.

retrieve?

optional retrieve?: CrudRetrieveFn

A function to be used instead of the default crud retrieve function.

subscribe?

optional subscribe?: CrudObjectSubscribeFn

A function to be used instead of the default crud subscribe function.

update?

optional update?: CrudUpdateFn

A function to be used instead of the default crud update function.


ObjectExecuteActionArgsRaw

Raw arguments for a single-object execute-action operation before additional CRUD arguments are merged in.

Properties

action

action: string

The action to execute.

isCancelled

isCancelled: Readonly<Ref<boolean, boolean>>

A readonly ref that becomes true once the request is cancelled.

pk

pk: string

The pk of the object to be acted upon.

pkKey

pkKey: string

The key name of the primary key.

target

target: TargetArgs

The arguments to be passed to the crud handlers.


ObjectSubscribeArgsRaw

Raw arguments for a single-object subscribe operation before run-tracking and additional CRUD arguments are merged in.

Properties

callback

callback: CrudSubscribeCallback

The callback to be called when the object is updated.

isCancelled

isCancelled: Readonly<Ref<boolean, boolean>>

A readonly ref that becomes true once the request is cancelled.

params

params: object

Your listing or retrieval arguments, passed through to the crud handlers.

Index Signature

[key: string]: any

pk

pk: string

The pk of the object to be acted upon.

pkKey

pkKey: string

The key name of the primary key.

target

target: TargetArgs

The arguments to be passed to the crud handlers.


ObjectTargetOption

Optional target arguments passed through to the object CRUD handlers.

Properties

target?

optional target?: TargetArgs

The arguments to be passed to the crud handlers.


ObjectTargetProperties

Defines the CRUD-related handlers and additional utilities provided by the object instance.

Properties

args

args: TargetArgs

The arguments to be passed to the crud handlers.


PartialArgsRaw

Raw arguments for an object patch (partial update) operation before additional CRUD arguments are merged in.

Properties

isCancelled

isCancelled: Readonly<Ref<boolean, boolean>>

A readonly ref that becomes true once the request is cancelled.

params

params: object

Your listing or retrieval arguments, passed through to the crud handlers.

Index Signature

[key: string]: any

partialObject

partialObject: object

The changed fields only.

Index Signature

[key: string]: any

pk

pk: string

The pk of the object to be acted upon.

pkKey

pkKey: string

The key name of the primary key.

target

target: TargetArgs

The arguments to be passed to the crud handlers.


RetrieveArgsRaw

Raw arguments for an object retrieve operation before run-tracking and additional CRUD arguments are merged in.

Properties

isCancelled

isCancelled: Readonly<Ref<boolean, boolean>>

A readonly ref that becomes true once the request is cancelled.

params

params: object

Your listing or retrieval arguments, passed through to the crud handlers.

Index Signature

[key: string]: any

pk

pk: string

The pk of the object to be acted upon.

pkKey

pkKey: string

The key name of the primary key.

target

target: TargetArgs

The arguments to be passed to the crud handlers.


UpdateArgsRaw

Raw arguments for an object update operation before additional CRUD arguments are merged in.

Properties

isCancelled

isCancelled: Readonly<Ref<boolean, boolean>>

A readonly ref that becomes true once the request is cancelled.

object

object: ExistingCrudObject

The complete object to update; its primary key rides inside it, at object[pkKey].

params

params: object

Your listing or retrieval arguments, passed through to the crud handlers.

Index Signature

[key: string]: any

pkKey

pkKey: string

The key name of the primary key.

target

target: TargetArgs

The arguments to be passed to the crud handlers.

Type Aliases

AdditionalCrudArgs

AdditionalCrudArgs = object

Additional arguments that can be passed to CRUD handlers.

Type Parameters

Index Signature

[key: string]: any


CreateArgs

CreateArgs = CreateArgsRaw & AdditionalCrudArgs

Arguments for an object create operation, combining the raw arguments with any additional CRUD arguments.

Type Parameters


CrudCompletionResponse

CrudCompletionResponse = MaybeCancellablePromise

The value returned by an object CRUD handler whose resolved value is ignored: delete, and executeAction. A possibly-cancellable promise whose resolution signals success and nothing more, so it may resolve a record, a primary key string, or nothing at all.

Type Parameters


CrudCreateFn

CrudCreateFn = (args) => CrudResponse

Signature for the handler that creates an object in the backing store.

Type Parameters

Parameters

args

CreateArgs

The arguments to be passed to the create function.

Returns

CrudResponse


CrudDeleteFn

CrudDeleteFn = (args) => CrudCompletionResponse

Signature for the handler that deletes an object from the backing store.

Type Parameters

Parameters

args

DeleteArgs

The arguments to be passed to the delete function.

Returns

CrudCompletionResponse


CrudObjectExecuteActionFn

CrudObjectExecuteActionFn = (args) => CrudCompletionResponse

Signature for the handler that executes an action on a single object in the backing store.

Type Parameters

Parameters

args

ObjectExecuteActionArgs

The arguments to be passed to the executeAction function.

Returns

CrudCompletionResponse


CrudObjectSubscribeFn

CrudObjectSubscribeFn = (args) => CancellablePromise

Signature for the handler that subscribes to changes on a single object in the backing store.

Type Parameters

Parameters

args

ObjectSubscribeArgs

The arguments to be passed to the subscribe function.

Returns

CancellablePromise


CrudPatchFn

CrudPatchFn = (args) => CrudResponse

Signature for the handler that partially updates (patches) an object in the backing store.

Type Parameters

Parameters

args

PartialArgs

The arguments to be passed to the patch function.

Returns

CrudResponse


CrudResponse

CrudResponse = MaybeCancellablePromise

The value returned by an object CRUD handler whose resolved value becomes the record: create, retrieve, update, and patch. A possibly-cancellable promise resolving to the complete record. The instance mirrors the resolved value into state.object, so a partial record drops the fields it omits, and a resolved value that is not an object (a bare primary key string, for instance) fails the assignment and is stored in state.error.

Type Parameters


CrudRetrieveFn

CrudRetrieveFn = (args) => CrudResponse

Signature for the handler that retrieves an object from the backing store.

Type Parameters

Parameters

args

RetrieveArgs

The arguments to be passed to the retrieve function.

Returns

CrudResponse


CrudSubscribeCallback

CrudSubscribeCallback = (data, action) => any

Callback invoked with the changed object and the action (create, update, or delete) when a subscribed object changes.

Type Parameters

Parameters

data

ExistingCrudObject

The data to be passed to the callback.

action

"delete" | "update" | "create"

The action that was performed.

Returns

any


CrudUpdateFn

CrudUpdateFn = (args) => CrudResponse

Signature for the handler that updates an object in the backing store.

Type Parameters

Parameters

args

UpdateArgs

The arguments to be passed to the update function.

Returns

CrudResponse


DeleteArgs

DeleteArgs = DeleteArgsRaw & AdditionalCrudArgs

Arguments for an object delete operation, combining the raw arguments with any additional CRUD arguments.

Type Parameters


ObjectExecuteActionArgs

ObjectExecuteActionArgs = ObjectExecuteActionArgsRaw & AdditionalCrudArgs

Arguments for a single-object execute-action operation, combining the raw arguments with any additional CRUD arguments.

Type Parameters


ObjectSubscribeArgs

ObjectSubscribeArgs = ObjectSubscribeArgsRaw & CommonRunTracking & AdditionalCrudArgs

Arguments for a single-object subscribe operation, combining the raw arguments with run-tracking and any additional CRUD arguments.

Type Parameters


ObjectTarget

ObjectTarget = ObjectTargetProperties & ObjectCrudHandlers

The CRUD arguments.

Type Parameters


PartialArgs

PartialArgs = PartialArgsRaw & AdditionalCrudArgs

Arguments for an object patch (partial update) operation, combining the raw arguments with any additional CRUD arguments.

Type Parameters


RetrieveArgs

RetrieveArgs = RetrieveArgsRaw & Partial<CommonRunTracking> & AdditionalCrudArgs

Arguments for an object retrieve operation, combining the raw arguments with run-tracking and any additional CRUD arguments.

Type Parameters


TargetArgs

TargetArgs = object

Implementation-specific arguments passed through to the CRUD handlers, such as endpoint identifiers.

Type Parameters

Index Signature

[key: string]: any


UpdateArgs

UpdateArgs = UpdateArgsRaw & AdditionalCrudArgs

Arguments for an object update operation, combining the raw arguments with any additional CRUD arguments.

Type Parameters

Variables

defaultObjectCrud

const defaultObjectCrud: Readonly<ObjectCrudHandlers>

The default object crud handlers.

Functions

getObjectCrud()

getObjectCrud(target, options): void

Get the previously set object crud handlers.

Parameters

target

The reactive object you want to add the resulting crud to.

args

TargetArgs

The arguments to be passed to the crud handlers.

options

The options for the reactive crud object.

handlers?

ObjectCrudHandlers

Any functions to override the default crud functions.

props?

{ target?: TargetArgs; }

The props with any passed target.

props.target?

TargetArgs

The arguments to be passed to the crud handlers.

Returns

void

Throws

  • If an invalid function is passed, or if the function is not a function.

setObjectCrud()

setObjectCrud(options): void

Set the object crud handlers.

Parameters

options

ObjectTarget

The options for the object crud handlers.

Returns

void

Throws

  • if unknown keys are passed.