Open Policy Agent TypeScript Packages
    Preparing search index...

    Module @open-policy-agent/ucast-prisma

    @open-policy-agent/ucast-prisma

    License NPM Version

    This package contains helpers for using UCAST conditions with Prisma queries.

    This package can be used to add filtering to Prisma queries from UCAST conditions. The conditions returned by the EOPA Compile API look like this:

    {
    "conditions": {
    "or": [
    { "tickets.resolved": false },
    { "users.name": "ceasar" }
    ]
    }
    }

    A call to ucastToPrisma(conditions, "tickets") turns it into this Prisma query:

    {
    "OR": [
    {
    "resolved": {
    "equals": false
    }
    },
    {
    "users": {
    "name": {
    "equals": "ceasar"
    }
    }
    }
    ]
    }

    A similar translation for masking rules is provided through the mask helper: E.g. the mask rules returned from the Compile API,

    {
    "tickets.assignee": {
    "replace": {
    "value": "***"
    }
    },
    "users.name": {
    "replace": {
    "value": "<username>"
    }
    }
    }

    can be applied to a Prisma-returned object like

    {
    "id": 200,
    "assignee": "bob",
    "users": {
    "id": 10,
    "name": "bobby"
    }
    }

    via mask(maskRules, obj, "tickets"), masking the appropriate fields.

    For questions, discussions and announcements related to this project, please join Slack!

    Interfaces

    MaskRule

    Type Aliases

    Options

    Functions

    mask
    project
    ucastToPrisma