Skip to content

v0.1.0

Latest

Choose a tag to compare

@pret-a-porter pret-a-porter released this 25 Sep 13:40
· 2 commits to main since this release
npm install --save-dev @pret-a-porter/bufaker

Initial release.

Added

  • mock(schema, options?) and mockList(schema, count, options?), generating
    a fully populated message from a protobuf-es DescMessage, with the return
    type inferred as MessageShape<Desc>.
  • Generation for every proto field kind: all 15 scalar types, enums, nested
    messages, repeated fields, maps, and oneof groups.
  • Well-known type handling for Timestamp, Duration, the *Value wrappers,
    Struct, Value, ListValue and Empty. Any and FieldMask are left
    unset — see the README for why.
  • A depth guard (maxDepth, default 3) that makes self-referential and
    mutually recursive schemas terminate.
  • An overrides system matching by field name, by path from the root, or by
    declaring message type, with the most specific key winning.
  • Built-in field-name heuristics (email, id, createdAt, and ~60 more),
    on by default and disabled with heuristics: false.
  • seed for reproducible output, including a pinned reference date so that
    generated timestamps do not vary with the wall clock.
  • refDate, setting the point that generated dates are drawn relative to.

Published with npm provenance from this tag.