/** * What `bitmagic assets remove ` does to world.json, decided before anything is written. * * Removal is world.json only. The uploaded bytes stay in storage — that is what the Creator's * Remove and game-play-agent's `/api/remove-asset` do too (there is no delete endpoint on either * server, and every upload is immutable-cached), so a published game that still points at the file * keeps working. * * The one thing this does that the Creator's button does not: it looks for what still POINTS at * the asset first. world.json references an asset by id under a handful of keys — placed objects' * `assetId`, a level's `vwldAssetId`, a map's `mapAssetId`, doors, key items, towers — and a * removed asset that any of them still names is a load error the creator finds later, in the * browser, with nothing connecting it back to this command. So the scan is a generic walk for * those keys rather than a list of known containers: a container added to the schema tomorrow is * still caught. What it cannot see is game CODE (`engine.playSound(assetId)`), and the refusal * says so. * * `--force` removes the asset and every placed instance in `environmentObjects[]` in the same * atomic write, and reports the rest as warnings. */ import type { WorldJsonModification } from '@bitmagic/world-forger/pipeline/index.js'; import { type JsonObject } from '../project/world-json.js'; export interface AssetReference { /** JSON-pointer-ish path to the referencing value, e.g. `environmentObjects[3].assetId`. */ path: string; /** * True when this is a placed instance in root `environmentObjects[]` — the one kind of reference * `--force` can clean up by removing it alongside the asset. * * Recorded during the walk rather than recovered by re-parsing {@link path}: the path is a * human-readable rendering, and deriving structure back out of it silently returns "no placed * instances" the moment that rendering changes. */ placed: boolean; } export interface RemovalPlan { asset: JsonObject; modifications: WorldJsonModification[]; /** Placed instances in `environmentObjects[]` — removed with the asset under `--force`. */ placedInstances: number; /** References elsewhere in the document, which `--force` leaves in place and reports. */ otherReferences: AssetReference[]; } /** * Every place in the document where one of the reference keys holds `assetId`. The asset's own * `assets[]` entry is skipped — its `id` is not a reference key, but a vehicle asset's own * `vehicleFitment` might one day carry one, so the whole `assets[]` subtree is excluded outright. */ export declare function findAssetReferences(world: JsonObject, assetId: string): AssetReference[]; export declare function planAssetRemoval(world: JsonObject, assetId: string, force: boolean): RemovalPlan;