RemoveChildAction
@blobs/sdk / actions/blob / RemoveChildAction
Defined in: actions/blob/RemoveChildAction.ts:43
Removes a child blob from its parent (sets parent_id to null).
Undo restores the original parent_id.
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 = createRemoveChildAction(payload);await actionManager.execute(action);await actionManager.undo();const action = createRemoveChildAction(payload);await action.execute({ blobsService: blobs.blobs });await action.undo({ blobsService: blobs.blobs });Extends
BaseAction<RemoveChildPayload,Blob,RemoveChildUndoState>
Constructors
Constructor
new RemoveChildAction(
payload):RemoveChildAction
Defined in: actions/blob/RemoveChildAction.ts:56
Parameters
payload
RemoveChildPayload
Returns
RemoveChildAction
Overrides
Properties
id
readonlyid:string
Defined in: actions/BaseAction.ts:74
Unique action identifier; assigned at construction time.
Inherited from
payload
readonlypayload:RemoveChildPayload
Defined in: actions/BaseAction.ts:80
The original payload the action was constructed with.
Inherited from
createdAt
readonlycreatedAt:number
Defined in: actions/BaseAction.ts:82
Wall-clock timestamp (ms) when the action was instantiated.
Inherited from
canUndo
readonlycanUndo:boolean
Defined in: actions/BaseAction.ts:84
Whether BaseAction.undo is allowed for this action.
Inherited from
canRedo
readonlycanRedo:boolean
Defined in: actions/BaseAction.ts:86
Whether BaseAction.redo is allowed after undo.
Inherited from
status
status:
ActionStatus='pending'
Defined in: actions/BaseAction.ts:89
Current lifecycle status; mutated by execute/undo/redo.
Inherited from
executedAt?
optionalexecutedAt?:number
Defined in: actions/BaseAction.ts:91
Wall-clock timestamp (ms) when execute most recently completed.
Inherited from
previousState?
optionalpreviousState?:ActionState<RemoveChildUndoState>
Defined in: actions/BaseAction.ts:93
Captured pre-execution state used by undo.
Inherited from
result?
optionalresult?:ActionResult<Blob>
Defined in: actions/BaseAction.ts:95
Last result produced by execute/undo/redo.
Inherited from
type
readonlytype:"blob:remove-child"='blob:remove-child'
Defined in: actions/blob/RemoveChildAction.ts:48
Action type tag (e.g. 'blob:delete'); set by subclasses.
Overrides
Accessors
description
Get Signature
get description():
string
Defined in: actions/blob/RemoveChildAction.ts:50
Human-readable description used in UI history listings.
Returns
string
Human-readable description used in UI history listings.
Overrides
Methods
execute()
execute(
context):Promise<ActionResult<Blob>>
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
Per-execution context.
Returns
Promise<ActionResult<Blob>>
The execution result.
Inherited from
undo()
undo(
context):Promise<ActionResult<Blob>>
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
Per-execution context.
Returns
Promise<ActionResult<Blob>>
The undo result.
Inherited from
redo()
redo(
context):Promise<ActionResult<Blob>>
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
Per-execution context.
Returns
Promise<ActionResult<Blob>>
The redo result.
Inherited from
doRedo()
protecteddoRedo(context):Promise<ActionResult<Blob>>
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
Per-execution context.
Returns
Promise<ActionResult<Blob>>
The redo result.
Inherited from
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
validate()
validate(
context):Promise<ActionResult<void>>
Defined in: actions/blob/RemoveChildAction.ts:60
Default validation hook — always passes. Subclasses override to add pre-execute checks (e.g. required services, payload sanity).
Parameters
context
Returns
Promise<ActionResult<void>>
A success result.
Overrides
captureState()
captureState(
context):Promise<RemoveChildUndoState>
Defined in: actions/blob/RemoveChildAction.ts:70
Captures the state needed to reverse this action. Subclasses must
implement this when canUndo is true.
Parameters
context
Per-execution context.
Returns
Promise<RemoveChildUndoState>
The undo-state snapshot.
Overrides
doExecute()
protecteddoExecute(context):Promise<ActionResult<Blob>>
Defined in: actions/blob/RemoveChildAction.ts:84
Subclass hook performing the forward operation.
Parameters
context
Per-execution context.
Returns
Promise<ActionResult<Blob>>
The execution result.
Overrides
doUndo()
protecteddoUndo(context,previousState):Promise<ActionResult<Blob>>
Defined in: actions/blob/RemoveChildAction.ts:96
Subclass hook performing the inverse operation.
Parameters
context
Per-execution context.
previousState
RemoveChildUndoState
The state snapshot captured before execute.
Returns
Promise<ActionResult<Blob>>
The undo result.