Skip to content

Releases: StyraInc/opa-typescript

@styra/ucast-prisma@0.0.9

21 Jan 11:31
Compare
Choose a tag to compare

Patch Changes

  • e05edba: ucast-prisma: support NOT and {starts,ends}with, contains

    The helpers now support NOT, encoded as a compound condition with a single
    child condition in an array in value:

    {
      type: "compound",
      operator: "not",
      value: [
        {
          type: "field",
          field: "price",
          operator: "lt",
          value: 10
        }
      ]
    }

    Furthermore, startswith, endswith and contains are know known operators.
    The first two are replaced with startsWith and endsWith respectively, since
    this is what prisma understands.

@styra/ucast-prisma@0.0.8

21 Jan 09:19
Compare
Choose a tag to compare

Patch Changes

  • 8a6007d: ucast-prisma: switch to non-concise AND encoding of conjuncts

    This isn't as concise as before, but it's free of edge cases.
    Also, as far as I can tell from the Prisma docs, it doesn't
    matter if multiple conditions are wrapped in AND or not.

@styra/ucast-prisma@0.0.7

04 Dec 13:58
Compare
Choose a tag to compare

Patch Changes

  • c31016a: support previously-expanded conditions input

@styra/ucast-prisma@0.0.6

07 Nov 10:03
f5f1b6c
Compare
Choose a tag to compare

Patch Changes

  • 5c7cb33: support translating table and column names via extra options

    An extra options object can be passed to ucastToPrisma to translate table and column names.
    This is useful when the Prisma schema uses different names than the OPA policy used to generate
    the conditions.

    const p = ucastToPrisma(
      { or: [{ "tickets.resolved": false }, { "users.name": "ceasar" }] },
      "tickets0",
      {
        translations: {
          tickets: { $self: "tickets0", resolved: "resolved0" },
          users: { $self: "users0", name: "name0" },
        },
      }
    );

    In this example, the conditions { or: [{ "tickets.resolved": false }, { "users.name": "ceasar" }] }
    will be rewritten to { OR: [{ tickets0: { resolved0: false } }, { users0: { name0: "ceasar" } }] },
    assuming that the Prisma schema uses tickets0 and users0 as table names and resolved0 and name0
    as column names respectively.

@styra/ucast-prisma@0.0.5

01 Nov 11:21
Compare
Choose a tag to compare

Patch Changes

  • f717e3e: handle 'or' correctly when including compound disjuncts

@styra/ucast-prisma@0.0.4

01 Nov 09:31
Compare
Choose a tag to compare

Patch Changes

  • 3920db7: Introduce laxer handling of empty compound conditions

    This aligns better with common Rego patterns, like using multi-value
    rules for generating conditions:

    conditions.or contains {"tickets.resolved": false} if { ... }

    If the RHS is not satisfied, the conditions would yield

    {
      "conditions": {
        "or": []
      }
    }

    and with this change, this will be valid. The condition itself is
    going to be dropped.

@styra/ucast-prisma@0.0.3

31 Oct 09:54
Compare
Choose a tag to compare

Patch Changes

  • 73b18d1: ucastToPrisma takes primary table to project conditions

    Previously, the conversion logic for OR conditions was faulty.
    It's not possible to properly translate OR conditions to Prisma
    query filters without knowing the primary table of the query.

    That table is now passed as an argument to ucastToPrisma.

@styra/ucast-prisma@0.0.2

28 Oct 14:26
Compare
Choose a tag to compare

Patch Changes

  • 0f2a82a: add minimal README and keywords

@styra/opa@1.6.0

16 Sep 20:11
5b851b5
Compare
Choose a tag to compare

Changes

Based on:

Generated

@styra/opa@1.5.0

20 Aug 08:03
9604a4c
Compare
Choose a tag to compare

Changes

Based on:

Generated