Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

convex-ents

xixixao1.6kApache-2.00.15.0TypeScript support: included

Relations, default values, unique fields, RLS for Convex

relations, orm, edges, schema, convex

readme

NPM Version

Convex Ents

Ents is in maintenance mode. We're open to taking PRs, and will make sure it doesn't break. There will not be active feature development from the Convex team.

Convex Ents are an ergonomic layer on top of the Convex built-in ctx.db API for reading from and writing to the database. They simplify working with relationships between documents, allow specifying unique fields, default values and rules (row level security).

Check out the docs: https://labs.convex.dev/convex-ents

changelog

0.13.0

Breaking schema change:

  • The syntax for 1:1 edge declaration has been aligned with 1:many edges. Before:

    defineEntSchema({
      users: defineEnt({
        name: v.string(),
      }).edges("messages", { optional: true }),
      messages: defineEnt({
        text: v.string(),
      }).edge("user"),
    });

    Now:

    defineEntSchema({
      users: defineEnt({
        name: v.string(),
      }).edges("messages", { ref: true }),
      messages: defineEnt({
        text: v.string(),
      }).edge("user"),
    });

    The optional flag is now reserved for the direction which stores the field:

    defineEntSchema({
      users: defineEnt({
        name: v.string(),
      }).edges("messages", { ref: true }),
      messages: defineEnt({
        text: v.string(),
      }).edge("user", { field: "userId", optional: true }),
    });

    In this case field is required to avoid ambiguity with the previous syntax, but this constraint might be removed in the future.

  • Added support for edges to _storage and _scheduled_functions