Delete the draft a given user holds at a path, or, without username, every draft at that path (the legacy ownerless one and the caller’s own included). Workspace admins / superadmins only, and only for script, flow, app and raw_app drafts. Unlike a discard of one’s own draft through drafts/update, this returns 404 when nothing was deleted.
Relocates the authed user’s own draft row, along with both path keys inside its value (the typed path and the mirror the editors keep beside it). Only for draft-only items — a deployed item must be moved through its own deploy endpoint, which carries every draft with it. Restricted to script, flow, app and raw_app; any other kind is rejected with 400, because only these keep their deploy target where this endpoint rewrites it.
In one transaction, copies the authed user’s own drafts of items into target_workspace (another workspace of this one’s family, with the same root through parent_workspace_id) and, with remove_from_source, deletes them here. Without target_workspace it only removes. If the user already has a draft of any item in the target, nothing is written and the items are returned in conflicts, unless replace_existing is set. A user who can only compose flows or apps in the target is held to the same rules as a direct draft save there.