Metreeca Keep
    Preparing search index...
    • Mints a fresh, isolated clone of a sample resource.

      Derives the resource identity from shape: the kind: "id" property names the identifier entry and the trailing {code} slot of the id pattern names the code entry. The code is regenerated by replacing each character with a random counterpart of the same class (digit, upper-case or lower-case letter), the identifier's trailing segment is swapped to match, the audit timestamps are reset, and the result is validated against shape.

      Lets conformance tests mint isolated fixtures whose identifiers collide neither with the sample dataset nor with other generated fixtures sharing the same store.

      Type Parameters

      • T extends Template

        The shape's template model

      Parameters

      • sample: Instance<T>

        The resource to clone; an instance of shape

      • shape: Lazy<ResourceShape & { model: T }>

        The resource shape whose id entry and id pattern drive identity derivation

      Returns Instance<T>

      The validated clone, carrying a freshly generated code, a matching identifier, and reset audit timestamps

      Error When shape declares no id entry or id pattern, the id pattern has no trailing slot, or sample is missing its identifier or code value