pub fn add_part_to_library(
name: &str,
source_key: &str,
source_signature: &str,
document_json: &str,
) -> Result<String, JsValue>Expand description
INSERT: hand the opened sub-part document over to the library. Executes the
document once, snapshots, stores the entry, and returns the EFFECTIVE part
name (the ACOMP partName the app must reference):
- a live entry with the same
sourceKeyANDsourceSignatureis reused verbatim (no re-execution — instant re-insert, spec §2.1); - same
sourceKeybut a DIFFERENT signature gets a fresh entry under a disambiguated name (existing instances keep their version; the explicit refresh lane isrefresh_library_entry); - a requested name taken by different content is disambiguated (
name-2).
The wasm export. A NATIVE caller must call add_part_to_library_impl:
building a JsValue off wasm32 panics inside a frame that cannot unwind,
so an error returned through this door aborts the whole app (the audit’s
Insert component crash).