Releases: StyraInc/opa-typescript
@styra/[email protected]
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 invalue
:{ type: "compound", operator: "not", value: [ { type: "field", field: "price", operator: "lt", value: 10 } ] }
Furthermore,
startswith
,endswith
andcontains
are know known operators.
The first two are replaced withstartsWith
andendsWith
respectively, since
this is what prisma understands.
@styra/[email protected]
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/[email protected]
Patch Changes
- c31016a: support previously-expanded conditions input
@styra/[email protected]
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 usestickets0
andusers0
as table names andresolved0
andname0
as column names respectively.
@styra/[email protected]
Patch Changes
- f717e3e: handle 'or' correctly when including compound disjuncts
@styra/[email protected]
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]
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]
Patch Changes
- 0f2a82a: add minimal README and keywords
@styra/[email protected]
Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.396.10 (2.415.7) https://github.com/speakeasy-api/speakeasy
Generated
- [typescript v1.6.0] packages/opa
- NPM 1.6.0
@styra/[email protected]
Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.376.0 (2.402.5) https://github.com/speakeasy-api/speakeasy
Generated
- [typescript v1.5.0] packages/opa
- NPM 1.5.0