diff --git a/go.mod b/go.mod index 3a93cf3e83..47abd44429 100644 --- a/go.mod +++ b/go.mod @@ -62,7 +62,7 @@ require ( github.com/onsi/ginkgo v1.16.5 github.com/onsi/ginkgo/v2 v2.27.2 github.com/onsi/gomega v1.38.2 - github.com/open-policy-agent/opa v1.9.0 + github.com/open-policy-agent/opa v1.10.1 github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89 github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76 github.com/opencloud-eu/reva/v2 v2.39.2-0.20251106122902-c13e27f55362 diff --git a/go.sum b/go.sum index 0158c36e87..dbe12078de 100644 --- a/go.sum +++ b/go.sum @@ -198,8 +198,8 @@ github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/ github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c= github.com/butonic/go-micro/v4 v4.11.1-0.20241115112658-b5d4de5ed9b3 h1:h8Z0hBv5tg/uZMKu8V47+DKWYVQg0lYP8lXDQq7uRpE= github.com/butonic/go-micro/v4 v4.11.1-0.20241115112658-b5d4de5ed9b3/go.mod h1:eE/tD53n3KbVrzrWxKLxdkGw45Fg1qaNLWjpJMvIUF4= -github.com/bytecodealliance/wasmtime-go/v3 v3.0.2 h1:3uZCA/BLTIu+DqCfguByNMJa2HVHpXvjfy0Dy7g6fuA= -github.com/bytecodealliance/wasmtime-go/v3 v3.0.2/go.mod h1:RnUjnIXxEJcL6BgCvNyzCCRzZcxCgsZCi+RNlvYor5Q= +github.com/bytecodealliance/wasmtime-go/v37 v37.0.0 h1:DPjdn2V3JhXHMoZ2ymRqGK+y1bDyr9wgpyYCvhjMky8= +github.com/bytecodealliance/wasmtime-go/v37 v37.0.0/go.mod h1:Pf1l2JCTUFMnOqDIwkjzx1qfVJ09xbaXETKgRVE4jZ0= github.com/c-bata/go-prompt v0.2.5/go.mod h1:vFnjEGDIIA/Lib7giyE4E9c50Lvl8j0S+7FVlAwDAVw= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= @@ -942,8 +942,8 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A= github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k= -github.com/open-policy-agent/opa v1.9.0 h1:QWFNwbcc29IRy0xwD3hRrMc/RtSersLY1Z6TaID3vgI= -github.com/open-policy-agent/opa v1.9.0/go.mod h1:72+lKmTda0O48m1VKAxxYl7MjP/EWFZu9fxHQK2xihs= +github.com/open-policy-agent/opa v1.10.1 h1:haIvxZSPky8HLjRrvQwWAjCPLg8JDFSZMbbG4yyUHgY= +github.com/open-policy-agent/opa v1.10.1/go.mod h1:7uPI3iRpOalJ0BhK6s1JALWPU9HvaV1XeBSSMZnr/PM= github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-20250512152754-23325793059a h1:Sakl76blJAaM6NxylVkgSzktjo2dS504iDotEFJsh3M= github.com/opencloud-eu/go-micro-plugins/v4/store/nats-js-kv v0.0.0-20250512152754-23325793059a/go.mod h1:pjcozWijkNPbEtX5SIQaxEW/h8VAVZYTLx+70bmB3LY= github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89 h1:W1ms+lP5lUUIzjRGDg93WrQfZJZCaV1ZP3KeyXi8bzY= diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.10.0.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.10.0.json new file mode 100644 index 0000000000..0a37621d0c --- /dev/null +++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.10.0.json @@ -0,0 +1,4867 @@ +{ + "builtins": [ + { + "name": "abs", + "decl": { + "args": [ + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "all", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "and", + "decl": { + "args": [ + { + "of": { + "type": "any" + }, + "type": "set" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "result": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "function" + }, + "infix": "\u0026" + }, + { + "name": "any", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "array.concat", + "decl": { + "args": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "result": { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "array.reverse", + "decl": { + "args": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "result": { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "array.slice", + "decl": { + "args": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "assign", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": ":=" + }, + { + "name": "base64.decode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "base64.encode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "base64.is_valid", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "base64url.decode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "base64url.encode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "base64url.encode_no_pad", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "bits.and", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "bits.lsh", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "bits.negate", + "decl": { + "args": [ + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "bits.or", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "bits.rsh", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "bits.xor", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "cast_array", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "cast_boolean", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "cast_null", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "null" + }, + "type": "function" + } + }, + { + "name": "cast_object", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "cast_set", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "cast_string", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "ceil", + "decl": { + "args": [ + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "concat", + "decl": { + "args": [ + { + "type": "string" + }, + { + "of": [ + { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + { + "of": { + "type": "string" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "contains", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "count", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "crypto.hmac.equal", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "crypto.hmac.md5", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "crypto.hmac.sha1", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "crypto.hmac.sha256", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "crypto.hmac.sha512", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "crypto.md5", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "crypto.parse_private_keys", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "dynamic": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "crypto.sha1", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "crypto.sha256", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "crypto.x509.parse_and_verify_certificates", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "static": [ + { + "type": "boolean" + }, + { + "dynamic": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "array" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "crypto.x509.parse_and_verify_certificates_with_options", + "decl": { + "args": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "result": { + "static": [ + { + "type": "boolean" + }, + { + "dynamic": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "array" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "crypto.x509.parse_certificate_request", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "crypto.x509.parse_certificates", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "dynamic": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "crypto.x509.parse_keypair", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "crypto.x509.parse_rsa_private_key", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "div", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + }, + "infix": "/" + }, + { + "name": "endswith", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "eq", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "=" + }, + { + "name": "equal", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "==" + }, + { + "name": "floor", + "decl": { + "args": [ + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "format_int", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "glob.match", + "decl": { + "args": [ + { + "type": "string" + }, + { + "of": [ + { + "type": "null" + }, + { + "dynamic": { + "type": "string" + }, + "type": "array" + } + ], + "type": "any" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "glob.quote_meta", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "graph.reachable", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + }, + "type": "object" + }, + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "graph.reachable_paths", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + }, + "type": "object" + }, + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "of": { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "graphql.is_valid", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "graphql.parse", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + } + ], + "result": { + "static": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "graphql.parse_and_verify", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + } + ], + "result": { + "static": [ + { + "type": "boolean" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "graphql.parse_query", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "graphql.parse_schema", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "graphql.schema_is_valid", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "gt", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "\u003e" + }, + { + "name": "gte", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "\u003e=" + }, + { + "name": "hex.decode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "hex.encode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "http.send", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "result": { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "indexof", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "indexof_n", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "dynamic": { + "type": "number" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "internal.member_2", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "in" + }, + { + "name": "internal.member_3", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "in" + }, + { + "name": "internal.print", + "decl": { + "args": [ + { + "dynamic": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "array" + } + ], + "type": "function" + } + }, + { + "name": "internal.test_case", + "decl": { + "args": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "function" + } + }, + { + "name": "intersection", + "decl": { + "args": [ + { + "of": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "set" + } + ], + "result": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "io.jwt.decode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "static": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "type": "string" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "io.jwt.decode_verify", + "decl": { + "args": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "result": { + "static": [ + { + "type": "boolean" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "array" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "io.jwt.encode_sign", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "result": { + "type": "string" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "io.jwt.encode_sign_raw", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "io.jwt.verify_eddsa", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_es256", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_es384", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_es512", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_hs256", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_hs384", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_hs512", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_ps256", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_ps384", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_ps512", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_rs256", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_rs384", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_rs512", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "is_array", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "is_boolean", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "is_null", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "is_number", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "is_object", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "is_set", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "is_string", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "json.filter", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": [ + { + "dynamic": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + }, + "type": "array" + }, + { + "of": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "json.is_valid", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "json.marshal", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "json.marshal_with_options", + "decl": { + "args": [ + { + "type": "any" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "static": [ + { + "key": "indent", + "value": { + "type": "string" + } + }, + { + "key": "prefix", + "value": { + "type": "string" + } + }, + { + "key": "pretty", + "value": { + "type": "boolean" + } + } + ], + "type": "object" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "json.match_schema", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + } + ], + "result": { + "static": [ + { + "type": "boolean" + }, + { + "dynamic": { + "static": [ + { + "key": "desc", + "value": { + "type": "string" + } + }, + { + "key": "error", + "value": { + "type": "string" + } + }, + { + "key": "field", + "value": { + "type": "string" + } + }, + { + "key": "type", + "value": { + "type": "string" + } + } + ], + "type": "object" + }, + "type": "array" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "json.patch", + "decl": { + "args": [ + { + "type": "any" + }, + { + "dynamic": { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "static": [ + { + "key": "op", + "value": { + "type": "string" + } + }, + { + "key": "path", + "value": { + "type": "any" + } + } + ], + "type": "object" + }, + "type": "array" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "json.remove", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": [ + { + "dynamic": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + }, + "type": "array" + }, + { + "of": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "json.unmarshal", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "json.verify_schema", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + } + ], + "result": { + "static": [ + { + "type": "boolean" + }, + { + "of": [ + { + "type": "null" + }, + { + "type": "string" + } + ], + "type": "any" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "lower", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "lt", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "\u003c" + }, + { + "name": "lte", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "\u003c=" + }, + { + "name": "max", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "min", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "minus", + "decl": { + "args": [ + { + "of": [ + { + "type": "number" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "number" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "of": [ + { + "type": "number" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + }, + "type": "function" + }, + "infix": "-" + }, + { + "name": "mul", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + }, + "infix": "*" + }, + { + "name": "neq", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "!=" + }, + { + "name": "net.cidr_contains", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "net.cidr_contains_matches", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + }, + "type": "array" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + } + }, + "type": "object" + }, + { + "of": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + }, + "type": "array" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + } + }, + "type": "object" + }, + { + "of": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "of": { + "static": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "type": "array" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "net.cidr_expand", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "of": { + "type": "string" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "net.cidr_intersects", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "net.cidr_is_valid", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "net.cidr_merge", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "of": [ + { + "type": "string" + } + ], + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "string" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "of": { + "type": "string" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "net.cidr_overlap", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "net.lookup_ip_addr", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "of": { + "type": "string" + }, + "type": "set" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "numbers.range", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "dynamic": { + "type": "number" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "numbers.range_step", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "dynamic": { + "type": "number" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "object.filter", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "object.get", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "object.keys", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "result": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "object.remove", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "object.subset", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + }, + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "object.union", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "object.union_n", + "decl": { + "args": [ + { + "dynamic": { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "array" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "opa.runtime", + "decl": { + "result": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "or", + "decl": { + "args": [ + { + "of": { + "type": "any" + }, + "type": "set" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "result": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "function" + }, + "infix": "|" + }, + { + "name": "plus", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + }, + "infix": "+" + }, + { + "name": "print", + "decl": { + "type": "function", + "variadic": { + "type": "any" + } + } + }, + { + "name": "product", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "type": "number" + }, + "type": "array" + }, + { + "of": { + "type": "number" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "providers.aws.sign_req", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "type": "number" + } + ], + "result": { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "rand.intn", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "re_match", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "regex.find_all_string_submatch_n", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "number" + } + ], + "result": { + "dynamic": { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "regex.find_n", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "number" + } + ], + "result": { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "regex.globs_match", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "regex.is_valid", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "regex.match", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "regex.replace", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "regex.split", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "regex.template_match", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "rego.metadata.chain", + "decl": { + "result": { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "rego.metadata.rule", + "decl": { + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "rego.parse_module", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "rem", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + }, + "infix": "%" + }, + { + "name": "replace", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "round", + "decl": { + "args": [ + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "semver.compare", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "semver.is_valid", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "set_diff", + "decl": { + "args": [ + { + "of": { + "type": "any" + }, + "type": "set" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "result": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "sort", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "split", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "sprintf", + "decl": { + "args": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "startswith", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "strings.any_prefix_match", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + { + "of": { + "type": "string" + }, + "type": "set" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + { + "of": { + "type": "string" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "strings.any_suffix_match", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + { + "of": { + "type": "string" + }, + "type": "set" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + { + "of": { + "type": "string" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "strings.count", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "strings.render_template", + "decl": { + "args": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "strings.replace_n", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "type": "object" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "strings.reverse", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "substring", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "sum", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "type": "number" + }, + "type": "array" + }, + { + "of": { + "type": "number" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "time.add_date", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "time.clock", + "decl": { + "args": [ + { + "of": [ + { + "type": "number" + }, + { + "static": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "type": "array" + } + ], + "type": "any" + } + ], + "result": { + "static": [ + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "time.date", + "decl": { + "args": [ + { + "of": [ + { + "type": "number" + }, + { + "static": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "type": "array" + } + ], + "type": "any" + } + ], + "result": { + "static": [ + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "time.diff", + "decl": { + "args": [ + { + "of": [ + { + "type": "number" + }, + { + "static": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "type": "array" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "number" + }, + { + "static": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "type": "array" + } + ], + "type": "any" + } + ], + "result": { + "static": [ + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "time.format", + "decl": { + "args": [ + { + "of": [ + { + "type": "number" + }, + { + "static": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "type": "array" + }, + { + "static": [ + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "string" + } + ], + "type": "array" + } + ], + "type": "any" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "time.now_ns", + "decl": { + "result": { + "type": "number" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "time.parse_duration_ns", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "time.parse_ns", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "time.parse_rfc3339_ns", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "time.weekday", + "decl": { + "args": [ + { + "of": [ + { + "type": "number" + }, + { + "static": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "type": "array" + } + ], + "type": "any" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "to_number", + "decl": { + "args": [ + { + "of": [ + { + "type": "null" + }, + { + "type": "boolean" + }, + { + "type": "number" + }, + { + "type": "string" + } + ], + "type": "any" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "trace", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "trim", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "trim_left", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "trim_prefix", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "trim_right", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "trim_space", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "trim_suffix", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "type_name", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "union", + "decl": { + "args": [ + { + "of": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "set" + } + ], + "result": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "units.parse", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "units.parse_bytes", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "upper", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "urlquery.decode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "urlquery.decode_object", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "dynamic": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "urlquery.encode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "urlquery.encode_object", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + { + "of": { + "type": "string" + }, + "type": "set" + } + ], + "type": "any" + } + }, + "type": "object" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "uuid.parse", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "uuid.rfc4122", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "walk", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "static": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "type": "any" + } + ], + "type": "array" + }, + "type": "function" + }, + "relation": true + }, + { + "name": "yaml.is_valid", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "yaml.marshal", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "yaml.unmarshal", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + } + ], + "wasm_abi_versions": [ + { + "version": 1, + "minor_version": 1 + }, + { + "version": 1, + "minor_version": 2 + } + ], + "features": [ + "keywords_in_refs", + "rego_v1" + ] +} diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.10.1.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.10.1.json new file mode 100644 index 0000000000..0a37621d0c --- /dev/null +++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.10.1.json @@ -0,0 +1,4867 @@ +{ + "builtins": [ + { + "name": "abs", + "decl": { + "args": [ + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "all", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "and", + "decl": { + "args": [ + { + "of": { + "type": "any" + }, + "type": "set" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "result": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "function" + }, + "infix": "\u0026" + }, + { + "name": "any", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "array.concat", + "decl": { + "args": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "result": { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "array.reverse", + "decl": { + "args": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "result": { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "array.slice", + "decl": { + "args": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "assign", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": ":=" + }, + { + "name": "base64.decode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "base64.encode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "base64.is_valid", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "base64url.decode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "base64url.encode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "base64url.encode_no_pad", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "bits.and", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "bits.lsh", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "bits.negate", + "decl": { + "args": [ + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "bits.or", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "bits.rsh", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "bits.xor", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "cast_array", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "cast_boolean", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "cast_null", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "null" + }, + "type": "function" + } + }, + { + "name": "cast_object", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "cast_set", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "cast_string", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "ceil", + "decl": { + "args": [ + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "concat", + "decl": { + "args": [ + { + "type": "string" + }, + { + "of": [ + { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + { + "of": { + "type": "string" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "contains", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "count", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "crypto.hmac.equal", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "crypto.hmac.md5", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "crypto.hmac.sha1", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "crypto.hmac.sha256", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "crypto.hmac.sha512", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "crypto.md5", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "crypto.parse_private_keys", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "dynamic": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "crypto.sha1", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "crypto.sha256", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "crypto.x509.parse_and_verify_certificates", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "static": [ + { + "type": "boolean" + }, + { + "dynamic": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "array" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "crypto.x509.parse_and_verify_certificates_with_options", + "decl": { + "args": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "result": { + "static": [ + { + "type": "boolean" + }, + { + "dynamic": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "array" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "crypto.x509.parse_certificate_request", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "crypto.x509.parse_certificates", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "dynamic": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "crypto.x509.parse_keypair", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "crypto.x509.parse_rsa_private_key", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "div", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + }, + "infix": "/" + }, + { + "name": "endswith", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "eq", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "=" + }, + { + "name": "equal", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "==" + }, + { + "name": "floor", + "decl": { + "args": [ + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "format_int", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "glob.match", + "decl": { + "args": [ + { + "type": "string" + }, + { + "of": [ + { + "type": "null" + }, + { + "dynamic": { + "type": "string" + }, + "type": "array" + } + ], + "type": "any" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "glob.quote_meta", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "graph.reachable", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + }, + "type": "object" + }, + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "graph.reachable_paths", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + }, + "type": "object" + }, + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "of": { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "graphql.is_valid", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "graphql.parse", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + } + ], + "result": { + "static": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "graphql.parse_and_verify", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + } + ], + "result": { + "static": [ + { + "type": "boolean" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "graphql.parse_query", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "graphql.parse_schema", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "graphql.schema_is_valid", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "gt", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "\u003e" + }, + { + "name": "gte", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "\u003e=" + }, + { + "name": "hex.decode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "hex.encode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "http.send", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "result": { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "indexof", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "indexof_n", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "dynamic": { + "type": "number" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "internal.member_2", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "in" + }, + { + "name": "internal.member_3", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "in" + }, + { + "name": "internal.print", + "decl": { + "args": [ + { + "dynamic": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "array" + } + ], + "type": "function" + } + }, + { + "name": "internal.test_case", + "decl": { + "args": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "function" + } + }, + { + "name": "intersection", + "decl": { + "args": [ + { + "of": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "set" + } + ], + "result": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "io.jwt.decode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "static": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "type": "string" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "io.jwt.decode_verify", + "decl": { + "args": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "result": { + "static": [ + { + "type": "boolean" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "array" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "io.jwt.encode_sign", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "result": { + "type": "string" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "io.jwt.encode_sign_raw", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "io.jwt.verify_eddsa", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_es256", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_es384", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_es512", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_hs256", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_hs384", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_hs512", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_ps256", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_ps384", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_ps512", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_rs256", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_rs384", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "io.jwt.verify_rs512", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "is_array", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "is_boolean", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "is_null", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "is_number", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "is_object", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "is_set", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "is_string", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "json.filter", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": [ + { + "dynamic": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + }, + "type": "array" + }, + { + "of": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "json.is_valid", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "json.marshal", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "json.marshal_with_options", + "decl": { + "args": [ + { + "type": "any" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "static": [ + { + "key": "indent", + "value": { + "type": "string" + } + }, + { + "key": "prefix", + "value": { + "type": "string" + } + }, + { + "key": "pretty", + "value": { + "type": "boolean" + } + } + ], + "type": "object" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "json.match_schema", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + } + ], + "result": { + "static": [ + { + "type": "boolean" + }, + { + "dynamic": { + "static": [ + { + "key": "desc", + "value": { + "type": "string" + } + }, + { + "key": "error", + "value": { + "type": "string" + } + }, + { + "key": "field", + "value": { + "type": "string" + } + }, + { + "key": "type", + "value": { + "type": "string" + } + } + ], + "type": "object" + }, + "type": "array" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "json.patch", + "decl": { + "args": [ + { + "type": "any" + }, + { + "dynamic": { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "static": [ + { + "key": "op", + "value": { + "type": "string" + } + }, + { + "key": "path", + "value": { + "type": "any" + } + } + ], + "type": "object" + }, + "type": "array" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "json.remove", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": [ + { + "dynamic": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + }, + "type": "array" + }, + { + "of": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "json.unmarshal", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "json.verify_schema", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "type": "any" + } + ], + "result": { + "static": [ + { + "type": "boolean" + }, + { + "of": [ + { + "type": "null" + }, + { + "type": "string" + } + ], + "type": "any" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "lower", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "lt", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "\u003c" + }, + { + "name": "lte", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "\u003c=" + }, + { + "name": "max", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "min", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "minus", + "decl": { + "args": [ + { + "of": [ + { + "type": "number" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "number" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "of": [ + { + "type": "number" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + }, + "type": "function" + }, + "infix": "-" + }, + { + "name": "mul", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + }, + "infix": "*" + }, + { + "name": "neq", + "decl": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + }, + "infix": "!=" + }, + { + "name": "net.cidr_contains", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "net.cidr_contains_matches", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + }, + "type": "array" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + } + }, + "type": "object" + }, + { + "of": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + }, + "type": "array" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + } + }, + "type": "object" + }, + { + "of": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "of": { + "static": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "type": "array" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "net.cidr_expand", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "of": { + "type": "string" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "net.cidr_intersects", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "net.cidr_is_valid", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "net.cidr_merge", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "of": [ + { + "type": "string" + } + ], + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "string" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "of": { + "type": "string" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "net.cidr_overlap", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "net.lookup_ip_addr", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "of": { + "type": "string" + }, + "type": "set" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "numbers.range", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "dynamic": { + "type": "number" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "numbers.range_step", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "dynamic": { + "type": "number" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "object.filter", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "object.get", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "type": "any" + }, + { + "type": "any" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "object.keys", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "result": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "object.remove", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "object.subset", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + }, + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "object.union", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "object.union_n", + "decl": { + "args": [ + { + "dynamic": { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "array" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "opa.runtime", + "decl": { + "result": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "or", + "decl": { + "args": [ + { + "of": { + "type": "any" + }, + "type": "set" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "result": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "function" + }, + "infix": "|" + }, + { + "name": "plus", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + }, + "infix": "+" + }, + { + "name": "print", + "decl": { + "type": "function", + "variadic": { + "type": "any" + } + } + }, + { + "name": "product", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "type": "number" + }, + "type": "array" + }, + { + "of": { + "type": "number" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "providers.aws.sign_req", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + { + "type": "number" + } + ], + "result": { + "dynamic": { + "key": { + "type": "any" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "rand.intn", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "re_match", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "regex.find_all_string_submatch_n", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "number" + } + ], + "result": { + "dynamic": { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "regex.find_n", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "number" + } + ], + "result": { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "regex.globs_match", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "regex.is_valid", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "regex.match", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "regex.replace", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "regex.split", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "regex.template_match", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "rego.metadata.chain", + "decl": { + "result": { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "rego.metadata.rule", + "decl": { + "result": { + "type": "any" + }, + "type": "function" + } + }, + { + "name": "rego.parse_module", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "rem", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + }, + "infix": "%" + }, + { + "name": "replace", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "round", + "decl": { + "args": [ + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "semver.compare", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "semver.is_valid", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "set_diff", + "decl": { + "args": [ + { + "of": { + "type": "any" + }, + "type": "set" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "result": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "sort", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "of": { + "type": "any" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "split", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + "type": "function" + } + }, + { + "name": "sprintf", + "decl": { + "args": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "any" + }, + "type": "array" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "startswith", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "strings.any_prefix_match", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + { + "of": { + "type": "string" + }, + "type": "set" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + { + "of": { + "type": "string" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "strings.any_suffix_match", + "decl": { + "args": [ + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + { + "of": { + "type": "string" + }, + "type": "set" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + { + "of": { + "type": "string" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "strings.count", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "strings.render_template", + "decl": { + "args": [ + { + "type": "string" + }, + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "strings.replace_n", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "type": "object" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "strings.reverse", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "substring", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "sum", + "decl": { + "args": [ + { + "of": [ + { + "dynamic": { + "type": "number" + }, + "type": "array" + }, + { + "of": { + "type": "number" + }, + "type": "set" + } + ], + "type": "any" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "time.add_date", + "decl": { + "args": [ + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "time.clock", + "decl": { + "args": [ + { + "of": [ + { + "type": "number" + }, + { + "static": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "type": "array" + } + ], + "type": "any" + } + ], + "result": { + "static": [ + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "time.date", + "decl": { + "args": [ + { + "of": [ + { + "type": "number" + }, + { + "static": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "type": "array" + } + ], + "type": "any" + } + ], + "result": { + "static": [ + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "time.diff", + "decl": { + "args": [ + { + "of": [ + { + "type": "number" + }, + { + "static": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "type": "array" + } + ], + "type": "any" + }, + { + "of": [ + { + "type": "number" + }, + { + "static": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "type": "array" + } + ], + "type": "any" + } + ], + "result": { + "static": [ + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + }, + { + "type": "number" + } + ], + "type": "array" + }, + "type": "function" + } + }, + { + "name": "time.format", + "decl": { + "args": [ + { + "of": [ + { + "type": "number" + }, + { + "static": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "type": "array" + }, + { + "static": [ + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "string" + } + ], + "type": "array" + } + ], + "type": "any" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "time.now_ns", + "decl": { + "result": { + "type": "number" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "time.parse_duration_ns", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "time.parse_ns", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "time.parse_rfc3339_ns", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "time.weekday", + "decl": { + "args": [ + { + "of": [ + { + "type": "number" + }, + { + "static": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "type": "array" + } + ], + "type": "any" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "to_number", + "decl": { + "args": [ + { + "of": [ + { + "type": "null" + }, + { + "type": "boolean" + }, + { + "type": "number" + }, + { + "type": "string" + } + ], + "type": "any" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "trace", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "trim", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "trim_left", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "trim_prefix", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "trim_right", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "trim_space", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "trim_suffix", + "decl": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "type_name", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "union", + "decl": { + "args": [ + { + "of": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "set" + } + ], + "result": { + "of": { + "type": "any" + }, + "type": "set" + }, + "type": "function" + } + }, + { + "name": "units.parse", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "units.parse_bytes", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "number" + }, + "type": "function" + } + }, + { + "name": "upper", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "urlquery.decode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "urlquery.decode_object", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "dynamic": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "urlquery.encode", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "urlquery.encode_object", + "decl": { + "args": [ + { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "of": [ + { + "type": "string" + }, + { + "dynamic": { + "type": "string" + }, + "type": "array" + }, + { + "of": { + "type": "string" + }, + "type": "set" + } + ], + "type": "any" + } + }, + "type": "object" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "uuid.parse", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "dynamic": { + "key": { + "type": "string" + }, + "value": { + "type": "any" + } + }, + "type": "object" + }, + "type": "function" + } + }, + { + "name": "uuid.rfc4122", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "string" + }, + "type": "function" + }, + "nondeterministic": true + }, + { + "name": "walk", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "static": [ + { + "dynamic": { + "type": "any" + }, + "type": "array" + }, + { + "type": "any" + } + ], + "type": "array" + }, + "type": "function" + }, + "relation": true + }, + { + "name": "yaml.is_valid", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "boolean" + }, + "type": "function" + } + }, + { + "name": "yaml.marshal", + "decl": { + "args": [ + { + "type": "any" + } + ], + "result": { + "type": "string" + }, + "type": "function" + } + }, + { + "name": "yaml.unmarshal", + "decl": { + "args": [ + { + "type": "string" + } + ], + "result": { + "type": "any" + }, + "type": "function" + } + } + ], + "wasm_abi_versions": [ + { + "version": 1, + "minor_version": 1 + }, + { + "version": 1, + "minor_version": 2 + } + ], + "features": [ + "keywords_in_refs", + "rego_v1" + ] +} diff --git a/vendor/github.com/open-policy-agent/opa/internal/bundle/utils.go b/vendor/github.com/open-policy-agent/opa/internal/bundle/utils.go index 836aa586b9..98093b774e 100644 --- a/vendor/github.com/open-policy-agent/opa/internal/bundle/utils.go +++ b/vendor/github.com/open-policy-agent/opa/internal/bundle/utils.go @@ -72,7 +72,7 @@ func LoadWasmResolversFromStore(ctx context.Context, store storage.Store, txn st var resolvers []*wasm.Resolver if len(resolversToLoad) > 0 { // Get a full snapshot of the current data (including any from "outside" the bundles) - data, err := store.Read(ctx, txn, storage.Path{}) + data, err := store.Read(ctx, txn, storage.RootPath) if err != nil { return nil, fmt.Errorf("failed to initialize wasm runtime: %s", err) } diff --git a/vendor/github.com/open-policy-agent/opa/internal/edittree/edittree.go b/vendor/github.com/open-policy-agent/opa/internal/edittree/edittree.go index 1dafc57b0b..ebfa875d75 100644 --- a/vendor/github.com/open-policy-agent/opa/internal/edittree/edittree.go +++ b/vendor/github.com/open-policy-agent/opa/internal/edittree/edittree.go @@ -148,7 +148,6 @@ package edittree import ( "errors" "fmt" - "math/big" "sort" "strings" @@ -203,89 +202,13 @@ func NewEditTree(term *ast.Term) *EditTree { // it was found in the table already. func (e *EditTree) getKeyHash(key *ast.Term) (int, bool) { hash := key.Hash() - // This `equal` utility is duplicated and manually inlined a number of - // time in this file. Inlining it avoids heap allocations, so it makes - // a big performance difference: some operations like lookup become twice - // as slow without it. - var equal func(v ast.Value) bool - - switch x := key.Value.(type) { - case ast.Null, ast.Boolean, ast.String, ast.Var: - equal = func(y ast.Value) bool { return x == y } - case ast.Number: - if xi, ok := x.Int64(); ok { - equal = func(y ast.Value) bool { - if y, ok := y.(ast.Number); ok { - if yi, ok := y.Int64(); ok { - return xi == yi - } - } - - return false - } - break - } - - // We use big.Rat for comparing big numbers. - // It replaces big.Float due to following reason: - // big.Float comes with a default precision of 64, and setting a - // larger precision results in more memory being allocated - // (regardless of the actual number we are parsing with SetString). - // - // Note: If we're so close to zero that big.Float says we are zero, do - // *not* big.Rat).SetString on the original string it'll potentially - // take very long. - var a *big.Rat - fa, ok := new(big.Float).SetString(string(x)) - if !ok { - panic("illegal value") - } - if fa.IsInt() { - if i, _ := fa.Int64(); i == 0 { - a = new(big.Rat).SetInt64(0) - } - } - if a == nil { - a, ok = new(big.Rat).SetString(string(x)) - if !ok { - panic("illegal value") - } - } - - equal = func(b ast.Value) bool { - if bNum, ok := b.(ast.Number); ok { - var b *big.Rat - fb, ok := new(big.Float).SetString(string(bNum)) - if !ok { - panic("illegal value") - } - if fb.IsInt() { - if i, _ := fb.Int64(); i == 0 { - b = new(big.Rat).SetInt64(0) - } - } - if b == nil { - b, ok = new(big.Rat).SetString(string(bNum)) - if !ok { - panic("illegal value") - } - } - - return a.Cmp(b) == 0 - } - return false - } - - default: - equal = func(y ast.Value) bool { return ast.Compare(x, y) == 0 } - } // Look through childKeys, looking up the original hash // value first, and then use linear-probing to iter // through the keys until we either find the Term we're // after, or run out of candidates. for curr, ok := e.childKeys[hash]; ok; { - if equal(curr.Value) { + if ast.KeyHashEqual(curr.Value, key.Value) { return hash, true } diff --git a/vendor/github.com/open-policy-agent/opa/internal/runtime/init/init.go b/vendor/github.com/open-policy-agent/opa/internal/runtime/init/init.go index 530deadb9a..de8ef87401 100644 --- a/vendor/github.com/open-policy-agent/opa/internal/runtime/init/init.go +++ b/vendor/github.com/open-policy-agent/opa/internal/runtime/init/init.go @@ -42,7 +42,7 @@ type InsertAndCompileResult struct { // store contents. func InsertAndCompile(ctx context.Context, opts InsertAndCompileOptions) (*InsertAndCompileResult, error) { if len(opts.Files.Documents) > 0 { - if err := opts.Store.Write(ctx, opts.Txn, storage.AddOp, storage.Path{}, opts.Files.Documents); err != nil { + if err := opts.Store.Write(ctx, opts.Txn, storage.AddOp, storage.RootPath, opts.Files.Documents); err != nil { return nil, fmt.Errorf("storage error: %w", err) } } diff --git a/vendor/github.com/open-policy-agent/opa/internal/semver/semver.go b/vendor/github.com/open-policy-agent/opa/internal/semver/semver.go index 389eeccc18..23c6c186d9 100644 --- a/vendor/github.com/open-policy-agent/opa/internal/semver/semver.go +++ b/vendor/github.com/open-policy-agent/opa/internal/semver/semver.go @@ -233,3 +233,18 @@ func validateIdentifier(id string) error { // reIdentifier is a regular expression used to check that pre-release and metadata // identifiers satisfy the spec requirements var reIdentifier = regexp.MustCompile(`^[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*$`) + +// Compare compares two semver strings. +func Compare(a, b string) int { + aV, err := NewVersion(strings.TrimPrefix(a, "v")) + if err != nil { + return -1 + } + + bV, err := NewVersion(strings.TrimPrefix(b, "v")) + if err != nil { + return 1 + } + + return aV.Compare(*bV) +} diff --git a/vendor/github.com/open-policy-agent/opa/v1/ast/builtins.go b/vendor/github.com/open-policy-agent/opa/v1/ast/builtins.go index 6a45d0af46..3d72aeab1f 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/ast/builtins.go +++ b/vendor/github.com/open-policy-agent/opa/v1/ast/builtins.go @@ -347,7 +347,7 @@ var Equality = &Builtin{ types.Args(types.A, types.A), types.B, ), - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -362,7 +362,7 @@ var Assign = &Builtin{ types.Args(types.A, types.A), types.B, ), - canSkipBctx: true, + CanSkipBctx: true, } // Member represents the `in` (infix) operator. @@ -376,7 +376,7 @@ var Member = &Builtin{ ), types.B, ), - canSkipBctx: true, + CanSkipBctx: true, } // MemberWithKey represents the `in` (infix) operator when used @@ -392,7 +392,7 @@ var MemberWithKey = &Builtin{ ), types.B, ), - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -411,7 +411,7 @@ var GreaterThan = &Builtin{ ), types.Named("result", types.B).Description("true if `x` is greater than `y`; false otherwise"), ), - canSkipBctx: true, + CanSkipBctx: true, } var GreaterThanEq = &Builtin{ @@ -425,7 +425,7 @@ var GreaterThanEq = &Builtin{ ), types.Named("result", types.B).Description("true if `x` is greater or equal to `y`; false otherwise"), ), - canSkipBctx: true, + CanSkipBctx: true, } // LessThan represents the "<" comparison operator. @@ -440,7 +440,7 @@ var LessThan = &Builtin{ ), types.Named("result", types.B).Description("true if `x` is less than `y`; false otherwise"), ), - canSkipBctx: true, + CanSkipBctx: true, } var LessThanEq = &Builtin{ @@ -454,7 +454,7 @@ var LessThanEq = &Builtin{ ), types.Named("result", types.B).Description("true if `x` is less than or equal to `y`; false otherwise"), ), - canSkipBctx: true, + CanSkipBctx: true, } var NotEqual = &Builtin{ @@ -468,7 +468,7 @@ var NotEqual = &Builtin{ ), types.Named("result", types.B).Description("true if `x` is not equal to `y`; false otherwise"), ), - canSkipBctx: true, + CanSkipBctx: true, } // Equal represents the "==" comparison operator. @@ -483,7 +483,7 @@ var Equal = &Builtin{ ), types.Named("result", types.B).Description("true if `x` is equal to `y`; false otherwise"), ), - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -503,7 +503,7 @@ var Plus = &Builtin{ types.Named("z", types.N).Description("the sum of `x` and `y`"), ), Categories: number, - canSkipBctx: true, + CanSkipBctx: true, } var Minus = &Builtin{ @@ -518,7 +518,7 @@ var Minus = &Builtin{ types.Named("z", types.NewAny(types.N, types.SetOfAny)).Description("the difference of `x` and `y`"), ), Categories: category("sets", "numbers"), - canSkipBctx: true, + CanSkipBctx: true, } var Multiply = &Builtin{ @@ -533,7 +533,7 @@ var Multiply = &Builtin{ types.Named("z", types.N).Description("the product of `x` and `y`"), ), Categories: number, - canSkipBctx: true, + CanSkipBctx: true, } var Divide = &Builtin{ @@ -548,7 +548,7 @@ var Divide = &Builtin{ types.Named("z", types.N).Description("the result of `x` divided by `y`"), ), Categories: number, - canSkipBctx: true, + CanSkipBctx: true, } var Round = &Builtin{ @@ -561,7 +561,7 @@ var Round = &Builtin{ types.Named("y", types.N).Description("the result of rounding `x`"), ), Categories: number, - canSkipBctx: true, + CanSkipBctx: true, } var Ceil = &Builtin{ @@ -574,7 +574,7 @@ var Ceil = &Builtin{ types.Named("y", types.N).Description("the result of rounding `x` _up_"), ), Categories: number, - canSkipBctx: true, + CanSkipBctx: true, } var Floor = &Builtin{ @@ -587,7 +587,7 @@ var Floor = &Builtin{ types.Named("y", types.N).Description("the result of rounding `x` _down_"), ), Categories: number, - canSkipBctx: true, + CanSkipBctx: true, } var Abs = &Builtin{ @@ -600,7 +600,7 @@ var Abs = &Builtin{ types.Named("y", types.N).Description("the absolute value of `x`"), ), Categories: number, - canSkipBctx: true, + CanSkipBctx: true, } var Rem = &Builtin{ @@ -615,7 +615,7 @@ var Rem = &Builtin{ types.Named("z", types.N).Description("the remainder"), ), Categories: number, - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -632,7 +632,7 @@ var BitsOr = &Builtin{ ), types.Named("z", types.N).Description("the bitwise OR of `x` and `y`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var BitsAnd = &Builtin{ @@ -645,7 +645,7 @@ var BitsAnd = &Builtin{ ), types.Named("z", types.N).Description("the bitwise AND of `x` and `y`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var BitsNegate = &Builtin{ @@ -657,7 +657,7 @@ var BitsNegate = &Builtin{ ), types.Named("z", types.N).Description("the bitwise negation of `x`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var BitsXOr = &Builtin{ @@ -670,7 +670,7 @@ var BitsXOr = &Builtin{ ), types.Named("z", types.N).Description("the bitwise XOR of `x` and `y`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var BitsShiftLeft = &Builtin{ @@ -683,7 +683,7 @@ var BitsShiftLeft = &Builtin{ ), types.Named("z", types.N).Description("the result of shifting `x` `s` bits to the left"), ), - canSkipBctx: true, + CanSkipBctx: true, } var BitsShiftRight = &Builtin{ @@ -696,7 +696,7 @@ var BitsShiftRight = &Builtin{ ), types.Named("z", types.N).Description("the result of shifting `x` `s` bits to the right"), ), - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -717,7 +717,7 @@ var And = &Builtin{ types.Named("z", types.SetOfAny).Description("the intersection of `x` and `y`"), ), Categories: sets, - canSkipBctx: true, + CanSkipBctx: true, } // Or performs a union operation on sets. @@ -733,7 +733,7 @@ var Or = &Builtin{ types.Named("z", types.SetOfAny).Description("the union of `x` and `y`"), ), Categories: sets, - canSkipBctx: true, + CanSkipBctx: true, } var Intersection = &Builtin{ @@ -746,7 +746,7 @@ var Intersection = &Builtin{ types.Named("y", types.SetOfAny).Description("the intersection of all `xs` sets"), ), Categories: sets, - canSkipBctx: true, + CanSkipBctx: true, } var Union = &Builtin{ @@ -759,7 +759,7 @@ var Union = &Builtin{ types.Named("y", types.SetOfAny).Description("the union of all `xs` sets"), ), Categories: sets, - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -783,7 +783,7 @@ var Count = &Builtin{ types.Named("n", types.N).Description("the count of elements, key/val pairs, or characters, respectively."), ), Categories: aggregates, - canSkipBctx: true, + CanSkipBctx: true, } var Sum = &Builtin{ @@ -799,7 +799,7 @@ var Sum = &Builtin{ types.Named("n", types.N).Description("the sum of all elements"), ), Categories: aggregates, - canSkipBctx: true, + CanSkipBctx: true, } var Product = &Builtin{ @@ -815,7 +815,7 @@ var Product = &Builtin{ types.Named("n", types.N).Description("the product of all elements"), ), Categories: aggregates, - canSkipBctx: true, + CanSkipBctx: true, } var Max = &Builtin{ @@ -831,7 +831,7 @@ var Max = &Builtin{ types.Named("n", types.A).Description("the maximum of all elements"), ), Categories: aggregates, - canSkipBctx: true, + CanSkipBctx: true, } var Min = &Builtin{ @@ -847,7 +847,7 @@ var Min = &Builtin{ types.Named("n", types.A).Description("the minimum of all elements"), ), Categories: aggregates, - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -867,7 +867,7 @@ var Sort = &Builtin{ types.Named("n", types.NewArray(nil, types.A)).Description("the sorted array"), ), Categories: aggregates, - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -884,7 +884,7 @@ var ArrayConcat = &Builtin{ ), types.Named("z", types.NewArray(nil, types.A)).Description("the concatenation of `x` and `y`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var ArraySlice = &Builtin{ @@ -898,7 +898,7 @@ var ArraySlice = &Builtin{ ), types.Named("slice", types.NewArray(nil, types.A)).Description("the subslice of `array`, from `start` to `end`, including `arr[start]`, but excluding `arr[end]`"), ), - canSkipBctx: true, + CanSkipBctx: true, } // NOTE(sr): this function really needs examples var ArrayReverse = &Builtin{ @@ -910,7 +910,7 @@ var ArrayReverse = &Builtin{ ), types.Named("rev", types.NewArray(nil, types.A)).Description("an array containing the elements of `arr` in reverse order"), ), - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -933,7 +933,7 @@ var ToNumber = &Builtin{ types.Named("num", types.N).Description("the numeric representation of `x`"), ), Categories: conversions, - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -961,7 +961,7 @@ var RegexIsValid = &Builtin{ ), types.Named("result", types.B).Description("true if `pattern` is a valid regular expression"), ), - canSkipBctx: true, + CanSkipBctx: true, } var RegexFindAllStringSubmatch = &Builtin{ @@ -975,7 +975,7 @@ var RegexFindAllStringSubmatch = &Builtin{ ), types.Named("output", types.NewArray(nil, types.NewArray(nil, types.S))).Description("array of all matches"), ), - canSkipBctx: false, + CanSkipBctx: false, } var RegexTemplateMatch = &Builtin{ @@ -990,7 +990,7 @@ var RegexTemplateMatch = &Builtin{ ), types.Named("result", types.B).Description("true if `value` matches the `template`"), ), - canSkipBctx: true, + CanSkipBctx: true, } // TODO(sr): example:`regex.template_match("urn:foo:{.*}", "urn:foo:bar:baz", "{", "}")`` returns ``true``. var RegexSplit = &Builtin{ @@ -1003,7 +1003,7 @@ var RegexSplit = &Builtin{ ), types.Named("output", types.NewArray(nil, types.S)).Description("the parts obtained by splitting `value`"), ), - canSkipBctx: false, + CanSkipBctx: false, } // RegexFind takes two strings and a number, the pattern, the value and number of match values to @@ -1019,7 +1019,7 @@ var RegexFind = &Builtin{ ), types.Named("output", types.NewArray(nil, types.S)).Description("collected matches"), ), - canSkipBctx: false, + CanSkipBctx: false, } // GlobsMatch takes two strings regexp-style strings and evaluates to true if their @@ -1038,7 +1038,7 @@ The set of regex symbols is limited for this builtin: only ` + "`.`, `*`, `+`, ` ), types.Named("result", types.B).Description("true if the intersection of `glob1` and `glob2` matches a non-empty set of non-empty strings"), ), - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -1065,7 +1065,7 @@ var AnyPrefixMatch = &Builtin{ types.Named("result", types.B).Description("result of the prefix check"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var AnySuffixMatch = &Builtin{ @@ -1087,7 +1087,7 @@ var AnySuffixMatch = &Builtin{ types.Named("result", types.B).Description("result of the suffix check"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var Concat = &Builtin{ @@ -1104,7 +1104,7 @@ var Concat = &Builtin{ types.Named("output", types.S).Description("the joined string"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var FormatInt = &Builtin{ @@ -1118,7 +1118,7 @@ var FormatInt = &Builtin{ types.Named("output", types.S).Description("formatted number"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var IndexOf = &Builtin{ @@ -1132,7 +1132,7 @@ var IndexOf = &Builtin{ types.Named("output", types.N).Description("index of first occurrence, `-1` if not found"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var IndexOfN = &Builtin{ @@ -1146,7 +1146,7 @@ var IndexOfN = &Builtin{ types.Named("output", types.NewArray(nil, types.N)).Description("all indices at which `needle` occurs in `haystack`, may be empty"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var Substring = &Builtin{ @@ -1161,7 +1161,7 @@ var Substring = &Builtin{ types.Named("output", types.S).Description("substring of `value` from `offset`, of length `length`"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var Contains = &Builtin{ @@ -1175,7 +1175,7 @@ var Contains = &Builtin{ types.Named("result", types.B).Description("result of the containment check"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var StringCount = &Builtin{ @@ -1189,7 +1189,7 @@ var StringCount = &Builtin{ types.Named("output", types.N).Description("count of occurrences, `0` if not found"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var StartsWith = &Builtin{ @@ -1203,7 +1203,7 @@ var StartsWith = &Builtin{ types.Named("result", types.B).Description("result of the prefix check"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var EndsWith = &Builtin{ @@ -1217,7 +1217,7 @@ var EndsWith = &Builtin{ types.Named("result", types.B).Description("result of the suffix check"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var Lower = &Builtin{ @@ -1230,7 +1230,7 @@ var Lower = &Builtin{ types.Named("y", types.S).Description("lower-case of x"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var Upper = &Builtin{ @@ -1243,7 +1243,7 @@ var Upper = &Builtin{ types.Named("y", types.S).Description("upper-case of x"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var Split = &Builtin{ @@ -1257,7 +1257,7 @@ var Split = &Builtin{ types.Named("ys", types.NewArray(nil, types.S)).Description("split parts"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var Replace = &Builtin{ @@ -1272,7 +1272,7 @@ var Replace = &Builtin{ types.Named("y", types.S).Description("string with replaced substrings"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var ReplaceN = &Builtin{ @@ -1292,7 +1292,7 @@ The old string comparisons are done in argument order.`, ), types.Named("output", types.S).Description("string with replaced substrings"), ), - canSkipBctx: true, + CanSkipBctx: true, } var RegexReplace = &Builtin{ @@ -1306,7 +1306,7 @@ var RegexReplace = &Builtin{ ), types.Named("output", types.S).Description("string with replaced substrings"), ), - canSkipBctx: false, + CanSkipBctx: false, } var Trim = &Builtin{ @@ -1320,7 +1320,7 @@ var Trim = &Builtin{ types.Named("output", types.S).Description("string trimmed of `cutset` characters"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var TrimLeft = &Builtin{ @@ -1334,7 +1334,7 @@ var TrimLeft = &Builtin{ types.Named("output", types.S).Description("string left-trimmed of `cutset` characters"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var TrimPrefix = &Builtin{ @@ -1348,7 +1348,7 @@ var TrimPrefix = &Builtin{ types.Named("output", types.S).Description("string with `prefix` cut off"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var TrimRight = &Builtin{ @@ -1362,7 +1362,7 @@ var TrimRight = &Builtin{ types.Named("output", types.S).Description("string right-trimmed of `cutset` characters"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var TrimSuffix = &Builtin{ @@ -1376,7 +1376,7 @@ var TrimSuffix = &Builtin{ types.Named("output", types.S).Description("string with `suffix` cut off"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var TrimSpace = &Builtin{ @@ -1389,7 +1389,7 @@ var TrimSpace = &Builtin{ types.Named("output", types.S).Description("string leading and trailing white space cut off"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var Sprintf = &Builtin{ @@ -1403,7 +1403,7 @@ var Sprintf = &Builtin{ types.Named("output", types.S).Description("`format` formatted by the values in `values`"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var StringReverse = &Builtin{ @@ -1416,7 +1416,7 @@ var StringReverse = &Builtin{ types.Named("y", types.S).Description("reversed string"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } var RenderTemplate = &Builtin{ @@ -1431,7 +1431,7 @@ var RenderTemplate = &Builtin{ types.Named("result", types.S).Description("rendered template with template variables injected"), ), Categories: stringsCat, - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -1452,7 +1452,7 @@ var RandIntn = &Builtin{ ), Categories: number, Nondeterministic: true, - canSkipBctx: false, + CanSkipBctx: false, } var NumbersRange = &Builtin{ @@ -1465,7 +1465,7 @@ var NumbersRange = &Builtin{ ), types.Named("range", types.NewArray(nil, types.N)).Description("the range between `a` and `b`"), ), - canSkipBctx: false, // needed for context timeout check + CanSkipBctx: false, // needed for context timeout check } var NumbersRangeStep = &Builtin{ @@ -1483,7 +1483,7 @@ var NumbersRangeStep = &Builtin{ ), types.Named("range", types.NewArray(nil, types.N)).Description("the range between `a` and `b` in `step` increments"), ), - canSkipBctx: false, // needed for context timeout check + CanSkipBctx: false, // needed for context timeout check } /** @@ -1508,7 +1508,7 @@ respectively. Other units are case-insensitive.`, ), types.Named("y", types.N).Description("the parsed number"), ), - canSkipBctx: true, + CanSkipBctx: true, } var UnitsParseBytes = &Builtin{ @@ -1527,7 +1527,7 @@ and "MiB" are equivalent).`, ), types.Named("y", types.N).Description("the parsed number"), ), - canSkipBctx: true, + CanSkipBctx: true, } // @@ -1547,7 +1547,7 @@ var UUIDRFC4122 = &Builtin{ types.Named("output", types.S).Description("a version 4 UUID; for any given `k`, the output will be consistent throughout a query evaluation"), ), Nondeterministic: true, - canSkipBctx: false, + CanSkipBctx: false, } var UUIDParse = &Builtin{ @@ -1561,7 +1561,7 @@ var UUIDParse = &Builtin{ types.Named("result", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("Properties of UUID if valid (version, variant, etc). Undefined otherwise."), ), Relation: false, - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -1606,7 +1606,7 @@ var JSONFilter = &Builtin{ types.Named("filtered", types.A).Description("remaining data from `object` with only keys specified in `paths`"), ), Categories: objectCat, - canSkipBctx: true, + CanSkipBctx: true, } var JSONRemove = &Builtin{ @@ -1645,7 +1645,7 @@ var JSONRemove = &Builtin{ types.Named("output", types.A).Description("result of removing all keys specified in `paths`"), ), Categories: objectCat, - canSkipBctx: true, + CanSkipBctx: true, } var JSONPatch = &Builtin{ @@ -1671,7 +1671,7 @@ var JSONPatch = &Builtin{ types.Named("output", types.A).Description("result obtained after consecutively applying all patch operations in `patches`"), ), Categories: objectCat, - canSkipBctx: true, + CanSkipBctx: true, } var ObjectSubset = &Builtin{ @@ -1705,7 +1705,7 @@ var ObjectSubset = &Builtin{ ), types.Named("result", types.A).Description("`true` if `sub` is a subset of `super`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var ObjectUnion = &Builtin{ @@ -1725,7 +1725,7 @@ var ObjectUnion = &Builtin{ ), types.Named("output", types.A).Description("a new object which is the result of an asymmetric recursive union of two objects where conflicts are resolved by choosing the key from the right-hand object `b`"), ), // TODO(sr): types.A? ^^^^^^^ (also below) - canSkipBctx: true, + CanSkipBctx: true, } var ObjectUnionN = &Builtin{ @@ -1741,7 +1741,7 @@ var ObjectUnionN = &Builtin{ ), types.Named("output", types.A).Description("asymmetric recursive union of all objects in `objects`, merged from left to right, where conflicts are resolved by choosing the key from the right-hand object"), ), - canSkipBctx: true, + CanSkipBctx: true, } var ObjectRemove = &Builtin{ @@ -1761,7 +1761,7 @@ var ObjectRemove = &Builtin{ ), types.Named("output", types.A).Description("result of removing the specified `keys` from `object`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var ObjectFilter = &Builtin{ @@ -1782,7 +1782,7 @@ var ObjectFilter = &Builtin{ ), types.Named("filtered", types.A).Description("remaining data from `object` with only keys specified in `keys`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var ObjectGet = &Builtin{ @@ -1798,7 +1798,7 @@ var ObjectGet = &Builtin{ ), types.Named("value", types.A).Description("`object[key]` if present, otherwise `default`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var ObjectKeys = &Builtin{ @@ -1811,7 +1811,7 @@ var ObjectKeys = &Builtin{ ), types.Named("value", types.SetOfAny).Description("set of `object`'s keys"), ), - canSkipBctx: true, + CanSkipBctx: true, } /* @@ -1829,7 +1829,7 @@ var JSONMarshal = &Builtin{ types.Named("y", types.S).Description("the JSON string representation of `x`"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var JSONMarshalWithOptions = &Builtin{ @@ -1851,7 +1851,7 @@ var JSONMarshalWithOptions = &Builtin{ types.Named("y", types.S).Description("the JSON string representation of `x`, with configured prefix/indent string(s) as appropriate"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var JSONUnmarshal = &Builtin{ @@ -1864,7 +1864,7 @@ var JSONUnmarshal = &Builtin{ types.Named("y", types.A).Description("the term deserialized from `x`"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var JSONIsValid = &Builtin{ @@ -1877,7 +1877,7 @@ var JSONIsValid = &Builtin{ types.Named("result", types.B).Description("`true` if `x` is valid JSON, `false` otherwise"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var Base64Encode = &Builtin{ @@ -1890,7 +1890,7 @@ var Base64Encode = &Builtin{ types.Named("y", types.S).Description("base64 serialization of `x`"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var Base64Decode = &Builtin{ @@ -1903,7 +1903,7 @@ var Base64Decode = &Builtin{ types.Named("y", types.S).Description("base64 deserialization of `x`"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var Base64IsValid = &Builtin{ @@ -1916,7 +1916,7 @@ var Base64IsValid = &Builtin{ types.Named("result", types.B).Description("`true` if `x` is valid base64 encoded value, `false` otherwise"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var Base64UrlEncode = &Builtin{ @@ -1929,7 +1929,7 @@ var Base64UrlEncode = &Builtin{ types.Named("y", types.S).Description("base64url serialization of `x`"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var Base64UrlEncodeNoPad = &Builtin{ @@ -1942,7 +1942,7 @@ var Base64UrlEncodeNoPad = &Builtin{ types.Named("y", types.S).Description("base64url serialization of `x`"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var Base64UrlDecode = &Builtin{ @@ -1955,7 +1955,7 @@ var Base64UrlDecode = &Builtin{ types.Named("y", types.S).Description("base64url deserialization of `x`"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var URLQueryDecode = &Builtin{ @@ -1968,7 +1968,7 @@ var URLQueryDecode = &Builtin{ types.Named("y", types.S).Description("URL-encoding deserialization of `x`"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var URLQueryEncode = &Builtin{ @@ -1981,7 +1981,7 @@ var URLQueryEncode = &Builtin{ types.Named("y", types.S).Description("URL-encoding serialization of `x`"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var URLQueryEncodeObject = &Builtin{ @@ -2005,7 +2005,7 @@ var URLQueryEncodeObject = &Builtin{ types.Named("y", types.S).Description("the URL-encoded serialization of `object`"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var URLQueryDecodeObject = &Builtin{ @@ -2020,7 +2020,7 @@ var URLQueryDecodeObject = &Builtin{ types.NewArray(nil, types.S)))).Description("the resulting object"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var YAMLMarshal = &Builtin{ @@ -2033,7 +2033,7 @@ var YAMLMarshal = &Builtin{ types.Named("y", types.S).Description("the YAML string representation of `x`"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var YAMLUnmarshal = &Builtin{ @@ -2046,7 +2046,7 @@ var YAMLUnmarshal = &Builtin{ types.Named("y", types.A).Description("the term deserialized from `x`"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } // YAMLIsValid verifies the input string is a valid YAML document. @@ -2060,7 +2060,7 @@ var YAMLIsValid = &Builtin{ types.Named("result", types.B).Description("`true` if `x` is valid YAML, `false` otherwise"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var HexEncode = &Builtin{ @@ -2073,7 +2073,7 @@ var HexEncode = &Builtin{ types.Named("y", types.S).Description("serialization of `x` using hex-encoding"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } var HexDecode = &Builtin{ @@ -2086,7 +2086,7 @@ var HexDecode = &Builtin{ types.Named("y", types.S).Description("deserialized from `x`"), ), Categories: encoding, - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -2108,7 +2108,7 @@ var JWTDecode = &Builtin{ }, nil)).Description("`[header, payload, sig]`, where `header` and `payload` are objects; `sig` is the hexadecimal representation of the signature on the token."), ), Categories: tokensCat, - canSkipBctx: true, + CanSkipBctx: true, } var JWTVerifyRS256 = &Builtin{ @@ -2122,7 +2122,7 @@ var JWTVerifyRS256 = &Builtin{ types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), Categories: tokensCat, - canSkipBctx: false, + CanSkipBctx: false, } var JWTVerifyRS384 = &Builtin{ @@ -2136,7 +2136,7 @@ var JWTVerifyRS384 = &Builtin{ types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), Categories: tokensCat, - canSkipBctx: false, + CanSkipBctx: false, } var JWTVerifyRS512 = &Builtin{ @@ -2150,7 +2150,7 @@ var JWTVerifyRS512 = &Builtin{ types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), Categories: tokensCat, - canSkipBctx: false, + CanSkipBctx: false, } var JWTVerifyPS256 = &Builtin{ @@ -2164,7 +2164,7 @@ var JWTVerifyPS256 = &Builtin{ types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), Categories: tokensCat, - canSkipBctx: false, + CanSkipBctx: false, } var JWTVerifyPS384 = &Builtin{ @@ -2178,7 +2178,7 @@ var JWTVerifyPS384 = &Builtin{ types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), Categories: tokensCat, - canSkipBctx: false, + CanSkipBctx: false, } var JWTVerifyPS512 = &Builtin{ @@ -2192,7 +2192,7 @@ var JWTVerifyPS512 = &Builtin{ types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), Categories: tokensCat, - canSkipBctx: false, + CanSkipBctx: false, } var JWTVerifyES256 = &Builtin{ @@ -2206,7 +2206,7 @@ var JWTVerifyES256 = &Builtin{ types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), Categories: tokensCat, - canSkipBctx: false, + CanSkipBctx: false, } var JWTVerifyES384 = &Builtin{ @@ -2220,7 +2220,7 @@ var JWTVerifyES384 = &Builtin{ types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), Categories: tokensCat, - canSkipBctx: false, + CanSkipBctx: false, } var JWTVerifyES512 = &Builtin{ @@ -2234,7 +2234,7 @@ var JWTVerifyES512 = &Builtin{ types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), Categories: tokensCat, - canSkipBctx: false, + CanSkipBctx: false, } var JWTVerifyEdDSA = &Builtin{ @@ -2248,7 +2248,7 @@ var JWTVerifyEdDSA = &Builtin{ types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), Categories: tokensCat, - canSkipBctx: false, + CanSkipBctx: false, } var JWTVerifyHS256 = &Builtin{ @@ -2262,7 +2262,7 @@ var JWTVerifyHS256 = &Builtin{ types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), Categories: tokensCat, - canSkipBctx: false, + CanSkipBctx: false, } var JWTVerifyHS384 = &Builtin{ @@ -2276,7 +2276,7 @@ var JWTVerifyHS384 = &Builtin{ types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), Categories: tokensCat, - canSkipBctx: false, + CanSkipBctx: false, } var JWTVerifyHS512 = &Builtin{ @@ -2290,7 +2290,7 @@ var JWTVerifyHS512 = &Builtin{ types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), Categories: tokensCat, - canSkipBctx: false, + CanSkipBctx: false, } // Marked non-deterministic because it relies on time internally. @@ -2311,7 +2311,7 @@ Supports the following algorithms: HS256, HS384, HS512, RS256, RS384, RS512, ES2 ), Categories: tokensCat, Nondeterministic: true, - canSkipBctx: false, + CanSkipBctx: false, } var tokenSign = category("tokensign") @@ -2330,7 +2330,7 @@ var JWTEncodeSignRaw = &Builtin{ ), Categories: tokenSign, Nondeterministic: true, - canSkipBctx: false, + CanSkipBctx: false, } // Marked non-deterministic because it relies on RNG internally. @@ -2347,7 +2347,7 @@ var JWTEncodeSign = &Builtin{ ), Categories: tokenSign, Nondeterministic: true, - canSkipBctx: false, + CanSkipBctx: false, } /** @@ -2363,7 +2363,7 @@ var NowNanos = &Builtin{ types.Named("now", types.N).Description("nanoseconds since epoch"), ), Nondeterministic: true, - canSkipBctx: false, + CanSkipBctx: false, } var ParseNanos = &Builtin{ @@ -2376,7 +2376,7 @@ var ParseNanos = &Builtin{ ), types.Named("ns", types.N).Description("`value` in nanoseconds since epoch"), ), - canSkipBctx: true, + CanSkipBctx: true, } var ParseRFC3339Nanos = &Builtin{ @@ -2388,7 +2388,7 @@ var ParseRFC3339Nanos = &Builtin{ ), types.Named("ns", types.N).Description("`value` in nanoseconds since epoch"), ), - canSkipBctx: true, + CanSkipBctx: true, } var ParseDurationNanos = &Builtin{ @@ -2400,7 +2400,7 @@ var ParseDurationNanos = &Builtin{ ), types.Named("ns", types.N).Description("the `duration` in nanoseconds"), ), - canSkipBctx: true, + CanSkipBctx: true, } var Format = &Builtin{ @@ -2416,7 +2416,7 @@ var Format = &Builtin{ ), types.Named("formatted timestamp", types.S).Description("the formatted timestamp represented for the nanoseconds since the epoch in the supplied timezone (or UTC)"), ), - canSkipBctx: true, + CanSkipBctx: true, } var Date = &Builtin{ @@ -2431,7 +2431,7 @@ var Date = &Builtin{ ), types.Named("date", types.NewArray([]types.Type{types.N, types.N, types.N}, nil)).Description("an array of `year`, `month` (1-12), and `day` (1-31)"), ), - canSkipBctx: true, + CanSkipBctx: true, } var Clock = &Builtin{ @@ -2447,7 +2447,7 @@ var Clock = &Builtin{ types.Named("output", types.NewArray([]types.Type{types.N, types.N, types.N}, nil)). Description("the `hour`, `minute` (0-59), and `second` (0-59) representing the time of day for the nanoseconds since epoch in the supplied timezone (or UTC)"), ), - canSkipBctx: true, + CanSkipBctx: true, } var Weekday = &Builtin{ @@ -2462,7 +2462,7 @@ var Weekday = &Builtin{ ), types.Named("day", types.S).Description("the weekday represented by `ns` nanoseconds since the epoch in the supplied timezone (or UTC)"), ), - canSkipBctx: true, + CanSkipBctx: true, } var AddDate = &Builtin{ @@ -2477,7 +2477,7 @@ var AddDate = &Builtin{ ), types.Named("output", types.N).Description("nanoseconds since the epoch representing the input time, with years, months and days added"), ), - canSkipBctx: true, + CanSkipBctx: true, } var Diff = &Builtin{ @@ -2496,7 +2496,7 @@ var Diff = &Builtin{ ), types.Named("output", types.NewArray([]types.Type{types.N, types.N, types.N, types.N, types.N, types.N}, nil)).Description("difference between `ns1` and `ns2` (in their supplied timezones, if supplied, or UTC) as array of numbers: `[years, months, days, hours, minutes, seconds]`"), ), - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -2516,7 +2516,7 @@ concatenated PEM blocks. The whole input of concatenated PEM blocks can optional ), types.Named("output", types.NewArray(nil, types.NewObject(nil, types.NewDynamicProperty(types.S, types.A)))).Description("parsed X.509 certificates represented as objects"), ), - canSkipBctx: true, + CanSkipBctx: true, } var CryptoX509ParseAndVerifyCertificates = &Builtin{ @@ -2536,7 +2536,7 @@ with all others being treated as intermediates.`, types.NewArray(nil, types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))), }, nil)).Description("array of `[valid, certs]`: if the input certificate chain could be verified then `valid` is `true` and `certs` is an array of X.509 certificates represented as objects; if the input certificate chain could not be verified then `valid` is `false` and `certs` is `[]`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var CryptoX509ParseAndVerifyCertificatesWithOptions = &Builtin{ @@ -2561,7 +2561,7 @@ with all others being treated as intermediates.`, types.NewArray(nil, types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))), }, nil)).Description("array of `[valid, certs]`: if the input certificate chain could be verified then `valid` is `true` and `certs` is an array of X.509 certificates represented as objects; if the input certificate chain could not be verified then `valid` is `false` and `certs` is `[]`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var CryptoX509ParseCertificateRequest = &Builtin{ @@ -2573,7 +2573,7 @@ var CryptoX509ParseCertificateRequest = &Builtin{ ), types.Named("output", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("X.509 CSR represented as an object"), ), - canSkipBctx: true, + CanSkipBctx: true, } var CryptoX509ParseKeyPair = &Builtin{ @@ -2586,7 +2586,7 @@ var CryptoX509ParseKeyPair = &Builtin{ ), types.Named("output", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("if key pair is valid, returns the tls.certificate(https://pkg.go.dev/crypto/tls#Certificate) as an object. If the key pair is invalid, nil and an error are returned."), ), - canSkipBctx: true, + CanSkipBctx: true, } var CryptoX509ParseRSAPrivateKey = &Builtin{ @@ -2598,7 +2598,7 @@ var CryptoX509ParseRSAPrivateKey = &Builtin{ ), types.Named("output", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("JWK as an object"), ), - canSkipBctx: true, + CanSkipBctx: true, } var CryptoParsePrivateKeys = &Builtin{ @@ -2612,7 +2612,7 @@ If the input is empty, the function will return null. The input string should be ), types.Named("output", types.NewArray(nil, types.NewObject(nil, types.NewDynamicProperty(types.S, types.A)))).Description("parsed private keys represented as objects"), ), - canSkipBctx: true, + CanSkipBctx: true, } var CryptoMd5 = &Builtin{ @@ -2624,7 +2624,7 @@ var CryptoMd5 = &Builtin{ ), types.Named("y", types.S).Description("MD5-hash of `x`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var CryptoSha1 = &Builtin{ @@ -2636,7 +2636,7 @@ var CryptoSha1 = &Builtin{ ), types.Named("y", types.S).Description("SHA1-hash of `x`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var CryptoSha256 = &Builtin{ @@ -2648,7 +2648,7 @@ var CryptoSha256 = &Builtin{ ), types.Named("y", types.S).Description("SHA256-hash of `x`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var CryptoHmacMd5 = &Builtin{ @@ -2661,7 +2661,7 @@ var CryptoHmacMd5 = &Builtin{ ), types.Named("y", types.S).Description("MD5-HMAC of `x`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var CryptoHmacSha1 = &Builtin{ @@ -2674,7 +2674,7 @@ var CryptoHmacSha1 = &Builtin{ ), types.Named("y", types.S).Description("SHA1-HMAC of `x`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var CryptoHmacSha256 = &Builtin{ @@ -2687,7 +2687,7 @@ var CryptoHmacSha256 = &Builtin{ ), types.Named("y", types.S).Description("SHA256-HMAC of `x`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var CryptoHmacSha512 = &Builtin{ @@ -2700,7 +2700,7 @@ var CryptoHmacSha512 = &Builtin{ ), types.Named("y", types.S).Description("SHA512-HMAC of `x`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var CryptoHmacEqual = &Builtin{ @@ -2713,7 +2713,7 @@ var CryptoHmacEqual = &Builtin{ ), types.Named("result", types.B).Description("`true` if the MACs are equals, `false` otherwise"), ), - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -2738,7 +2738,7 @@ var WalkBuiltin = &Builtin{ )).Description("pairs of `path` and `value`: `path` is an array representing the pointer to `value` in `x`. If `path` is assigned a wildcard (`_`), the `walk` function will skip path creation entirely for faster evaluation."), ), Categories: graphs, - canSkipBctx: true, + CanSkipBctx: true, } var ReachableBuiltin = &Builtin{ @@ -2759,7 +2759,7 @@ var ReachableBuiltin = &Builtin{ ), types.Named("output", types.SetOfAny).Description("set of vertices reachable from the `initial` vertices in the directed `graph`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var ReachablePathsBuiltin = &Builtin{ @@ -2780,7 +2780,7 @@ var ReachablePathsBuiltin = &Builtin{ ), types.Named("output", types.NewSet(types.NewArray(nil, types.A))).Description("paths reachable from the `initial` vertices in the directed `graph`"), ), - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -2798,7 +2798,7 @@ var IsNumber = &Builtin{ types.Named("result", types.B).Description("`true` if `x` is a number, `false` otherwise."), ), Categories: typesCat, - canSkipBctx: true, + CanSkipBctx: true, } var IsString = &Builtin{ @@ -2811,7 +2811,7 @@ var IsString = &Builtin{ types.Named("result", types.B).Description("`true` if `x` is a string, `false` otherwise."), ), Categories: typesCat, - canSkipBctx: true, + CanSkipBctx: true, } var IsBoolean = &Builtin{ @@ -2824,7 +2824,7 @@ var IsBoolean = &Builtin{ types.Named("result", types.B).Description("`true` if `x` is an boolean, `false` otherwise."), ), Categories: typesCat, - canSkipBctx: true, + CanSkipBctx: true, } var IsArray = &Builtin{ @@ -2837,7 +2837,7 @@ var IsArray = &Builtin{ types.Named("result", types.B).Description("`true` if `x` is an array, `false` otherwise."), ), Categories: typesCat, - canSkipBctx: true, + CanSkipBctx: true, } var IsSet = &Builtin{ @@ -2850,7 +2850,7 @@ var IsSet = &Builtin{ types.Named("result", types.B).Description("`true` if `x` is a set, `false` otherwise."), ), Categories: typesCat, - canSkipBctx: true, + CanSkipBctx: true, } var IsObject = &Builtin{ @@ -2863,7 +2863,7 @@ var IsObject = &Builtin{ types.Named("result", types.B).Description("`true` if `x` is an object, `false` otherwise."), ), Categories: typesCat, - canSkipBctx: true, + CanSkipBctx: true, } var IsNull = &Builtin{ @@ -2876,7 +2876,7 @@ var IsNull = &Builtin{ types.Named("result", types.B).Description("`true` if `x` is null, `false` otherwise."), ), Categories: typesCat, - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -2894,7 +2894,7 @@ var TypeNameBuiltin = &Builtin{ types.Named("type", types.S).Description(`one of "null", "boolean", "number", "string", "array", "object", "set"`), ), Categories: typesCat, - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -2914,7 +2914,7 @@ var HTTPSend = &Builtin{ Description("the HTTP response object"), ), Nondeterministic: true, - canSkipBctx: false, + CanSkipBctx: false, } /** @@ -2937,7 +2937,7 @@ var GraphQLParse = &Builtin{ types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)), }, nil)).Description("`output` is of the form `[query_ast, schema_ast]`. If the GraphQL query is valid given the provided schema, then `query_ast` and `schema_ast` are objects describing the ASTs for the query and schema."), ), - canSkipBctx: false, + CanSkipBctx: false, } // GraphQLParseAndVerify returns a boolean and a pair of AST object from parsing/validation. @@ -2957,7 +2957,7 @@ var GraphQLParseAndVerify = &Builtin{ types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)), }, nil)).Description(" `output` is of the form `[valid, query_ast, schema_ast]`. If the query is valid given the provided schema, then `valid` is `true`, and `query_ast` and `schema_ast` are objects describing the ASTs for the GraphQL query and schema. Otherwise, `valid` is `false` and `query_ast` and `schema_ast` are `{}`."), ), - canSkipBctx: false, + CanSkipBctx: false, } // GraphQLParseQuery parses the input GraphQL query and returns a JSON @@ -2971,7 +2971,7 @@ var GraphQLParseQuery = &Builtin{ ), types.Named("output", types.NewObject(nil, types.NewDynamicProperty(types.A, types.A))).Description("AST object for the GraphQL query."), ), - canSkipBctx: true, + CanSkipBctx: true, } // GraphQLParseSchema parses the input GraphQL schema and returns a JSON @@ -2985,7 +2985,7 @@ var GraphQLParseSchema = &Builtin{ ), types.Named("output", types.NewObject(nil, types.NewDynamicProperty(types.A, types.A))).Description("AST object for the GraphQL schema."), ), - canSkipBctx: false, + CanSkipBctx: false, } // GraphQLIsValid returns true if a GraphQL query is valid with a given @@ -3002,7 +3002,7 @@ var GraphQLIsValid = &Builtin{ ), types.Named("output", types.B).Description("`true` if the query is valid under the given schema. `false` otherwise."), ), - canSkipBctx: false, + CanSkipBctx: false, } // GraphQLSchemaIsValid returns true if the input is valid GraphQL schema, @@ -3017,7 +3017,7 @@ var GraphQLSchemaIsValid = &Builtin{ ), types.Named("output", types.B).Description("`true` if the schema is a valid GraphQL schema. `false` otherwise."), ), - canSkipBctx: false, + CanSkipBctx: false, } /** @@ -3041,7 +3041,7 @@ var JSONSchemaVerify = &Builtin{ Description("`output` is of the form `[valid, error]`. If the schema is valid, then `valid` is `true`, and `error` is `null`. Otherwise, `valid` is `false` and `error` is a string describing the error."), ), Categories: objectCat, - canSkipBctx: true, + CanSkipBctx: true, } // JSONMatchSchema returns empty array if the document matches the JSON schema, @@ -3073,7 +3073,7 @@ var JSONMatchSchema = &Builtin{ Description("`output` is of the form `[match, errors]`. If the document is valid given the schema, then `match` is `true`, and `errors` is an empty array. Otherwise, `match` is `false` and `errors` is an array of objects describing the error(s)."), ), Categories: objectCat, - canSkipBctx: false, + CanSkipBctx: false, } /** @@ -3096,7 +3096,7 @@ var ProvidersAWSSignReqObj = &Builtin{ Description("HTTP request object with `Authorization` header"), ), Categories: providersAWSCat, - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -3114,7 +3114,7 @@ var RegoParseModule = &Builtin{ types.Named("output", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))). Description("AST object for the Rego module"), ), - canSkipBctx: true, + CanSkipBctx: true, } var RegoMetadataChain = &Builtin{ @@ -3127,7 +3127,7 @@ The first entry in the chain always points to the active rule, even if it has no types.Args(), types.Named("chain", types.NewArray(nil, types.A)).Description("each array entry represents a node in the path ancestry (chain) of the active rule that also has declared annotations"), ), - canSkipBctx: true, + CanSkipBctx: true, } // RegoMetadataRule returns the metadata for the active rule @@ -3138,7 +3138,7 @@ var RegoMetadataRule = &Builtin{ types.Args(), types.Named("output", types.A).Description("\"rule\" scope annotations for this rule; empty object if no annotations exist"), ), - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -3155,7 +3155,7 @@ var OPARuntime = &Builtin{ Description("includes a `config` key if OPA was started with a configuration file; an `env` key containing the environment variables that the OPA process was started with; includes `version` and `commit` keys containing the version and build commit of OPA."), ), Nondeterministic: true, - canSkipBctx: false, + CanSkipBctx: false, } /** @@ -3173,7 +3173,7 @@ var Trace = &Builtin{ types.Named("result", types.B).Description("always `true`"), ), Categories: tracing, - canSkipBctx: false, + CanSkipBctx: false, } /** @@ -3194,7 +3194,7 @@ var GlobMatch = &Builtin{ ), types.Named("result", types.B).Description("true if `match` can be found in `pattern` which is separated by `delimiters`"), ), - canSkipBctx: false, + CanSkipBctx: false, } var GlobQuoteMeta = &Builtin{ @@ -3206,7 +3206,7 @@ var GlobQuoteMeta = &Builtin{ ), types.Named("output", types.S).Description("the escaped string of `pattern`"), ), - canSkipBctx: true, + CanSkipBctx: true, // TODO(sr): example for this was: Calling ``glob.quote_meta("*.github.com", output)`` returns ``\\*.github.com`` as ``output``. } @@ -3224,7 +3224,7 @@ var NetCIDRIntersects = &Builtin{ ), types.Named("result", types.B).Description("`true` if `cidr1` intersects with `cidr2`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var NetCIDRExpand = &Builtin{ @@ -3236,7 +3236,7 @@ var NetCIDRExpand = &Builtin{ ), types.Named("hosts", types.SetOfStr).Description("set of IP addresses the CIDR `cidr` expands to"), ), - canSkipBctx: false, + CanSkipBctx: false, } var NetCIDRContains = &Builtin{ @@ -3249,7 +3249,7 @@ var NetCIDRContains = &Builtin{ ), types.Named("result", types.B).Description("`true` if `cidr_or_ip` is contained within `cidr`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var NetCIDRContainsMatches = &Builtin{ @@ -3263,7 +3263,7 @@ var NetCIDRContainsMatches = &Builtin{ ), types.Named("output", types.NewSet(types.NewArray([]types.Type{types.A, types.A}, nil))).Description("tuples identifying matches where `cidrs_or_ips` are contained within `cidrs`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var NetCIDRMerge = &Builtin{ @@ -3280,7 +3280,7 @@ Supports both IPv4 and IPv6 notations. IPv6 inputs need a prefix length (e.g. "/ ), types.Named("output", types.SetOfStr).Description("smallest possible set of CIDRs obtained after merging the provided list of IP addresses and subnets in `addrs`"), ), - canSkipBctx: true, + CanSkipBctx: true, } var NetCIDRIsValid = &Builtin{ @@ -3292,7 +3292,7 @@ var NetCIDRIsValid = &Builtin{ ), types.Named("result", types.B).Description("`true` if `cidr` is a valid CIDR"), ), - canSkipBctx: true, + CanSkipBctx: true, } var netCidrContainsMatchesOperandType = types.NewAny( @@ -3325,7 +3325,7 @@ var NetLookupIPAddr = &Builtin{ types.Named("addrs", types.SetOfStr).Description("IP addresses (v4 and v6) that `name` resolves to"), ), Nondeterministic: true, - canSkipBctx: false, + CanSkipBctx: false, } /** @@ -3341,7 +3341,7 @@ var SemVerIsValid = &Builtin{ ), types.Named("result", types.B).Description("`true` if `vsn` is a valid SemVer; `false` otherwise"), ), - canSkipBctx: true, + CanSkipBctx: true, } var SemVerCompare = &Builtin{ @@ -3354,7 +3354,7 @@ var SemVerCompare = &Builtin{ ), types.Named("result", types.N).Description("`-1` if `a < b`; `1` if `a > b`; `0` if `a == b`"), ), - canSkipBctx: true, + CanSkipBctx: true, } /** @@ -3398,7 +3398,7 @@ var SetDiff = &Builtin{ types.SetOfAny, ), deprecated: true, - canSkipBctx: true, + CanSkipBctx: true, } // NetCIDROverlap has been replaced by the `net.cidr_contains` built-in. @@ -3412,7 +3412,7 @@ var NetCIDROverlap = &Builtin{ types.B, ), deprecated: true, - canSkipBctx: true, + CanSkipBctx: true, } // CastArray checks the underlying type of the input. If it is array or set, an array @@ -3424,7 +3424,7 @@ var CastArray = &Builtin{ types.NewArray(nil, types.A), ), deprecated: true, - canSkipBctx: true, + CanSkipBctx: true, } // CastSet checks the underlying type of the input. @@ -3438,7 +3438,7 @@ var CastSet = &Builtin{ types.SetOfAny, ), deprecated: true, - canSkipBctx: true, + CanSkipBctx: true, } // CastString returns input if it is a string; if not returns error. @@ -3450,7 +3450,7 @@ var CastString = &Builtin{ types.S, ), deprecated: true, - canSkipBctx: true, + CanSkipBctx: true, } // CastBoolean returns input if it is a boolean; if not returns error. @@ -3461,7 +3461,7 @@ var CastBoolean = &Builtin{ types.B, ), deprecated: true, - canSkipBctx: true, + CanSkipBctx: true, } // CastNull returns null if input is null; if not returns error. @@ -3472,7 +3472,7 @@ var CastNull = &Builtin{ types.Nl, ), deprecated: true, - canSkipBctx: true, + CanSkipBctx: true, } // CastObject returns the given object if it is null; throws an error otherwise @@ -3483,7 +3483,7 @@ var CastObject = &Builtin{ types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)), ), deprecated: true, - canSkipBctx: true, + CanSkipBctx: true, } // RegexMatchDeprecated declares `re_match` which has been deprecated. Use `regex.match` instead. @@ -3497,7 +3497,7 @@ var RegexMatchDeprecated = &Builtin{ types.B, ), deprecated: true, - canSkipBctx: false, + CanSkipBctx: false, } // All takes a list and returns true if all of the items @@ -3514,7 +3514,7 @@ var All = &Builtin{ types.B, ), deprecated: true, - canSkipBctx: true, + CanSkipBctx: true, } // Any takes a collection and returns true if any of the items @@ -3531,7 +3531,7 @@ var Any = &Builtin{ types.B, ), deprecated: true, - canSkipBctx: true, + CanSkipBctx: true, } // Builtin represents a built-in function supported by OPA. Every built-in @@ -3545,11 +3545,11 @@ type Builtin struct { // "minus" for example, is part of two categories: numbers and sets. (NOTE(sr): aspirational) Categories []string `json:"categories,omitempty"` - Decl *types.Function `json:"decl"` // Built-in function type declaration. - Infix string `json:"infix,omitempty"` // Unique name of infix operator. Default should be unset. - Relation bool `json:"relation,omitempty"` // Indicates if the built-in acts as a relation. - deprecated bool // Indicates if the built-in has been deprecated. - canSkipBctx bool // Built-in needs no data from the built-in context. + Decl *types.Function `json:"decl"` // Built-in function type declaration. + Infix string `json:"infix,omitempty"` // Unique name of infix operator. Default should be unset. + Relation bool `json:"relation,omitempty"` // Indicates if the built-in acts as a relation. + deprecated bool `json:"-"` // Indicates if the built-in has been deprecated. + CanSkipBctx bool `json:"-"` // Built-in needs no data from the built-in context. Nondeterministic bool `json:"nondeterministic,omitempty"` // Indicates if the built-in returns non-deterministic results. } @@ -3626,7 +3626,7 @@ func (b *Builtin) IsTargetPos(i int) bool { func (b *Builtin) NeedsBuiltInContext() bool { // Negated, so built-ins we don't know about (and who don't know about this option) // will get a built-in context provided to them. - return !b.canSkipBctx + return !b.CanSkipBctx } func init() { diff --git a/vendor/github.com/open-policy-agent/opa/v1/ast/capabilities.go b/vendor/github.com/open-policy-agent/opa/v1/ast/capabilities.go index 8c98c0a9eb..844cb66f0b 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/ast/capabilities.go +++ b/vendor/github.com/open-policy-agent/opa/v1/ast/capabilities.go @@ -95,7 +95,6 @@ type Capabilities struct { // As of now, this only controls fetching remote refs for using JSON Schemas in // the type checker. // TODO(sr): support ports to further restrict connection peers - // TODO(sr): support restricting `http.send` using the same mechanism (see https://github.com/open-policy-agent/opa/issues/3665) AllowNet []string `json:"allow_net,omitempty"` } @@ -220,6 +219,9 @@ func LoadCapabilitiesVersions() ([]string, error) { for _, ent := range ents { capabilitiesVersions = append(capabilitiesVersions, strings.Replace(ent.Name(), ".json", "", 1)) } + + slices.SortStableFunc(capabilitiesVersions, semver.Compare) + return capabilitiesVersions, nil } diff --git a/vendor/github.com/open-policy-agent/opa/v1/ast/compare.go b/vendor/github.com/open-policy-agent/opa/v1/ast/compare.go index c4754341de..663ad5ae05 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/ast/compare.go +++ b/vendor/github.com/open-policy-agent/opa/v1/ast/compare.go @@ -5,9 +5,10 @@ package ast import ( - "encoding/json" + "cmp" "fmt" "math/big" + "strings" ) // Compare returns an integer indicating whether two AST values are less than, @@ -77,8 +78,7 @@ func Compare(a, b any) int { case Null: return 0 case Boolean: - b := b.(Boolean) - if a.Equal(b) { + if a == b.(Boolean) { return 0 } if !a { @@ -86,64 +86,10 @@ func Compare(a, b any) int { } return 1 case Number: - if ai, err := json.Number(a).Int64(); err == nil { - if bi, err := json.Number(b.(Number)).Int64(); err == nil { - if ai == bi { - return 0 - } - if ai < bi { - return -1 - } - return 1 - } - } - - // We use big.Rat for comparing big numbers. - // It replaces big.Float due to following reason: - // big.Float comes with a default precision of 64, and setting a - // larger precision results in more memory being allocated - // (regardless of the actual number we are parsing with SetString). - // - // Note: If we're so close to zero that big.Float says we are zero, do - // *not* big.Rat).SetString on the original string it'll potentially - // take very long. - var bigA, bigB *big.Rat - fa, ok := new(big.Float).SetString(string(a)) - if !ok { - panic("illegal value") - } - if fa.IsInt() { - if i, _ := fa.Int64(); i == 0 { - bigA = new(big.Rat).SetInt64(0) - } - } - if bigA == nil { - bigA, ok = new(big.Rat).SetString(string(a)) - if !ok { - panic("illegal value") - } - } - - fb, ok := new(big.Float).SetString(string(b.(Number))) - if !ok { - panic("illegal value") - } - if fb.IsInt() { - if i, _ := fb.Int64(); i == 0 { - bigB = new(big.Rat).SetInt64(0) - } - } - if bigB == nil { - bigB, ok = new(big.Rat).SetString(string(b.(Number))) - if !ok { - panic("illegal value") - } - } - - return bigA.Cmp(bigB) + return NumberCompare(a, b.(Number)) case String: b := b.(String) - if a.Equal(b) { + if a == b { return 0 } if a < b { @@ -153,8 +99,7 @@ func Compare(a, b any) int { case Var: return VarCompare(a, b.(Var)) case Ref: - b := b.(Ref) - return termSliceCompare(a, b) + return termSliceCompare(a, b.(Ref)) case *Array: b := b.(*Array) return termSliceCompare(a.elems, b.elems) @@ -164,11 +109,9 @@ func Compare(a, b any) int { if x, ok := b.(*lazyObj); ok { b = x.force() } - b := b.(*object) - return a.Compare(b) + return a.Compare(b.(*object)) case Set: - b := b.(Set) - return a.Compare(b) + return a.Compare(b.(Set)) case *ArrayComprehension: b := b.(*ArrayComprehension) if cmp := Compare(a.Term, b.Term); cmp != 0 { @@ -191,44 +134,31 @@ func Compare(a, b any) int { } return a.Body.Compare(b.Body) case Call: - b := b.(Call) - return termSliceCompare(a, b) + return termSliceCompare(a, b.(Call)) case *Expr: - b := b.(*Expr) - return a.Compare(b) + return a.Compare(b.(*Expr)) case *SomeDecl: - b := b.(*SomeDecl) - return a.Compare(b) + return a.Compare(b.(*SomeDecl)) case *Every: - b := b.(*Every) - return a.Compare(b) + return a.Compare(b.(*Every)) case *With: - b := b.(*With) - return a.Compare(b) + return a.Compare(b.(*With)) case Body: - b := b.(Body) - return a.Compare(b) + return a.Compare(b.(Body)) case *Head: - b := b.(*Head) - return a.Compare(b) + return a.Compare(b.(*Head)) case *Rule: - b := b.(*Rule) - return a.Compare(b) + return a.Compare(b.(*Rule)) case Args: - b := b.(Args) - return termSliceCompare(a, b) + return termSliceCompare(a, b.(Args)) case *Import: - b := b.(*Import) - return a.Compare(b) + return a.Compare(b.(*Import)) case *Package: - b := b.(*Package) - return a.Compare(b) + return a.Compare(b.(*Package)) case *Annotations: - b := b.(*Annotations) - return a.Compare(b) + return a.Compare(b.(*Annotations)) case *Module: - b := b.(*Module) - return a.Compare(b) + return a.Compare(b.(*Module)) } panic(fmt.Sprintf("illegal value: %T", a)) } @@ -427,3 +357,84 @@ func RefCompare(a, b Ref) int { func RefEqual(a, b Ref) bool { return termSliceEqual(a, b) } + +func NumberCompare(x, y Number) int { + xs, ys := string(x), string(y) + + var xIsF, yIsF bool + + // Treat "1" and "1.0", "1.00", etc as "1" + if strings.Contains(xs, ".") { + if tx := strings.TrimRight(xs, ".0"); tx != xs { + // Still a float after trimming? + xIsF = strings.Contains(tx, ".") + xs = tx + } + } + if strings.Contains(ys, ".") { + if ty := strings.TrimRight(ys, ".0"); ty != ys { + yIsF = strings.Contains(ty, ".") + ys = ty + } + } + if xs == ys { + return 0 + } + + var xi, yi int64 + var xf, yf float64 + var xiOK, yiOK, xfOK, yfOK bool + + if xi, xiOK = x.Int64(); xiOK { + if yi, yiOK = y.Int64(); yiOK { + return cmp.Compare(xi, yi) + } + } + + if xIsF && yIsF { + if xf, xfOK = x.Float64(); xfOK { + if yf, yfOK = y.Float64(); yfOK { + if xf == yf { + return 0 + } + // could still be "equal" depending on precision, so we continue? + } + } + } + + var a *big.Rat + fa, ok := new(big.Float).SetString(string(x)) + if !ok { + panic("illegal value") + } + if fa.IsInt() { + if i, _ := fa.Int64(); i == 0 { + a = new(big.Rat).SetInt64(0) + } + } + if a == nil { + a, ok = new(big.Rat).SetString(string(x)) + if !ok { + panic("illegal value") + } + } + + var b *big.Rat + fb, ok := new(big.Float).SetString(string(y)) + if !ok { + panic("illegal value") + } + if fb.IsInt() { + if i, _ := fb.Int64(); i == 0 { + b = new(big.Rat).SetInt64(0) + } + } + if b == nil { + b, ok = new(big.Rat).SetString(string(y)) + if !ok { + panic("illegal value") + } + } + + return a.Cmp(b) +} diff --git a/vendor/github.com/open-policy-agent/opa/v1/ast/compile.go b/vendor/github.com/open-policy-agent/opa/v1/ast/compile.go index 094e659328..62e22bf937 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/ast/compile.go +++ b/vendor/github.com/open-policy-agent/opa/v1/ast/compile.go @@ -2163,6 +2163,15 @@ func rewritePrintCalls(gen *localVarGenerator, getArity func(Ref) int, globals V var errs Errors safe := outputVarsForBody(body[:i], getArity, globals) safe.Update(globals) + + // Fixes Issue #7647 by adding generated variables to the safe set + WalkVars(body[:i], func(v Var) bool { + if v.IsGenerated() { + safe.Add(v) + } + return false + }) + args := body[i].Operands() var vis *VarVisitor diff --git a/vendor/github.com/open-policy-agent/opa/v1/ast/interning.go b/vendor/github.com/open-policy-agent/opa/v1/ast/interning.go index 564a3cc41f..fc5a89f69a 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/ast/interning.go +++ b/vendor/github.com/open-policy-agent/opa/v1/ast/interning.go @@ -18,7 +18,13 @@ type internable interface { // at any time without notice. var ( - InternedNullTerm = &Term{Value: Null{}} + InternedNullValue Value = Null{} + InternedNullTerm = &Term{Value: InternedNullValue} + + InternedBooleanTrueValue Value = Boolean(true) + InternedBooleanFalseValue Value = Boolean(false) + InternedBooleanTrueTerm = &Term{Value: InternedBooleanTrueValue} + InternedBooleanFalseTerm = &Term{Value: InternedBooleanFalseValue} InternedEmptyString = StringTerm("") InternedEmptyObject = ObjectTerm() @@ -27,11 +33,9 @@ var ( InternedEmptyArrayValue = NewArray() - booleanTrueTerm = &Term{Value: Boolean(true)} - booleanFalseTerm = &Term{Value: Boolean(false)} - // since this is by far the most common negative number - minusOneTerm = &Term{Value: Number("-1")} + minusOneValue Value = Number("-1") + minusOneTerm = &Term{Value: minusOneValue} internedStringTerms = map[string]*Term{ "": InternedEmptyString, @@ -52,6 +56,74 @@ func InternStringTerm(str ...string) { } } +// HasInternedValue returns true if the given value is interned, otherwise false. +func HasInternedValue[T internable](v T) bool { + switch value := any(v).(type) { + case bool: + return true + case int: + return HasInternedIntNumberTerm(value) + case int8: + return HasInternedIntNumberTerm(int(value)) + case int16: + return HasInternedIntNumberTerm(int(value)) + case int32: + return HasInternedIntNumberTerm(int(value)) + case int64: + return HasInternedIntNumberTerm(int(value)) + case uint: + return HasInternedIntNumberTerm(int(value)) + case uint8: + return HasInternedIntNumberTerm(int(value)) + case uint16: + return HasInternedIntNumberTerm(int(value)) + case uint32: + return HasInternedIntNumberTerm(int(value)) + case uint64: + return HasInternedIntNumberTerm(int(value)) + case string: + _, ok := internedStringTerms[value] + return ok + } + return false +} + +// InternedValue returns an interned Value for scalar v, if the value is +// interned. If the value is not interned, a new Value is returned. +func InternedValue[T internable](v T) Value { + return InternedValueOr(v, internedTermValue) +} + +// InternedValueOr returns an interned Value for scalar v. Calls supplier +// to produce a Value if the value is not interned. +func InternedValueOr[T internable](v T, supplier func(T) Value) Value { + switch value := any(v).(type) { + case bool: + return internedBooleanValue(value) + case int: + return internedIntNumberValue(value) + case int8: + return internedIntNumberValue(int(value)) + case int16: + return internedIntNumberValue(int(value)) + case int32: + return internedIntNumberValue(int(value)) + case int64: + return internedIntNumberValue(int(value)) + case uint: + return internedIntNumberValue(int(value)) + case uint8: + return internedIntNumberValue(int(value)) + case uint16: + return internedIntNumberValue(int(value)) + case uint32: + return internedIntNumberValue(int(value)) + case uint64: + return internedIntNumberValue(int(value)) + } + return supplier(v) +} + // Interned returns a possibly interned term for the given scalar value. // If the value is not interned, a new term is created for that value. func InternedTerm[T internable](v T) *Term { @@ -123,13 +195,33 @@ func InternedIntegerString(i int) *Term { return StringTerm(s) } +func internedBooleanValue(b bool) Value { + if b { + return InternedBooleanTrueValue + } + + return InternedBooleanFalseValue +} + // InternedBooleanTerm returns an interned term with the given boolean value. func internedBooleanTerm(b bool) *Term { if b { - return booleanTrueTerm + return InternedBooleanTrueTerm } - return booleanFalseTerm + return InternedBooleanFalseTerm +} + +func internedIntNumberValue(i int) Value { + if i >= 0 && i < len(intNumberTerms) { + return intNumberValues[i] + } + + if i == -1 { + return minusOneValue + } + + return Number(strconv.Itoa(i)) } // InternedIntNumberTerm returns a term with the given integer value. The term is @@ -158,10 +250,15 @@ func internedStringTerm(s string) *Term { return StringTerm(s) } +func internedTermValue[T internable](v T) Value { + return InternedTerm(v).Value +} + func init() { InternStringTerm( // Numbers - "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", + "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "70", "71", "72", "73", "74", @@ -185,6 +282,9 @@ func init() { // Decisions "revision", "labels", "decision_id", "bundles", "query", "mapped_result", "nd_builtin_cache", "erased", "masked", "requested_by", "timestamp", "metrics", "req_id", + + // Whitespace + " ", "\n", "\t", ) } @@ -705,518 +805,1034 @@ var stringToIntNumberTermMap = map[string]*Term{ "512": intNumberTerms[512], } -var intNumberTerms = [...]*Term{ - {Value: Number("0")}, - {Value: Number("1")}, - {Value: Number("2")}, - {Value: Number("3")}, - {Value: Number("4")}, - {Value: Number("5")}, - {Value: Number("6")}, - {Value: Number("7")}, - {Value: Number("8")}, - {Value: Number("9")}, - {Value: Number("10")}, - {Value: Number("11")}, - {Value: Number("12")}, - {Value: Number("13")}, - {Value: Number("14")}, - {Value: Number("15")}, - {Value: Number("16")}, - {Value: Number("17")}, - {Value: Number("18")}, - {Value: Number("19")}, - {Value: Number("20")}, - {Value: Number("21")}, - {Value: Number("22")}, - {Value: Number("23")}, - {Value: Number("24")}, - {Value: Number("25")}, - {Value: Number("26")}, - {Value: Number("27")}, - {Value: Number("28")}, - {Value: Number("29")}, - {Value: Number("30")}, - {Value: Number("31")}, - {Value: Number("32")}, - {Value: Number("33")}, - {Value: Number("34")}, - {Value: Number("35")}, - {Value: Number("36")}, - {Value: Number("37")}, - {Value: Number("38")}, - {Value: Number("39")}, - {Value: Number("40")}, - {Value: Number("41")}, - {Value: Number("42")}, - {Value: Number("43")}, - {Value: Number("44")}, - {Value: Number("45")}, - {Value: Number("46")}, - {Value: Number("47")}, - {Value: Number("48")}, - {Value: Number("49")}, - {Value: Number("50")}, - {Value: Number("51")}, - {Value: Number("52")}, - {Value: Number("53")}, - {Value: Number("54")}, - {Value: Number("55")}, - {Value: Number("56")}, - {Value: Number("57")}, - {Value: Number("58")}, - {Value: Number("59")}, - {Value: Number("60")}, - {Value: Number("61")}, - {Value: Number("62")}, - {Value: Number("63")}, - {Value: Number("64")}, - {Value: Number("65")}, - {Value: Number("66")}, - {Value: Number("67")}, - {Value: Number("68")}, - {Value: Number("69")}, - {Value: Number("70")}, - {Value: Number("71")}, - {Value: Number("72")}, - {Value: Number("73")}, - {Value: Number("74")}, - {Value: Number("75")}, - {Value: Number("76")}, - {Value: Number("77")}, - {Value: Number("78")}, - {Value: Number("79")}, - {Value: Number("80")}, - {Value: Number("81")}, - {Value: Number("82")}, - {Value: Number("83")}, - {Value: Number("84")}, - {Value: Number("85")}, - {Value: Number("86")}, - {Value: Number("87")}, - {Value: Number("88")}, - {Value: Number("89")}, - {Value: Number("90")}, - {Value: Number("91")}, - {Value: Number("92")}, - {Value: Number("93")}, - {Value: Number("94")}, - {Value: Number("95")}, - {Value: Number("96")}, - {Value: Number("97")}, - {Value: Number("98")}, - {Value: Number("99")}, - {Value: Number("100")}, - {Value: Number("101")}, - {Value: Number("102")}, - {Value: Number("103")}, - {Value: Number("104")}, - {Value: Number("105")}, - {Value: Number("106")}, - {Value: Number("107")}, - {Value: Number("108")}, - {Value: Number("109")}, - {Value: Number("110")}, - {Value: Number("111")}, - {Value: Number("112")}, - {Value: Number("113")}, - {Value: Number("114")}, - {Value: Number("115")}, - {Value: Number("116")}, - {Value: Number("117")}, - {Value: Number("118")}, - {Value: Number("119")}, - {Value: Number("120")}, - {Value: Number("121")}, - {Value: Number("122")}, - {Value: Number("123")}, - {Value: Number("124")}, - {Value: Number("125")}, - {Value: Number("126")}, - {Value: Number("127")}, - {Value: Number("128")}, - {Value: Number("129")}, - {Value: Number("130")}, - {Value: Number("131")}, - {Value: Number("132")}, - {Value: Number("133")}, - {Value: Number("134")}, - {Value: Number("135")}, - {Value: Number("136")}, - {Value: Number("137")}, - {Value: Number("138")}, - {Value: Number("139")}, - {Value: Number("140")}, - {Value: Number("141")}, - {Value: Number("142")}, - {Value: Number("143")}, - {Value: Number("144")}, - {Value: Number("145")}, - {Value: Number("146")}, - {Value: Number("147")}, - {Value: Number("148")}, - {Value: Number("149")}, - {Value: Number("150")}, - {Value: Number("151")}, - {Value: Number("152")}, - {Value: Number("153")}, - {Value: Number("154")}, - {Value: Number("155")}, - {Value: Number("156")}, - {Value: Number("157")}, - {Value: Number("158")}, - {Value: Number("159")}, - {Value: Number("160")}, - {Value: Number("161")}, - {Value: Number("162")}, - {Value: Number("163")}, - {Value: Number("164")}, - {Value: Number("165")}, - {Value: Number("166")}, - {Value: Number("167")}, - {Value: Number("168")}, - {Value: Number("169")}, - {Value: Number("170")}, - {Value: Number("171")}, - {Value: Number("172")}, - {Value: Number("173")}, - {Value: Number("174")}, - {Value: Number("175")}, - {Value: Number("176")}, - {Value: Number("177")}, - {Value: Number("178")}, - {Value: Number("179")}, - {Value: Number("180")}, - {Value: Number("181")}, - {Value: Number("182")}, - {Value: Number("183")}, - {Value: Number("184")}, - {Value: Number("185")}, - {Value: Number("186")}, - {Value: Number("187")}, - {Value: Number("188")}, - {Value: Number("189")}, - {Value: Number("190")}, - {Value: Number("191")}, - {Value: Number("192")}, - {Value: Number("193")}, - {Value: Number("194")}, - {Value: Number("195")}, - {Value: Number("196")}, - {Value: Number("197")}, - {Value: Number("198")}, - {Value: Number("199")}, - {Value: Number("200")}, - {Value: Number("201")}, - {Value: Number("202")}, - {Value: Number("203")}, - {Value: Number("204")}, - {Value: Number("205")}, - {Value: Number("206")}, - {Value: Number("207")}, - {Value: Number("208")}, - {Value: Number("209")}, - {Value: Number("210")}, - {Value: Number("211")}, - {Value: Number("212")}, - {Value: Number("213")}, - {Value: Number("214")}, - {Value: Number("215")}, - {Value: Number("216")}, - {Value: Number("217")}, - {Value: Number("218")}, - {Value: Number("219")}, - {Value: Number("220")}, - {Value: Number("221")}, - {Value: Number("222")}, - {Value: Number("223")}, - {Value: Number("224")}, - {Value: Number("225")}, - {Value: Number("226")}, - {Value: Number("227")}, - {Value: Number("228")}, - {Value: Number("229")}, - {Value: Number("230")}, - {Value: Number("231")}, - {Value: Number("232")}, - {Value: Number("233")}, - {Value: Number("234")}, - {Value: Number("235")}, - {Value: Number("236")}, - {Value: Number("237")}, - {Value: Number("238")}, - {Value: Number("239")}, - {Value: Number("240")}, - {Value: Number("241")}, - {Value: Number("242")}, - {Value: Number("243")}, - {Value: Number("244")}, - {Value: Number("245")}, - {Value: Number("246")}, - {Value: Number("247")}, - {Value: Number("248")}, - {Value: Number("249")}, - {Value: Number("250")}, - {Value: Number("251")}, - {Value: Number("252")}, - {Value: Number("253")}, - {Value: Number("254")}, - {Value: Number("255")}, - {Value: Number("256")}, - {Value: Number("257")}, - {Value: Number("258")}, - {Value: Number("259")}, - {Value: Number("260")}, - {Value: Number("261")}, - {Value: Number("262")}, - {Value: Number("263")}, - {Value: Number("264")}, - {Value: Number("265")}, - {Value: Number("266")}, - {Value: Number("267")}, - {Value: Number("268")}, - {Value: Number("269")}, - {Value: Number("270")}, - {Value: Number("271")}, - {Value: Number("272")}, - {Value: Number("273")}, - {Value: Number("274")}, - {Value: Number("275")}, - {Value: Number("276")}, - {Value: Number("277")}, - {Value: Number("278")}, - {Value: Number("279")}, - {Value: Number("280")}, - {Value: Number("281")}, - {Value: Number("282")}, - {Value: Number("283")}, - {Value: Number("284")}, - {Value: Number("285")}, - {Value: Number("286")}, - {Value: Number("287")}, - {Value: Number("288")}, - {Value: Number("289")}, - {Value: Number("290")}, - {Value: Number("291")}, - {Value: Number("292")}, - {Value: Number("293")}, - {Value: Number("294")}, - {Value: Number("295")}, - {Value: Number("296")}, - {Value: Number("297")}, - {Value: Number("298")}, - {Value: Number("299")}, - {Value: Number("300")}, - {Value: Number("301")}, - {Value: Number("302")}, - {Value: Number("303")}, - {Value: Number("304")}, - {Value: Number("305")}, - {Value: Number("306")}, - {Value: Number("307")}, - {Value: Number("308")}, - {Value: Number("309")}, - {Value: Number("310")}, - {Value: Number("311")}, - {Value: Number("312")}, - {Value: Number("313")}, - {Value: Number("314")}, - {Value: Number("315")}, - {Value: Number("316")}, - {Value: Number("317")}, - {Value: Number("318")}, - {Value: Number("319")}, - {Value: Number("320")}, - {Value: Number("321")}, - {Value: Number("322")}, - {Value: Number("323")}, - {Value: Number("324")}, - {Value: Number("325")}, - {Value: Number("326")}, - {Value: Number("327")}, - {Value: Number("328")}, - {Value: Number("329")}, - {Value: Number("330")}, - {Value: Number("331")}, - {Value: Number("332")}, - {Value: Number("333")}, - {Value: Number("334")}, - {Value: Number("335")}, - {Value: Number("336")}, - {Value: Number("337")}, - {Value: Number("338")}, - {Value: Number("339")}, - {Value: Number("340")}, - {Value: Number("341")}, - {Value: Number("342")}, - {Value: Number("343")}, - {Value: Number("344")}, - {Value: Number("345")}, - {Value: Number("346")}, - {Value: Number("347")}, - {Value: Number("348")}, - {Value: Number("349")}, - {Value: Number("350")}, - {Value: Number("351")}, - {Value: Number("352")}, - {Value: Number("353")}, - {Value: Number("354")}, - {Value: Number("355")}, - {Value: Number("356")}, - {Value: Number("357")}, - {Value: Number("358")}, - {Value: Number("359")}, - {Value: Number("360")}, - {Value: Number("361")}, - {Value: Number("362")}, - {Value: Number("363")}, - {Value: Number("364")}, - {Value: Number("365")}, - {Value: Number("366")}, - {Value: Number("367")}, - {Value: Number("368")}, - {Value: Number("369")}, - {Value: Number("370")}, - {Value: Number("371")}, - {Value: Number("372")}, - {Value: Number("373")}, - {Value: Number("374")}, - {Value: Number("375")}, - {Value: Number("376")}, - {Value: Number("377")}, - {Value: Number("378")}, - {Value: Number("379")}, - {Value: Number("380")}, - {Value: Number("381")}, - {Value: Number("382")}, - {Value: Number("383")}, - {Value: Number("384")}, - {Value: Number("385")}, - {Value: Number("386")}, - {Value: Number("387")}, - {Value: Number("388")}, - {Value: Number("389")}, - {Value: Number("390")}, - {Value: Number("391")}, - {Value: Number("392")}, - {Value: Number("393")}, - {Value: Number("394")}, - {Value: Number("395")}, - {Value: Number("396")}, - {Value: Number("397")}, - {Value: Number("398")}, - {Value: Number("399")}, - {Value: Number("400")}, - {Value: Number("401")}, - {Value: Number("402")}, - {Value: Number("403")}, - {Value: Number("404")}, - {Value: Number("405")}, - {Value: Number("406")}, - {Value: Number("407")}, - {Value: Number("408")}, - {Value: Number("409")}, - {Value: Number("410")}, - {Value: Number("411")}, - {Value: Number("412")}, - {Value: Number("413")}, - {Value: Number("414")}, - {Value: Number("415")}, - {Value: Number("416")}, - {Value: Number("417")}, - {Value: Number("418")}, - {Value: Number("419")}, - {Value: Number("420")}, - {Value: Number("421")}, - {Value: Number("422")}, - {Value: Number("423")}, - {Value: Number("424")}, - {Value: Number("425")}, - {Value: Number("426")}, - {Value: Number("427")}, - {Value: Number("428")}, - {Value: Number("429")}, - {Value: Number("430")}, - {Value: Number("431")}, - {Value: Number("432")}, - {Value: Number("433")}, - {Value: Number("434")}, - {Value: Number("435")}, - {Value: Number("436")}, - {Value: Number("437")}, - {Value: Number("438")}, - {Value: Number("439")}, - {Value: Number("440")}, - {Value: Number("441")}, - {Value: Number("442")}, - {Value: Number("443")}, - {Value: Number("444")}, - {Value: Number("445")}, - {Value: Number("446")}, - {Value: Number("447")}, - {Value: Number("448")}, - {Value: Number("449")}, - {Value: Number("450")}, - {Value: Number("451")}, - {Value: Number("452")}, - {Value: Number("453")}, - {Value: Number("454")}, - {Value: Number("455")}, - {Value: Number("456")}, - {Value: Number("457")}, - {Value: Number("458")}, - {Value: Number("459")}, - {Value: Number("460")}, - {Value: Number("461")}, - {Value: Number("462")}, - {Value: Number("463")}, - {Value: Number("464")}, - {Value: Number("465")}, - {Value: Number("466")}, - {Value: Number("467")}, - {Value: Number("468")}, - {Value: Number("469")}, - {Value: Number("470")}, - {Value: Number("471")}, - {Value: Number("472")}, - {Value: Number("473")}, - {Value: Number("474")}, - {Value: Number("475")}, - {Value: Number("476")}, - {Value: Number("477")}, - {Value: Number("478")}, - {Value: Number("479")}, - {Value: Number("480")}, - {Value: Number("481")}, - {Value: Number("482")}, - {Value: Number("483")}, - {Value: Number("484")}, - {Value: Number("485")}, - {Value: Number("486")}, - {Value: Number("487")}, - {Value: Number("488")}, - {Value: Number("489")}, - {Value: Number("490")}, - {Value: Number("491")}, - {Value: Number("492")}, - {Value: Number("493")}, - {Value: Number("494")}, - {Value: Number("495")}, - {Value: Number("496")}, - {Value: Number("497")}, - {Value: Number("498")}, - {Value: Number("499")}, - {Value: Number("500")}, - {Value: Number("501")}, - {Value: Number("502")}, - {Value: Number("503")}, - {Value: Number("504")}, - {Value: Number("505")}, - {Value: Number("506")}, - {Value: Number("507")}, - {Value: Number("508")}, - {Value: Number("509")}, - {Value: Number("510")}, - {Value: Number("511")}, - {Value: Number("512")}, +var intNumberValues = [...]Value{ + Number("0"), + Number("1"), + Number("2"), + Number("3"), + Number("4"), + Number("5"), + Number("6"), + Number("7"), + Number("8"), + Number("9"), + Number("10"), + Number("11"), + Number("12"), + Number("13"), + Number("14"), + Number("15"), + Number("16"), + Number("17"), + Number("18"), + Number("19"), + Number("20"), + Number("21"), + Number("22"), + Number("23"), + Number("24"), + Number("25"), + Number("26"), + Number("27"), + Number("28"), + Number("29"), + Number("30"), + Number("31"), + Number("32"), + Number("33"), + Number("34"), + Number("35"), + Number("36"), + Number("37"), + Number("38"), + Number("39"), + Number("40"), + Number("41"), + Number("42"), + Number("43"), + Number("44"), + Number("45"), + Number("46"), + Number("47"), + Number("48"), + Number("49"), + Number("50"), + Number("51"), + Number("52"), + Number("53"), + Number("54"), + Number("55"), + Number("56"), + Number("57"), + Number("58"), + Number("59"), + Number("60"), + Number("61"), + Number("62"), + Number("63"), + Number("64"), + Number("65"), + Number("66"), + Number("67"), + Number("68"), + Number("69"), + Number("70"), + Number("71"), + Number("72"), + Number("73"), + Number("74"), + Number("75"), + Number("76"), + Number("77"), + Number("78"), + Number("79"), + Number("80"), + Number("81"), + Number("82"), + Number("83"), + Number("84"), + Number("85"), + Number("86"), + Number("87"), + Number("88"), + Number("89"), + Number("90"), + Number("91"), + Number("92"), + Number("93"), + Number("94"), + Number("95"), + Number("96"), + Number("97"), + Number("98"), + Number("99"), + Number("100"), + Number("101"), + Number("102"), + Number("103"), + Number("104"), + Number("105"), + Number("106"), + Number("107"), + Number("108"), + Number("109"), + Number("110"), + Number("111"), + Number("112"), + Number("113"), + Number("114"), + Number("115"), + Number("116"), + Number("117"), + Number("118"), + Number("119"), + Number("120"), + Number("121"), + Number("122"), + Number("123"), + Number("124"), + Number("125"), + Number("126"), + Number("127"), + Number("128"), + Number("129"), + Number("130"), + Number("131"), + Number("132"), + Number("133"), + Number("134"), + Number("135"), + Number("136"), + Number("137"), + Number("138"), + Number("139"), + Number("140"), + Number("141"), + Number("142"), + Number("143"), + Number("144"), + Number("145"), + Number("146"), + Number("147"), + Number("148"), + Number("149"), + Number("150"), + Number("151"), + Number("152"), + Number("153"), + Number("154"), + Number("155"), + Number("156"), + Number("157"), + Number("158"), + Number("159"), + Number("160"), + Number("161"), + Number("162"), + Number("163"), + Number("164"), + Number("165"), + Number("166"), + Number("167"), + Number("168"), + Number("169"), + Number("170"), + Number("171"), + Number("172"), + Number("173"), + Number("174"), + Number("175"), + Number("176"), + Number("177"), + Number("178"), + Number("179"), + Number("180"), + Number("181"), + Number("182"), + Number("183"), + Number("184"), + Number("185"), + Number("186"), + Number("187"), + Number("188"), + Number("189"), + Number("190"), + Number("191"), + Number("192"), + Number("193"), + Number("194"), + Number("195"), + Number("196"), + Number("197"), + Number("198"), + Number("199"), + Number("200"), + Number("201"), + Number("202"), + Number("203"), + Number("204"), + Number("205"), + Number("206"), + Number("207"), + Number("208"), + Number("209"), + Number("210"), + Number("211"), + Number("212"), + Number("213"), + Number("214"), + Number("215"), + Number("216"), + Number("217"), + Number("218"), + Number("219"), + Number("220"), + Number("221"), + Number("222"), + Number("223"), + Number("224"), + Number("225"), + Number("226"), + Number("227"), + Number("228"), + Number("229"), + Number("230"), + Number("231"), + Number("232"), + Number("233"), + Number("234"), + Number("235"), + Number("236"), + Number("237"), + Number("238"), + Number("239"), + Number("240"), + Number("241"), + Number("242"), + Number("243"), + Number("244"), + Number("245"), + Number("246"), + Number("247"), + Number("248"), + Number("249"), + Number("250"), + Number("251"), + Number("252"), + Number("253"), + Number("254"), + Number("255"), + Number("256"), + Number("257"), + Number("258"), + Number("259"), + Number("260"), + Number("261"), + Number("262"), + Number("263"), + Number("264"), + Number("265"), + Number("266"), + Number("267"), + Number("268"), + Number("269"), + Number("270"), + Number("271"), + Number("272"), + Number("273"), + Number("274"), + Number("275"), + Number("276"), + Number("277"), + Number("278"), + Number("279"), + Number("280"), + Number("281"), + Number("282"), + Number("283"), + Number("284"), + Number("285"), + Number("286"), + Number("287"), + Number("288"), + Number("289"), + Number("290"), + Number("291"), + Number("292"), + Number("293"), + Number("294"), + Number("295"), + Number("296"), + Number("297"), + Number("298"), + Number("299"), + Number("300"), + Number("301"), + Number("302"), + Number("303"), + Number("304"), + Number("305"), + Number("306"), + Number("307"), + Number("308"), + Number("309"), + Number("310"), + Number("311"), + Number("312"), + Number("313"), + Number("314"), + Number("315"), + Number("316"), + Number("317"), + Number("318"), + Number("319"), + Number("320"), + Number("321"), + Number("322"), + Number("323"), + Number("324"), + Number("325"), + Number("326"), + Number("327"), + Number("328"), + Number("329"), + Number("330"), + Number("331"), + Number("332"), + Number("333"), + Number("334"), + Number("335"), + Number("336"), + Number("337"), + Number("338"), + Number("339"), + Number("340"), + Number("341"), + Number("342"), + Number("343"), + Number("344"), + Number("345"), + Number("346"), + Number("347"), + Number("348"), + Number("349"), + Number("350"), + Number("351"), + Number("352"), + Number("353"), + Number("354"), + Number("355"), + Number("356"), + Number("357"), + Number("358"), + Number("359"), + Number("360"), + Number("361"), + Number("362"), + Number("363"), + Number("364"), + Number("365"), + Number("366"), + Number("367"), + Number("368"), + Number("369"), + Number("370"), + Number("371"), + Number("372"), + Number("373"), + Number("374"), + Number("375"), + Number("376"), + Number("377"), + Number("378"), + Number("379"), + Number("380"), + Number("381"), + Number("382"), + Number("383"), + Number("384"), + Number("385"), + Number("386"), + Number("387"), + Number("388"), + Number("389"), + Number("390"), + Number("391"), + Number("392"), + Number("393"), + Number("394"), + Number("395"), + Number("396"), + Number("397"), + Number("398"), + Number("399"), + Number("400"), + Number("401"), + Number("402"), + Number("403"), + Number("404"), + Number("405"), + Number("406"), + Number("407"), + Number("408"), + Number("409"), + Number("410"), + Number("411"), + Number("412"), + Number("413"), + Number("414"), + Number("415"), + Number("416"), + Number("417"), + Number("418"), + Number("419"), + Number("420"), + Number("421"), + Number("422"), + Number("423"), + Number("424"), + Number("425"), + Number("426"), + Number("427"), + Number("428"), + Number("429"), + Number("430"), + Number("431"), + Number("432"), + Number("433"), + Number("434"), + Number("435"), + Number("436"), + Number("437"), + Number("438"), + Number("439"), + Number("440"), + Number("441"), + Number("442"), + Number("443"), + Number("444"), + Number("445"), + Number("446"), + Number("447"), + Number("448"), + Number("449"), + Number("450"), + Number("451"), + Number("452"), + Number("453"), + Number("454"), + Number("455"), + Number("456"), + Number("457"), + Number("458"), + Number("459"), + Number("460"), + Number("461"), + Number("462"), + Number("463"), + Number("464"), + Number("465"), + Number("466"), + Number("467"), + Number("468"), + Number("469"), + Number("470"), + Number("471"), + Number("472"), + Number("473"), + Number("474"), + Number("475"), + Number("476"), + Number("477"), + Number("478"), + Number("479"), + Number("480"), + Number("481"), + Number("482"), + Number("483"), + Number("484"), + Number("485"), + Number("486"), + Number("487"), + Number("488"), + Number("489"), + Number("490"), + Number("491"), + Number("492"), + Number("493"), + Number("494"), + Number("495"), + Number("496"), + Number("497"), + Number("498"), + Number("499"), + Number("500"), + Number("501"), + Number("502"), + Number("503"), + Number("504"), + Number("505"), + Number("506"), + Number("507"), + Number("508"), + Number("509"), + Number("510"), + Number("511"), + Number("512"), +} + +var intNumberTerms = [...]*Term{ + {Value: intNumberValues[0]}, + {Value: intNumberValues[1]}, + {Value: intNumberValues[2]}, + {Value: intNumberValues[3]}, + {Value: intNumberValues[4]}, + {Value: intNumberValues[5]}, + {Value: intNumberValues[6]}, + {Value: intNumberValues[7]}, + {Value: intNumberValues[8]}, + {Value: intNumberValues[9]}, + {Value: intNumberValues[10]}, + {Value: intNumberValues[11]}, + {Value: intNumberValues[12]}, + {Value: intNumberValues[13]}, + {Value: intNumberValues[14]}, + {Value: intNumberValues[15]}, + {Value: intNumberValues[16]}, + {Value: intNumberValues[17]}, + {Value: intNumberValues[18]}, + {Value: intNumberValues[19]}, + {Value: intNumberValues[20]}, + {Value: intNumberValues[21]}, + {Value: intNumberValues[22]}, + {Value: intNumberValues[23]}, + {Value: intNumberValues[24]}, + {Value: intNumberValues[25]}, + {Value: intNumberValues[26]}, + {Value: intNumberValues[27]}, + {Value: intNumberValues[28]}, + {Value: intNumberValues[29]}, + {Value: intNumberValues[30]}, + {Value: intNumberValues[31]}, + {Value: intNumberValues[32]}, + {Value: intNumberValues[33]}, + {Value: intNumberValues[34]}, + {Value: intNumberValues[35]}, + {Value: intNumberValues[36]}, + {Value: intNumberValues[37]}, + {Value: intNumberValues[38]}, + {Value: intNumberValues[39]}, + {Value: intNumberValues[40]}, + {Value: intNumberValues[41]}, + {Value: intNumberValues[42]}, + {Value: intNumberValues[43]}, + {Value: intNumberValues[44]}, + {Value: intNumberValues[45]}, + {Value: intNumberValues[46]}, + {Value: intNumberValues[47]}, + {Value: intNumberValues[48]}, + {Value: intNumberValues[49]}, + {Value: intNumberValues[50]}, + {Value: intNumberValues[51]}, + {Value: intNumberValues[52]}, + {Value: intNumberValues[53]}, + {Value: intNumberValues[54]}, + {Value: intNumberValues[55]}, + {Value: intNumberValues[56]}, + {Value: intNumberValues[57]}, + {Value: intNumberValues[58]}, + {Value: intNumberValues[59]}, + {Value: intNumberValues[60]}, + {Value: intNumberValues[61]}, + {Value: intNumberValues[62]}, + {Value: intNumberValues[63]}, + {Value: intNumberValues[64]}, + {Value: intNumberValues[65]}, + {Value: intNumberValues[66]}, + {Value: intNumberValues[67]}, + {Value: intNumberValues[68]}, + {Value: intNumberValues[69]}, + {Value: intNumberValues[70]}, + {Value: intNumberValues[71]}, + {Value: intNumberValues[72]}, + {Value: intNumberValues[73]}, + {Value: intNumberValues[74]}, + {Value: intNumberValues[75]}, + {Value: intNumberValues[76]}, + {Value: intNumberValues[77]}, + {Value: intNumberValues[78]}, + {Value: intNumberValues[79]}, + {Value: intNumberValues[80]}, + {Value: intNumberValues[81]}, + {Value: intNumberValues[82]}, + {Value: intNumberValues[83]}, + {Value: intNumberValues[84]}, + {Value: intNumberValues[85]}, + {Value: intNumberValues[86]}, + {Value: intNumberValues[87]}, + {Value: intNumberValues[88]}, + {Value: intNumberValues[89]}, + {Value: intNumberValues[90]}, + {Value: intNumberValues[91]}, + {Value: intNumberValues[92]}, + {Value: intNumberValues[93]}, + {Value: intNumberValues[94]}, + {Value: intNumberValues[95]}, + {Value: intNumberValues[96]}, + {Value: intNumberValues[97]}, + {Value: intNumberValues[98]}, + {Value: intNumberValues[99]}, + {Value: intNumberValues[100]}, + {Value: intNumberValues[101]}, + {Value: intNumberValues[102]}, + {Value: intNumberValues[103]}, + {Value: intNumberValues[104]}, + {Value: intNumberValues[105]}, + {Value: intNumberValues[106]}, + {Value: intNumberValues[107]}, + {Value: intNumberValues[108]}, + {Value: intNumberValues[109]}, + {Value: intNumberValues[110]}, + {Value: intNumberValues[111]}, + {Value: intNumberValues[112]}, + {Value: intNumberValues[113]}, + {Value: intNumberValues[114]}, + {Value: intNumberValues[115]}, + {Value: intNumberValues[116]}, + {Value: intNumberValues[117]}, + {Value: intNumberValues[118]}, + {Value: intNumberValues[119]}, + {Value: intNumberValues[120]}, + {Value: intNumberValues[121]}, + {Value: intNumberValues[122]}, + {Value: intNumberValues[123]}, + {Value: intNumberValues[124]}, + {Value: intNumberValues[125]}, + {Value: intNumberValues[126]}, + {Value: intNumberValues[127]}, + {Value: intNumberValues[128]}, + {Value: intNumberValues[129]}, + {Value: intNumberValues[130]}, + {Value: intNumberValues[131]}, + {Value: intNumberValues[132]}, + {Value: intNumberValues[133]}, + {Value: intNumberValues[134]}, + {Value: intNumberValues[135]}, + {Value: intNumberValues[136]}, + {Value: intNumberValues[137]}, + {Value: intNumberValues[138]}, + {Value: intNumberValues[139]}, + {Value: intNumberValues[140]}, + {Value: intNumberValues[141]}, + {Value: intNumberValues[142]}, + {Value: intNumberValues[143]}, + {Value: intNumberValues[144]}, + {Value: intNumberValues[145]}, + {Value: intNumberValues[146]}, + {Value: intNumberValues[147]}, + {Value: intNumberValues[148]}, + {Value: intNumberValues[149]}, + {Value: intNumberValues[150]}, + {Value: intNumberValues[151]}, + {Value: intNumberValues[152]}, + {Value: intNumberValues[153]}, + {Value: intNumberValues[154]}, + {Value: intNumberValues[155]}, + {Value: intNumberValues[156]}, + {Value: intNumberValues[157]}, + {Value: intNumberValues[158]}, + {Value: intNumberValues[159]}, + {Value: intNumberValues[160]}, + {Value: intNumberValues[161]}, + {Value: intNumberValues[162]}, + {Value: intNumberValues[163]}, + {Value: intNumberValues[164]}, + {Value: intNumberValues[165]}, + {Value: intNumberValues[166]}, + {Value: intNumberValues[167]}, + {Value: intNumberValues[168]}, + {Value: intNumberValues[169]}, + {Value: intNumberValues[170]}, + {Value: intNumberValues[171]}, + {Value: intNumberValues[172]}, + {Value: intNumberValues[173]}, + {Value: intNumberValues[174]}, + {Value: intNumberValues[175]}, + {Value: intNumberValues[176]}, + {Value: intNumberValues[177]}, + {Value: intNumberValues[178]}, + {Value: intNumberValues[179]}, + {Value: intNumberValues[180]}, + {Value: intNumberValues[181]}, + {Value: intNumberValues[182]}, + {Value: intNumberValues[183]}, + {Value: intNumberValues[184]}, + {Value: intNumberValues[185]}, + {Value: intNumberValues[186]}, + {Value: intNumberValues[187]}, + {Value: intNumberValues[188]}, + {Value: intNumberValues[189]}, + {Value: intNumberValues[190]}, + {Value: intNumberValues[191]}, + {Value: intNumberValues[192]}, + {Value: intNumberValues[193]}, + {Value: intNumberValues[194]}, + {Value: intNumberValues[195]}, + {Value: intNumberValues[196]}, + {Value: intNumberValues[197]}, + {Value: intNumberValues[198]}, + {Value: intNumberValues[199]}, + {Value: intNumberValues[200]}, + {Value: intNumberValues[201]}, + {Value: intNumberValues[202]}, + {Value: intNumberValues[203]}, + {Value: intNumberValues[204]}, + {Value: intNumberValues[205]}, + {Value: intNumberValues[206]}, + {Value: intNumberValues[207]}, + {Value: intNumberValues[208]}, + {Value: intNumberValues[209]}, + {Value: intNumberValues[210]}, + {Value: intNumberValues[211]}, + {Value: intNumberValues[212]}, + {Value: intNumberValues[213]}, + {Value: intNumberValues[214]}, + {Value: intNumberValues[215]}, + {Value: intNumberValues[216]}, + {Value: intNumberValues[217]}, + {Value: intNumberValues[218]}, + {Value: intNumberValues[219]}, + {Value: intNumberValues[220]}, + {Value: intNumberValues[221]}, + {Value: intNumberValues[222]}, + {Value: intNumberValues[223]}, + {Value: intNumberValues[224]}, + {Value: intNumberValues[225]}, + {Value: intNumberValues[226]}, + {Value: intNumberValues[227]}, + {Value: intNumberValues[228]}, + {Value: intNumberValues[229]}, + {Value: intNumberValues[230]}, + {Value: intNumberValues[231]}, + {Value: intNumberValues[232]}, + {Value: intNumberValues[233]}, + {Value: intNumberValues[234]}, + {Value: intNumberValues[235]}, + {Value: intNumberValues[236]}, + {Value: intNumberValues[237]}, + {Value: intNumberValues[238]}, + {Value: intNumberValues[239]}, + {Value: intNumberValues[240]}, + {Value: intNumberValues[241]}, + {Value: intNumberValues[242]}, + {Value: intNumberValues[243]}, + {Value: intNumberValues[244]}, + {Value: intNumberValues[245]}, + {Value: intNumberValues[246]}, + {Value: intNumberValues[247]}, + {Value: intNumberValues[248]}, + {Value: intNumberValues[249]}, + {Value: intNumberValues[250]}, + {Value: intNumberValues[251]}, + {Value: intNumberValues[252]}, + {Value: intNumberValues[253]}, + {Value: intNumberValues[254]}, + {Value: intNumberValues[255]}, + {Value: intNumberValues[256]}, + {Value: intNumberValues[257]}, + {Value: intNumberValues[258]}, + {Value: intNumberValues[259]}, + {Value: intNumberValues[260]}, + {Value: intNumberValues[261]}, + {Value: intNumberValues[262]}, + {Value: intNumberValues[263]}, + {Value: intNumberValues[264]}, + {Value: intNumberValues[265]}, + {Value: intNumberValues[266]}, + {Value: intNumberValues[267]}, + {Value: intNumberValues[268]}, + {Value: intNumberValues[269]}, + {Value: intNumberValues[270]}, + {Value: intNumberValues[271]}, + {Value: intNumberValues[272]}, + {Value: intNumberValues[273]}, + {Value: intNumberValues[274]}, + {Value: intNumberValues[275]}, + {Value: intNumberValues[276]}, + {Value: intNumberValues[277]}, + {Value: intNumberValues[278]}, + {Value: intNumberValues[279]}, + {Value: intNumberValues[280]}, + {Value: intNumberValues[281]}, + {Value: intNumberValues[282]}, + {Value: intNumberValues[283]}, + {Value: intNumberValues[284]}, + {Value: intNumberValues[285]}, + {Value: intNumberValues[286]}, + {Value: intNumberValues[287]}, + {Value: intNumberValues[288]}, + {Value: intNumberValues[289]}, + {Value: intNumberValues[290]}, + {Value: intNumberValues[291]}, + {Value: intNumberValues[292]}, + {Value: intNumberValues[293]}, + {Value: intNumberValues[294]}, + {Value: intNumberValues[295]}, + {Value: intNumberValues[296]}, + {Value: intNumberValues[297]}, + {Value: intNumberValues[298]}, + {Value: intNumberValues[299]}, + {Value: intNumberValues[300]}, + {Value: intNumberValues[301]}, + {Value: intNumberValues[302]}, + {Value: intNumberValues[303]}, + {Value: intNumberValues[304]}, + {Value: intNumberValues[305]}, + {Value: intNumberValues[306]}, + {Value: intNumberValues[307]}, + {Value: intNumberValues[308]}, + {Value: intNumberValues[309]}, + {Value: intNumberValues[310]}, + {Value: intNumberValues[311]}, + {Value: intNumberValues[312]}, + {Value: intNumberValues[313]}, + {Value: intNumberValues[314]}, + {Value: intNumberValues[315]}, + {Value: intNumberValues[316]}, + {Value: intNumberValues[317]}, + {Value: intNumberValues[318]}, + {Value: intNumberValues[319]}, + {Value: intNumberValues[320]}, + {Value: intNumberValues[321]}, + {Value: intNumberValues[322]}, + {Value: intNumberValues[323]}, + {Value: intNumberValues[324]}, + {Value: intNumberValues[325]}, + {Value: intNumberValues[326]}, + {Value: intNumberValues[327]}, + {Value: intNumberValues[328]}, + {Value: intNumberValues[329]}, + {Value: intNumberValues[330]}, + {Value: intNumberValues[331]}, + {Value: intNumberValues[332]}, + {Value: intNumberValues[333]}, + {Value: intNumberValues[334]}, + {Value: intNumberValues[335]}, + {Value: intNumberValues[336]}, + {Value: intNumberValues[337]}, + {Value: intNumberValues[338]}, + {Value: intNumberValues[339]}, + {Value: intNumberValues[340]}, + {Value: intNumberValues[341]}, + {Value: intNumberValues[342]}, + {Value: intNumberValues[343]}, + {Value: intNumberValues[344]}, + {Value: intNumberValues[345]}, + {Value: intNumberValues[346]}, + {Value: intNumberValues[347]}, + {Value: intNumberValues[348]}, + {Value: intNumberValues[349]}, + {Value: intNumberValues[350]}, + {Value: intNumberValues[351]}, + {Value: intNumberValues[352]}, + {Value: intNumberValues[353]}, + {Value: intNumberValues[354]}, + {Value: intNumberValues[355]}, + {Value: intNumberValues[356]}, + {Value: intNumberValues[357]}, + {Value: intNumberValues[358]}, + {Value: intNumberValues[359]}, + {Value: intNumberValues[360]}, + {Value: intNumberValues[361]}, + {Value: intNumberValues[362]}, + {Value: intNumberValues[363]}, + {Value: intNumberValues[364]}, + {Value: intNumberValues[365]}, + {Value: intNumberValues[366]}, + {Value: intNumberValues[367]}, + {Value: intNumberValues[368]}, + {Value: intNumberValues[369]}, + {Value: intNumberValues[370]}, + {Value: intNumberValues[371]}, + {Value: intNumberValues[372]}, + {Value: intNumberValues[373]}, + {Value: intNumberValues[374]}, + {Value: intNumberValues[375]}, + {Value: intNumberValues[376]}, + {Value: intNumberValues[377]}, + {Value: intNumberValues[378]}, + {Value: intNumberValues[379]}, + {Value: intNumberValues[380]}, + {Value: intNumberValues[381]}, + {Value: intNumberValues[382]}, + {Value: intNumberValues[383]}, + {Value: intNumberValues[384]}, + {Value: intNumberValues[385]}, + {Value: intNumberValues[386]}, + {Value: intNumberValues[387]}, + {Value: intNumberValues[388]}, + {Value: intNumberValues[389]}, + {Value: intNumberValues[390]}, + {Value: intNumberValues[391]}, + {Value: intNumberValues[392]}, + {Value: intNumberValues[393]}, + {Value: intNumberValues[394]}, + {Value: intNumberValues[395]}, + {Value: intNumberValues[396]}, + {Value: intNumberValues[397]}, + {Value: intNumberValues[398]}, + {Value: intNumberValues[399]}, + {Value: intNumberValues[400]}, + {Value: intNumberValues[401]}, + {Value: intNumberValues[402]}, + {Value: intNumberValues[403]}, + {Value: intNumberValues[404]}, + {Value: intNumberValues[405]}, + {Value: intNumberValues[406]}, + {Value: intNumberValues[407]}, + {Value: intNumberValues[408]}, + {Value: intNumberValues[409]}, + {Value: intNumberValues[410]}, + {Value: intNumberValues[411]}, + {Value: intNumberValues[412]}, + {Value: intNumberValues[413]}, + {Value: intNumberValues[414]}, + {Value: intNumberValues[415]}, + {Value: intNumberValues[416]}, + {Value: intNumberValues[417]}, + {Value: intNumberValues[418]}, + {Value: intNumberValues[419]}, + {Value: intNumberValues[420]}, + {Value: intNumberValues[421]}, + {Value: intNumberValues[422]}, + {Value: intNumberValues[423]}, + {Value: intNumberValues[424]}, + {Value: intNumberValues[425]}, + {Value: intNumberValues[426]}, + {Value: intNumberValues[427]}, + {Value: intNumberValues[428]}, + {Value: intNumberValues[429]}, + {Value: intNumberValues[430]}, + {Value: intNumberValues[431]}, + {Value: intNumberValues[432]}, + {Value: intNumberValues[433]}, + {Value: intNumberValues[434]}, + {Value: intNumberValues[435]}, + {Value: intNumberValues[436]}, + {Value: intNumberValues[437]}, + {Value: intNumberValues[438]}, + {Value: intNumberValues[439]}, + {Value: intNumberValues[440]}, + {Value: intNumberValues[441]}, + {Value: intNumberValues[442]}, + {Value: intNumberValues[443]}, + {Value: intNumberValues[444]}, + {Value: intNumberValues[445]}, + {Value: intNumberValues[446]}, + {Value: intNumberValues[447]}, + {Value: intNumberValues[448]}, + {Value: intNumberValues[449]}, + {Value: intNumberValues[450]}, + {Value: intNumberValues[451]}, + {Value: intNumberValues[452]}, + {Value: intNumberValues[453]}, + {Value: intNumberValues[454]}, + {Value: intNumberValues[455]}, + {Value: intNumberValues[456]}, + {Value: intNumberValues[457]}, + {Value: intNumberValues[458]}, + {Value: intNumberValues[459]}, + {Value: intNumberValues[460]}, + {Value: intNumberValues[461]}, + {Value: intNumberValues[462]}, + {Value: intNumberValues[463]}, + {Value: intNumberValues[464]}, + {Value: intNumberValues[465]}, + {Value: intNumberValues[466]}, + {Value: intNumberValues[467]}, + {Value: intNumberValues[468]}, + {Value: intNumberValues[469]}, + {Value: intNumberValues[470]}, + {Value: intNumberValues[471]}, + {Value: intNumberValues[472]}, + {Value: intNumberValues[473]}, + {Value: intNumberValues[474]}, + {Value: intNumberValues[475]}, + {Value: intNumberValues[476]}, + {Value: intNumberValues[477]}, + {Value: intNumberValues[478]}, + {Value: intNumberValues[479]}, + {Value: intNumberValues[480]}, + {Value: intNumberValues[481]}, + {Value: intNumberValues[482]}, + {Value: intNumberValues[483]}, + {Value: intNumberValues[484]}, + {Value: intNumberValues[485]}, + {Value: intNumberValues[486]}, + {Value: intNumberValues[487]}, + {Value: intNumberValues[488]}, + {Value: intNumberValues[489]}, + {Value: intNumberValues[490]}, + {Value: intNumberValues[491]}, + {Value: intNumberValues[492]}, + {Value: intNumberValues[493]}, + {Value: intNumberValues[494]}, + {Value: intNumberValues[495]}, + {Value: intNumberValues[496]}, + {Value: intNumberValues[497]}, + {Value: intNumberValues[498]}, + {Value: intNumberValues[499]}, + {Value: intNumberValues[500]}, + {Value: intNumberValues[501]}, + {Value: intNumberValues[502]}, + {Value: intNumberValues[503]}, + {Value: intNumberValues[504]}, + {Value: intNumberValues[505]}, + {Value: intNumberValues[506]}, + {Value: intNumberValues[507]}, + {Value: intNumberValues[508]}, + {Value: intNumberValues[509]}, + {Value: intNumberValues[510]}, + {Value: intNumberValues[511]}, + {Value: intNumberValues[512]}, } diff --git a/vendor/github.com/open-policy-agent/opa/v1/ast/parser.go b/vendor/github.com/open-policy-agent/opa/v1/ast/parser.go index 1599a73556..8355186cb9 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/ast/parser.go +++ b/vendor/github.com/open-policy-agent/opa/v1/ast/parser.go @@ -1056,7 +1056,7 @@ func (p *Parser) parseHead(defaultRule bool) (*Head, bool) { return nil, false } - ref := p.parseTermFinish(term, true) + ref := p.parseHeadFinish(term, true) if ref == nil { p.illegal("expected rule head name") return nil, false @@ -1778,6 +1778,35 @@ func (p *Parser) parseTermFinish(head *Term, skipws bool) *Term { } } +func (p *Parser) parseHeadFinish(head *Term, skipws bool) *Term { + if head == nil { + return nil + } + offset := p.s.loc.Offset + p.doScan(false) + + switch p.s.tok { + case tokens.Add, tokens.Sub, tokens.Mul, tokens.Quo, tokens.Rem, + tokens.And, tokens.Or, + tokens.Equal, tokens.Neq, tokens.Gt, tokens.Gte, tokens.Lt, tokens.Lte: + p.illegalToken() + case tokens.Whitespace: + p.doScan(skipws) + } + + switch p.s.tok { + case tokens.LParen, tokens.Dot, tokens.LBrack: + return p.parseRef(head, offset) + case tokens.Whitespace: + p.scan() + } + + if _, ok := head.Value.(Var); ok && RootDocumentNames.Contains(head) { + return RefTerm(head).SetLocation(head.Location) + } + return head +} + func (p *Parser) parseNumber() *Term { var prefix string loc := p.s.Loc() @@ -1853,13 +1882,11 @@ func (p *Parser) parseString() *Term { } var s string - err := json.Unmarshal([]byte(p.s.lit), &s) - if err != nil { + if err := json.Unmarshal([]byte(p.s.lit), &s); err != nil { p.errorf(p.s.Loc(), "illegal string literal: %s", p.s.lit) return nil } - term := StringTerm(s).SetLocation(p.s.Loc()) - return term + return StringTerm(s).SetLocation(p.s.Loc()) } return p.parseRawString() } @@ -1868,8 +1895,7 @@ func (p *Parser) parseRawString() *Term { if len(p.s.lit) < 2 { return nil } - term := StringTerm(p.s.lit[1 : len(p.s.lit)-1]).SetLocation(p.s.Loc()) - return term + return StringTerm(p.s.lit[1 : len(p.s.lit)-1]).SetLocation(p.s.Loc()) } // this is the name to use for instantiating an empty set, e.g., `set()`. diff --git a/vendor/github.com/open-policy-agent/opa/v1/ast/performance.go b/vendor/github.com/open-policy-agent/opa/v1/ast/performance.go new file mode 100644 index 0000000000..3e285f963d --- /dev/null +++ b/vendor/github.com/open-policy-agent/opa/v1/ast/performance.go @@ -0,0 +1,85 @@ +// Copyright 2025 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. +package ast + +import ( + "strings" + "sync" +) + +var builtinNamesByNumParts = sync.OnceValue(func() map[int][]string { + m := map[int][]string{} + for name := range BuiltinMap { + parts := strings.Count(name, ".") + 1 + if parts > 1 { + m[parts] = append(m[parts], name) + } + } + return m +}) + +// BuiltinNameFromRef attempts to extract a known built-in function name from a ref, +// in the most efficient way possible. I.e. without allocating memory for a new string. +// If no built-in function name can be extracted, the second return value is false. +func BuiltinNameFromRef(ref Ref) (string, bool) { + reflen := len(ref) + if reflen == 0 { + return "", false + } + + _var, ok := ref[0].Value.(Var) + if !ok { + return "", false + } + + varName := string(_var) + if reflen == 1 { + if _, ok := BuiltinMap[varName]; ok { + return varName, true + } + return "", false + } + + totalLen := len(varName) + for _, term := range ref[1:] { + if _, ok = term.Value.(String); !ok { + return "", false + } + totalLen += 1 + len(term.Value.(String)) // account for dot + } + + matched, ok := builtinNamesByNumParts()[reflen] + if !ok { + return "", false + } + + for _, name := range matched { + // This check saves us a huge amount of work, as only very few built-in + // names will have the exact same length as the ref we are checking. + if len(name) != totalLen { + continue + } + // Example: `name` is "io.jwt.decode" (and so is ref) + // The first part is varName, which have already been established to be 'io': + // io, jwt.decode io == io + if curr, remaining, _ := strings.Cut(name, "."); curr == varName { + // Loop over the remaining (now known to be string) terms in the ref, e.g. "jwt" and "decode" + for _, term := range ref[1:] { + ts := string(term.Value.(String)) + // First iteration: jwt.decode != jwt, so we continue cutting + // Second iteration: remaining is "decode", and so is term + if remaining == ts { + return name, true + } + // Cutting remaining (e.g. jwt.decode), and we now get: + // jwt, decode, false || jwt != jwt + if curr, remaining, _ = strings.Cut(remaining, "."); remaining == "" || curr != ts { + break + } + } + } + } + + return "", false +} diff --git a/vendor/github.com/open-policy-agent/opa/v1/ast/term.go b/vendor/github.com/open-policy-agent/opa/v1/ast/term.go index 32d294f3ce..18f8a423d9 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/ast/term.go +++ b/vendor/github.com/open-policy-agent/opa/v1/ast/term.go @@ -12,7 +12,6 @@ import ( "fmt" "io" "math" - "math/big" "net/url" "regexp" "slices" @@ -61,20 +60,20 @@ func InterfaceToValue(x any) (Value, error) { case nil: return NullValue, nil case bool: - return InternedTerm(x).Value, nil + return InternedValue(x), nil case json.Number: if interned := InternedIntNumberTermFromString(string(x)); interned != nil { return interned.Value, nil } return Number(x), nil + case int: + return InternedValueOr(x, newIntNumberValue), nil case int64: - return int64Number(x), nil + return InternedValueOr(x, newInt64NumberValue), nil case uint64: - return uint64Number(x), nil + return InternedValueOr(x, newUint64NumberValue), nil case float64: return floatNumber(x), nil - case int: - return intNumber(x), nil case string: return String(x), nil case []any: @@ -586,10 +585,7 @@ type Boolean bool // BooleanTerm creates a new Term with a Boolean value. func BooleanTerm(b bool) *Term { - if b { - return &Term{Value: InternedTerm(true).Value} - } - return &Term{Value: InternedTerm(false).Value} + return &Term{Value: internedBooleanValue(b)} } // Equal returns true if the other Value is a Boolean and is equal. @@ -656,12 +652,12 @@ func NumberTerm(n json.Number) *Term { // IntNumberTerm creates a new Term with an integer Number value. func IntNumberTerm(i int) *Term { - return &Term{Value: Number(strconv.Itoa(i))} + return &Term{Value: newIntNumberValue(i)} } // UIntNumberTerm creates a new Term with an unsigned integer Number value. func UIntNumberTerm(u uint64) *Term { - return &Term{Value: uint64Number(u)} + return &Term{Value: newUint64NumberValue(u)} } // FloatNumberTerm creates a new Term with a floating point Number value. @@ -672,22 +668,10 @@ func FloatNumberTerm(f float64) *Term { // Equal returns true if the other Value is a Number and is equal. func (num Number) Equal(other Value) bool { - switch other := other.(type) { - case Number: - if num == other { - return true - } - if n1, ok1 := num.Int64(); ok1 { - n2, ok2 := other.Int64() - if ok1 && ok2 { - return n1 == n2 - } - } - - return num.Compare(other) == 0 - default: - return false + if other, ok := other.(Number); ok { + return NumberCompare(num, other) == 0 } + return false } // Compare compares num to other, return <0, 0, or >0 if it is less than, equal to, @@ -695,17 +679,7 @@ func (num Number) Equal(other Value) bool { func (num Number) Compare(other Value) int { // Optimize for the common case, as calling Compare allocates on heap. if otherNum, yes := other.(Number); yes { - if ai, ok := num.Int64(); ok { - if bi, ok := otherNum.Int64(); ok { - if ai == bi { - return 0 - } - if ai < bi { - return -1 - } - return 1 - } - } + return NumberCompare(num, otherNum) } return Compare(num, other) @@ -726,13 +700,10 @@ func (num Number) Hash() int { return i } } - f, err := json.Number(num).Float64() - if err != nil { - bs := []byte(num) - h := xxhash.Sum64(bs) - return int(h) + if f, ok := num.Float64(); ok { + return int(f) } - return int(f) + return int(xxhash.Sum64String(string(num))) } // Int returns the int representation of num if possible. @@ -773,15 +744,15 @@ func (num Number) String() string { return string(num) } -func intNumber(i int) Number { +func newIntNumberValue(i int) Value { return Number(strconv.Itoa(i)) } -func int64Number(i int64) Number { +func newInt64NumberValue(i int64) Value { return Number(strconv.FormatInt(i, 10)) } -func uint64Number(u uint64) Number { +func newUint64NumberValue(u uint64) Value { return Number(strconv.FormatUint(u, 10)) } @@ -1183,52 +1154,68 @@ func IsVarCompatibleString(s string) bool { return varRegexp.MatchString(s) } +var bbPool = &sync.Pool{ + New: func() any { + return new(bytes.Buffer) + }, +} + func (ref Ref) String() string { - if len(ref) == 0 { + // Note(anderseknert): + // Options tried in the order of cheapness, where after some effort, + // only the last option now requires a (single) allocation: + // 1. empty ref + // 2. single var ref + // 3. built-in function ref + // 4. concatenated parts + reflen := len(ref) + if reflen == 0 { return "" } - - if len(ref) == 1 { - switch p := ref[0].Value.(type) { - case Var: - return p.String() - } + if reflen == 1 { + return ref[0].Value.String() + } + if name, ok := BuiltinNameFromRef(ref); ok { + return name } - sb := sbPool.Get() - defer sbPool.Put(sb) + _var := ref[0].Value.String() - sb.Grow(10 * len(ref)) - sb.WriteString(ref[0].Value.String()) + bb := bbPool.Get().(*bytes.Buffer) + bb.Reset() + + defer bbPool.Put(bb) + + bb.Grow(len(_var) + len(ref[1:])*7) // rough estimate + bb.WriteString(_var) for _, p := range ref[1:] { switch p := p.Value.(type) { case String: str := string(p) - if varRegexp.MatchString(str) && !IsKeyword(str) { - sb.WriteByte('.') - sb.WriteString(str) + if IsVarCompatibleString(str) && !IsKeyword(str) { + bb.WriteByte('.') + bb.WriteString(str) } else { - sb.WriteByte('[') + bb.WriteByte('[') // Determine whether we need the full JSON-escaped form if strings.ContainsFunc(str, isControlOrBackslash) { - // only now pay the cost of expensive JSON-escaped form - sb.WriteString(p.String()) + bb.Write(strconv.AppendQuote(bb.AvailableBuffer(), str)) } else { - sb.WriteByte('"') - sb.WriteString(str) - sb.WriteByte('"') + bb.WriteByte('"') + bb.WriteString(str) + bb.WriteByte('"') } - sb.WriteByte(']') + bb.WriteByte(']') } default: - sb.WriteByte('[') - sb.WriteString(p.String()) - sb.WriteByte(']') + bb.WriteByte('[') + bb.WriteString(p.String()) + bb.WriteByte(']') } } - return sb.String() + return bb.String() } // OutputVars returns a VarSet containing variables that would be bound by evaluating @@ -1779,85 +1766,9 @@ func (s *set) Slice() []*Term { func (s *set) insert(x *Term, resetSortGuard bool) { hash := x.Hash() insertHash := hash - // This `equal` utility is duplicated and manually inlined a number of - // time in this file. Inlining it avoids heap allocations, so it makes - // a big performance difference: some operations like lookup become twice - // as slow without it. - var equal func(v Value) bool - - switch x := x.Value.(type) { - case Null, Boolean, String, Var: - equal = func(y Value) bool { return x == y } - case Number: - if xi, err := json.Number(x).Int64(); err == nil { - equal = func(y Value) bool { - if y, ok := y.(Number); ok { - if yi, err := json.Number(y).Int64(); err == nil { - return xi == yi - } - } - - return false - } - break - } - - // We use big.Rat for comparing big numbers. - // It replaces big.Float due to following reason: - // big.Float comes with a default precision of 64, and setting a - // larger precision results in more memory being allocated - // (regardless of the actual number we are parsing with SetString). - // - // Note: If we're so close to zero that big.Float says we are zero, do - // *not* big.Rat).SetString on the original string it'll potentially - // take very long. - var a *big.Rat - fa, ok := new(big.Float).SetString(string(x)) - if !ok { - panic("illegal value") - } - if fa.IsInt() { - if i, _ := fa.Int64(); i == 0 { - a = new(big.Rat).SetInt64(0) - } - } - if a == nil { - a, ok = new(big.Rat).SetString(string(x)) - if !ok { - panic("illegal value") - } - } - - equal = func(b Value) bool { - if bNum, ok := b.(Number); ok { - var b *big.Rat - fb, ok := new(big.Float).SetString(string(bNum)) - if !ok { - panic("illegal value") - } - if fb.IsInt() { - if i, _ := fb.Int64(); i == 0 { - b = new(big.Rat).SetInt64(0) - } - } - if b == nil { - b, ok = new(big.Rat).SetString(string(bNum)) - if !ok { - panic("illegal value") - } - } - - return a.Cmp(b) == 0 - } - - return false - } - default: - equal = func(y Value) bool { return Compare(x, y) == 0 } - } for curr, ok := s.elems[insertHash]; ok; { - if equal(curr.Value) { + if KeyHashEqual(curr.Value, x.Value) { return } @@ -1883,87 +1794,18 @@ func (s *set) insert(x *Term, resetSortGuard bool) { } func (s *set) get(x *Term) *Term { - hash := x.Hash() - // This `equal` utility is duplicated and manually inlined a number of - // time in this file. Inlining it avoids heap allocations, so it makes - // a big performance difference: some operations like lookup become twice - // as slow without it. - var equal func(v Value) bool - - switch x := x.Value.(type) { - case Null, Boolean, String, Var: - equal = func(y Value) bool { return x == y } - case Number: - if xi, err := json.Number(x).Int64(); err == nil { - equal = func(y Value) bool { - if y, ok := y.(Number); ok { - if yi, err := json.Number(y).Int64(); err == nil { - return xi == yi - } - } - - return false - } - break - } - - // We use big.Rat for comparing big numbers. - // It replaces big.Float due to following reason: - // big.Float comes with a default precision of 64, and setting a - // larger precision results in more memory being allocated - // (regardless of the actual number we are parsing with SetString). - // - // Note: If we're so close to zero that big.Float says we are zero, do - // *not* big.Rat).SetString on the original string it'll potentially - // take very long. - var a *big.Rat - fa, ok := new(big.Float).SetString(string(x)) - if !ok { - panic("illegal value") - } - if fa.IsInt() { - if i, _ := fa.Int64(); i == 0 { - a = new(big.Rat).SetInt64(0) - } - } - if a == nil { - a, ok = new(big.Rat).SetString(string(x)) - if !ok { - panic("illegal value") - } - } - - equal = func(b Value) bool { - if bNum, ok := b.(Number); ok { - var b *big.Rat - fb, ok := new(big.Float).SetString(string(bNum)) - if !ok { - panic("illegal value") - } - if fb.IsInt() { - if i, _ := fb.Int64(); i == 0 { - b = new(big.Rat).SetInt64(0) - } - } - if b == nil { - b, ok = new(big.Rat).SetString(string(bNum)) - if !ok { - panic("illegal value") - } - } - - return a.Cmp(b) == 0 - } - return false - - } - - default: - equal = func(y Value) bool { return Compare(x, y) == 0 } + if len(s.elems) == 0 { + return nil } + hash := x.Hash() + for curr, ok := s.elems[hash]; ok; { - if equal(curr.Value) { + // Pointer equality check first + if curr == x { + return curr + } + if KeyHashEqual(curr.Value, x.Value) { return curr } @@ -2304,12 +2146,37 @@ func (obj *object) Insert(k, v *Term) { // Get returns the value of k in obj if k exists, otherwise nil. func (obj *object) Get(k *Term) *Term { - if elem := obj.get(k); elem != nil { - return elem.value + if len(obj.elems) == 0 { + return nil + } + + hash := k.Hash() + for curr := obj.elems[hash]; curr != nil; curr = curr.next { + // Pointer equality check always fastest, and not too unlikely with interning. + if curr.key == k { + return curr.value + } + + if KeyHashEqual(curr.key.Value, k.Value) { + return curr.value + } } return nil } +func KeyHashEqual(x, y Value) bool { + switch x := x.(type) { + case Null, Boolean, String, Var: + return x == y + case Number: + if y, ok := y.(Number); ok { + return x.Equal(y) + } + } + + return Compare(x, y) == 0 +} + // Hash returns the hash code for the Value. func (obj *object) Hash() int { return obj.hash @@ -2516,94 +2383,7 @@ func (obj *object) String() string { return sb.String() } -func (obj *object) get(k *Term) *objectElem { - hash := k.Hash() - - // This `equal` utility is duplicated and manually inlined a number of - // time in this file. Inlining it avoids heap allocations, so it makes - // a big performance difference: some operations like lookup become twice - // as slow without it. - var equal func(v Value) bool - - switch x := k.Value.(type) { - case Null, Boolean, String, Var: - equal = func(y Value) bool { return x == y } - case Number: - if xi, ok := x.Int64(); ok { - equal = func(y Value) bool { - if x == y { - return true - } - if y, ok := y.(Number); ok { - if yi, ok := y.Int64(); ok { - return xi == yi - } - } - - return false - } - break - } - - // We use big.Rat for comparing big numbers. - // It replaces big.Float due to following reason: - // big.Float comes with a default precision of 64, and setting a - // larger precision results in more memory being allocated - // (regardless of the actual number we are parsing with SetString). - // - // Note: If we're so close to zero that big.Float says we are zero, do - // *not* big.Rat).SetString on the original string it'll potentially - // take very long. - var a *big.Rat - fa, ok := new(big.Float).SetString(string(x)) - if !ok { - panic("illegal value") - } - if fa.IsInt() { - if i, _ := fa.Int64(); i == 0 { - a = new(big.Rat).SetInt64(0) - } - } - if a == nil { - a, ok = new(big.Rat).SetString(string(x)) - if !ok { - panic("illegal value") - } - } - - equal = func(b Value) bool { - if bNum, ok := b.(Number); ok { - var b *big.Rat - fb, ok := new(big.Float).SetString(string(bNum)) - if !ok { - panic("illegal value") - } - if fb.IsInt() { - if i, _ := fb.Int64(); i == 0 { - b = new(big.Rat).SetInt64(0) - } - } - if b == nil { - b, ok = new(big.Rat).SetString(string(bNum)) - if !ok { - panic("illegal value") - } - } - - return a.Cmp(b) == 0 - } - - return false - } - default: - equal = func(y Value) bool { return Compare(x, y) == 0 } - } - - for curr := obj.elems[hash]; curr != nil; curr = curr.next { - if equal(curr.key.Value) { - return curr - } - } +func (*object) get(*Term) *objectElem { return nil } @@ -2612,88 +2392,9 @@ func (obj *object) get(k *Term) *objectElem { func (obj *object) insert(k, v *Term, resetSortGuard bool) { hash := k.Hash() head := obj.elems[hash] - // This `equal` utility is duplicated and manually inlined a number of - // time in this file. Inlining it avoids heap allocations, so it makes - // a big performance difference: some operations like lookup become twice - // as slow without it. - var equal func(v Value) bool - - switch x := k.Value.(type) { - case Null, Boolean, String, Var: - equal = func(y Value) bool { return x == y } - case Number: - if xi, err := json.Number(x).Int64(); err == nil { - equal = func(y Value) bool { - if x == y { - return true - } - if y, ok := y.(Number); ok { - if yi, err := json.Number(y).Int64(); err == nil { - return xi == yi - } - } - - return false - } - break - } - - // We use big.Rat for comparing big numbers. - // It replaces big.Float due to following reason: - // big.Float comes with a default precision of 64, and setting a - // larger precision results in more memory being allocated - // (regardless of the actual number we are parsing with SetString). - // - // Note: If we're so close to zero that big.Float says we are zero, do - // *not* big.Rat).SetString on the original string it'll potentially - // take very long. - var a *big.Rat - fa, ok := new(big.Float).SetString(string(x)) - if !ok { - panic("illegal value") - } - if fa.IsInt() { - if i, _ := fa.Int64(); i == 0 { - a = new(big.Rat).SetInt64(0) - } - } - if a == nil { - a, ok = new(big.Rat).SetString(string(x)) - if !ok { - panic("illegal value") - } - } - - equal = func(b Value) bool { - if bNum, ok := b.(Number); ok { - var b *big.Rat - fb, ok := new(big.Float).SetString(string(bNum)) - if !ok { - panic("illegal value") - } - if fb.IsInt() { - if i, _ := fb.Int64(); i == 0 { - b = new(big.Rat).SetInt64(0) - } - } - if b == nil { - b, ok = new(big.Rat).SetString(string(bNum)) - if !ok { - panic("illegal value") - } - } - - return a.Cmp(b) == 0 - } - - return false - } - default: - equal = func(y Value) bool { return Compare(x, y) == 0 } - } for curr := head; curr != nil; curr = curr.next { - if equal(curr.key.Value) { + if KeyHashEqual(curr.key.Value, k.Value) { if curr.value.IsGround() { obj.ground-- } diff --git a/vendor/github.com/open-policy-agent/opa/v1/bundle/store.go b/vendor/github.com/open-policy-agent/opa/v1/bundle/store.go index f203f7086b..992bf78f63 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/bundle/store.go +++ b/vendor/github.com/open-policy-agent/opa/v1/bundle/store.go @@ -86,6 +86,12 @@ func moduleInfoPath(id string) storage.Path { func read(ctx context.Context, store storage.Store, txn storage.Transaction, path storage.Path) (any, error) { value, err := store.Read(ctx, txn, path) if err != nil { + if storage.IsNotFound(err) { + return nil, &storage.Error{ + Code: storage.NotFoundErr, + Message: strings.TrimPrefix(path.String(), "/system") + ": document does not exist", + } + } return nil, err } diff --git a/vendor/github.com/open-policy-agent/opa/v1/format/format.go b/vendor/github.com/open-policy-agent/opa/v1/format/format.go index 4867594905..75514d39c0 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/format/format.go +++ b/vendor/github.com/open-policy-agent/opa/v1/format/format.go @@ -18,6 +18,20 @@ import ( "github.com/open-policy-agent/opa/internal/future" "github.com/open-policy-agent/opa/v1/ast" "github.com/open-policy-agent/opa/v1/types" + "github.com/open-policy-agent/opa/v1/util" +) + +// defaultLocationFile is the file name used in `Ast()` for terms +// without a location, as could happen when pretty-printing the +// results of partial eval. +const defaultLocationFile = "__format_default__" + +var ( + elseVar ast.Value = ast.Var("else") + + expandedConst = ast.NewBody(ast.NewExpr(ast.InternedTerm(true))) + commentsSlicePool = util.NewSlicePool[*ast.Comment](50) + varRegexp = regexp.MustCompile("^[[:alpha:]_][[:alpha:][:digit:]_]*$") ) // Opts lets you control the code formatting via `AstWithOpts()`. @@ -38,6 +52,11 @@ type Opts struct { // Imports are only removed if [Opts.RegoVersion] makes them redundant. DropV0Imports bool + // SkipDefensiveCopying, if true, will avoid deep-copying the AST before formatting it. + // This is true by default for all Source* functions, but false by default for Ast* functions, + // as some formatting operations may otherwise mutate the AST. + SkipDefensiveCopying bool + Capabilities *ast.Capabilities } @@ -48,16 +67,11 @@ func (o Opts) effectiveRegoVersion() ast.RegoVersion { return o.RegoVersion } -// defaultLocationFile is the file name used in `Ast()` for terms -// without a location, as could happen when pretty-printing the -// results of partial eval. -const defaultLocationFile = "__format_default__" - // Source formats a Rego source file. The bytes provided must describe a complete // Rego module. If they don't, Source will return an error resulting from the attempt // to parse the bytes. func Source(filename string, src []byte) ([]byte, error) { - return SourceWithOpts(filename, src, Opts{}) + return SourceWithOpts(filename, src, Opts{SkipDefensiveCopying: true}) } func SourceWithOpts(filename string, src []byte, opts Opts) ([]byte, error) { @@ -72,6 +86,9 @@ func SourceWithOpts(filename string, src []byte, opts Opts) ([]byte, error) { parserOpts.RegoVersion = ast.RegoV1 } + // Copying the node does not make sense when both input and output are bytes. + opts.SkipDefensiveCopying = true + if parserOpts.RegoVersion == ast.RegoUndefined { parserOpts.RegoVersion = ast.DefaultRegoVersion } @@ -166,7 +183,9 @@ func AstWithOpts(x any, opts Opts) ([]byte, error) { // The node has to be deep copied because it may be mutated below. Alternatively, // we could avoid the copy by checking if mutation will occur first. For now, // since format is not latency sensitive, just deep copy in all cases. - x = ast.Copy(x) + if !opts.SkipDefensiveCopying { + x = ast.Copy(x) + } wildcards := map[ast.Var]*ast.Term{} @@ -233,10 +252,11 @@ func AstWithOpts(x any, opts Opts) ([]byte, error) { } case *ast.Rule: - if len(n.Head.Ref()) > 2 { + headLen := len(n.Head.Ref()) + if headLen > 2 { o.refHeads = true } - if len(n.Head.Ref()) == 2 && n.Head.Key != nil && n.Head.Value == nil { // p.q contains "x" + if headLen == 2 && n.Head.Key != nil && n.Head.Value == nil { // p.q contains "x" o.refHeads = true } } @@ -339,6 +359,7 @@ func AstWithOpts(x any, opts Opts) ([]byte, error) { if len(w.errs) > 0 { return nil, w.errs } + return squashTrailingNewlines(w.buf.Bytes()), nil } @@ -545,8 +566,6 @@ func (w *writer) writeRules(rules []*ast.Rule, comments []*ast.Comment) ([]*ast. return comments, nil } -var expandedConst = ast.NewBody(ast.NewExpr(ast.InternedTerm(true))) - func (w *writer) groupableOneLiner(rule *ast.Rule) bool { // Location required to determine if two rules are adjacent in the policy. // If not, we respect line breaks between rules. @@ -667,8 +686,6 @@ func (w *writer) writeRule(rule *ast.Rule, isElse bool, comments []*ast.Comment) return comments, nil } -var elseVar ast.Value = ast.Var("else") - func (w *writer) writeElse(rule *ast.Rule, comments []*ast.Comment) ([]*ast.Comment, error) { // If there was nothing else on the line before the "else" starts // then preserve this style of else block, otherwise it will be @@ -1127,18 +1144,33 @@ func (w *writer) writeWith(with *ast.With, comments []*ast.Comment, indented boo return comments, nil } +// saveComments saves a copy of the comments slice in a pooled slice to and returns it. +// This is to avoid having to create a new slice every time we need to save comments. +// The caller is responsible for putting the slice back in the pool when done. +func saveComments(comments []*ast.Comment) *[]*ast.Comment { + cmlen := len(comments) + saved := commentsSlicePool.Get(cmlen) + + copy(*saved, comments) + + return saved +} + func (w *writer) writeTerm(term *ast.Term, comments []*ast.Comment) ([]*ast.Comment, error) { - currentComments := make([]*ast.Comment, len(comments)) - copy(currentComments, comments) + if len(comments) == 0 { + return w.writeTermParens(false, term, comments) + } currentLen := w.buf.Len() + currentComments := saveComments(comments) + defer commentsSlicePool.Put(currentComments) comments, err := w.writeTermParens(false, term, comments) if err != nil { if errors.As(err, &unexpectedCommentError{}) { w.buf.Truncate(currentLen) - comments, uErr := w.writeUnformatted(term.Location, currentComments) + comments, uErr := w.writeUnformatted(term.Location, *currentComments) if uErr != nil { return nil, uErr } @@ -1156,16 +1188,16 @@ func (w *writer) writeUnformatted(location *ast.Location, currentComments []*ast return nil, errors.New("original unformatted text is empty") } - rawRule := string(location.Text) - rowNum := len(strings.Split(rawRule, "\n")) + rowNum := bytes.Count(location.Text, []byte{'\n'}) + 1 - w.write(string(location.Text)) + w.writeBytes(location.Text) comments := make([]*ast.Comment, 0, len(currentComments)) for _, c := range currentComments { // if there is a body then wait to write the last comment if w.writeCommentOnFinalLine && c.Location.Row == location.Row+rowNum-1 { - w.write(" " + string(c.Location.Text)) + w.write(" ") + w.writeBytes(c.Location.Text) continue } @@ -1227,19 +1259,19 @@ func (w *writer) writeTermParens(parens bool, term *ast.Term, comments []*ast.Co case ast.String: if term.Location.Text[0] == '`' { // To preserve raw strings, we need to output the original text, - w.write(string(term.Location.Text)) + w.writeBytes(term.Location.Text) } else { // x.String() cannot be used by default because it can change the input string "\u0000" to "\x00" - var after, quote string + var after, quote []byte var found bool // term.Location.Text could contain the prefix `else :=`, remove it switch term.Location.Text[len(term.Location.Text)-1] { case '"': - quote = "\"" - _, after, found = strings.Cut(string(term.Location.Text), quote) + quote = []byte{'"'} + _, after, found = bytes.Cut(term.Location.Text, quote) case '`': - quote = "`" - _, after, found = strings.Cut(string(term.Location.Text), quote) + quote = []byte{'`'} + _, after, found = bytes.Cut(term.Location.Text, quote) } if !found { @@ -1247,7 +1279,8 @@ func (w *writer) writeTermParens(parens bool, term *ast.Term, comments []*ast.Co // e.g. partial_set.y to partial_set["y"] w.write(x.String()) } else { - w.write(quote + after) + w.writeBytes(quote) + w.writeBytes(after) } } @@ -1310,8 +1343,6 @@ func (w *writer) writeBracketed(str string) { w.write("[" + str + "]") } -var varRegexp = regexp.MustCompile("^[[:alpha:]_][[:alpha:][:digit:]_]*$") - func (w *writer) writeRefStringPath(s ast.String, l *ast.Location) { str := string(s) if w.shouldBracketRefTerm(str, l) { @@ -2130,11 +2161,16 @@ func (w *writer) blankLine() { w.write("\n") } -// write the input string and writes it to the buffer. +// write writes string s to the buffer. func (w *writer) write(s string) { w.buf.WriteString(s) } +// writeBytes writes []byte b to the buffer. +func (w *writer) writeBytes(b []byte) { + w.buf.Write(b) +} + // writeLine writes the string on a newly started line, then terminate the line. func (w *writer) writeLine(s string) { if !w.inline { diff --git a/vendor/github.com/open-policy-agent/opa/v1/plugins/rest/auth.go b/vendor/github.com/open-policy-agent/opa/v1/plugins/rest/auth.go index 3927a25435..8ec337bd1e 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/plugins/rest/auth.go +++ b/vendor/github.com/open-policy-agent/opa/v1/plugins/rest/auth.go @@ -397,7 +397,7 @@ func (ap *oauth2ClientCredentialsAuthPlugin) createAuthJWT(ctx context.Context, } // Parse headers - var headers map[string]interface{} + var headers map[string]any if err := json.Unmarshal(header, &headers); err != nil { return nil, err } diff --git a/vendor/github.com/open-policy-agent/opa/v1/rego/rego.go b/vendor/github.com/open-policy-agent/opa/v1/rego/rego.go index 8a47d90a93..2c4d8a8d91 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/rego/rego.go +++ b/vendor/github.com/open-policy-agent/opa/v1/rego/rego.go @@ -1798,7 +1798,7 @@ func (r *Rego) PrepareForEval(ctx context.Context, opts ...PrepareOption) (Prepa } // nolint: staticcheck // SA4006 false positive - data, err := r.store.Read(ctx, r.txn, storage.Path{}) + data, err := r.store.Read(ctx, r.txn, storage.RootPath) if err != nil { _ = txnClose(ctx, err) // Ignore error return PreparedEvalQuery{}, err @@ -2020,7 +2020,7 @@ func (r *Rego) loadFiles(ctx context.Context, txn storage.Transaction, m metrics } if len(result.Documents) > 0 { - err = r.store.Write(ctx, txn, storage.AddOp, storage.Path{}, result.Documents) + err = r.store.Write(ctx, txn, storage.AddOp, storage.RootPath, result.Documents) if err != nil { return err } diff --git a/vendor/github.com/open-policy-agent/opa/v1/storage/inmem/ast.go b/vendor/github.com/open-policy-agent/opa/v1/storage/inmem/ast.go index 941cbeef51..40f18ab0de 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/storage/inmem/ast.go +++ b/vendor/github.com/open-policy-agent/opa/v1/storage/inmem/ast.go @@ -73,10 +73,9 @@ func (u *updateAST) Apply(v any) any { } func newUpdateAST(data any, op storage.PatchOp, path storage.Path, idx int, value ast.Value) (*updateAST, error) { - switch data.(type) { case ast.Null, ast.Boolean, ast.Number, ast.String: - return nil, errors.NewNotFoundError(path) + return nil, errors.NotFoundErr } switch data := data.(type) { @@ -94,11 +93,10 @@ func newUpdateAST(data any, op storage.PatchOp, path storage.Path, idx int, valu } func newUpdateArrayAST(data *ast.Array, op storage.PatchOp, path storage.Path, idx int, value ast.Value) (*updateAST, error) { - if idx == len(path)-1 { if path[idx] == "-" || path[idx] == strconv.Itoa(data.Len()) { if op != storage.AddOp { - return nil, invalidPatchError("%v: invalid patch path", path) + return nil, errors.NewInvalidPatchError("%v: invalid patch path", path) } cpy := data.Append(ast.NewTerm(value)) @@ -161,7 +159,7 @@ func newUpdateObjectAST(data ast.Object, op storage.PatchOp, path storage.Path, switch op { case storage.ReplaceOp, storage.RemoveOp: if val == nil { - return nil, errors.NewNotFoundError(path) + return nil, errors.NotFoundErr } } return &updateAST{path, op == storage.RemoveOp, value}, nil @@ -171,14 +169,7 @@ func newUpdateObjectAST(data ast.Object, op storage.PatchOp, path storage.Path, return newUpdateAST(val.Value, op, path, idx+1, value) } - return nil, errors.NewNotFoundError(path) -} - -func interfaceToValue(v any) (ast.Value, error) { - if v, ok := v.(ast.Value); ok { - return v, nil - } - return ast.InterfaceToValue(v) + return nil, errors.NotFoundErr } // setInAst updates the value in the AST at the given path with the given value. diff --git a/vendor/github.com/open-policy-agent/opa/v1/storage/inmem/inmem.go b/vendor/github.com/open-policy-agent/opa/v1/storage/inmem/inmem.go index 742d6c167f..cdc43424dd 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/storage/inmem/inmem.go +++ b/vendor/github.com/open-policy-agent/opa/v1/storage/inmem/inmem.go @@ -27,6 +27,7 @@ import ( "github.com/open-policy-agent/opa/internal/merge" "github.com/open-policy-agent/opa/v1/ast" "github.com/open-policy-agent/opa/v1/storage" + "github.com/open-policy-agent/opa/v1/storage/internal/errors" "github.com/open-policy-agent/opa/v1/util" ) @@ -50,6 +51,7 @@ func NewWithOpts(opts ...Opt) storage.Store { if s.returnASTValuesOnRead { s.data = ast.NewObject() + s.roundTripOnWrite = false } else { s.data = map[string]any{} } @@ -71,7 +73,7 @@ func NewFromObjectWithOpts(data map[string]any, opts ...Opt) storage.Store { if err != nil { panic(err) } - if err := db.Write(ctx, txn, storage.AddOp, storage.Path{}, data); err != nil { + if err := db.Write(ctx, txn, storage.AddOp, storage.RootPath, data); err != nil { panic(err) } if err := db.Commit(ctx, txn); err != nil { @@ -89,9 +91,8 @@ func NewFromReader(r io.Reader) storage.Store { // NewFromReader returns a new in-memory store from a reader that produces a // JSON serialized object, with extra options. This function is for test purposes. func NewFromReaderWithOpts(r io.Reader, opts ...Opt) storage.Store { - d := util.NewJSONDecoder(r) var data map[string]any - if err := d.Decode(&data); err != nil { + if err := util.NewJSONDecoder(r).Decode(&data); err != nil { panic(err) } return NewFromObjectWithOpts(data, opts...) @@ -120,35 +121,39 @@ type handle struct { } func (db *store) NewTransaction(_ context.Context, params ...storage.TransactionParams) (storage.Transaction, error) { - var write bool - var ctx *storage.Context - if len(params) > 0 { - write = params[0].Write - ctx = params[0].Context + txn := &transaction{ + xid: atomic.AddUint64(&db.xid, uint64(1)), + db: db, } - xid := atomic.AddUint64(&db.xid, uint64(1)) - if write { + + if len(params) > 0 { + txn.write = params[0].Write + txn.context = params[0].Context + } + + if txn.write { db.wmu.Lock() } else { db.rmu.RLock() } - return newTransaction(xid, write, ctx, db), nil + + return txn, nil } // Truncate implements the storage.Store interface. This method must be called within a transaction. func (db *store) Truncate(ctx context.Context, txn storage.Transaction, params storage.TransactionParams, it storage.Iterator) error { var update *storage.Update var err error - mergedData := map[string]any{} underlying, err := db.underlying(txn) if err != nil { return err } + mergedData := map[string]any{} + for { - update, err = it.Next() - if err != nil { + if update, err = it.Next(); err != nil { break } @@ -159,8 +164,7 @@ func (db *store) Truncate(ctx context.Context, txn storage.Transaction, params s } } else { var value any - err = util.Unmarshal(update.Value, &value) - if err != nil { + if err = util.Unmarshal(update.Value, &value); err != nil { return err } @@ -193,11 +197,7 @@ func (db *store) Truncate(ctx context.Context, txn storage.Transaction, params s // For backwards compatibility, check if `RootOverwrite` was configured. if params.RootOverwrite { - newPath, ok := storage.ParsePathEscaped("/") - if !ok { - return fmt.Errorf("storage path invalid: %v", newPath) - } - return underlying.Write(storage.AddOp, newPath, mergedData) + return underlying.Write(storage.AddOp, storage.RootPath, mergedData) } for _, root := range params.BasePaths { @@ -310,12 +310,7 @@ func (db *store) Read(_ context.Context, txn storage.Transaction, path storage.P return nil, err } - v, err := underlying.Read(path) - if err != nil { - return nil, err - } - - return v, nil + return underlying.Read(path) } func (db *store) Write(_ context.Context, txn storage.Transaction, op storage.PatchOp, path storage.Path, value any) error { @@ -323,12 +318,19 @@ func (db *store) Write(_ context.Context, txn storage.Transaction, op storage.Pa if err != nil { return err } + + if db.returnASTValuesOnRead || !util.NeedsRoundTrip(value) { + // Fast path when value is nil, bool, string or json.Number. + return underlying.Write(op, path, value) + } + val := util.Reference(value) if db.roundTripOnWrite { if err := util.RoundTrip(val); err != nil { return err } } + return underlying.Write(op, path, *val) } @@ -409,22 +411,12 @@ func (db *store) underlying(txn storage.Transaction) (*transaction, error) { return underlying, nil } -const rootMustBeObjectMsg = "root must be object" -const rootCannotBeRemovedMsg = "root cannot be removed" - -func invalidPatchError(f string, a ...any) *storage.Error { - return &storage.Error{ - Code: storage.InvalidPatchErr, - Message: fmt.Sprintf(f, a...), - } -} - func mktree(path []string, value any) (map[string]any, error) { if len(path) == 0 { // For 0 length path the value is the full tree. obj, ok := value.(map[string]any) if !ok { - return nil, invalidPatchError(rootMustBeObjectMsg) + return nil, errors.RootMustBeObjectErr } return obj, nil } diff --git a/vendor/github.com/open-policy-agent/opa/v1/storage/inmem/txn.go b/vendor/github.com/open-policy-agent/opa/v1/storage/inmem/txn.go index 28e68c20f2..e76bccd013 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/storage/inmem/txn.go +++ b/vendor/github.com/open-policy-agent/opa/v1/storage/inmem/txn.go @@ -7,6 +7,7 @@ package inmem import ( "container/list" "encoding/json" + "slices" "strconv" "github.com/open-policy-agent/opa/internal/deepcopy" @@ -34,13 +35,13 @@ import ( // Read transactions do not require any special handling and simply passthrough // to the underlying store. Read transactions do not support upgrade. type transaction struct { + db *store + updates *list.List + context *storage.Context + policies map[string]policyUpdate xid uint64 write bool stale bool - db *store - updates *list.List - policies map[string]policyUpdate - context *storage.Context } type policyUpdate struct { @@ -48,28 +49,17 @@ type policyUpdate struct { remove bool } -func newTransaction(xid uint64, write bool, context *storage.Context, db *store) *transaction { - return &transaction{ - xid: xid, - write: write, - db: db, - policies: map[string]policyUpdate{}, - updates: list.New(), - context: context, - } -} - func (txn *transaction) ID() uint64 { return txn.xid } func (txn *transaction) Write(op storage.PatchOp, path storage.Path, value any) error { - if !txn.write { - return &storage.Error{ - Code: storage.InvalidTransactionErr, - Message: "data write during read transaction", - } + return &storage.Error{Code: storage.InvalidTransactionErr, Message: "data write during read transaction"} + } + + if txn.updates == nil { + txn.updates = list.New() } if len(path) == 0 { @@ -85,9 +75,20 @@ func (txn *transaction) Write(op storage.PatchOp, path storage.Path, value any) if update.Path().Equal(path) { if update.Remove() { if op != storage.AddOp { - return errors.NewNotFoundError(path) + return errors.NotFoundErr } } + // If the last update has the same path and value, we have nothing to do. + if txn.db.returnASTValuesOnRead { + if astValue, ok := update.Value().(ast.Value); ok { + if equalsValue(value, astValue) { + return nil + } + } + } else if comparableEquals(update.Value(), value) { + return nil + } + txn.updates.Remove(curr) break } @@ -106,7 +107,7 @@ func (txn *transaction) Write(op storage.PatchOp, path storage.Path, value any) // existing update is mutated. if path.HasPrefix(update.Path()) { if update.Remove() { - return errors.NewNotFoundError(path) + return errors.NotFoundErr } suffix := path[len(update.Path()):] newUpdate, err := txn.db.newUpdate(update.Value(), op, suffix, 0, value) @@ -129,33 +130,53 @@ func (txn *transaction) Write(op storage.PatchOp, path storage.Path, value any) return nil } +func comparableEquals(a, b any) bool { + switch a := a.(type) { + case nil: + return b == nil + case bool: + if vb, ok := b.(bool); ok { + return vb == a + } + case string: + if vs, ok := b.(string); ok { + return vs == a + } + case json.Number: + if vn, ok := b.(json.Number); ok { + return vn == a + } + } + return false +} + func (txn *transaction) updateRoot(op storage.PatchOp, value any) error { if op == storage.RemoveOp { - return invalidPatchError(rootCannotBeRemovedMsg) + return errors.RootCannotBeRemovedErr } var update any if txn.db.returnASTValuesOnRead { - valueAST, err := interfaceToValue(value) + valueAST, err := ast.InterfaceToValue(value) if err != nil { return err } if _, ok := valueAST.(ast.Object); !ok { - return invalidPatchError(rootMustBeObjectMsg) + return errors.RootMustBeObjectErr } update = &updateAST{ - path: storage.Path{}, + path: storage.RootPath, remove: false, value: valueAST, } } else { if _, ok := value.(map[string]any); !ok { - return invalidPatchError(rootMustBeObjectMsg) + return errors.RootMustBeObjectErr } update = &updateRaw{ - path: storage.Path{}, + path: storage.RootPath, remove: false, value: value, } @@ -163,21 +184,36 @@ func (txn *transaction) updateRoot(op storage.PatchOp, value any) error { txn.updates.Init() txn.updates.PushFront(update) + return nil } func (txn *transaction) Commit() (result storage.TriggerEvent) { result.Context = txn.context - for curr := txn.updates.Front(); curr != nil; curr = curr.Next() { - action := curr.Value.(dataUpdate) - txn.db.data = action.Apply(txn.db.data) - result.Data = append(result.Data, storage.DataEvent{ - Path: action.Path(), - Data: action.Value(), - Removed: action.Remove(), - }) + if txn.updates != nil { + if len(txn.db.triggers) > 0 { + result.Data = slices.Grow(result.Data, txn.updates.Len()) + } + + for curr := txn.updates.Front(); curr != nil; curr = curr.Next() { + action := curr.Value.(dataUpdate) + txn.db.data = action.Apply(txn.db.data) + + if len(txn.db.triggers) > 0 { + result.Data = append(result.Data, storage.DataEvent{ + Path: action.Path(), + Data: action.Value(), + Removed: action.Remove(), + }) + } + } } + + if len(txn.policies) > 0 && len(txn.db.triggers) > 0 { + result.Policy = slices.Grow(result.Policy, len(txn.policies)) + } + for id, upd := range txn.policies { if upd.remove { delete(txn.db.policies, id) @@ -185,11 +221,13 @@ func (txn *transaction) Commit() (result storage.TriggerEvent) { txn.db.policies[id] = upd.value } - result.Policy = append(result.Policy, storage.PolicyEvent{ - ID: id, - Data: upd.value, - Removed: upd.remove, - }) + if len(txn.db.triggers) > 0 { + result.Policy = append(result.Policy, storage.PolicyEvent{ + ID: id, + Data: upd.value, + Removed: upd.remove, + }) + } } return result } @@ -218,8 +256,7 @@ func deepcpy(v any) any { } func (txn *transaction) Read(path storage.Path) (any, error) { - - if !txn.write { + if !txn.write || txn.updates == nil { return pointer(txn.db.data, path) } @@ -231,7 +268,7 @@ func (txn *transaction) Read(path storage.Path) (any, error) { if path.HasPrefix(upd.Path()) { if upd.Remove() { - return nil, errors.NewNotFoundError(path) + return nil, errors.NotFoundErr } return pointer(upd.Value(), path[len(upd.Path()):]) } @@ -260,8 +297,7 @@ func (txn *transaction) Read(path storage.Path) (any, error) { return cpy, nil } -func (txn *transaction) ListPolicies() []string { - var ids []string +func (txn *transaction) ListPolicies() (ids []string) { for id := range txn.db.policies { if _, ok := txn.policies[id]; !ok { ids = append(ids, id) @@ -276,11 +312,13 @@ func (txn *transaction) ListPolicies() []string { } func (txn *transaction) GetPolicy(id string) ([]byte, error) { - if update, ok := txn.policies[id]; ok { - if !update.remove { - return update.value, nil + if txn.policies != nil { + if update, ok := txn.policies[id]; ok { + if !update.remove { + return update.value, nil + } + return nil, errors.NewNotFoundErrorf("policy id %q", id) } - return nil, errors.NewNotFoundErrorf("policy id %q", id) } if exist, ok := txn.db.policies[id]; ok { return exist, nil @@ -289,24 +327,24 @@ func (txn *transaction) GetPolicy(id string) ([]byte, error) { } func (txn *transaction) UpsertPolicy(id string, bs []byte) error { - if !txn.write { - return &storage.Error{ - Code: storage.InvalidTransactionErr, - Message: "policy write during read transaction", - } - } - txn.policies[id] = policyUpdate{bs, false} - return nil + return txn.updatePolicy(id, policyUpdate{bs, false}) } func (txn *transaction) DeletePolicy(id string) error { + return txn.updatePolicy(id, policyUpdate{nil, true}) +} + +func (txn *transaction) updatePolicy(id string, update policyUpdate) error { if !txn.write { - return &storage.Error{ - Code: storage.InvalidTransactionErr, - Message: "policy write during read transaction", - } + return &storage.Error{Code: storage.InvalidTransactionErr, Message: "policy write during read transaction"} } - txn.policies[id] = policyUpdate{nil, true} + + if txn.policies == nil { + txn.policies = map[string]policyUpdate{id: update} + } else { + txn.policies[id] = update + } + return nil } @@ -327,13 +365,33 @@ type updateRaw struct { value any // value to add/replace at path (ignored if remove is true) } +func equalsValue(a any, v ast.Value) bool { + if a, ok := a.(ast.Value); ok { + return a.Compare(v) == 0 + } + switch a := a.(type) { + case nil: + return v == ast.NullValue + case bool: + if vb, ok := v.(ast.Boolean); ok { + return bool(vb) == a + } + case string: + if vs, ok := v.(ast.String); ok { + return string(vs) == a + } + } + + return false +} + func (db *store) newUpdate(data any, op storage.PatchOp, path storage.Path, idx int, value any) (dataUpdate, error) { if db.returnASTValuesOnRead { - astData, err := interfaceToValue(data) + astData, err := ast.InterfaceToValue(data) if err != nil { return nil, err } - astValue, err := interfaceToValue(value) + astValue, err := ast.InterfaceToValue(value) if err != nil { return nil, err } @@ -343,10 +401,9 @@ func (db *store) newUpdate(data any, op storage.PatchOp, path storage.Path, idx } func newUpdateRaw(data any, op storage.PatchOp, path storage.Path, idx int, value any) (dataUpdate, error) { - switch data.(type) { case nil, bool, json.Number, string: - return nil, errors.NewNotFoundError(path) + return nil, errors.NotFoundErr } switch data := data.(type) { @@ -364,11 +421,10 @@ func newUpdateRaw(data any, op storage.PatchOp, path storage.Path, idx int, valu } func newUpdateArray(data []any, op storage.PatchOp, path storage.Path, idx int, value any) (dataUpdate, error) { - if idx == len(path)-1 { if path[idx] == "-" || path[idx] == strconv.Itoa(len(data)) { if op != storage.AddOp { - return nil, invalidPatchError("%v: invalid patch path", path) + return nil, errors.NewInvalidPatchError("%v: invalid patch path", path) } cpy := make([]any, len(data)+1) copy(cpy, data) @@ -417,7 +473,7 @@ func newUpdateObject(data map[string]any, op storage.PatchOp, path storage.Path, switch op { case storage.ReplaceOp, storage.RemoveOp: if _, ok := data[path[idx]]; !ok { - return nil, errors.NewNotFoundError(path) + return nil, errors.NotFoundErr } } return &updateRaw{path, op == storage.RemoveOp, value}, nil @@ -427,7 +483,7 @@ func newUpdateObject(data map[string]any, op storage.PatchOp, path storage.Path, return newUpdateRaw(data, op, path, idx+1, value) } - return nil, errors.NewNotFoundError(path) + return nil, errors.NotFoundErr } func (u *updateRaw) Remove() bool { diff --git a/vendor/github.com/open-policy-agent/opa/v1/storage/internal/errors/errors.go b/vendor/github.com/open-policy-agent/opa/v1/storage/internal/errors/errors.go index d13fff50fc..a478b9f257 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/storage/internal/errors/errors.go +++ b/vendor/github.com/open-policy-agent/opa/v1/storage/internal/errors/errors.go @@ -11,27 +11,31 @@ import ( "github.com/open-policy-agent/opa/v1/storage" ) -const ArrayIndexTypeMsg = "array index must be integer" -const DoesNotExistMsg = "document does not exist" -const OutOfRangeMsg = "array index out of range" +const ( + ArrayIndexTypeMsg = "array index must be integer" + DoesNotExistMsg = "document does not exist" + OutOfRangeMsg = "array index out of range" + RootMustBeObjectMsg = "root must be object" + RootCannotBeRemovedMsg = "root cannot be removed" +) -func NewNotFoundError(path storage.Path) *storage.Error { - return NewNotFoundErrorWithHint(path, DoesNotExistMsg) -} +var ( + NotFoundErr = &storage.Error{Code: storage.NotFoundErr, Message: DoesNotExistMsg} + RootMustBeObjectErr = &storage.Error{Code: storage.InvalidPatchErr, Message: RootMustBeObjectMsg} + RootCannotBeRemovedErr = &storage.Error{Code: storage.InvalidPatchErr, Message: RootCannotBeRemovedMsg} +) func NewNotFoundErrorWithHint(path storage.Path, hint string) *storage.Error { - message := path.String() + ": " + hint return &storage.Error{ Code: storage.NotFoundErr, - Message: message, + Message: path.String() + ": " + hint, } } func NewNotFoundErrorf(f string, a ...any) *storage.Error { - msg := fmt.Sprintf(f, a...) return &storage.Error{ Code: storage.NotFoundErr, - Message: msg, + Message: fmt.Sprintf(f, a...), } } @@ -41,3 +45,10 @@ func NewWriteConflictError(p storage.Path) *storage.Error { Message: p.String(), } } + +func NewInvalidPatchError(f string, a ...any) *storage.Error { + return &storage.Error{ + Code: storage.InvalidPatchErr, + Message: fmt.Sprintf(f, a...), + } +} diff --git a/vendor/github.com/open-policy-agent/opa/v1/storage/internal/ptr/ptr.go b/vendor/github.com/open-policy-agent/opa/v1/storage/internal/ptr/ptr.go index c5e380af04..bef39ebf49 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/storage/internal/ptr/ptr.go +++ b/vendor/github.com/open-policy-agent/opa/v1/storage/internal/ptr/ptr.go @@ -21,7 +21,7 @@ func Ptr(data any, path storage.Path) (any, error) { case map[string]any: var ok bool if node, ok = curr[key]; !ok { - return nil, errors.NewNotFoundError(path) + return nil, errors.NotFoundErr } case []any: pos, err := ValidateArrayIndex(curr, key, path) @@ -30,7 +30,7 @@ func Ptr(data any, path storage.Path) (any, error) { } node = curr[pos] default: - return nil, errors.NewNotFoundError(path) + return nil, errors.NotFoundErr } } @@ -38,24 +38,45 @@ func Ptr(data any, path storage.Path) (any, error) { } func ValuePtr(data ast.Value, path storage.Path) (ast.Value, error) { + var keyTerm *ast.Term + + defer func() { + if keyTerm != nil { + ast.TermPtrPool.Put(keyTerm) + } + }() + node := data for i := range path { key := path[i] switch curr := node.(type) { case ast.Object: - // This term is only created for the lookup, which is not.. ideal. - // By using the pool, we can at least avoid allocating the term itself, - // while still having to pay 1 allocation for the value. A better solution - // would be dynamically interned string terms. - keyTerm := ast.TermPtrPool.Get() - keyTerm.Value = ast.String(key) - - val := curr.Get(keyTerm) - ast.TermPtrPool.Put(keyTerm) - if val == nil { - return nil, errors.NewNotFoundError(path) + // Note(anders): + // This term is only created for the lookup, which is not great — especially + // considering the path likely was converted from a ref, where we had all + // the terms available already! Without chaging the storage API, our options + // for performant lookups are limitied to using interning or a pool. Prefer + // interning when possible, as that is zero alloc. Using the pool avoids at + // least allocating a new term for every lookup, but still requires an alloc + // for the string Value. + if ast.HasInternedValue(key) { + if val := curr.Get(ast.InternedTerm(key)); val != nil { + node = val.Value + } else { + return nil, errors.NotFoundErr + } + } else { + if keyTerm == nil { + keyTerm = ast.TermPtrPool.Get() + } + // 1 alloc + keyTerm.Value = ast.String(key) + if val := curr.Get(keyTerm); val != nil { + node = val.Value + } else { + return nil, errors.NotFoundErr + } } - node = val.Value case *ast.Array: pos, err := ValidateASTArrayIndex(curr, key, path) if err != nil { @@ -63,7 +84,7 @@ func ValuePtr(data ast.Value, path storage.Path) (ast.Value, error) { } node = curr.Elem(pos).Value default: - return nil, errors.NewNotFoundError(path) + return nil, errors.NotFoundErr } } diff --git a/vendor/github.com/open-policy-agent/opa/v1/storage/path.go b/vendor/github.com/open-policy-agent/opa/v1/storage/path.go index f774d2eeda..16bb3e42c5 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/storage/path.go +++ b/vendor/github.com/open-policy-agent/opa/v1/storage/path.go @@ -8,40 +8,40 @@ import ( "errors" "fmt" "net/url" + "slices" "strconv" "strings" "github.com/open-policy-agent/opa/v1/ast" ) +// RootPath refers to the root document in storage. +var RootPath = Path{} + // Path refers to a document in storage. type Path []string // ParsePath returns a new path for the given str. func ParsePath(str string) (path Path, ok bool) { - if len(str) == 0 { - return nil, false - } - if str[0] != '/' { + if len(str) == 0 || str[0] != '/' { return nil, false } if len(str) == 1 { return Path{}, true } - parts := strings.Split(str[1:], "/") - return parts, true + + return strings.Split(str[1:], "/"), true } // ParsePathEscaped returns a new path for the given escaped str. func ParsePathEscaped(str string) (path Path, ok bool) { - path, ok = ParsePath(str) - if !ok { - return - } - for i := range path { - segment, err := url.PathUnescape(path[i]) - if err == nil { - path[i] = segment + if path, ok = ParsePath(str); ok { + for i := range path { + if segment, err := url.PathUnescape(path[i]); err == nil { + path[i] = segment + } else { + return nil, false + } } } return @@ -49,7 +49,6 @@ func ParsePathEscaped(str string) (path Path, ok bool) { // NewPathForRef returns a new path for the given ref. func NewPathForRef(ref ast.Ref) (path Path, err error) { - if len(ref) == 0 { return nil, errors.New("empty reference (indicates error in caller)") } @@ -85,36 +84,17 @@ func NewPathForRef(ref ast.Ref) (path Path, err error) { // is less than other, 0 if p is equal to other, or 1 if p is greater than // other. func (p Path) Compare(other Path) (cmp int) { - for i := range min(len(p), len(other)) { - if cmp := strings.Compare(p[i], other[i]); cmp != 0 { - return cmp - } - } - if len(p) < len(other) { - return -1 - } - if len(p) == len(other) { - return 0 - } - return 1 + return slices.Compare(p, other) } // Equal returns true if p is the same as other. func (p Path) Equal(other Path) bool { - return p.Compare(other) == 0 + return slices.Equal(p, other) } // HasPrefix returns true if p starts with other. func (p Path) HasPrefix(other Path) bool { - if len(other) > len(p) { - return false - } - for i := range other { - if p[i] != other[i] { - return false - } - } - return true + return len(other) <= len(p) && p[:len(other)].Equal(other) } // Ref returns a ref that represents p rooted at head. diff --git a/vendor/github.com/open-policy-agent/opa/v1/topdown/aggregates.go b/vendor/github.com/open-policy-agent/opa/v1/topdown/aggregates.go index eec49f7b88..03d07668d8 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/topdown/aggregates.go +++ b/vendor/github.com/open-policy-agent/opa/v1/topdown/aggregates.go @@ -177,7 +177,7 @@ func builtinMin(_ BuiltinContext, operands []*ast.Term, iter func(*ast.Term) err // The null term is considered to be less than any other term, // so in order for min of a set to make sense, we need to check // for it. - if min.Value.Compare(ast.InternedNullTerm.Value) == 0 { + if min.Value.Compare(ast.InternedNullValue) == 0 { return elem, nil } diff --git a/vendor/github.com/open-policy-agent/opa/v1/topdown/eval.go b/vendor/github.com/open-policy-agent/opa/v1/topdown/eval.go index 4b3a9ba260..f05fd9d94a 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/topdown/eval.go +++ b/vendor/github.com/open-policy-agent/opa/v1/topdown/eval.go @@ -106,6 +106,7 @@ type eval struct { tracers []QueryTracer tracingOpts tracing.Options queryID uint64 + timeStart int64 index int genvarid int indexing bool @@ -171,16 +172,17 @@ func (e *eval) string(s *strings.Builder) { func (e *eval) builtinFunc(name string) (*ast.Builtin, BuiltinFunc, bool) { decl, ok := ast.BuiltinMap[name] if ok { - f, ok := builtinFunctions[name] - if ok { + if f, ok := builtinFunctions[name]; ok { return decl, f, true } - } else { - bi, ok := e.builtins[name] - if ok { - return bi.Decl, bi.Func, true + if bi, ok := e.builtins[name]; ok { + return decl, bi.Func, true } } + if bi, ok := e.builtins[name]; ok { + return bi.Decl, bi.Func, true + } + return nil, nil, false } @@ -951,7 +953,7 @@ func (e *eval) evalCall(terms []*ast.Term, iter unifyIterator) error { var bctx *BuiltinContext // Creating a BuiltinContext is expensive, so only do it if the builtin depends on it. - if bi.NeedsBuiltInContext() { + if !bi.CanSkipBctx { var parentID uint64 if e.parent != nil { parentID = e.parent.queryID @@ -962,6 +964,10 @@ func (e *eval) evalCall(terms []*ast.Term, iter unifyIterator) error { capabilities = e.compiler.Capabilities() } + if e.time == nil { + e.time = ast.NumberTerm(int64ToJSONNumber(e.timeStart)) + } + bctx = &BuiltinContext{ Context: e.ctx, Metrics: e.metrics, diff --git a/vendor/github.com/open-policy-agent/opa/v1/topdown/http.go b/vendor/github.com/open-policy-agent/opa/v1/topdown/http.go index f7dc3dc2ea..36c622e5a4 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/topdown/http.go +++ b/vendor/github.com/open-policy-agent/opa/v1/topdown/http.go @@ -1316,7 +1316,7 @@ func parseCacheControlHeader(headers http.Header) map[string]string { ccDirectives := map[string]string{} ccHeader := headers.Get("cache-control") - for _, part := range strings.Split(ccHeader, ",") { + for part := range strings.SplitSeq(ccHeader, ",") { part = strings.Trim(part, " ") if part == "" { continue diff --git a/vendor/github.com/open-policy-agent/opa/v1/topdown/query.go b/vendor/github.com/open-policy-agent/opa/v1/topdown/query.go index aee6ba12eb..aadcc060cf 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/topdown/query.go +++ b/vendor/github.com/open-policy-agent/opa/v1/topdown/query.go @@ -374,7 +374,7 @@ func (q *Query) PartialRun(ctx context.Context) (partials []ast.Body, support [] ctx: ctx, metrics: q.metrics, seed: q.seed, - time: ast.NumberTerm(int64ToJSONNumber(q.time.UnixNano())), + timeStart: q.time.UnixNano(), cancel: q.cancel, query: q.query, queryCompiler: q.queryCompiler, @@ -569,7 +569,7 @@ func (q *Query) Iter(ctx context.Context, iter func(QueryResult) error) error { ctx: ctx, metrics: q.metrics, seed: q.seed, - time: ast.NumberTerm(int64ToJSONNumber(q.time.UnixNano())), + timeStart: q.time.UnixNano(), cancel: q.cancel, query: q.query, queryCompiler: q.queryCompiler, diff --git a/vendor/github.com/open-policy-agent/opa/v1/topdown/strings.go b/vendor/github.com/open-policy-agent/opa/v1/topdown/strings.go index 53108ca0db..13e9b81339 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/topdown/strings.go +++ b/vendor/github.com/open-policy-agent/opa/v1/topdown/strings.go @@ -18,6 +18,7 @@ import ( "github.com/open-policy-agent/opa/v1/ast" "github.com/open-policy-agent/opa/v1/topdown/builtins" + "github.com/open-policy-agent/opa/v1/util" ) func builtinAnyPrefixMatch(_ BuiltinContext, operands []*ast.Term, iter func(*ast.Term) error) error { @@ -514,18 +515,12 @@ func builtinSplit(_ BuiltinContext, operands []*ast.Term, iter func(*ast.Term) e return err } - if !strings.Contains(string(s), string(d)) { + text, delim := string(s), string(d) + if !strings.Contains(text, delim) { return iter(ast.ArrayTerm(operands[0])) } - elems := strings.Split(string(s), string(d)) - arr := make([]*ast.Term, len(elems)) - - for i := range elems { - arr[i] = ast.InternedTerm(elems[i]) - } - - return iter(ast.ArrayTerm(arr...)) + return iter(ast.ArrayTerm(util.SplitMap(text, delim, ast.InternedTerm)...)) } func builtinReplace(_ BuiltinContext, operands []*ast.Term, iter func(*ast.Term) error) error { diff --git a/vendor/github.com/open-policy-agent/opa/v1/topdown/tokens.go b/vendor/github.com/open-policy-agent/opa/v1/topdown/tokens.go index 72d290073c..aea15dd26a 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/topdown/tokens.go +++ b/vendor/github.com/open-policy-agent/opa/v1/topdown/tokens.go @@ -342,7 +342,7 @@ func getKeysFromCertOrJWK(certificate string) ([]verificationKey, error) { if !ok { continue } - var key interface{} + var key any if err := jwk.Export(k, &key); err != nil { return nil, err } diff --git a/vendor/github.com/open-policy-agent/opa/v1/util/json.go b/vendor/github.com/open-policy-agent/opa/v1/util/json.go index fdb2626c78..de95ed50bf 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/util/json.go +++ b/vendor/github.com/open-policy-agent/opa/v1/util/json.go @@ -10,6 +10,7 @@ import ( "fmt" "io" "reflect" + "strconv" "sigs.k8s.io/yaml" @@ -19,15 +20,14 @@ import ( // UnmarshalJSON parses the JSON encoded data and stores the result in the value // pointed to by x. // -// This function is intended to be used in place of the standard json.Marshal -// function when json.Number is required. +// This function is intended to be used in place of the standard [json.Marshal] +// function when [json.Number] is required. func UnmarshalJSON(bs []byte, x any) error { return unmarshalJSON(bs, x, true) } func unmarshalJSON(bs []byte, x any, ext bool) error { - buf := bytes.NewBuffer(bs) - decoder := NewJSONDecoder(buf) + decoder := NewJSONDecoder(bytes.NewBuffer(bs)) if err := decoder.Decode(x); err != nil { if handler := extension.FindExtension(".json"); handler != nil && ext { return handler(bs, x) @@ -49,8 +49,8 @@ func unmarshalJSON(bs []byte, x any, ext bool) error { // NewJSONDecoder returns a new decoder that reads from r. // -// This function is intended to be used in place of the standard json.NewDecoder -// when json.Number is required. +// This function is intended to be used in place of the standard [json.NewDecoder] +// when [json.Number] is required. func NewJSONDecoder(r io.Reader) *json.Decoder { decoder := json.NewDecoder(r) decoder.UseNumber() @@ -87,6 +87,55 @@ func MustMarshalJSON(x any) []byte { // rego.Input and inmem's Write operations. Works with both references and // values. func RoundTrip(x *any) error { + // Avoid round-tripping types that won't change as a result of + // marshalling/unmarshalling, as even for those values, round-tripping + // comes with a significant cost. + if x == nil || !NeedsRoundTrip(*x) { + return nil + } + + // For number types, we can write the json.Number representation + // directly into x without marshalling to bytes and back. + a := *x + switch v := a.(type) { + case int: + *x = json.Number(strconv.Itoa(v)) + return nil + case int8: + *x = json.Number(strconv.FormatInt(int64(v), 10)) + return nil + case int16: + *x = json.Number(strconv.FormatInt(int64(v), 10)) + return nil + case int32: + *x = json.Number(strconv.FormatInt(int64(v), 10)) + return nil + case int64: + *x = json.Number(strconv.FormatInt(v, 10)) + return nil + case uint: + *x = json.Number(strconv.FormatUint(uint64(v), 10)) + return nil + case uint8: + *x = json.Number(strconv.FormatUint(uint64(v), 10)) + return nil + case uint16: + *x = json.Number(strconv.FormatUint(uint64(v), 10)) + return nil + case uint32: + *x = json.Number(strconv.FormatUint(uint64(v), 10)) + return nil + case uint64: + *x = json.Number(strconv.FormatUint(v, 10)) + return nil + case float32: + *x = json.Number(strconv.FormatFloat(float64(v), 'f', -1, 32)) + return nil + case float64: + *x = json.Number(strconv.FormatFloat(v, 'f', -1, 64)) + return nil + } + bs, err := json.Marshal(x) if err != nil { return err @@ -94,15 +143,28 @@ func RoundTrip(x *any) error { return UnmarshalJSON(bs, x) } +// NeedsRoundTrip returns true if the value won't change as a result of +// a marshalling/unmarshalling round-trip. Since [RoundTrip] itself calls +// this you normally don't need to call this function directly, unless you +// want to make decisions based on the round-tripability of a value without +// actually doing the round-trip. +func NeedsRoundTrip(x any) bool { + switch x.(type) { + case nil, bool, string, json.Number: + return false + } + return true +} + // Reference returns a pointer to its argument unless the argument already is // a pointer. If the argument is **t, or ***t, etc, it will return *t. // // Used for preparing Go types (including pointers to structs) into values to be -// put through util.RoundTrip(). +// put through [RoundTrip]. func Reference(x any) *any { var y any rv := reflect.ValueOf(x) - if rv.Kind() == reflect.Ptr { + if rv.Kind() == reflect.Pointer { return Reference(rv.Elem().Interface()) } if rv.Kind() != reflect.Invalid { diff --git a/vendor/github.com/open-policy-agent/opa/v1/util/performance.go b/vendor/github.com/open-policy-agent/opa/v1/util/performance.go index e9b4468188..c7bd57ea04 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/util/performance.go +++ b/vendor/github.com/open-policy-agent/opa/v1/util/performance.go @@ -3,6 +3,8 @@ package util import ( "math" "slices" + "strings" + "sync" "unsafe" ) @@ -73,3 +75,59 @@ func KeysCount[K comparable, V any](m map[K]V, p func(K) bool) int { } return count } + +// SplitMap calls fn for each delim-separated part of text and returns a slice of the results. +// Cheaper than calling fn on strings.Split(text, delim), as it avoids allocating an intermediate slice of strings. +func SplitMap[T any](text string, delim string, fn func(string) T) []T { + sl := make([]T, 0, strings.Count(text, delim)+1) + for s := range strings.SplitSeq(text, delim) { + sl = append(sl, fn(s)) + } + return sl +} + +// SlicePool is a pool for (pointers to) slices of type T. +// It uses sync.Pool to pool the slices, and grows them as needed. +type SlicePool[T any] struct { + pool sync.Pool +} + +// NewSlicePool creates a new SlicePool for slices of type T with the given initial length. +// This number is only a hint, as the slices will grow as needed. For best performance, store +// slices of similar lengths in the same pool. +func NewSlicePool[T any](length int) *SlicePool[T] { + return &SlicePool[T]{ + pool: sync.Pool{ + New: func() any { + s := make([]T, length) + return &s + }, + }, + } +} + +// Get returns a pointer to a slice of type T with the given length +// from the pool. The slice capacity will grow as needed to accommodate +// the requested length. The returned slice will have all its elements +// set to the zero value of T. Returns a pointer to avoid allocating. +func (sp *SlicePool[T]) Get(length int) *[]T { + s := sp.pool.Get().(*[]T) + d := *s + + if cap(d) < length { + d = slices.Grow(d, length) + } + + d = d[:length] // reslice to requested length, while keeping capacity + + clear(d) + + *s = d + + return s +} + +// Put returns a pointer to a slice of type T to the pool. +func (sp *SlicePool[T]) Put(s *[]T) { + sp.pool.Put(s) +} diff --git a/vendor/github.com/open-policy-agent/opa/v1/util/read_gzip_body.go b/vendor/github.com/open-policy-agent/opa/v1/util/read_gzip_body.go index ddffe2a4de..92c0df8b08 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/util/read_gzip_body.go +++ b/vendor/github.com/open-policy-agent/opa/v1/util/read_gzip_body.go @@ -27,55 +27,46 @@ var gzipReaderPool = sync.Pool{ // payload size, but not an unbounded amount of memory, as was potentially // possible before. func ReadMaybeCompressedBody(r *http.Request) ([]byte, error) { - var content *bytes.Buffer - // Note(philipc): If the request body is of unknown length (such as what - // happens when 'Transfer-Encoding: chunked' is set), we have to do an - // incremental read of the body. In this case, we can't be too clever, we - // just do the best we can with whatever is streamed over to us. - // Fetch gzip payload size limit from request context. - if maxLength, ok := decoding.GetServerDecodingMaxLen(r.Context()); ok { - bs, err := io.ReadAll(io.LimitReader(r.Body, maxLength)) - if err != nil { - return bs, err - } - content = bytes.NewBuffer(bs) - } else { - // Read content from the request body into a buffer of known size. - content = bytes.NewBuffer(make([]byte, 0, r.ContentLength)) - if _, err := io.CopyN(content, r.Body, r.ContentLength); err != nil { - return content.Bytes(), err - } + length := r.ContentLength + if maxLenConf, ok := decoding.GetServerDecodingMaxLen(r.Context()); ok { + length = maxLenConf + } + + content, err := io.ReadAll(io.LimitReader(r.Body, length)) + if err != nil { + return nil, err } - // Decompress gzip content by reading from the buffer. if strings.Contains(r.Header.Get("Content-Encoding"), "gzip") { - // Fetch gzip payload size limit from request context. gzipMaxLength, _ := decoding.GetServerDecodingGzipMaxLen(r.Context()) // Note(philipc): The last 4 bytes of a well-formed gzip blob will // always be a little-endian uint32, representing the decompressed // content size, modulo 2^32. We validate that the size is safe, // earlier in DecodingLimitHandler. - sizeTrailerField := binary.LittleEndian.Uint32(content.Bytes()[content.Len()-4:]) - if sizeTrailerField > uint32(gzipMaxLength) { - return content.Bytes(), errors.New("gzip payload too large") + sizeDecompressed := int64(binary.LittleEndian.Uint32(content[len(content)-4:])) + if sizeDecompressed > gzipMaxLength { + return nil, errors.New("gzip payload too large") } - // Pull a gzip decompressor from the pool, and assign it to the current - // buffer, using Reset(). Later, return it back to the pool for another - // request to use. + gzReader := gzipReaderPool.Get().(*gzip.Reader) - if err := gzReader.Reset(content); err != nil { + defer func() { + gzReader.Close() + gzipReaderPool.Put(gzReader) + }() + + if err := gzReader.Reset(bytes.NewReader(content)); err != nil { return nil, err } - defer gzReader.Close() - defer gzipReaderPool.Put(gzReader) - decompressedContent := bytes.NewBuffer(make([]byte, 0, sizeTrailerField)) - if _, err := io.CopyN(decompressedContent, gzReader, int64(sizeTrailerField)); err != nil { - return decompressedContent.Bytes(), err + + decompressed := bytes.NewBuffer(make([]byte, 0, sizeDecompressed)) + if _, err = io.CopyN(decompressed, gzReader, sizeDecompressed); err != nil { + return nil, err } - return decompressedContent.Bytes(), nil + + return decompressed.Bytes(), nil } // Request was not compressed; return the content bytes. - return content.Bytes(), nil + return content, nil } diff --git a/vendor/github.com/open-policy-agent/opa/v1/version/version.go b/vendor/github.com/open-policy-agent/opa/v1/version/version.go index f8644aaba3..2aef6b113f 100644 --- a/vendor/github.com/open-policy-agent/opa/v1/version/version.go +++ b/vendor/github.com/open-policy-agent/opa/v1/version/version.go @@ -10,7 +10,7 @@ import ( "runtime/debug" ) -var Version = "1.9.0" +var Version = "1.10.1" // GoVersion is the version of Go this was built with var GoVersion = runtime.Version() diff --git a/vendor/modules.txt b/vendor/modules.txt index 32a42f82ab..1b511cab22 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1249,7 +1249,7 @@ github.com/onsi/gomega/matchers/support/goraph/edge github.com/onsi/gomega/matchers/support/goraph/node github.com/onsi/gomega/matchers/support/goraph/util github.com/onsi/gomega/types -# github.com/open-policy-agent/opa v1.9.0 +# github.com/open-policy-agent/opa v1.10.1 ## explicit; go 1.24.6 github.com/open-policy-agent/opa/ast github.com/open-policy-agent/opa/ast/json