Skip to content

Releases: StyraInc/opa-typescript

@styra/[email protected]

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/[email protected]

01 Nov 11:21
Compare
Choose a tag to compare

Patch Changes

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

@styra/[email protected]

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/[email protected]

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/[email protected]

28 Oct 14:26
Compare
Choose a tag to compare

Patch Changes

  • 0f2a82a: add minimal README and keywords

@styra/[email protected]

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

Changes

Based on:

Generated

@styra/[email protected]

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

Changes

Based on:

Generated

@styra/[email protected]

20 Aug 11:44
Compare
Choose a tag to compare

Minor Changes

  • 410b448: update @styra/opa to v1.5.0

@styra/[email protected]

15 Aug 12:02
1547f18
Compare
Choose a tag to compare

Changes

Based on:

Generated

@styra/[email protected]

12 Aug 08:35
Compare
Choose a tag to compare

Changes

Based on:

Generated

  • [typescript v1.4.0] packages/opa
  • NPM 1.4.0"