Skip to main content

Interface: ModularBatchTransaction

Transaction handed to the modularBatch callback. Steps run one after another in call order, also when they are not awaited. Any step rejection makes the whole batch roll back.

Methods​

addToSnap()​

addToSnap(hostInstanceId, snapIdTo, productId): Promise<string>

Adds a product to a snap of the host instance. Resolves with the new instance id.

Parameters​

hostInstanceId​

string

snapIdTo​

string

productId​

string

Returns​

Promise<string>


insertAtSnap()​

insertAtSnap(hostInstanceId, snapIdTo, productId): Promise<string>

Inserts a product between the host and its neighbour at an occupied snap, then resolves with the new instance id. Use addToSnap for free snaps. Refuses a missing host, unavailable product, product at its quantity limit, incompatible snap pair, or non-parent product at a parent/child joint.

Parameters​

hostInstanceId​

string

snapIdTo​

string

productId​

string

Returns​

Promise<string>


remove()​

remove(instanceIds): Promise<void>

Removes the instances. Ids already gone (for example removed earlier in this batch) are skipped.

Parameters​

instanceIds​

string[]

Returns​

Promise<void>


replace()​

replace(instanceId, productId): Promise<string>

Replaces the instance and resolves with the new instance id. Refuses missing instances, products that disallow replacement, and instances automatically inserted by scene rules.

Parameters​

instanceId​

string

productId​

string

Returns​

Promise<string>


setOptions()​

setOptions(instanceIds, change): Promise<void>

Applies an option change to the instances. Refuses the whole step if any target instance is missing or lacks the option block. Writes no history of its own.

Parameters​

instanceIds​

string[]

change​

ModularOptionChange

Returns​

Promise<void>