github-actions
released this
07 Nov 10:03
·
9 commits
to main
since this release
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.