Skip to content

UpdateApplicationAction

@blobs/sdk v0.1.0


@blobs/sdk / actions/application / UpdateApplicationAction

Defined in: actions/application/UpdateApplicationAction.ts:53

Patches non-credential fields on an existing application row — typically name, description, permissions, rate_limit, expires_at, or metadata. The hashed api_key field cannot be patched here; key rotation is a separate, non-undoable server endpoint because rotation irreversibly invalidates the prior key for every consumer.

captureState snapshots only the fields the payload intends to change, so undo restores precisely those fields and won’t clobber unrelated edits that were made between the action’s execute and undo. The id is preserved across the round trip — this is a true in-place update, unlike the Create→Delete reversal pattern used by CreateApplicationAction.

Remarks

Use ActionManager.execute for managed flow — adds the action to a linear history stack so manager.undo() / manager.redo() find it without you keeping a reference, discards forward branches on a new execute, emits action:executing / action:completed events, and injects a pre-configured ActionContext. Calling action.execute(context) directly is also supported for one-shot use without history; see BaseAction for the full contract.

Examples

const action = createUpdateApplicationAction(payload);
await actionManager.execute(action);
await actionManager.undo();
const action = createUpdateApplicationAction(payload);
await action.execute({ applicationsService: blobs.applications });
await action.undo({ applicationsService: blobs.applications });

Extends

Constructors

Constructor

new UpdateApplicationAction(payload): UpdateApplicationAction

Defined in: actions/application/UpdateApplicationAction.ts:66

Parameters

payload

UpdateApplicationPayload

Returns

UpdateApplicationAction

Overrides

BaseAction.constructor

Properties

id

readonly id: string

Defined in: actions/BaseAction.ts:74

Unique action identifier; assigned at construction time.

Inherited from

BaseAction.id


payload

readonly payload: UpdateApplicationPayload

Defined in: actions/BaseAction.ts:80

The original payload the action was constructed with.

Inherited from

BaseAction.payload


createdAt

readonly createdAt: number

Defined in: actions/BaseAction.ts:82

Wall-clock timestamp (ms) when the action was instantiated.

Inherited from

BaseAction.createdAt


canUndo

readonly canUndo: boolean

Defined in: actions/BaseAction.ts:84

Whether BaseAction.undo is allowed for this action.

Inherited from

BaseAction.canUndo


canRedo

readonly canRedo: boolean

Defined in: actions/BaseAction.ts:86

Whether BaseAction.redo is allowed after undo.

Inherited from

BaseAction.canRedo


status

status: ActionStatus = 'pending'

Defined in: actions/BaseAction.ts:89

Current lifecycle status; mutated by execute/undo/redo.

Inherited from

BaseAction.status


executedAt?

optional executedAt?: number

Defined in: actions/BaseAction.ts:91

Wall-clock timestamp (ms) when execute most recently completed.

Inherited from

BaseAction.executedAt


previousState?

optional previousState?: ActionState<UpdateApplicationUndoState>

Defined in: actions/BaseAction.ts:93

Captured pre-execution state used by undo.

Inherited from

BaseAction.previousState


result?

optional result?: ActionResult<{ message: string; }>

Defined in: actions/BaseAction.ts:95

Last result produced by execute/undo/redo.

Inherited from

BaseAction.result


type

readonly type: "application:update" = 'application:update'

Defined in: actions/application/UpdateApplicationAction.ts:58

Action type tag (e.g. 'blob:delete'); set by subclasses.

Overrides

BaseAction.type

Accessors

description

Get Signature

get description(): string

Defined in: actions/application/UpdateApplicationAction.ts:60

Human-readable description used in UI history listings.

Returns

string

Human-readable description used in UI history listings.

Overrides

BaseAction.description

Methods

execute()

execute(context): Promise<ActionResult<{ message: string; }>>

Defined in: actions/BaseAction.ts:123

Runs the action: validates first, captures undo state when applicable, then dispatches to the subclass-implemented doExecute. Catches exceptions and converts them into a failed ActionResult.

Parameters

context

ActionContext

Per-execution context.

Returns

Promise<ActionResult<{ message: string; }>>

The execution result.

Inherited from

BaseAction.execute


undo()

undo(context): Promise<ActionResult<{ message: string; }>>

Defined in: actions/BaseAction.ts:171

Reverses the action by delegating to the subclass doUndo with the captured undo state. Refuses to run unless the action previously completed (or was last redone) and undo state is available.

Parameters

context

ActionContext

Per-execution context.

Returns

Promise<ActionResult<{ message: string; }>>

The undo result.

Inherited from

BaseAction.undo


redo()

redo(context): Promise<ActionResult<{ message: string; }>>

Defined in: actions/BaseAction.ts:215

Re-applies a previously undone action. By default delegates to doExecute; subclasses can override doRedo for an optimized path that does not re-capture undo state.

Parameters

context

ActionContext

Per-execution context.

Returns

Promise<ActionResult<{ message: string; }>>

The redo result.

Inherited from

BaseAction.redo


doRedo()

protected doRedo(context): Promise<ActionResult<{ message: string; }>>

Defined in: actions/BaseAction.ts:292

Subclass hook performing the redo path. The default implementation re-runs doExecute; override when redo can be performed without recomputing state.

Parameters

context

ActionContext

Per-execution context.

Returns

Promise<ActionResult<{ message: string; }>>

The redo result.

Inherited from

BaseAction.doRedo


toJSON()

toJSON(): Record<string, unknown>

Defined in: actions/BaseAction.ts:300

Serializes the action’s identity and lifecycle metadata for storage or transmission. Excludes captured undo state and methods.

Returns

Record<string, unknown>

Inherited from

BaseAction.toJSON


validate()

validate(context): Promise<ActionResult<void>>

Defined in: actions/application/UpdateApplicationAction.ts:70

Default validation hook — always passes. Subclasses override to add pre-execute checks (e.g. required services, payload sanity).

Parameters

context

ActionContext

Returns

Promise<ActionResult<void>>

A success result.

Overrides

BaseAction.validate


captureState()

captureState(context): Promise<UpdateApplicationUndoState>

Defined in: actions/application/UpdateApplicationAction.ts:78

Captures the state needed to reverse this action. Subclasses must implement this when canUndo is true.

Parameters

context

ActionContext

Per-execution context.

Returns

Promise<UpdateApplicationUndoState>

The undo-state snapshot.

Overrides

BaseAction.captureState


doExecute()

protected doExecute(context): Promise<ActionResult<{ message: string; }>>

Defined in: actions/application/UpdateApplicationAction.ts:93

Subclass hook performing the forward operation.

Parameters

context

ActionContext

Per-execution context.

Returns

Promise<ActionResult<{ message: string; }>>

The execution result.

Overrides

BaseAction.doExecute


doUndo()

protected doUndo(context, previousState): Promise<ActionResult<{ message: string; }>>

Defined in: actions/application/UpdateApplicationAction.ts:102

Subclass hook performing the inverse operation.

Parameters

context

ActionContext

Per-execution context.

previousState

UpdateApplicationUndoState

The state snapshot captured before execute.

Returns

Promise<ActionResult<{ message: string; }>>

The undo result.

Overrides

BaseAction.doUndo