Skip to content

DeleteApplicationAction

@blobs/sdk v0.1.0


@blobs/sdk / actions/application / DeleteApplicationAction

Defined in: actions/application/DeleteApplicationAction.ts:57

Removes an application registration from the server. The forward path is a single ApplicationsService.delete() call.

Undo is best-effort, not lossless. Before deletion, captureState snapshots every recoverable field on the application (name, description, network, permissions, rate limit, expiry, metadata). Undo recreates the application from that snapshot — but since the plaintext api_key is not part of any captured state (the server only stores its hash), the recreated application will have a new id and a new key. Any external service still authenticating with the deleted application’s old key must be reissued credentials before it can connect again.

If you need to “pause” an application without losing its key, prefer patching expires_at via UpdateApplicationAction — that’s fully reversible and preserves credentials.

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 = createDeleteApplicationAction(payload);
await actionManager.execute(action);
await actionManager.undo();
const action = createDeleteApplicationAction(payload);
await action.execute({ applicationsService: blobs.applications });
await action.undo({ applicationsService: blobs.applications });

Extends

Constructors

Constructor

new DeleteApplicationAction(payload): DeleteApplicationAction

Defined in: actions/application/DeleteApplicationAction.ts:68

Parameters

payload

DeleteApplicationPayload

Returns

DeleteApplicationAction

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: DeleteApplicationPayload

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<DeleteApplicationUndoState>

Defined in: actions/BaseAction.ts:93

Captured pre-execution state used by undo.

Inherited from

BaseAction.previousState


result?

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

Defined in: actions/BaseAction.ts:95

Last result produced by execute/undo/redo.

Inherited from

BaseAction.result


type

readonly type: "application:delete" = 'application:delete'

Defined in: actions/application/DeleteApplicationAction.ts:62

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

Overrides

BaseAction.type

Accessors

description

Get Signature

get description(): string

Defined in: actions/application/DeleteApplicationAction.ts:64

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<Application | { message: string; } | null>>

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<Application | { message: string; } | null>>

The execution result.

Inherited from

BaseAction.execute


undo()

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

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<Application | { message: string; } | null>>

The undo result.

Inherited from

BaseAction.undo


redo()

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

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<Application | { message: string; } | null>>

The redo result.

Inherited from

BaseAction.redo


doRedo()

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

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<Application | { message: string; } | null>>

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/DeleteApplicationAction.ts:72

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<DeleteApplicationUndoState>

Defined in: actions/application/DeleteApplicationAction.ts:77

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

Parameters

context

ActionContext

Per-execution context.

Returns

Promise<DeleteApplicationUndoState>

The undo-state snapshot.

Overrides

BaseAction.captureState


doExecute()

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

Defined in: actions/application/DeleteApplicationAction.ts:98

Subclass hook performing the forward operation.

Parameters

context

ActionContext

Per-execution context.

Returns

Promise<ActionResult<Application | { message: string; } | null>>

The execution result.

Overrides

BaseAction.doExecute


doUndo()

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

Defined in: actions/application/DeleteApplicationAction.ts:109

Subclass hook performing the inverse operation.

Parameters

context

ActionContext

Per-execution context.

previousState

DeleteApplicationUndoState

The state snapshot captured before execute.

Returns

Promise<ActionResult<Application | { message: string; } | null>>

The undo result.

Overrides

BaseAction.doUndo