Modules
Each module of rego4k is a Maven artifact in the group dev.rego4k, and the BOM rego4k-bom gives each module the
same version.
The BOM
rego4k-bom
rego4k-bom is a Maven BOM (a bill of materials). It names the same version for each module in modules.
Import it, and then declare the rego4k modules without a version.
- Maven:
dev.rego4k:rego4k-bom - Depends on: no module. It is a platform that names the version of each other module.
- README: modules/bom/README.md
- Needs: no module at run time. It only sets versions. Leave out: each module that you do not declare.
- Used in: Publishing
Core
rego4k-core
rego4k-core is the Rego engine. It parses, compiles and evaluates Rego (v1 syntax) in the JVM. It has no
builtins of its own.
- Maven:
dev.rego4k:rego4k-core - Depends on:
dev.forkhandles:parser4k. - README: modules/core/README.md
- Needs: only parser4k. Leave out: all the builtins modules. Then an engine has only the builtins that you give
it, and
Builtins.NONEis empty. - Used in: Rego and its parts, Use rego4k in an existing application
rego4k-http4k-json
rego4k-http4k-json converts between the nodes of an http4k Json and the Values of rego4k-core. It works
with each JSON library that http4k supports, for example Moshi, Kondor, Gson and Jackson.
- Maven:
dev.rego4k:rego4k-http4k-json - Depends on:
rego4k-core,org.http4k:http4k-format-core. - README: modules/http4k-json/README.md
- Needs:
rego4k-coreand a JSON library of http4k that you add. Leave out: the builtins modules. - Used in: From JSON, Convert the input
rego4k-formatter
rego4k-formatter formats Rego v1 modules. Its output is the output of opa fmt of OPA 1.23.0, byte for byte.
It is a port of OPA's v1/format/format.go.
- Maven:
dev.rego4k:rego4k-formatter - Depends on:
rego4k-core. - README: modules/formatter/README.md
- Needs:
rego4k-core. Leave out: the builtins modules and anopabinary.
Builtins
rego4k-builtins-stdlib
rego4k-builtins-stdlib holds all the builtins of OPA's library that rego4k has, in one value:
Builtins.stdlib(regex). It is the sum of the pure, provided, impure and yaml.* builtins. The builtins that compile
a regex use the regex engine regex.
- Maven:
dev.rego4k:rego4k-builtins-stdlib - Depends on:
rego4k-builtins-stdlib-pure,rego4k-builtins-stdlib-provided,rego4k-builtins-stdlib-impure,rego4k-builtins-yaml. - README: modules/builtins/stdlib/README.md
- Needs: each module of the four sets. Leave out: this module if you need only some sets. Then depend on the modules of those sets.
- Used in: The sets of OPA's library
rego4k-builtins-stdlib-pure
rego4k-builtins-stdlib-pure holds the pure builtins of OPA's standard library: Builtins.Pure.stdlib(regex). A
pure builtin depends only on its arguments. Rego.standard(regex) gives an engine with these builtins.
- Maven:
dev.rego4k:rego4k-builtins-stdlib-pure - Depends on:
rego4k-core. - README: modules/builtins/stdlib-pure/README.md
- Needs:
rego4k-core. Leave out: the provided, impure, YAML and RE2 builtins. Without RE2, giveJavaRegexEngineas the regex engine. - Used in: The sets of OPA's library, Make an engine, Add the dependencies
rego4k-builtins-stdlib-provided
rego4k-builtins-stdlib-provided holds the provided builtins of OPA's standard library:
Builtins.Provided.stdlib. A provided builtin reads a value that the runtime provides, for example the time of the query. The query records each
value that it reads.
- Maven:
dev.rego4k:rego4k-builtins-stdlib-provided - Depends on:
rego4k-builtins-stdlib-pure. - README: modules/builtins/stdlib-provided/README.md
- Needs:
rego4k-builtins-stdlib-pure. Leave out:rego4k-builtins-stdlib-impure. - Used in: The sets of OPA's library, Add the dependencies
rego4k-builtins-stdlib-impure
rego4k-builtins-stdlib-impure holds the impure builtins of OPA's standard library: Builtins.Impure.stdlib. An
impure builtin depends on the network or on randomness, for example http.send and rand.intn.
- Maven:
dev.rego4k:rego4k-builtins-stdlib-impure - Depends on:
rego4k-builtins-stdlib-pure. - README: modules/builtins/stdlib-impure/README.md
- Needs:
rego4k-builtins-stdlib-pure. Leave out:rego4k-builtins-stdlib-provided. - Used in: The sets of OPA's library, Add the dependencies
rego4k-builtins-yaml
rego4k-builtins-yaml holds OPA's yaml.* builtins: yaml.unmarshal, yaml.marshal and yaml.is_valid. The
parser uses yaml.unmarshal to read # METADATA blocks.
- Maven:
dev.rego4k:rego4k-builtins-yaml - Depends on:
rego4k-core,org.snakeyaml:snakeyaml-engine. - README: modules/builtins/yaml/README.md
- Needs:
rego4k-coreand snakeyaml-engine. Leave out: this module if your modules have no# METADATAblock and your bundles have no YAML data file. Without it, a# METADATAblock is a parse error. - Used in: The sets of OPA's library, YAML is optional, Add the dependencies
rego4k-builtins-re2
rego4k-builtins-re2 holds Re2Engine, the RE2 regex engine, for Builtins.Pure.stdlib(Re2Engine). With it, the
builtins that compile a regex have the regex syntax, the regex semantics and the linear running time of OPA.
- Maven:
dev.rego4k:rego4k-builtins-re2 - Depends on:
rego4k-builtins-stdlib-pure,com.google.re2j:re2j. - README: modules/builtins/re2/README.md
- Needs:
rego4k-builtins-stdlib-pureand re2j. Leave out: this module ifJavaRegexEngineis sufficient for your policies. - Used in: The sets of OPA's library
rego4k-builtins-http4k-send
rego4k-builtins-http4k-send has an http.send builtin that sends each request to an http4k HttpHandler:
Builtins.httpSend(handler). In a test, an in-memory handler lets a policy call http.send with no network.
- Maven:
dev.rego4k:rego4k-builtins-http4k-send - Depends on:
rego4k-core,rego4k-builtins-stdlib-pure,org.http4k:http4k-core. - README: modules/builtins/http4k-send/README.md
- Needs:
rego4k-builtins-stdlib-pureand http4k-core. Leave out:rego4k-builtins-stdlib-impure, ifhttp.sendis the only impure builtin that your policies call. - Used in:
http.sendon an http4k handler,http.sendin a test
Bundles
rego4k-bundles-core
rego4k-bundles-core reads and writes OPA bundles. A bundle holds the policy and the data of one deployment. The
module also does tree shaking (Bundle.shake) and its dry run (Bundle.shakeDryRun).
- Maven:
dev.rego4k:rego4k-bundles-core - Depends on:
rego4k-core. - README: modules/bundles/core/README.md
- Needs:
rego4k-core. Leave out: the builtins modules. Adata.yamlfile needsrego4k-builtins-yaml. - Used in: Bundles, Compile the policy one time
rego4k-bundles-signing
rego4k-bundles-signing verifies and signs OPA bundles, with the same format and the same options as OPA. OPA can
verify a bundle that it signs.
- Maven:
dev.rego4k:rego4k-bundles-signing - Depends on:
rego4k-bundles-core,rego4k-signing-utils. - README: modules/bundles/signing/README.md
- Needs:
rego4k-bundles-coreandrego4k-signing-utils. Leave out: the decision signing modules and anopabinary. - Used in: Signed bundles
Signing
rego4k-signing-utils
rego4k-signing-utils holds the cryptography that bundle signing and decision signing share: the signature
algorithms, the JWS, the PEM keys and the canonical JSON form. Thus both can use the same keys.
- Maven:
dev.rego4k:rego4k-signing-utils - Depends on:
rego4k-core. - README: modules/signing/utils/README.md
- Needs:
rego4k-core. Leave out: the bundles modules and the builtins modules. - Used in: What a signed decision holds
rego4k-signing-verifier
rego4k-signing-verifier is for a system that receives signed decisions. It verifies the signature of a signed
decision and gives the Decision. It does not evaluate Rego.
- Maven:
dev.rego4k:rego4k-signing-verifier - Depends on:
rego4k-signing-utils. - README: modules/signing/verifier/README.md
- Needs:
rego4k-signing-utils. Leave out:rego4k-bundles-core,rego4k-signing-signerand the builtins modules. - Used in: Verify and reproduce a decision, Signed decisions
rego4k-signing-signer
rego4k-signing-signer signs the output of a query. A reader can then prove which policy gave which output for
which input, and when. Decision.reproduce evaluates the query again and compares the output.
- Maven:
dev.rego4k:rego4k-signing-signer - Depends on:
rego4k-signing-verifier,rego4k-bundles-core. - README: modules/signing/signer/README.md
- Needs:
rego4k-signing-verifier,rego4k-bundles-core, and the builtins that your policy calls. Leave out: the server modules. - Used in: Sign a decision, Sign an input, Signed decisions
OPA
rego4k-opa-core
rego4k-opa-core declares the capabilities of OPA as interfaces, for example Evaluation and Checking, and the
sets of capabilities Toolchain and Opa. It has no engine.
- Maven:
dev.rego4k:rego4k-opa-core - Depends on:
rego4k-bundles-core. - README: modules/opa/core/README.md
- Needs:
rego4k-bundles-core. Leave out: the implementations that you do not use:rego4k-opa-embedded,rego4k-opa-command-lineandrego4k-opa-server. - Used in: The capabilities of OPA as interfaces
rego4k-opa-embedded
rego4k-opa-embedded gives the Toolchain with rego4k in the process: Toolchain.embedded(rego). It has the
capabilities that rego4k shares with OPA, and it needs no OPA.
- Maven:
dev.rego4k:rego4k-opa-embedded - Depends on:
rego4k-opa-core,rego4k-formatter. - README: modules/opa/embedded/README.md
- Needs:
rego4k-opa-coreandrego4k-formatter. Leave out: anopabinary and the other implementations ofrego4k-opa-core. - Used in: The capabilities of OPA as interfaces
rego4k-opa-command-line
rego4k-opa-command-line gives the Opa that runs the opa binary: Opa.cli(). It has all the capabilities of
rego4k-opa-core. Each call runs one opa command in a temporary directory.
- Maven:
dev.rego4k:rego4k-opa-command-line - Depends on:
rego4k-opa-core. - README: modules/opa/command-line/README.md
- Needs:
rego4k-opa-coreand anopabinary. Leave out: the other implementations ofrego4k-opa-core. - Used in: The capabilities of OPA as interfaces
rego4k-opa-server
rego4k-opa-server gives OpaServer: the capabilities of OPA's REST API, through an http4k HttpHandler. It works
with opa run --server, and with the OPA-compatible API of the decision server of rego4k.
- Maven:
dev.rego4k:rego4k-opa-server - Depends on:
rego4k-opa-core,org.http4k:http4k-core. - README: modules/opa/server/README.md
- Needs:
rego4k-opa-core, http4k-core, and anHttpHandlerof a server with OPA's API. Leave out: the other implementations ofrego4k-opa-core. - Used in: The capabilities of OPA as interfaces
Testing
rego4k-testing-core
rego4k-testing-core runs the Rego tests of policies, as opa test does. It gives the outcome of each test, and
the text of opa test.
- Maven:
dev.rego4k:rego4k-testing-core - Depends on:
rego4k-bundles-core. - README: modules/testing/core/README.md
- Needs:
rego4k-bundles-core, and the builtins that your policies call. Leave out:rego4k-testing-junitand anopabinary. - Used in: Run the tests, Test your Rego with JUnit
rego4k-testing-junit
rego4k-testing-junit gives the Rego tests of policies to JUnit 5 as dynamic tests. Gradle, Maven and an IDE then
show each Rego test with the tests of the application.
- Maven:
dev.rego4k:rego4k-testing-junit - Depends on:
rego4k-testing-core,org.junit.jupiter:junit-jupiter-api. - README: modules/testing/junit/README.md
- Needs:
rego4k-testing-core, JUnit 5, and the builtins that your policies call. Leave out: anopabinary. - Used in: In JUnit, Test your Rego with JUnit
Server
rego4k-server-core
rego4k-server-core is the base of the decision server. DecisionServer is an http4k HttpHandler that puts the
routes of its modules in one contract. The module also holds the hosted bundles and the plumbing of OPA's REST API.
- Maven:
dev.rego4k:rego4k-server-core - Depends on:
rego4k-core,rego4k-signing-verifier,rego4k-bundles-core,org.http4k:http4k-core,org.http4k:http4k-api-openapi,org.http4k:http4k-format-kondor-json. - README: modules/server/core/README.md
- Needs:
rego4k-core,rego4k-bundles-core,rego4k-signing-verifier, http4k, and the builtins that your policies call. Leave out: each other server module. - Used in: The decision server, Build a custom decision server
rego4k-server-policies
rego4k-server-policies holds the module OpaApi: OPA's REST API for the bundles that a decision server hosts.
- Maven:
dev.rego4k:rego4k-server-policies - Depends on:
rego4k-server-core,org.http4k:http4k-format-kondor-json. - README: modules/server/policies/README.md
- Needs:
rego4k-server-core. Leave out: the other server modules. - Used in: The modules, Start a server with OPA's API
rego4k-server-signing
rego4k-server-signing adds signed decisions to the decision server. Another system then verifies a signed
decision with only the certificate of an authority that it trusts.
- Maven:
dev.rego4k:rego4k-server-signing - Depends on:
rego4k-server-core,rego4k-signing-signer. - README: modules/server/signing/README.md
- Needs:
rego4k-server-coreandrego4k-signing-signer. Leave out: the other server modules. - Used in: The modules, Signed decisions on the server
rego4k-server-debugger
rego4k-server-debugger is a debugger for Rego policies in the browser. It steps through the evaluation, and shows
the bindings of the vars and the part of the input that each step reads. It is a library, and also an application.
- Maven:
dev.rego4k:rego4k-server-debugger - Depends on:
rego4k-core,rego4k-server-core,org.http4k:http4k-core,org.jetbrains.kotlinx:kotlinx-html-jvm,org.http4k:http4k-web-datastar,org.http4k:http4k-api-openapi,org.http4k:http4k-format-kondor-json,org.commonmark:commonmark,rego4k-builtins-stdlib,rego4k-builtins-re2,rego4k-testing-core,rego4k-formatter. - README: modules/server/debugger/README.md
- Needs:
rego4k-server-coreand the four builtins modules of OPA's library, even when the debugger runs alone. Leave out: the other server modules. - Used in: The debugger, The debugger and the demo
rego4k-server-shaking
rego4k-server-shaking shows what tree shaking does to a bundle of the decision server, before anybody deploys the
shaken bundle. It gives the dry run as JSON, and as a page in the browser.
- Maven:
dev.rego4k:rego4k-server-shaking - Depends on:
rego4k-server-core,rego4k-server-debugger,org.http4k:http4k-web-datastar,org.http4k:http4k-format-kondor-json. - README: modules/server/shaking/README.md
- Needs:
rego4k-server-coreandrego4k-server-debugger. Leave out: the other server modules. - Used in: The modules
rego4k-server-docs
rego4k-server-docs serves an HTML page with the OpenAPI descriptions of the decision server. It is a separate
module because it renders HTML with kotlinx.html.
- Maven:
dev.rego4k:rego4k-server-docs - Depends on:
rego4k-server-core,org.jetbrains.kotlinx:kotlinx-html-jvm. - README: modules/server/docs/README.md
- Needs:
rego4k-server-core. Leave out: the other server modules. - Used in: The modules
rego4k-server-lsp
rego4k-server-lsp is a language server for Rego v1 files. Each editor with a client for the Language Server
Protocol (LSP) can use it. The editor shows the errors of OPA and the format of opa fmt without an opa binary.
- Maven:
dev.rego4k:rego4k-server-lsp - Depends on:
rego4k-core,org.eclipse.lsp4j:org.eclipse.lsp4j,rego4k-formatter,rego4k-builtins-stdlib,rego4k-builtins-re2. - README: modules/server/lsp/README.md
- Needs:
rego4k-core,rego4k-formatterand the four builtins modules of OPA's library. Leave out: all the decision server modules and anopabinary. - Used in: The AST in Kotlin
Command line
rego4k-cli-core
rego4k-cli-core is the base of the command line. Each module in modules/cli gives its commands as Commands,
and Cli runs the command that a command line names. Its flags read a command line as OPA's library pflag does.
- Maven:
dev.rego4k:rego4k-cli-core - Depends on: no other module or library.
- README: modules/cli/core/README.md
- Needs: no other module. Leave out: all the other modules.
- Used in: Your own command line
rego4k-cli-opa
rego4k-cli-opa is the command line of opa, with rego4k in place of OPA. Its commands are eval, check,
fmt, parse, test and build, with OPA's flags, output and exit codes.
- Maven:
dev.rego4k:rego4k-cli-opa - Depends on:
rego4k-cli-core,rego4k-opa-embedded,rego4k-testing-core,org.bitbucket.cowwoc:diff-match-patch. - README: modules/cli/opa/README.md
- Needs:
rego4k-cli-core,rego4k-opa-embedded,rego4k-testing-core, and the builtins that you give to its engine. Leave out: anopabinary and the other command line modules. - Used in: The command line
rego4k-cli-decision-signing
rego4k-cli-decision-signing is the command line of signed decisions. Its commands are sign-decision,
verify-decision, reproduce-decision and sign-input.
- Maven:
dev.rego4k:rego4k-cli-decision-signing - Depends on:
rego4k-cli-core,rego4k-signing-signer. - README: modules/cli/decision-signing/README.md
- Needs:
rego4k-cli-core,rego4k-signing-signer, and the builtins that your policies call. Leave out: the other command line modules. - Used in: The command line
rego4k-cli-shaking
rego4k-cli-shaking is the command line of tree shaking: the command shake. With --wasm, it gives the shaken
bundle to opa build -t wasm.
- Maven:
dev.rego4k:rego4k-cli-shaking - Depends on:
rego4k-cli-core,rego4k-bundles-core,rego4k-opa-command-line. - README: modules/cli/shaking/README.md
- Needs:
rego4k-cli-coreandrego4k-bundles-core, and anopabinary only for--wasm. Leave out: the other command line modules. - Used in: The command line
rego4k-cli-server
rego4k-cli-server is the command line of the decision server: the command run --server. A script that starts
opa run --server can start rego4k run --server with the same flags and the same paths.
- Maven:
dev.rego4k:rego4k-cli-server - Depends on:
rego4k-cli-core,rego4k-server-core,rego4k-server-policies,rego4k-server-signing,rego4k-server-debugger,rego4k-server-shaking,rego4k-server-docs,rego4k-cli-opa,rego4k-cli-decision-signing. - README: modules/cli/server/README.md
- Needs: all the server modules,
rego4k-cli-opa,rego4k-cli-decision-signing, and the builtins that your policies call. Leave out:rego4k-cli-shaking. - Used in: On the command line, The command line
rego4k-cli-full
rego4k-cli-full is the command rego4k: the commands of each module in modules/cli, with OPA's builtins. The
build writes it as one runnable jar, rego4k.jar, and a start script.
- Maven:
dev.rego4k:rego4k-cli-full - Depends on:
rego4k-cli-opa,rego4k-cli-decision-signing,rego4k-cli-shaking,rego4k-cli-server,rego4k-builtins-stdlib,rego4k-builtins-re2. - README: modules/cli/full/README.md
- Needs: Java 21 or later. The jar holds all its dependencies. Leave out: an
opabinary, except forshake --wasm. - Used in: Run it