MoveBlobAction
@blobs/sdk / actions/blob / MoveBlobAction
Defined in: actions/blob/MoveBlobAction.ts:78
Action that moves a blob to a new parent or to the root level.
Forward path: calls BlobsService.update(id, { parent_id }) with the new
parent. The backend treats an empty string as NULL, so root moves use
'' over the wire. Undo path: writes the original parent reference back.
The captured MoveBlobUndoState stores the original parent id
(and optionally title for display).
Validation rejects moving a blob to itself; circular-reference detection (moving a parent into one of its descendants) is a TODO and currently delegated to the backend.
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 = createMoveBlobAction(payload);await actionManager.execute(action);await actionManager.undo();const action = createMoveBlobAction(payload);await action.execute({ blobsService: blobs.blobs });await action.undo({ blobsService: blobs.blobs });Extends
Constructors
Constructor
new MoveBlobAction(
payload):MoveBlobAction
Defined in: actions/blob/MoveBlobAction.ts:91
Parameters
payload
MoveBlobPayload describing the move.
Returns
MoveBlobAction
Overrides
Properties
id
readonlyid:string
Defined in: actions/BaseAction.ts:74
Unique action identifier; assigned at construction time.
Inherited from
payload
readonlypayload:MoveBlobPayload
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<MoveBlobUndoState>
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:move"='blob:move'
Defined in: actions/blob/MoveBlobAction.ts:79
Action type tag (e.g. 'blob:delete'); set by subclasses.
Overrides
Accessors
description
Get Signature
get description():
string
Defined in: actions/blob/MoveBlobAction.ts:82
Human-readable description used in undo/redo UI 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/MoveBlobAction.ts:101
Validates that a BlobsService is reachable and that the move does not target the blob itself.
Parameters
context
Per-execution context.
Returns
Promise<ActionResult<void>>
Overrides
captureState()
captureState(
context):Promise<MoveBlobUndoState>
Defined in: actions/blob/MoveBlobAction.ts:133
Loads the blob and records its current parent_id so undo can move
it back.
Parameters
context
Per-execution context.
Returns
Promise<MoveBlobUndoState>
The captured undo state.
Throws
When the blob cannot be loaded.
Overrides
doExecute()
protecteddoExecute(context):Promise<ActionResult<Blob>>
Defined in: actions/blob/MoveBlobAction.ts:158
Issues the move by updating the blob’s parent_id. Sends '' for a
null target (root) since the backend treats empty strings as NULL.
Parameters
context
Returns
Promise<ActionResult<Blob>>
Overrides
doUndo()
protecteddoUndo(context,previousState):Promise<ActionResult<Blob>>
Defined in: actions/blob/MoveBlobAction.ts:197
Restores the blob’s original parent reference.
Parameters
context
Per-execution context.
previousState
The pre-move snapshot.
Returns
Promise<ActionResult<Blob>>