Body, Mind & Soul — API Reference
    Preparing search index...

    Function prepareImportedActionData

    • Prepare an imported action object for creation on an actor.

      Handles ID regeneration (top-level and embedded effects), origin rewriting (self-referential and foreign), and schema validation.

      Parameters

      • raw: object

        Raw parsed object from JSON export (shape of item.toObject())

      Returns object

      { ok: true, data } on success; { ok: false, errors: [...] } on failure

      const parsed = JSON.parse(jsonString);
      const result = prepareImportedActionData(parsed);
      if (result.ok) {
      const item = await Item.create(result.data, { parent: actor });
      } else {
      console.error("Import failed:", result.errors);
      }