diff --git a/go.mod b/go.mod
index 79893bfdd3..76af0baa51 100644
--- a/go.mod
+++ b/go.mod
@@ -47,7 +47,7 @@ require (
github.com/linuxkit/virtsock v0.0.0-20241009230534-cb6a20cc0422
github.com/mattn/go-shellwords v1.0.12
github.com/moby/sys/user v0.4.0
- github.com/open-policy-agent/opa v0.70.0
+ github.com/open-policy-agent/opa v1.15.2
github.com/opencontainers/cgroups v0.0.6
github.com/opencontainers/runc v1.4.2
github.com/opencontainers/runtime-spec v1.3.0
@@ -71,10 +71,8 @@ require (
require (
cyphar.com/go-pathrs v0.2.4 // indirect
- github.com/OneOfOne/xxhash v1.2.8 // indirect
- github.com/agnivade/levenshtein v1.2.0 // indirect
+ github.com/agnivade/levenshtein v1.2.1 // indirect
github.com/akavel/rsrc v0.10.2 // indirect
- github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/checkpoint-restore/go-criu/v7 v7.2.0 // indirect
github.com/cilium/ebpf v0.17.3 // indirect
@@ -90,24 +88,25 @@ require (
github.com/docker/docker-credential-helpers v0.9.3 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
- github.com/go-ini/ini v1.67.0 // indirect
- github.com/go-logr/logr v1.4.3 // indirect
- github.com/go-logr/stdr v1.2.2 // indirect
github.com/gobwas/glob v0.2.3 // indirect
- github.com/goccy/go-json v0.10.3 // indirect
+ github.com/goccy/go-json v0.10.5 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/golang/protobuf v1.5.4 // indirect
- github.com/gorilla/mux v1.8.1 // indirect
github.com/josephspurrier/goversioninfo v1.5.0 // indirect
github.com/klauspost/compress v1.18.5 // indirect
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
- github.com/lestrrat-go/blackmagic v1.0.2 // indirect
+ github.com/lestrrat-go/blackmagic v1.0.4 // indirect
+ github.com/lestrrat-go/dsig v1.0.0 // indirect
+ github.com/lestrrat-go/dsig-secp256k1 v1.0.0 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect
+ github.com/lestrrat-go/httprc/v3 v3.0.2 // indirect
github.com/lestrrat-go/iter v1.0.2 // indirect
github.com/lestrrat-go/jwx v1.2.31 // indirect
+ github.com/lestrrat-go/jwx/v3 v3.0.13 // indirect
github.com/lestrrat-go/option v1.0.1 // indirect
+ github.com/lestrrat-go/option/v2 v2.0.0 // indirect
github.com/mdlayher/socket v0.5.1 // indirect
github.com/mdlayher/vsock v1.2.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
@@ -115,38 +114,33 @@ require (
github.com/moby/sys/mountinfo v0.7.2 // indirect
github.com/moby/sys/userns v0.1.0 // indirect
github.com/mrunalp/fileutils v0.5.1 // indirect
- github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/opencontainers/selinux v1.13.1 // indirect
- github.com/prometheus/client_golang v1.23.2 // indirect
- github.com/prometheus/client_model v0.6.2 // indirect
- github.com/prometheus/common v0.66.1 // indirect
- github.com/prometheus/procfs v0.16.1 // indirect
- github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect
+ github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/seccomp/libseccomp-golang v0.11.1 // indirect
+ github.com/segmentio/asm v1.2.1 // indirect
github.com/tchap/go-patricia/v2 v2.3.3 // indirect
+ github.com/valyala/fastjson v1.6.7 // indirect
github.com/vbatts/tar-split v0.12.2 // indirect
+ github.com/vektah/gqlparser/v2 v2.5.32 // indirect
github.com/veraison/go-cose v1.3.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
github.com/yashtewari/glob-intersection v0.2.0 // indirect
- go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/otel v1.43.0 // indirect
- go.opentelemetry.io/otel/metric v1.43.0 // indirect
- go.opentelemetry.io/otel/sdk v1.43.0 // indirect
- go.opentelemetry.io/otel/trace v1.43.0 // indirect
+ go.opentelemetry.io/otel/sdk/metric v1.43.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
+ go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.50.0 // indirect
golang.org/x/mod v0.35.0 // indirect
golang.org/x/text v0.36.0 // indirect
golang.org/x/tools v0.44.0 // indirect
- google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516 // indirect
+ google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.1 // indirect
- gopkg.in/yaml.v3 v3.0.1 // indirect
sigs.k8s.io/yaml v1.6.0 // indirect
)
diff --git a/go.sum b/go.sum
index e299a51753..fce7c4ef54 100644
--- a/go.sum
+++ b/go.sum
@@ -369,10 +369,8 @@ github.com/Microsoft/didx509go v0.0.3/go.mod h1:wWt+iQsLzn3011+VfESzznLIp/Owhuj7
github.com/Microsoft/go-winio v0.6.3-0.20251027160822-ad3df93bed29 h1:0kQAzHq8vLs7Pptv+7TxjdETLf/nIqJpIB4oC6Ba4vY=
github.com/Microsoft/go-winio v0.6.3-0.20251027160822-ad3df93bed29/go.mod h1:ZWa7ssZJT30CCDGJ7fk/2SBTq9BIQrrVjrcss0UW2s0=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
-github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8=
-github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
-github.com/agnivade/levenshtein v1.2.0 h1:U9L4IOT0Y3i0TIlUIDJ7rVUziKi/zPbrJGaFrtYH3SY=
-github.com/agnivade/levenshtein v1.2.0/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU=
+github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM=
+github.com/agnivade/levenshtein v1.2.1/go.mod h1:QVVI16kDrtSuwcpd0p1+xMC6Z/VfhtCyDIjcwga4/DU=
github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY=
github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk=
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
@@ -384,6 +382,8 @@ github.com/alecthomas/assert/v2 v2.3.0/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhk
github.com/alecthomas/participle/v2 v2.0.0/go.mod h1:rAKZdJldHu8084ojcWevWAL8KmEU+AT+Olodb+WoN2Y=
github.com/alecthomas/participle/v2 v2.1.0/go.mod h1:Y1+hAs8DHPmc3YUFzqllV+eSQ9ljPTk0ZkPMtEdAx2c=
github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
+github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
+github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/apache/arrow/go/v15 v15.0.2/go.mod h1:DGXsR3ajT524njufqf95822i+KTh+yea1jass9YXgjA=
@@ -397,14 +397,13 @@ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
-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/v39 v39.0.1 h1:RibaT47yiyCRxMOj/l2cvL8cWiWBSqDXHyqsa9sGcCE=
+github.com/bytecodealliance/wasmtime-go/v39 v39.0.1/go.mod h1:miR4NYIEBXeDNamZIzpskhJ0z/p8al+lwMWylQ/ZJb4=
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw=
-github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
@@ -485,14 +484,15 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/cyphar/filepath-securejoin v0.6.1 h1:5CeZ1jPXEiYt3+Z6zqprSAgSWiggmpVyciv8syjIpVE=
github.com/cyphar/filepath-securejoin v0.6.1/go.mod h1:A8hd4EnAeyujCJRrICiOWqjS1AX0a9kM5XL+NwKoYSc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
+github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40=
-github.com/dgraph-io/badger/v3 v3.2103.5 h1:ylPa6qzbjYRQMU6jokoj4wzcaweHylt//CH0AKt0akg=
-github.com/dgraph-io/badger/v3 v3.2103.5/go.mod h1:4MPiseMeDQ3FNCYwRbbcBOGJLf5jsE0PPFzRiKjtcdw=
-github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8=
-github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA=
+github.com/dgraph-io/badger/v4 v4.9.1 h1:DocZXZkg5JJHJPtUErA0ibyHxOVUDVoXLSCV6t8NC8w=
+github.com/dgraph-io/badger/v4 v4.9.1/go.mod h1:5/MEx97uzdPUHR4KtkNt8asfI2T4JiEiQlV7kWUo8c0=
+github.com/dgraph-io/ristretto/v2 v2.2.0 h1:bkY3XzJcXoMuELV8F+vS8kzNgicwQFAaGINAEJdWGOM=
+github.com/dgraph-io/ristretto/v2 v2.2.0/go.mod h1:RZrm63UmcBAaYWC1DotLYBmTvgkrs0+XhBd7Npn7/zI=
github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54 h1:SG7nF6SRlWhcT7cNTs5R6Hk4V2lcmLz2NsG2VnInyNo=
github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
github.com/docker/cli v29.4.0+incompatible h1:+IjXULMetlvWJiuSI0Nbor36lcJ5BTcVpUmB21KBoVM=
@@ -541,14 +541,13 @@ github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
-github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
-github.com/foxcpp/go-mockdns v1.1.0 h1:jI0rD8M0wuYAxL7r/ynTrCQQq0BVqfB99Vgk7DlmewI=
-github.com/foxcpp/go-mockdns v1.1.0/go.mod h1:IhLeSFGed3mJIAXPH2aiRQB+kqz7oqu8ld2qVbOu7Wk=
+github.com/foxcpp/go-mockdns v1.2.0 h1:omK3OrHRD1IWJz1FuFBCFquhXslXoF17OvBS6JPzZF0=
+github.com/foxcpp/go-mockdns v1.2.0/go.mod h1:IhLeSFGed3mJIAXPH2aiRQB+kqz7oqu8ld2qVbOu7Wk=
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
@@ -560,8 +559,6 @@ github.com/go-fonts/stix v0.1.0/go.mod h1:w/c1f0ldAUlJmLBvlbkvVXLAD+tAMqobIIQpmn
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
-github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
-github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/go-latex/latex v0.0.0-20210118124228-b3d85cf34e07/go.mod h1:CO1AlKB2CSIqUrmQPqA0gdRIlnLEY0gK5JGjh37zN5U=
github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81/go.mod h1:SX0U8uGpxhq9o2S/CELCSUxEWWAuoCUcVCQWv7G2OCk=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
@@ -583,8 +580,8 @@ github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZs
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
-github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA=
-github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
+github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
+github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/goccy/go-yaml v1.9.8/go.mod h1:JubOolP3gh0HpiBc4BLRD4YmjEjHAmIIB2aaXKkTfoE=
github.com/goccy/go-yaml v1.11.0/go.mod h1:H+mJrWtjPTJAHvRbV09MCK9xYwODM+wRTVFFTWckfng=
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
@@ -601,8 +598,6 @@ github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwm
github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
github.com/golang/glog v1.2.3/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
github.com/golang/glog v1.2.4/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
-github.com/golang/glog v1.2.5 h1:DrW6hGnjIhtvhOIiAKT6Psh/Kd/ldepEa81DKeiRJ5I=
-github.com/golang/glog v1.2.5/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
@@ -640,14 +635,14 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
-github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
-github.com/google/flatbuffers v23.5.26+incompatible h1:M9dgRyhJemaM4Sw8+66GHBu8ioaQmyPLg1b8VwK5WJg=
github.com/google/flatbuffers v23.5.26+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
+github.com/google/flatbuffers v25.2.10+incompatible h1:F3vclr7C3HpB1k9mxCGRMXq6FdUalZ6H/pNX4FP1v0Q=
+github.com/google/flatbuffers v25.2.10+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
@@ -748,15 +743,10 @@ github.com/googleapis/gax-go/v2 v2.14.0/go.mod h1:lhBCnjdLrWRaPvLWhmc8IS24m9mr07
github.com/googleapis/gax-go/v2 v2.14.1/go.mod h1:Hb/NubMaVM88SrNkvl8X/o8XWwDJEPqouaLeN2IUxoA=
github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
-github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
-github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
-github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg=
-github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1 h1:e9Rjr40Z98/clHv5Yg79Is0NtosR5LXRvdr7o/6NwbA=
-github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.1/go.mod h1:tIxuGz/9mpox++sgp9fJjHO0+q1X9/UOWd798aAm22M=
github.com/hamba/avro/v2 v2.17.2/go.mod h1:Q9YK+qxAhtVrNqOhwlZTATLgLA8qxG2vtvkhK8fJ7Jo=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
@@ -799,17 +789,27 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/lestrrat-go/backoff/v2 v2.0.8 h1:oNb5E5isby2kiro9AgdHLv5N5tint1AnDVVf2E2un5A=
github.com/lestrrat-go/backoff/v2 v2.0.8/go.mod h1:rHP/q/r9aT27n24JQLa7JhSQZCKBBOiM/uP402WwN8Y=
-github.com/lestrrat-go/blackmagic v1.0.2 h1:Cg2gVSc9h7sz9NOByczrbUvLopQmXrfFx//N+AkAr5k=
-github.com/lestrrat-go/blackmagic v1.0.2/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU=
+github.com/lestrrat-go/blackmagic v1.0.4 h1:IwQibdnf8l2KoO+qC3uT4OaTWsW7tuRQXy9TRN9QanA=
+github.com/lestrrat-go/blackmagic v1.0.4/go.mod h1:6AWFyKNNj0zEXQYfTMPfZrAXUWUfTIZ5ECEUEJaijtw=
+github.com/lestrrat-go/dsig v1.0.0 h1:OE09s2r9Z81kxzJYRn07TFM9XA4akrUdoMwr0L8xj38=
+github.com/lestrrat-go/dsig v1.0.0/go.mod h1:dEgoOYYEJvW6XGbLasr8TFcAxoWrKlbQvmJgCR0qkDo=
+github.com/lestrrat-go/dsig-secp256k1 v1.0.0 h1:JpDe4Aybfl0soBvoVwjqDbp+9S1Y2OM7gcrVVMFPOzY=
+github.com/lestrrat-go/dsig-secp256k1 v1.0.0/go.mod h1:CxUgAhssb8FToqbL8NjSPoGQlnO4w3LG1P0qPWQm/NU=
github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE=
github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E=
+github.com/lestrrat-go/httprc/v3 v3.0.2 h1:7u4HUaD0NQbf2/n5+fyp+T10hNCsAnwKfqn4A4Baif0=
+github.com/lestrrat-go/httprc/v3 v3.0.2/go.mod h1:mSMtkZW92Z98M5YoNNztbRGxbXHql7tSitCvaxvo9l0=
github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI=
github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4=
github.com/lestrrat-go/jwx v1.2.31 h1:/OM9oNl/fzyldpv5HKZ9m7bTywa7COUfg8gujd9nJ54=
github.com/lestrrat-go/jwx v1.2.31/go.mod h1:eQJKoRwWcLg4PfD5CFA5gIZGxhPgoPYq9pZISdxLf0c=
+github.com/lestrrat-go/jwx/v3 v3.0.13 h1:AdHKiPIYeCSnOJtvdpipPg/0SuFh9rdkN+HF3O0VdSk=
+github.com/lestrrat-go/jwx/v3 v3.0.13/go.mod h1:2m0PV1A9tM4b/jVLMx8rh6rBl7F6WGb3EG2hufN9OQU=
github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=
github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU=
github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=
+github.com/lestrrat-go/option/v2 v2.0.0 h1:XxrcaJESE1fokHy3FpaQ/cXW8ZsIdWcdFzzLOcID3Ss=
+github.com/lestrrat-go/option/v2 v2.0.0/go.mod h1:oSySsmzMoR0iRzCDCaUfsCzxQHUEuhOViQObyy7S6Vg=
github.com/linuxkit/virtsock v0.0.0-20241009230534-cb6a20cc0422 h1:XvRuyDDRvi+UDxHN/M4MW4HxjmNVMmUKQj/+AbgsYgk=
github.com/linuxkit/virtsock v0.0.0-20241009230534-cb6a20cc0422/go.mod h1:JLgfq4XMVbvfNlAXla/41lZnp21O72a/wWHGJefAvgQ=
github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA=
@@ -856,8 +856,8 @@ github.com/mrunalp/fileutils v0.5.1 h1:F+S7ZlNKnrwHfSwdlgNSkKo67ReVf8o9fel6C3dkm
github.com/mrunalp/fileutils v0.5.1/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
-github.com/open-policy-agent/opa v0.70.0 h1:B3cqCN2iQAyKxK6+GI+N40uqkin+wzIrM7YA60t9x1U=
-github.com/open-policy-agent/opa v0.70.0/go.mod h1:Y/nm5NY0BX0BqjBriKUiV81sCl8XOjjvqQG7dXrggtI=
+github.com/open-policy-agent/opa v1.15.2 h1:dS9q+0Yvruq/VNvWJc5qCvCchn715OWc3HLHXn/UCCc=
+github.com/open-policy-agent/opa v1.15.2/go.mod h1:c6SN+7jSsUcKJLQc5P4yhwx8YYDRbjpAiGkBOTqxaa4=
github.com/opencontainers/cgroups v0.0.6 h1:tfZFWTIIGaUUFImTyuTg+Mr5x8XRiSdZESgEBW7UxuI=
github.com/opencontainers/cgroups v0.0.6/go.mod h1:oWVzJsKK0gG9SCRBfTpnn16WcGEqDI8PAcpMGbqWxcs=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
@@ -884,8 +884,9 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8=
-github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
+github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
@@ -899,10 +900,10 @@ github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNw
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs=
github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA=
-github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg=
-github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is=
-github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ=
-github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
+github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0=
+github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw=
+github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 h1:bsUq1dX0N8AOIL7EB/X911+m4EHsnWEHeJ0c+3TTBrg=
+github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
@@ -921,6 +922,10 @@ github.com/samber/lo v1.53.0 h1:t975lj2py4kJPQ6haz1QMgtId2gtmfktACxIXArw3HM=
github.com/samber/lo v1.53.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
github.com/seccomp/libseccomp-golang v0.11.1 h1:wuk4ZjSx6kyQII4rj6G6fvVzRHQaSiPvccJazDagu4g=
github.com/seccomp/libseccomp-golang v0.11.1/go.mod h1:5m1Lk8E9OwgZTTVz4bBOer7JuazaBa+xTkM895tDiWc=
+github.com/segmentio/asm v1.2.1 h1:DTNbBqs57ioxAD4PrArqftgypG4/qNpXoJx8TVXxPR0=
+github.com/segmentio/asm v1.2.1/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
+github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw=
+github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=
github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
@@ -960,8 +965,12 @@ github.com/urfave/cli v1.22.17 h1:SYzXoiPfQjHBbkYxbew5prZHS1TOLT3ierW8SYLqtVQ=
github.com/urfave/cli v1.22.17/go.mod h1:b0ht0aqgH/6pBYzzxURyrM4xXNgsoT/n2ZzwQiEhNVo=
github.com/urfave/cli/v2 v2.27.7 h1:bH59vdhbjLv3LAvIu6gd0usJHgoTTPhCFib8qqOwXYU=
github.com/urfave/cli/v2 v2.27.7/go.mod h1:CyNAG/xg+iAOg0N4MPGZqVmv2rCoP267496AOXUZjA4=
+github.com/valyala/fastjson v1.6.7 h1:ZE4tRy0CIkh+qDc5McjatheGX2czdn8slQjomexVpBM=
+github.com/valyala/fastjson v1.6.7/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=
github.com/vbatts/tar-split v0.12.2 h1:w/Y6tjxpeiFMR47yzZPlPj/FcPLpXbTUi/9H7d3CPa4=
github.com/vbatts/tar-split v0.12.2/go.mod h1:eF6B6i6ftWQcDqEn3/iGFRFRo8cBIMSJVOpnNdfTMFA=
+github.com/vektah/gqlparser/v2 v2.5.32 h1:k9QPJd4sEDTL+qB4ncPLflqTJ3MmjB9SrVzJrawpFSc=
+github.com/vektah/gqlparser/v2 v2.5.32/go.mod h1:c1I28gSOVNzlfc4WuDlqU7voQnsqI6OG2amkBAFmgts=
github.com/veraison/go-cose v1.3.0 h1:2/H5w8kdSpQJyVtIhx8gmwPJ2uSz1PkyWFx0idbd7rk=
github.com/veraison/go-cose v1.3.0/go.mod h1:df09OV91aHoQWLmy1KsDdYiagtXgyAwAl8vFeFn1gMc=
github.com/vishvananda/netlink v1.3.1 h1:3AEMt62VKqz90r0tmNhog0r/PpWKmrEShJU0wJW6bV0=
@@ -1028,8 +1037,6 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0/go.mod h1:umTcuxiv1n/s/S6/c2AT/g2CQ7u5C59sHDNmfSwgz7Q=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0/go.mod h1:FRmFuRJfag1IZ2dPkHnEoSFVgTVPUd2qf5Vi69hLb8I=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0/go.mod h1:69uWxva0WgAA/4bu2Yy70SLDBwZXuQ6PbBpbsa5iZrQ=
-go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus=
-go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q=
go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo=
go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI=
go.opentelemetry.io/otel v1.23.0/go.mod h1:YCycw9ZeKhcJFrb34iVSkyT0iczq/zYDtZYFufObyB0=
@@ -1045,10 +1052,6 @@ go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7
go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y=
go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I=
go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 h1:1fTNlAIJZGWLP5FVu0fikVry1IsiUnXjf7QFvoNN3Xw=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0/go.mod h1:zjPK58DtkqQFn+YUMbx0M2XV3QgKU0gS9LeGohREyK4=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 h1:m639+BofXTvcY1q8CGs4ItwQarYtJPOWmVobfM1HpVI=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0/go.mod h1:LjReUci/F4BUyv+y4dwnq3h/26iNOeC3wAIqgvTIZVo=
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.29.0/go.mod h1:BLbf7zbNIONBLPwvFnwNHGj4zge8uTCM/UPIVW1Mq2I=
go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM=
go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY=
@@ -1106,8 +1109,6 @@ go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqe
go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM=
-go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4=
-go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
@@ -1781,7 +1782,6 @@ google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
-google.golang.org/genproto v0.0.0-20250428153025-10db94c68c34 h1:oklGWmm0ZiCw4efmdYZo5MF9t6nRvGzM5+0klSjOmGM=
google.golang.org/genproto v0.0.0-20250428153025-10db94c68c34/go.mod h1:hiH/EqX5GBdTyIpkqMqDGUHDiBniln8b4FCw+NzPxQY=
google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig=
google.golang.org/genproto/googleapis/api v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig=
@@ -1836,8 +1836,6 @@ google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.
google.golang.org/genproto/googleapis/api v0.0.0-20250313205543-e70fdf4c4cb4/go.mod h1:c8q6Z6OCqnfVIqUFJkCzKcrj8eCvUrz+K4KRzSTuANg=
google.golang.org/genproto/googleapis/api v0.0.0-20250414145226-207652e42e2e/go.mod h1:085qFyf2+XaZlRdCgKNCIZ3afY2p4HHZdoIRpId8F4A=
google.golang.org/genproto/googleapis/api v0.0.0-20250425173222-7b384671a197/go.mod h1:Cd8IzgPo5Akum2c9R6FsXNaZbH3Jpa2gpHlW89FqlyQ=
-google.golang.org/genproto/googleapis/api v0.0.0-20260120221211-b8f7ae30c516 h1:vmC/ws+pLzWjj/gzApyoZuSVrDtF1aod4u/+bbj8hgM=
-google.golang.org/genproto/googleapis/api v0.0.0-20260120221211-b8f7ae30c516/go.mod h1:p3MLuOwURrGBRoEyFHBT3GjUwaCQVKeNqqWxlcISGdw=
google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:ylj+BE99M198VPbBh6A8d9n3w8fChvyLK3wwBOjXBFA=
google.golang.org/genproto/googleapis/bytestream v0.0.0-20231012201019-e917dd12ba7a/go.mod h1:+34luvCflYKiKylNwGJfn9cFBbcL/WrkciMmDmsTQ/A=
google.golang.org/genproto/googleapis/bytestream v0.0.0-20231030173426-d783a09b4405/go.mod h1:GRUCuLdzVqZte8+Dl/D4N25yLzcGqqWaYkeVOwulFqw=
@@ -1951,8 +1949,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4/go.
google.golang.org/genproto/googleapis/rpc v0.0.0-20250409194420-de1ac958c67a/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250414145226-207652e42e2e/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250425173222-7b384671a197/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
-google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516 h1:sNrWoksmOyF5bvJUcnmbeAmQi8baNhqg5IWaI3llQqU=
-google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 h1:H86B94AW+VfJWDqFeEbBPhEtHzJwJfTbgE2lZa54ZAQ=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
diff --git a/vendor/github.com/OneOfOne/xxhash/.gitignore b/vendor/github.com/OneOfOne/xxhash/.gitignore
deleted file mode 100644
index f4faa7f8f1..0000000000
--- a/vendor/github.com/OneOfOne/xxhash/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*.txt
-*.pprof
-cmap2/
-cache/
diff --git a/vendor/github.com/OneOfOne/xxhash/.travis.yml b/vendor/github.com/OneOfOne/xxhash/.travis.yml
deleted file mode 100644
index 1c6dc55bc7..0000000000
--- a/vendor/github.com/OneOfOne/xxhash/.travis.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-language: go
-sudo: false
-
-go:
- - "1.10"
- - "1.11"
- - "1.12"
- - master
-
-script:
- - go test -tags safe ./...
- - go test ./...
- -
diff --git a/vendor/github.com/OneOfOne/xxhash/LICENSE b/vendor/github.com/OneOfOne/xxhash/LICENSE
deleted file mode 100644
index 9e30b4f342..0000000000
--- a/vendor/github.com/OneOfOne/xxhash/LICENSE
+++ /dev/null
@@ -1,187 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
diff --git a/vendor/github.com/OneOfOne/xxhash/README.md b/vendor/github.com/OneOfOne/xxhash/README.md
deleted file mode 100644
index 8eea28c394..0000000000
--- a/vendor/github.com/OneOfOne/xxhash/README.md
+++ /dev/null
@@ -1,74 +0,0 @@
-# xxhash [](https://godoc.org/github.com/OneOfOne/xxhash) [](https://travis-ci.org/OneOfOne/xxhash) [](https://gocover.io/github.com/OneOfOne/xxhash)
-
-This is a native Go implementation of the excellent [xxhash](https://github.com/Cyan4973/xxHash)* algorithm, an extremely fast non-cryptographic Hash algorithm, working at speeds close to RAM limits.
-
-* The C implementation is ([Copyright](https://github.com/Cyan4973/xxHash/blob/master/LICENSE) (c) 2012-2014, Yann Collet)
-
-## Install
-
- go get github.com/OneOfOne/xxhash
-
-## Features
-
-* On Go 1.7+ the pure go version is faster than CGO for all inputs.
-* Supports ChecksumString{32,64} xxhash{32,64}.WriteString, which uses no copies when it can, falls back to copy on appengine.
-* The native version falls back to a less optimized version on appengine due to the lack of unsafe.
-* Almost as fast as the mostly pure assembly version written by the brilliant [cespare](https://github.com/cespare/xxhash), while also supporting seeds.
-* To manually toggle the appengine version build with `-tags safe`.
-
-## Benchmark
-
-### Core i7-4790 @ 3.60GHz, Linux 4.12.6-1-ARCH (64bit), Go tip (+ff90f4af66 2017-08-19)
-
-```bash
-➤ go test -bench '64' -count 5 -tags cespare | benchstat /dev/stdin
-name time/op
-
-# https://github.com/cespare/xxhash
-XXSum64Cespare/Func-8 160ns ± 2%
-XXSum64Cespare/Struct-8 173ns ± 1%
-XXSum64ShortCespare/Func-8 6.78ns ± 1%
-XXSum64ShortCespare/Struct-8 19.6ns ± 2%
-
-# this package (default mode, using unsafe)
-XXSum64/Func-8 170ns ± 1%
-XXSum64/Struct-8 182ns ± 1%
-XXSum64Short/Func-8 13.5ns ± 3%
-XXSum64Short/Struct-8 20.4ns ± 0%
-
-# this package (appengine, *not* using unsafe)
-XXSum64/Func-8 241ns ± 5%
-XXSum64/Struct-8 243ns ± 6%
-XXSum64Short/Func-8 15.2ns ± 2%
-XXSum64Short/Struct-8 23.7ns ± 5%
-
-CRC64ISO-8 1.23µs ± 1%
-CRC64ISOString-8 2.71µs ± 4%
-CRC64ISOShort-8 22.2ns ± 3%
-
-Fnv64-8 2.34µs ± 1%
-Fnv64Short-8 74.7ns ± 8%
-```
-
-## Usage
-
-```go
- h := xxhash.New64()
- // r, err := os.Open("......")
- // defer f.Close()
- r := strings.NewReader(F)
- io.Copy(h, r)
- fmt.Println("xxhash.Backend:", xxhash.Backend)
- fmt.Println("File checksum:", h.Sum64())
-```
-
-[playground](https://play.golang.org/p/wHKBwfu6CPV)
-
-## TODO
-
-* Rewrite the 32bit version to be more optimized.
-* General cleanup as the Go inliner gets smarter.
-
-## License
-
-This project is released under the Apache v2. license. See [LICENSE](LICENSE) for more details.
diff --git a/vendor/github.com/OneOfOne/xxhash/xxhash.go b/vendor/github.com/OneOfOne/xxhash/xxhash.go
deleted file mode 100644
index af2496b77f..0000000000
--- a/vendor/github.com/OneOfOne/xxhash/xxhash.go
+++ /dev/null
@@ -1,294 +0,0 @@
-package xxhash
-
-import (
- "encoding/binary"
- "errors"
- "hash"
-)
-
-const (
- prime32x1 uint32 = 2654435761
- prime32x2 uint32 = 2246822519
- prime32x3 uint32 = 3266489917
- prime32x4 uint32 = 668265263
- prime32x5 uint32 = 374761393
-
- prime64x1 uint64 = 11400714785074694791
- prime64x2 uint64 = 14029467366897019727
- prime64x3 uint64 = 1609587929392839161
- prime64x4 uint64 = 9650029242287828579
- prime64x5 uint64 = 2870177450012600261
-
- maxInt32 int32 = (1<<31 - 1)
-
- // precomputed zero Vs for seed 0
- zero64x1 = 0x60ea27eeadc0b5d6
- zero64x2 = 0xc2b2ae3d27d4eb4f
- zero64x3 = 0x0
- zero64x4 = 0x61c8864e7a143579
-)
-
-const (
- magic32 = "xxh\x07"
- magic64 = "xxh\x08"
- marshaled32Size = len(magic32) + 4*7 + 16
- marshaled64Size = len(magic64) + 8*6 + 32 + 1
-)
-
-func NewHash32() hash.Hash { return New32() }
-func NewHash64() hash.Hash { return New64() }
-
-// Checksum32 returns the checksum of the input data with the seed set to 0.
-func Checksum32(in []byte) uint32 {
- return Checksum32S(in, 0)
-}
-
-// ChecksumString32 returns the checksum of the input data, without creating a copy, with the seed set to 0.
-func ChecksumString32(s string) uint32 {
- return ChecksumString32S(s, 0)
-}
-
-type XXHash32 struct {
- mem [16]byte
- ln, memIdx int32
- v1, v2, v3, v4 uint32
- seed uint32
-}
-
-// Size returns the number of bytes Sum will return.
-func (xx *XXHash32) Size() int {
- return 4
-}
-
-// BlockSize returns the hash's underlying block size.
-// The Write method must be able to accept any amount
-// of data, but it may operate more efficiently if all writes
-// are a multiple of the block size.
-func (xx *XXHash32) BlockSize() int {
- return 16
-}
-
-// NewS32 creates a new hash.Hash32 computing the 32bit xxHash checksum starting with the specific seed.
-func NewS32(seed uint32) (xx *XXHash32) {
- xx = &XXHash32{
- seed: seed,
- }
- xx.Reset()
- return
-}
-
-// New32 creates a new hash.Hash32 computing the 32bit xxHash checksum starting with the seed set to 0.
-func New32() *XXHash32 {
- return NewS32(0)
-}
-
-func (xx *XXHash32) Reset() {
- xx.v1 = xx.seed + prime32x1 + prime32x2
- xx.v2 = xx.seed + prime32x2
- xx.v3 = xx.seed
- xx.v4 = xx.seed - prime32x1
- xx.ln, xx.memIdx = 0, 0
-}
-
-// Sum appends the current hash to b and returns the resulting slice.
-// It does not change the underlying hash state.
-func (xx *XXHash32) Sum(in []byte) []byte {
- s := xx.Sum32()
- return append(in, byte(s>>24), byte(s>>16), byte(s>>8), byte(s))
-}
-
-// MarshalBinary implements the encoding.BinaryMarshaler interface.
-func (xx *XXHash32) MarshalBinary() ([]byte, error) {
- b := make([]byte, 0, marshaled32Size)
- b = append(b, magic32...)
- b = appendUint32(b, xx.v1)
- b = appendUint32(b, xx.v2)
- b = appendUint32(b, xx.v3)
- b = appendUint32(b, xx.v4)
- b = appendUint32(b, xx.seed)
- b = appendInt32(b, xx.ln)
- b = appendInt32(b, xx.memIdx)
- b = append(b, xx.mem[:]...)
- return b, nil
-}
-
-// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
-func (xx *XXHash32) UnmarshalBinary(b []byte) error {
- if len(b) < len(magic32) || string(b[:len(magic32)]) != magic32 {
- return errors.New("xxhash: invalid hash state identifier")
- }
- if len(b) != marshaled32Size {
- return errors.New("xxhash: invalid hash state size")
- }
- b = b[len(magic32):]
- b, xx.v1 = consumeUint32(b)
- b, xx.v2 = consumeUint32(b)
- b, xx.v3 = consumeUint32(b)
- b, xx.v4 = consumeUint32(b)
- b, xx.seed = consumeUint32(b)
- b, xx.ln = consumeInt32(b)
- b, xx.memIdx = consumeInt32(b)
- copy(xx.mem[:], b)
- return nil
-}
-
-// Checksum64 an alias for Checksum64S(in, 0)
-func Checksum64(in []byte) uint64 {
- return Checksum64S(in, 0)
-}
-
-// ChecksumString64 returns the checksum of the input data, without creating a copy, with the seed set to 0.
-func ChecksumString64(s string) uint64 {
- return ChecksumString64S(s, 0)
-}
-
-type XXHash64 struct {
- v1, v2, v3, v4 uint64
- seed uint64
- ln uint64
- mem [32]byte
- memIdx int8
-}
-
-// Size returns the number of bytes Sum will return.
-func (xx *XXHash64) Size() int {
- return 8
-}
-
-// BlockSize returns the hash's underlying block size.
-// The Write method must be able to accept any amount
-// of data, but it may operate more efficiently if all writes
-// are a multiple of the block size.
-func (xx *XXHash64) BlockSize() int {
- return 32
-}
-
-// NewS64 creates a new hash.Hash64 computing the 64bit xxHash checksum starting with the specific seed.
-func NewS64(seed uint64) (xx *XXHash64) {
- xx = &XXHash64{
- seed: seed,
- }
- xx.Reset()
- return
-}
-
-// New64 creates a new hash.Hash64 computing the 64bit xxHash checksum starting with the seed set to 0x0.
-func New64() *XXHash64 {
- return NewS64(0)
-}
-
-func (xx *XXHash64) Reset() {
- xx.ln, xx.memIdx = 0, 0
- xx.v1, xx.v2, xx.v3, xx.v4 = resetVs64(xx.seed)
-}
-
-// Sum appends the current hash to b and returns the resulting slice.
-// It does not change the underlying hash state.
-func (xx *XXHash64) Sum(in []byte) []byte {
- s := xx.Sum64()
- return append(in, byte(s>>56), byte(s>>48), byte(s>>40), byte(s>>32), byte(s>>24), byte(s>>16), byte(s>>8), byte(s))
-}
-
-// MarshalBinary implements the encoding.BinaryMarshaler interface.
-func (xx *XXHash64) MarshalBinary() ([]byte, error) {
- b := make([]byte, 0, marshaled64Size)
- b = append(b, magic64...)
- b = appendUint64(b, xx.v1)
- b = appendUint64(b, xx.v2)
- b = appendUint64(b, xx.v3)
- b = appendUint64(b, xx.v4)
- b = appendUint64(b, xx.seed)
- b = appendUint64(b, xx.ln)
- b = append(b, byte(xx.memIdx))
- b = append(b, xx.mem[:]...)
- return b, nil
-}
-
-// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
-func (xx *XXHash64) UnmarshalBinary(b []byte) error {
- if len(b) < len(magic64) || string(b[:len(magic64)]) != magic64 {
- return errors.New("xxhash: invalid hash state identifier")
- }
- if len(b) != marshaled64Size {
- return errors.New("xxhash: invalid hash state size")
- }
- b = b[len(magic64):]
- b, xx.v1 = consumeUint64(b)
- b, xx.v2 = consumeUint64(b)
- b, xx.v3 = consumeUint64(b)
- b, xx.v4 = consumeUint64(b)
- b, xx.seed = consumeUint64(b)
- b, xx.ln = consumeUint64(b)
- xx.memIdx = int8(b[0])
- b = b[1:]
- copy(xx.mem[:], b)
- return nil
-}
-
-func appendInt32(b []byte, x int32) []byte { return appendUint32(b, uint32(x)) }
-
-func appendUint32(b []byte, x uint32) []byte {
- var a [4]byte
- binary.LittleEndian.PutUint32(a[:], x)
- return append(b, a[:]...)
-}
-
-func appendUint64(b []byte, x uint64) []byte {
- var a [8]byte
- binary.LittleEndian.PutUint64(a[:], x)
- return append(b, a[:]...)
-}
-
-func consumeInt32(b []byte) ([]byte, int32) { bn, x := consumeUint32(b); return bn, int32(x) }
-func consumeUint32(b []byte) ([]byte, uint32) { x := u32(b); return b[4:], x }
-func consumeUint64(b []byte) ([]byte, uint64) { x := u64(b); return b[8:], x }
-
-// force the compiler to use ROTL instructions
-
-func rotl32_1(x uint32) uint32 { return (x << 1) | (x >> (32 - 1)) }
-func rotl32_7(x uint32) uint32 { return (x << 7) | (x >> (32 - 7)) }
-func rotl32_11(x uint32) uint32 { return (x << 11) | (x >> (32 - 11)) }
-func rotl32_12(x uint32) uint32 { return (x << 12) | (x >> (32 - 12)) }
-func rotl32_13(x uint32) uint32 { return (x << 13) | (x >> (32 - 13)) }
-func rotl32_17(x uint32) uint32 { return (x << 17) | (x >> (32 - 17)) }
-func rotl32_18(x uint32) uint32 { return (x << 18) | (x >> (32 - 18)) }
-
-func rotl64_1(x uint64) uint64 { return (x << 1) | (x >> (64 - 1)) }
-func rotl64_7(x uint64) uint64 { return (x << 7) | (x >> (64 - 7)) }
-func rotl64_11(x uint64) uint64 { return (x << 11) | (x >> (64 - 11)) }
-func rotl64_12(x uint64) uint64 { return (x << 12) | (x >> (64 - 12)) }
-func rotl64_18(x uint64) uint64 { return (x << 18) | (x >> (64 - 18)) }
-func rotl64_23(x uint64) uint64 { return (x << 23) | (x >> (64 - 23)) }
-func rotl64_27(x uint64) uint64 { return (x << 27) | (x >> (64 - 27)) }
-func rotl64_31(x uint64) uint64 { return (x << 31) | (x >> (64 - 31)) }
-
-func mix64(h uint64) uint64 {
- h ^= h >> 33
- h *= prime64x2
- h ^= h >> 29
- h *= prime64x3
- h ^= h >> 32
- return h
-}
-
-func resetVs64(seed uint64) (v1, v2, v3, v4 uint64) {
- if seed == 0 {
- return zero64x1, zero64x2, zero64x3, zero64x4
- }
- return (seed + prime64x1 + prime64x2), (seed + prime64x2), (seed), (seed - prime64x1)
-}
-
-// borrowed from cespare
-func round64(h, v uint64) uint64 {
- h += v * prime64x2
- h = rotl64_31(h)
- h *= prime64x1
- return h
-}
-
-func mergeRound64(h, v uint64) uint64 {
- v = round64(0, v)
- h ^= v
- h = h*prime64x1 + prime64x4
- return h
-}
diff --git a/vendor/github.com/OneOfOne/xxhash/xxhash_go17.go b/vendor/github.com/OneOfOne/xxhash/xxhash_go17.go
deleted file mode 100644
index ae48e0c5ca..0000000000
--- a/vendor/github.com/OneOfOne/xxhash/xxhash_go17.go
+++ /dev/null
@@ -1,161 +0,0 @@
-package xxhash
-
-func u32(in []byte) uint32 {
- return uint32(in[0]) | uint32(in[1])<<8 | uint32(in[2])<<16 | uint32(in[3])<<24
-}
-
-func u64(in []byte) uint64 {
- return uint64(in[0]) | uint64(in[1])<<8 | uint64(in[2])<<16 | uint64(in[3])<<24 | uint64(in[4])<<32 | uint64(in[5])<<40 | uint64(in[6])<<48 | uint64(in[7])<<56
-}
-
-// Checksum32S returns the checksum of the input bytes with the specific seed.
-func Checksum32S(in []byte, seed uint32) (h uint32) {
- var i int
-
- if len(in) > 15 {
- var (
- v1 = seed + prime32x1 + prime32x2
- v2 = seed + prime32x2
- v3 = seed + 0
- v4 = seed - prime32x1
- )
- for ; i < len(in)-15; i += 16 {
- in := in[i : i+16 : len(in)]
- v1 += u32(in[0:4:len(in)]) * prime32x2
- v1 = rotl32_13(v1) * prime32x1
-
- v2 += u32(in[4:8:len(in)]) * prime32x2
- v2 = rotl32_13(v2) * prime32x1
-
- v3 += u32(in[8:12:len(in)]) * prime32x2
- v3 = rotl32_13(v3) * prime32x1
-
- v4 += u32(in[12:16:len(in)]) * prime32x2
- v4 = rotl32_13(v4) * prime32x1
- }
-
- h = rotl32_1(v1) + rotl32_7(v2) + rotl32_12(v3) + rotl32_18(v4)
-
- } else {
- h = seed + prime32x5
- }
-
- h += uint32(len(in))
- for ; i <= len(in)-4; i += 4 {
- in := in[i : i+4 : len(in)]
- h += u32(in[0:4:len(in)]) * prime32x3
- h = rotl32_17(h) * prime32x4
- }
-
- for ; i < len(in); i++ {
- h += uint32(in[i]) * prime32x5
- h = rotl32_11(h) * prime32x1
- }
-
- h ^= h >> 15
- h *= prime32x2
- h ^= h >> 13
- h *= prime32x3
- h ^= h >> 16
-
- return
-}
-
-func (xx *XXHash32) Write(in []byte) (n int, err error) {
- i, ml := 0, int(xx.memIdx)
- n = len(in)
- xx.ln += int32(n)
-
- if d := 16 - ml; ml > 0 && ml+len(in) > 16 {
- xx.memIdx += int32(copy(xx.mem[xx.memIdx:], in[:d]))
- ml, in = 16, in[d:len(in):len(in)]
- } else if ml+len(in) < 16 {
- xx.memIdx += int32(copy(xx.mem[xx.memIdx:], in))
- return
- }
-
- if ml > 0 {
- i += 16 - ml
- xx.memIdx += int32(copy(xx.mem[xx.memIdx:len(xx.mem):len(xx.mem)], in))
- in := xx.mem[:16:len(xx.mem)]
-
- xx.v1 += u32(in[0:4:len(in)]) * prime32x2
- xx.v1 = rotl32_13(xx.v1) * prime32x1
-
- xx.v2 += u32(in[4:8:len(in)]) * prime32x2
- xx.v2 = rotl32_13(xx.v2) * prime32x1
-
- xx.v3 += u32(in[8:12:len(in)]) * prime32x2
- xx.v3 = rotl32_13(xx.v3) * prime32x1
-
- xx.v4 += u32(in[12:16:len(in)]) * prime32x2
- xx.v4 = rotl32_13(xx.v4) * prime32x1
-
- xx.memIdx = 0
- }
-
- for ; i <= len(in)-16; i += 16 {
- in := in[i : i+16 : len(in)]
- xx.v1 += u32(in[0:4:len(in)]) * prime32x2
- xx.v1 = rotl32_13(xx.v1) * prime32x1
-
- xx.v2 += u32(in[4:8:len(in)]) * prime32x2
- xx.v2 = rotl32_13(xx.v2) * prime32x1
-
- xx.v3 += u32(in[8:12:len(in)]) * prime32x2
- xx.v3 = rotl32_13(xx.v3) * prime32x1
-
- xx.v4 += u32(in[12:16:len(in)]) * prime32x2
- xx.v4 = rotl32_13(xx.v4) * prime32x1
- }
-
- if len(in)-i != 0 {
- xx.memIdx += int32(copy(xx.mem[xx.memIdx:], in[i:len(in):len(in)]))
- }
-
- return
-}
-
-func (xx *XXHash32) Sum32() (h uint32) {
- var i int32
- if xx.ln > 15 {
- h = rotl32_1(xx.v1) + rotl32_7(xx.v2) + rotl32_12(xx.v3) + rotl32_18(xx.v4)
- } else {
- h = xx.seed + prime32x5
- }
-
- h += uint32(xx.ln)
-
- if xx.memIdx > 0 {
- for ; i < xx.memIdx-3; i += 4 {
- in := xx.mem[i : i+4 : len(xx.mem)]
- h += u32(in[0:4:len(in)]) * prime32x3
- h = rotl32_17(h) * prime32x4
- }
-
- for ; i < xx.memIdx; i++ {
- h += uint32(xx.mem[i]) * prime32x5
- h = rotl32_11(h) * prime32x1
- }
- }
- h ^= h >> 15
- h *= prime32x2
- h ^= h >> 13
- h *= prime32x3
- h ^= h >> 16
-
- return
-}
-
-// Checksum64S returns the 64bit xxhash checksum for a single input
-func Checksum64S(in []byte, seed uint64) uint64 {
- if len(in) == 0 && seed == 0 {
- return 0xef46db3751d8e999
- }
-
- if len(in) > 31 {
- return checksum64(in, seed)
- }
-
- return checksum64Short(in, seed)
-}
diff --git a/vendor/github.com/OneOfOne/xxhash/xxhash_safe.go b/vendor/github.com/OneOfOne/xxhash/xxhash_safe.go
deleted file mode 100644
index e92ec29e02..0000000000
--- a/vendor/github.com/OneOfOne/xxhash/xxhash_safe.go
+++ /dev/null
@@ -1,183 +0,0 @@
-// +build appengine safe ppc64le ppc64be mipsle mips s390x
-
-package xxhash
-
-// Backend returns the current version of xxhash being used.
-const Backend = "GoSafe"
-
-func ChecksumString32S(s string, seed uint32) uint32 {
- return Checksum32S([]byte(s), seed)
-}
-
-func (xx *XXHash32) WriteString(s string) (int, error) {
- if len(s) == 0 {
- return 0, nil
- }
- return xx.Write([]byte(s))
-}
-
-func ChecksumString64S(s string, seed uint64) uint64 {
- return Checksum64S([]byte(s), seed)
-}
-
-func (xx *XXHash64) WriteString(s string) (int, error) {
- if len(s) == 0 {
- return 0, nil
- }
- return xx.Write([]byte(s))
-}
-
-func checksum64(in []byte, seed uint64) (h uint64) {
- var (
- v1, v2, v3, v4 = resetVs64(seed)
-
- i int
- )
-
- for ; i < len(in)-31; i += 32 {
- in := in[i : i+32 : len(in)]
- v1 = round64(v1, u64(in[0:8:len(in)]))
- v2 = round64(v2, u64(in[8:16:len(in)]))
- v3 = round64(v3, u64(in[16:24:len(in)]))
- v4 = round64(v4, u64(in[24:32:len(in)]))
- }
-
- h = rotl64_1(v1) + rotl64_7(v2) + rotl64_12(v3) + rotl64_18(v4)
-
- h = mergeRound64(h, v1)
- h = mergeRound64(h, v2)
- h = mergeRound64(h, v3)
- h = mergeRound64(h, v4)
-
- h += uint64(len(in))
-
- for ; i < len(in)-7; i += 8 {
- h ^= round64(0, u64(in[i:len(in):len(in)]))
- h = rotl64_27(h)*prime64x1 + prime64x4
- }
-
- for ; i < len(in)-3; i += 4 {
- h ^= uint64(u32(in[i:len(in):len(in)])) * prime64x1
- h = rotl64_23(h)*prime64x2 + prime64x3
- }
-
- for ; i < len(in); i++ {
- h ^= uint64(in[i]) * prime64x5
- h = rotl64_11(h) * prime64x1
- }
-
- return mix64(h)
-}
-
-func checksum64Short(in []byte, seed uint64) uint64 {
- var (
- h = seed + prime64x5 + uint64(len(in))
- i int
- )
-
- for ; i < len(in)-7; i += 8 {
- k := u64(in[i : i+8 : len(in)])
- h ^= round64(0, k)
- h = rotl64_27(h)*prime64x1 + prime64x4
- }
-
- for ; i < len(in)-3; i += 4 {
- h ^= uint64(u32(in[i:i+4:len(in)])) * prime64x1
- h = rotl64_23(h)*prime64x2 + prime64x3
- }
-
- for ; i < len(in); i++ {
- h ^= uint64(in[i]) * prime64x5
- h = rotl64_11(h) * prime64x1
- }
-
- return mix64(h)
-}
-
-func (xx *XXHash64) Write(in []byte) (n int, err error) {
- var (
- ml = int(xx.memIdx)
- d = 32 - ml
- )
-
- n = len(in)
- xx.ln += uint64(n)
-
- if ml+len(in) < 32 {
- xx.memIdx += int8(copy(xx.mem[xx.memIdx:len(xx.mem):len(xx.mem)], in))
- return
- }
-
- i, v1, v2, v3, v4 := 0, xx.v1, xx.v2, xx.v3, xx.v4
- if ml > 0 && ml+len(in) > 32 {
- xx.memIdx += int8(copy(xx.mem[xx.memIdx:len(xx.mem):len(xx.mem)], in[:d:len(in)]))
- in = in[d:len(in):len(in)]
-
- in := xx.mem[0:32:len(xx.mem)]
-
- v1 = round64(v1, u64(in[0:8:len(in)]))
- v2 = round64(v2, u64(in[8:16:len(in)]))
- v3 = round64(v3, u64(in[16:24:len(in)]))
- v4 = round64(v4, u64(in[24:32:len(in)]))
-
- xx.memIdx = 0
- }
-
- for ; i < len(in)-31; i += 32 {
- in := in[i : i+32 : len(in)]
- v1 = round64(v1, u64(in[0:8:len(in)]))
- v2 = round64(v2, u64(in[8:16:len(in)]))
- v3 = round64(v3, u64(in[16:24:len(in)]))
- v4 = round64(v4, u64(in[24:32:len(in)]))
- }
-
- if len(in)-i != 0 {
- xx.memIdx += int8(copy(xx.mem[xx.memIdx:], in[i:len(in):len(in)]))
- }
-
- xx.v1, xx.v2, xx.v3, xx.v4 = v1, v2, v3, v4
-
- return
-}
-
-func (xx *XXHash64) Sum64() (h uint64) {
- var i int
- if xx.ln > 31 {
- v1, v2, v3, v4 := xx.v1, xx.v2, xx.v3, xx.v4
- h = rotl64_1(v1) + rotl64_7(v2) + rotl64_12(v3) + rotl64_18(v4)
-
- h = mergeRound64(h, v1)
- h = mergeRound64(h, v2)
- h = mergeRound64(h, v3)
- h = mergeRound64(h, v4)
- } else {
- h = xx.seed + prime64x5
- }
-
- h += uint64(xx.ln)
- if xx.memIdx > 0 {
- in := xx.mem[:xx.memIdx]
- for ; i < int(xx.memIdx)-7; i += 8 {
- in := in[i : i+8 : len(in)]
- k := u64(in[0:8:len(in)])
- k *= prime64x2
- k = rotl64_31(k)
- k *= prime64x1
- h ^= k
- h = rotl64_27(h)*prime64x1 + prime64x4
- }
-
- for ; i < int(xx.memIdx)-3; i += 4 {
- in := in[i : i+4 : len(in)]
- h ^= uint64(u32(in[0:4:len(in)])) * prime64x1
- h = rotl64_23(h)*prime64x2 + prime64x3
- }
-
- for ; i < int(xx.memIdx); i++ {
- h ^= uint64(in[i]) * prime64x5
- h = rotl64_11(h) * prime64x1
- }
- }
-
- return mix64(h)
-}
diff --git a/vendor/github.com/OneOfOne/xxhash/xxhash_unsafe.go b/vendor/github.com/OneOfOne/xxhash/xxhash_unsafe.go
deleted file mode 100644
index 1e2b5e8f1f..0000000000
--- a/vendor/github.com/OneOfOne/xxhash/xxhash_unsafe.go
+++ /dev/null
@@ -1,240 +0,0 @@
-// +build !safe
-// +build !appengine
-// +build !ppc64le
-// +build !mipsle
-// +build !ppc64be
-// +build !mips
-// +build !s390x
-
-package xxhash
-
-import (
- "reflect"
- "unsafe"
-)
-
-// Backend returns the current version of xxhash being used.
-const Backend = "GoUnsafe"
-
-// ChecksumString32S returns the checksum of the input data, without creating a copy, with the specific seed.
-func ChecksumString32S(s string, seed uint32) uint32 {
- if len(s) == 0 {
- return Checksum32S(nil, seed)
- }
- ss := (*reflect.StringHeader)(unsafe.Pointer(&s))
- return Checksum32S((*[maxInt32]byte)(unsafe.Pointer(ss.Data))[:len(s):len(s)], seed)
-}
-
-func (xx *XXHash32) WriteString(s string) (int, error) {
- if len(s) == 0 {
- return 0, nil
- }
-
- ss := (*reflect.StringHeader)(unsafe.Pointer(&s))
- return xx.Write((*[maxInt32]byte)(unsafe.Pointer(ss.Data))[:len(s):len(s)])
-}
-
-// ChecksumString64S returns the checksum of the input data, without creating a copy, with the specific seed.
-func ChecksumString64S(s string, seed uint64) uint64 {
- if len(s) == 0 {
- return Checksum64S(nil, seed)
- }
-
- ss := (*reflect.StringHeader)(unsafe.Pointer(&s))
- return Checksum64S((*[maxInt32]byte)(unsafe.Pointer(ss.Data))[:len(s):len(s)], seed)
-}
-
-func (xx *XXHash64) WriteString(s string) (int, error) {
- if len(s) == 0 {
- return 0, nil
- }
- ss := (*reflect.StringHeader)(unsafe.Pointer(&s))
- return xx.Write((*[maxInt32]byte)(unsafe.Pointer(ss.Data))[:len(s):len(s)])
-}
-
-//go:nocheckptr
-func checksum64(in []byte, seed uint64) uint64 {
- var (
- wordsLen = len(in) >> 3
- words = ((*[maxInt32 / 8]uint64)(unsafe.Pointer(&in[0])))[:wordsLen:wordsLen]
-
- v1, v2, v3, v4 = resetVs64(seed)
-
- h uint64
- i int
- )
-
- for ; i < len(words)-3; i += 4 {
- words := (*[4]uint64)(unsafe.Pointer(&words[i]))
-
- v1 = round64(v1, words[0])
- v2 = round64(v2, words[1])
- v3 = round64(v3, words[2])
- v4 = round64(v4, words[3])
- }
-
- h = rotl64_1(v1) + rotl64_7(v2) + rotl64_12(v3) + rotl64_18(v4)
-
- h = mergeRound64(h, v1)
- h = mergeRound64(h, v2)
- h = mergeRound64(h, v3)
- h = mergeRound64(h, v4)
-
- h += uint64(len(in))
-
- for _, k := range words[i:] {
- h ^= round64(0, k)
- h = rotl64_27(h)*prime64x1 + prime64x4
- }
-
- if in = in[wordsLen<<3 : len(in) : len(in)]; len(in) > 3 {
- words := (*[1]uint32)(unsafe.Pointer(&in[0]))
- h ^= uint64(words[0]) * prime64x1
- h = rotl64_23(h)*prime64x2 + prime64x3
-
- in = in[4:len(in):len(in)]
- }
-
- for _, b := range in {
- h ^= uint64(b) * prime64x5
- h = rotl64_11(h) * prime64x1
- }
-
- return mix64(h)
-}
-
-//go:nocheckptr
-func checksum64Short(in []byte, seed uint64) uint64 {
- var (
- h = seed + prime64x5 + uint64(len(in))
- i int
- )
-
- if len(in) > 7 {
- var (
- wordsLen = len(in) >> 3
- words = ((*[maxInt32 / 8]uint64)(unsafe.Pointer(&in[0])))[:wordsLen:wordsLen]
- )
-
- for i := range words {
- h ^= round64(0, words[i])
- h = rotl64_27(h)*prime64x1 + prime64x4
- }
-
- i = wordsLen << 3
- }
-
- if in = in[i:len(in):len(in)]; len(in) > 3 {
- words := (*[1]uint32)(unsafe.Pointer(&in[0]))
- h ^= uint64(words[0]) * prime64x1
- h = rotl64_23(h)*prime64x2 + prime64x3
-
- in = in[4:len(in):len(in)]
- }
-
- for _, b := range in {
- h ^= uint64(b) * prime64x5
- h = rotl64_11(h) * prime64x1
- }
-
- return mix64(h)
-}
-
-func (xx *XXHash64) Write(in []byte) (n int, err error) {
- mem, idx := xx.mem[:], int(xx.memIdx)
-
- xx.ln, n = xx.ln+uint64(len(in)), len(in)
-
- if idx+len(in) < 32 {
- xx.memIdx += int8(copy(mem[idx:len(mem):len(mem)], in))
- return
- }
-
- var (
- v1, v2, v3, v4 = xx.v1, xx.v2, xx.v3, xx.v4
-
- i int
- )
-
- if d := 32 - int(idx); d > 0 && int(idx)+len(in) > 31 {
- copy(mem[idx:len(mem):len(mem)], in[:len(in):len(in)])
-
- words := (*[4]uint64)(unsafe.Pointer(&mem[0]))
-
- v1 = round64(v1, words[0])
- v2 = round64(v2, words[1])
- v3 = round64(v3, words[2])
- v4 = round64(v4, words[3])
-
- if in, xx.memIdx = in[d:len(in):len(in)], 0; len(in) == 0 {
- goto RET
- }
- }
-
- for ; i < len(in)-31; i += 32 {
- words := (*[4]uint64)(unsafe.Pointer(&in[i]))
-
- v1 = round64(v1, words[0])
- v2 = round64(v2, words[1])
- v3 = round64(v3, words[2])
- v4 = round64(v4, words[3])
- }
-
- if len(in)-i != 0 {
- xx.memIdx += int8(copy(mem[xx.memIdx:len(mem):len(mem)], in[i:len(in):len(in)]))
- }
-
-RET:
- xx.v1, xx.v2, xx.v3, xx.v4 = v1, v2, v3, v4
-
- return
-}
-
-func (xx *XXHash64) Sum64() (h uint64) {
- if seed := xx.seed; xx.ln > 31 {
- v1, v2, v3, v4 := xx.v1, xx.v2, xx.v3, xx.v4
- h = rotl64_1(v1) + rotl64_7(v2) + rotl64_12(v3) + rotl64_18(v4)
-
- h = mergeRound64(h, v1)
- h = mergeRound64(h, v2)
- h = mergeRound64(h, v3)
- h = mergeRound64(h, v4)
- } else if seed == 0 {
- h = prime64x5
- } else {
- h = seed + prime64x5
- }
-
- h += uint64(xx.ln)
-
- if xx.memIdx == 0 {
- return mix64(h)
- }
-
- var (
- in = xx.mem[:xx.memIdx:xx.memIdx]
- wordsLen = len(in) >> 3
- words = ((*[maxInt32 / 8]uint64)(unsafe.Pointer(&in[0])))[:wordsLen:wordsLen]
- )
-
- for _, k := range words {
- h ^= round64(0, k)
- h = rotl64_27(h)*prime64x1 + prime64x4
- }
-
- if in = in[wordsLen<<3 : len(in) : len(in)]; len(in) > 3 {
- words := (*[1]uint32)(unsafe.Pointer(&in[0]))
-
- h ^= uint64(words[0]) * prime64x1
- h = rotl64_23(h)*prime64x2 + prime64x3
-
- in = in[4:len(in):len(in)]
- }
-
- for _, b := range in {
- h ^= uint64(b) * prime64x5
- h = rotl64_11(h) * prime64x1
- }
-
- return mix64(h)
-}
diff --git a/vendor/github.com/beorn7/perks/LICENSE b/vendor/github.com/beorn7/perks/LICENSE
deleted file mode 100644
index 339177be66..0000000000
--- a/vendor/github.com/beorn7/perks/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (C) 2013 Blake Mizerany
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/beorn7/perks/quantile/exampledata.txt b/vendor/github.com/beorn7/perks/quantile/exampledata.txt
deleted file mode 100644
index 1602287d7c..0000000000
--- a/vendor/github.com/beorn7/perks/quantile/exampledata.txt
+++ /dev/null
@@ -1,2388 +0,0 @@
-8
-5
-26
-12
-5
-235
-13
-6
-28
-30
-3
-3
-3
-3
-5
-2
-33
-7
-2
-4
-7
-12
-14
-5
-8
-3
-10
-4
-5
-3
-6
-6
-209
-20
-3
-10
-14
-3
-4
-6
-8
-5
-11
-7
-3
-2
-3
-3
-212
-5
-222
-4
-10
-10
-5
-6
-3
-8
-3
-10
-254
-220
-2
-3
-5
-24
-5
-4
-222
-7
-3
-3
-223
-8
-15
-12
-14
-14
-3
-2
-2
-3
-13
-3
-11
-4
-4
-6
-5
-7
-13
-5
-3
-5
-2
-5
-3
-5
-2
-7
-15
-17
-14
-3
-6
-6
-3
-17
-5
-4
-7
-6
-4
-4
-8
-6
-8
-3
-9
-3
-6
-3
-4
-5
-3
-3
-660
-4
-6
-10
-3
-6
-3
-2
-5
-13
-2
-4
-4
-10
-4
-8
-4
-3
-7
-9
-9
-3
-10
-37
-3
-13
-4
-12
-3
-6
-10
-8
-5
-21
-2
-3
-8
-3
-2
-3
-3
-4
-12
-2
-4
-8
-8
-4
-3
-2
-20
-1
-6
-32
-2
-11
-6
-18
-3
-8
-11
-3
-212
-3
-4
-2
-6
-7
-12
-11
-3
-2
-16
-10
-6
-4
-6
-3
-2
-7
-3
-2
-2
-2
-2
-5
-6
-4
-3
-10
-3
-4
-6
-5
-3
-4
-4
-5
-6
-4
-3
-4
-4
-5
-7
-5
-5
-3
-2
-7
-2
-4
-12
-4
-5
-6
-2
-4
-4
-8
-4
-15
-13
-7
-16
-5
-3
-23
-5
-5
-7
-3
-2
-9
-8
-7
-5
-8
-11
-4
-10
-76
-4
-47
-4
-3
-2
-7
-4
-2
-3
-37
-10
-4
-2
-20
-5
-4
-4
-10
-10
-4
-3
-7
-23
-240
-7
-13
-5
-5
-3
-3
-2
-5
-4
-2
-8
-7
-19
-2
-23
-8
-7
-2
-5
-3
-8
-3
-8
-13
-5
-5
-5
-2
-3
-23
-4
-9
-8
-4
-3
-3
-5
-220
-2
-3
-4
-6
-14
-3
-53
-6
-2
-5
-18
-6
-3
-219
-6
-5
-2
-5
-3
-6
-5
-15
-4
-3
-17
-3
-2
-4
-7
-2
-3
-3
-4
-4
-3
-2
-664
-6
-3
-23
-5
-5
-16
-5
-8
-2
-4
-2
-24
-12
-3
-2
-3
-5
-8
-3
-5
-4
-3
-14
-3
-5
-8
-2
-3
-7
-9
-4
-2
-3
-6
-8
-4
-3
-4
-6
-5
-3
-3
-6
-3
-19
-4
-4
-6
-3
-6
-3
-5
-22
-5
-4
-4
-3
-8
-11
-4
-9
-7
-6
-13
-4
-4
-4
-6
-17
-9
-3
-3
-3
-4
-3
-221
-5
-11
-3
-4
-2
-12
-6
-3
-5
-7
-5
-7
-4
-9
-7
-14
-37
-19
-217
-16
-3
-5
-2
-2
-7
-19
-7
-6
-7
-4
-24
-5
-11
-4
-7
-7
-9
-13
-3
-4
-3
-6
-28
-4
-4
-5
-5
-2
-5
-6
-4
-4
-6
-10
-5
-4
-3
-2
-3
-3
-6
-5
-5
-4
-3
-2
-3
-7
-4
-6
-18
-16
-8
-16
-4
-5
-8
-6
-9
-13
-1545
-6
-215
-6
-5
-6
-3
-45
-31
-5
-2
-2
-4
-3
-3
-2
-5
-4
-3
-5
-7
-7
-4
-5
-8
-5
-4
-749
-2
-31
-9
-11
-2
-11
-5
-4
-4
-7
-9
-11
-4
-5
-4
-7
-3
-4
-6
-2
-15
-3
-4
-3
-4
-3
-5
-2
-13
-5
-5
-3
-3
-23
-4
-4
-5
-7
-4
-13
-2
-4
-3
-4
-2
-6
-2
-7
-3
-5
-5
-3
-29
-5
-4
-4
-3
-10
-2
-3
-79
-16
-6
-6
-7
-7
-3
-5
-5
-7
-4
-3
-7
-9
-5
-6
-5
-9
-6
-3
-6
-4
-17
-2
-10
-9
-3
-6
-2
-3
-21
-22
-5
-11
-4
-2
-17
-2
-224
-2
-14
-3
-4
-4
-2
-4
-4
-4
-4
-5
-3
-4
-4
-10
-2
-6
-3
-3
-5
-7
-2
-7
-5
-6
-3
-218
-2
-2
-5
-2
-6
-3
-5
-222
-14
-6
-33
-3
-2
-5
-3
-3
-3
-9
-5
-3
-3
-2
-7
-4
-3
-4
-3
-5
-6
-5
-26
-4
-13
-9
-7
-3
-221
-3
-3
-4
-4
-4
-4
-2
-18
-5
-3
-7
-9
-6
-8
-3
-10
-3
-11
-9
-5
-4
-17
-5
-5
-6
-6
-3
-2
-4
-12
-17
-6
-7
-218
-4
-2
-4
-10
-3
-5
-15
-3
-9
-4
-3
-3
-6
-29
-3
-3
-4
-5
-5
-3
-8
-5
-6
-6
-7
-5
-3
-5
-3
-29
-2
-31
-5
-15
-24
-16
-5
-207
-4
-3
-3
-2
-15
-4
-4
-13
-5
-5
-4
-6
-10
-2
-7
-8
-4
-6
-20
-5
-3
-4
-3
-12
-12
-5
-17
-7
-3
-3
-3
-6
-10
-3
-5
-25
-80
-4
-9
-3
-2
-11
-3
-3
-2
-3
-8
-7
-5
-5
-19
-5
-3
-3
-12
-11
-2
-6
-5
-5
-5
-3
-3
-3
-4
-209
-14
-3
-2
-5
-19
-4
-4
-3
-4
-14
-5
-6
-4
-13
-9
-7
-4
-7
-10
-2
-9
-5
-7
-2
-8
-4
-6
-5
-5
-222
-8
-7
-12
-5
-216
-3
-4
-4
-6
-3
-14
-8
-7
-13
-4
-3
-3
-3
-3
-17
-5
-4
-3
-33
-6
-6
-33
-7
-5
-3
-8
-7
-5
-2
-9
-4
-2
-233
-24
-7
-4
-8
-10
-3
-4
-15
-2
-16
-3
-3
-13
-12
-7
-5
-4
-207
-4
-2
-4
-27
-15
-2
-5
-2
-25
-6
-5
-5
-6
-13
-6
-18
-6
-4
-12
-225
-10
-7
-5
-2
-2
-11
-4
-14
-21
-8
-10
-3
-5
-4
-232
-2
-5
-5
-3
-7
-17
-11
-6
-6
-23
-4
-6
-3
-5
-4
-2
-17
-3
-6
-5
-8
-3
-2
-2
-14
-9
-4
-4
-2
-5
-5
-3
-7
-6
-12
-6
-10
-3
-6
-2
-2
-19
-5
-4
-4
-9
-2
-4
-13
-3
-5
-6
-3
-6
-5
-4
-9
-6
-3
-5
-7
-3
-6
-6
-4
-3
-10
-6
-3
-221
-3
-5
-3
-6
-4
-8
-5
-3
-6
-4
-4
-2
-54
-5
-6
-11
-3
-3
-4
-4
-4
-3
-7
-3
-11
-11
-7
-10
-6
-13
-223
-213
-15
-231
-7
-3
-7
-228
-2
-3
-4
-4
-5
-6
-7
-4
-13
-3
-4
-5
-3
-6
-4
-6
-7
-2
-4
-3
-4
-3
-3
-6
-3
-7
-3
-5
-18
-5
-6
-8
-10
-3
-3
-3
-2
-4
-2
-4
-4
-5
-6
-6
-4
-10
-13
-3
-12
-5
-12
-16
-8
-4
-19
-11
-2
-4
-5
-6
-8
-5
-6
-4
-18
-10
-4
-2
-216
-6
-6
-6
-2
-4
-12
-8
-3
-11
-5
-6
-14
-5
-3
-13
-4
-5
-4
-5
-3
-28
-6
-3
-7
-219
-3
-9
-7
-3
-10
-6
-3
-4
-19
-5
-7
-11
-6
-15
-19
-4
-13
-11
-3
-7
-5
-10
-2
-8
-11
-2
-6
-4
-6
-24
-6
-3
-3
-3
-3
-6
-18
-4
-11
-4
-2
-5
-10
-8
-3
-9
-5
-3
-4
-5
-6
-2
-5
-7
-4
-4
-14
-6
-4
-4
-5
-5
-7
-2
-4
-3
-7
-3
-3
-6
-4
-5
-4
-4
-4
-3
-3
-3
-3
-8
-14
-2
-3
-5
-3
-2
-4
-5
-3
-7
-3
-3
-18
-3
-4
-4
-5
-7
-3
-3
-3
-13
-5
-4
-8
-211
-5
-5
-3
-5
-2
-5
-4
-2
-655
-6
-3
-5
-11
-2
-5
-3
-12
-9
-15
-11
-5
-12
-217
-2
-6
-17
-3
-3
-207
-5
-5
-4
-5
-9
-3
-2
-8
-5
-4
-3
-2
-5
-12
-4
-14
-5
-4
-2
-13
-5
-8
-4
-225
-4
-3
-4
-5
-4
-3
-3
-6
-23
-9
-2
-6
-7
-233
-4
-4
-6
-18
-3
-4
-6
-3
-4
-4
-2
-3
-7
-4
-13
-227
-4
-3
-5
-4
-2
-12
-9
-17
-3
-7
-14
-6
-4
-5
-21
-4
-8
-9
-2
-9
-25
-16
-3
-6
-4
-7
-8
-5
-2
-3
-5
-4
-3
-3
-5
-3
-3
-3
-2
-3
-19
-2
-4
-3
-4
-2
-3
-4
-4
-2
-4
-3
-3
-3
-2
-6
-3
-17
-5
-6
-4
-3
-13
-5
-3
-3
-3
-4
-9
-4
-2
-14
-12
-4
-5
-24
-4
-3
-37
-12
-11
-21
-3
-4
-3
-13
-4
-2
-3
-15
-4
-11
-4
-4
-3
-8
-3
-4
-4
-12
-8
-5
-3
-3
-4
-2
-220
-3
-5
-223
-3
-3
-3
-10
-3
-15
-4
-241
-9
-7
-3
-6
-6
-23
-4
-13
-7
-3
-4
-7
-4
-9
-3
-3
-4
-10
-5
-5
-1
-5
-24
-2
-4
-5
-5
-6
-14
-3
-8
-2
-3
-5
-13
-13
-3
-5
-2
-3
-15
-3
-4
-2
-10
-4
-4
-4
-5
-5
-3
-5
-3
-4
-7
-4
-27
-3
-6
-4
-15
-3
-5
-6
-6
-5
-4
-8
-3
-9
-2
-6
-3
-4
-3
-7
-4
-18
-3
-11
-3
-3
-8
-9
-7
-24
-3
-219
-7
-10
-4
-5
-9
-12
-2
-5
-4
-4
-4
-3
-3
-19
-5
-8
-16
-8
-6
-22
-3
-23
-3
-242
-9
-4
-3
-3
-5
-7
-3
-3
-5
-8
-3
-7
-5
-14
-8
-10
-3
-4
-3
-7
-4
-6
-7
-4
-10
-4
-3
-11
-3
-7
-10
-3
-13
-6
-8
-12
-10
-5
-7
-9
-3
-4
-7
-7
-10
-8
-30
-9
-19
-4
-3
-19
-15
-4
-13
-3
-215
-223
-4
-7
-4
-8
-17
-16
-3
-7
-6
-5
-5
-4
-12
-3
-7
-4
-4
-13
-4
-5
-2
-5
-6
-5
-6
-6
-7
-10
-18
-23
-9
-3
-3
-6
-5
-2
-4
-2
-7
-3
-3
-2
-5
-5
-14
-10
-224
-6
-3
-4
-3
-7
-5
-9
-3
-6
-4
-2
-5
-11
-4
-3
-3
-2
-8
-4
-7
-4
-10
-7
-3
-3
-18
-18
-17
-3
-3
-3
-4
-5
-3
-3
-4
-12
-7
-3
-11
-13
-5
-4
-7
-13
-5
-4
-11
-3
-12
-3
-6
-4
-4
-21
-4
-6
-9
-5
-3
-10
-8
-4
-6
-4
-4
-6
-5
-4
-8
-6
-4
-6
-4
-4
-5
-9
-6
-3
-4
-2
-9
-3
-18
-2
-4
-3
-13
-3
-6
-6
-8
-7
-9
-3
-2
-16
-3
-4
-6
-3
-2
-33
-22
-14
-4
-9
-12
-4
-5
-6
-3
-23
-9
-4
-3
-5
-5
-3
-4
-5
-3
-5
-3
-10
-4
-5
-5
-8
-4
-4
-6
-8
-5
-4
-3
-4
-6
-3
-3
-3
-5
-9
-12
-6
-5
-9
-3
-5
-3
-2
-2
-2
-18
-3
-2
-21
-2
-5
-4
-6
-4
-5
-10
-3
-9
-3
-2
-10
-7
-3
-6
-6
-4
-4
-8
-12
-7
-3
-7
-3
-3
-9
-3
-4
-5
-4
-4
-5
-5
-10
-15
-4
-4
-14
-6
-227
-3
-14
-5
-216
-22
-5
-4
-2
-2
-6
-3
-4
-2
-9
-9
-4
-3
-28
-13
-11
-4
-5
-3
-3
-2
-3
-3
-5
-3
-4
-3
-5
-23
-26
-3
-4
-5
-6
-4
-6
-3
-5
-5
-3
-4
-3
-2
-2
-2
-7
-14
-3
-6
-7
-17
-2
-2
-15
-14
-16
-4
-6
-7
-13
-6
-4
-5
-6
-16
-3
-3
-28
-3
-6
-15
-3
-9
-2
-4
-6
-3
-3
-22
-4
-12
-6
-7
-2
-5
-4
-10
-3
-16
-6
-9
-2
-5
-12
-7
-5
-5
-5
-5
-2
-11
-9
-17
-4
-3
-11
-7
-3
-5
-15
-4
-3
-4
-211
-8
-7
-5
-4
-7
-6
-7
-6
-3
-6
-5
-6
-5
-3
-4
-4
-26
-4
-6
-10
-4
-4
-3
-2
-3
-3
-4
-5
-9
-3
-9
-4
-4
-5
-5
-8
-2
-4
-2
-3
-8
-4
-11
-19
-5
-8
-6
-3
-5
-6
-12
-3
-2
-4
-16
-12
-3
-4
-4
-8
-6
-5
-6
-6
-219
-8
-222
-6
-16
-3
-13
-19
-5
-4
-3
-11
-6
-10
-4
-7
-7
-12
-5
-3
-3
-5
-6
-10
-3
-8
-2
-5
-4
-7
-2
-4
-4
-2
-12
-9
-6
-4
-2
-40
-2
-4
-10
-4
-223
-4
-2
-20
-6
-7
-24
-5
-4
-5
-2
-20
-16
-6
-5
-13
-2
-3
-3
-19
-3
-2
-4
-5
-6
-7
-11
-12
-5
-6
-7
-7
-3
-5
-3
-5
-3
-14
-3
-4
-4
-2
-11
-1
-7
-3
-9
-6
-11
-12
-5
-8
-6
-221
-4
-2
-12
-4
-3
-15
-4
-5
-226
-7
-218
-7
-5
-4
-5
-18
-4
-5
-9
-4
-4
-2
-9
-18
-18
-9
-5
-6
-6
-3
-3
-7
-3
-5
-4
-4
-4
-12
-3
-6
-31
-5
-4
-7
-3
-6
-5
-6
-5
-11
-2
-2
-11
-11
-6
-7
-5
-8
-7
-10
-5
-23
-7
-4
-3
-5
-34
-2
-5
-23
-7
-3
-6
-8
-4
-4
-4
-2
-5
-3
-8
-5
-4
-8
-25
-2
-3
-17
-8
-3
-4
-8
-7
-3
-15
-6
-5
-7
-21
-9
-5
-6
-6
-5
-3
-2
-3
-10
-3
-6
-3
-14
-7
-4
-4
-8
-7
-8
-2
-6
-12
-4
-213
-6
-5
-21
-8
-2
-5
-23
-3
-11
-2
-3
-6
-25
-2
-3
-6
-7
-6
-6
-4
-4
-6
-3
-17
-9
-7
-6
-4
-3
-10
-7
-2
-3
-3
-3
-11
-8
-3
-7
-6
-4
-14
-36
-3
-4
-3
-3
-22
-13
-21
-4
-2
-7
-4
-4
-17
-15
-3
-7
-11
-2
-4
-7
-6
-209
-6
-3
-2
-2
-24
-4
-9
-4
-3
-3
-3
-29
-2
-2
-4
-3
-3
-5
-4
-6
-3
-3
-2
-4
diff --git a/vendor/github.com/beorn7/perks/quantile/stream.go b/vendor/github.com/beorn7/perks/quantile/stream.go
deleted file mode 100644
index d7d14f8eb6..0000000000
--- a/vendor/github.com/beorn7/perks/quantile/stream.go
+++ /dev/null
@@ -1,316 +0,0 @@
-// Package quantile computes approximate quantiles over an unbounded data
-// stream within low memory and CPU bounds.
-//
-// A small amount of accuracy is traded to achieve the above properties.
-//
-// Multiple streams can be merged before calling Query to generate a single set
-// of results. This is meaningful when the streams represent the same type of
-// data. See Merge and Samples.
-//
-// For more detailed information about the algorithm used, see:
-//
-// Effective Computation of Biased Quantiles over Data Streams
-//
-// http://www.cs.rutgers.edu/~muthu/bquant.pdf
-package quantile
-
-import (
- "math"
- "sort"
-)
-
-// Sample holds an observed value and meta information for compression. JSON
-// tags have been added for convenience.
-type Sample struct {
- Value float64 `json:",string"`
- Width float64 `json:",string"`
- Delta float64 `json:",string"`
-}
-
-// Samples represents a slice of samples. It implements sort.Interface.
-type Samples []Sample
-
-func (a Samples) Len() int { return len(a) }
-func (a Samples) Less(i, j int) bool { return a[i].Value < a[j].Value }
-func (a Samples) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
-
-type invariant func(s *stream, r float64) float64
-
-// NewLowBiased returns an initialized Stream for low-biased quantiles
-// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but
-// error guarantees can still be given even for the lower ranks of the data
-// distribution.
-//
-// The provided epsilon is a relative error, i.e. the true quantile of a value
-// returned by a query is guaranteed to be within (1±Epsilon)*Quantile.
-//
-// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error
-// properties.
-func NewLowBiased(epsilon float64) *Stream {
- ƒ := func(s *stream, r float64) float64 {
- return 2 * epsilon * r
- }
- return newStream(ƒ)
-}
-
-// NewHighBiased returns an initialized Stream for high-biased quantiles
-// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but
-// error guarantees can still be given even for the higher ranks of the data
-// distribution.
-//
-// The provided epsilon is a relative error, i.e. the true quantile of a value
-// returned by a query is guaranteed to be within 1-(1±Epsilon)*(1-Quantile).
-//
-// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error
-// properties.
-func NewHighBiased(epsilon float64) *Stream {
- ƒ := func(s *stream, r float64) float64 {
- return 2 * epsilon * (s.n - r)
- }
- return newStream(ƒ)
-}
-
-// NewTargeted returns an initialized Stream concerned with a particular set of
-// quantile values that are supplied a priori. Knowing these a priori reduces
-// space and computation time. The targets map maps the desired quantiles to
-// their absolute errors, i.e. the true quantile of a value returned by a query
-// is guaranteed to be within (Quantile±Epsilon).
-//
-// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error properties.
-func NewTargeted(targetMap map[float64]float64) *Stream {
- // Convert map to slice to avoid slow iterations on a map.
- // ƒ is called on the hot path, so converting the map to a slice
- // beforehand results in significant CPU savings.
- targets := targetMapToSlice(targetMap)
-
- ƒ := func(s *stream, r float64) float64 {
- var m = math.MaxFloat64
- var f float64
- for _, t := range targets {
- if t.quantile*s.n <= r {
- f = (2 * t.epsilon * r) / t.quantile
- } else {
- f = (2 * t.epsilon * (s.n - r)) / (1 - t.quantile)
- }
- if f < m {
- m = f
- }
- }
- return m
- }
- return newStream(ƒ)
-}
-
-type target struct {
- quantile float64
- epsilon float64
-}
-
-func targetMapToSlice(targetMap map[float64]float64) []target {
- targets := make([]target, 0, len(targetMap))
-
- for quantile, epsilon := range targetMap {
- t := target{
- quantile: quantile,
- epsilon: epsilon,
- }
- targets = append(targets, t)
- }
-
- return targets
-}
-
-// Stream computes quantiles for a stream of float64s. It is not thread-safe by
-// design. Take care when using across multiple goroutines.
-type Stream struct {
- *stream
- b Samples
- sorted bool
-}
-
-func newStream(ƒ invariant) *Stream {
- x := &stream{ƒ: ƒ}
- return &Stream{x, make(Samples, 0, 500), true}
-}
-
-// Insert inserts v into the stream.
-func (s *Stream) Insert(v float64) {
- s.insert(Sample{Value: v, Width: 1})
-}
-
-func (s *Stream) insert(sample Sample) {
- s.b = append(s.b, sample)
- s.sorted = false
- if len(s.b) == cap(s.b) {
- s.flush()
- }
-}
-
-// Query returns the computed qth percentiles value. If s was created with
-// NewTargeted, and q is not in the set of quantiles provided a priori, Query
-// will return an unspecified result.
-func (s *Stream) Query(q float64) float64 {
- if !s.flushed() {
- // Fast path when there hasn't been enough data for a flush;
- // this also yields better accuracy for small sets of data.
- l := len(s.b)
- if l == 0 {
- return 0
- }
- i := int(math.Ceil(float64(l) * q))
- if i > 0 {
- i -= 1
- }
- s.maybeSort()
- return s.b[i].Value
- }
- s.flush()
- return s.stream.query(q)
-}
-
-// Merge merges samples into the underlying streams samples. This is handy when
-// merging multiple streams from separate threads, database shards, etc.
-//
-// ATTENTION: This method is broken and does not yield correct results. The
-// underlying algorithm is not capable of merging streams correctly.
-func (s *Stream) Merge(samples Samples) {
- sort.Sort(samples)
- s.stream.merge(samples)
-}
-
-// Reset reinitializes and clears the list reusing the samples buffer memory.
-func (s *Stream) Reset() {
- s.stream.reset()
- s.b = s.b[:0]
-}
-
-// Samples returns stream samples held by s.
-func (s *Stream) Samples() Samples {
- if !s.flushed() {
- return s.b
- }
- s.flush()
- return s.stream.samples()
-}
-
-// Count returns the total number of samples observed in the stream
-// since initialization.
-func (s *Stream) Count() int {
- return len(s.b) + s.stream.count()
-}
-
-func (s *Stream) flush() {
- s.maybeSort()
- s.stream.merge(s.b)
- s.b = s.b[:0]
-}
-
-func (s *Stream) maybeSort() {
- if !s.sorted {
- s.sorted = true
- sort.Sort(s.b)
- }
-}
-
-func (s *Stream) flushed() bool {
- return len(s.stream.l) > 0
-}
-
-type stream struct {
- n float64
- l []Sample
- ƒ invariant
-}
-
-func (s *stream) reset() {
- s.l = s.l[:0]
- s.n = 0
-}
-
-func (s *stream) insert(v float64) {
- s.merge(Samples{{v, 1, 0}})
-}
-
-func (s *stream) merge(samples Samples) {
- // TODO(beorn7): This tries to merge not only individual samples, but
- // whole summaries. The paper doesn't mention merging summaries at
- // all. Unittests show that the merging is inaccurate. Find out how to
- // do merges properly.
- var r float64
- i := 0
- for _, sample := range samples {
- for ; i < len(s.l); i++ {
- c := s.l[i]
- if c.Value > sample.Value {
- // Insert at position i.
- s.l = append(s.l, Sample{})
- copy(s.l[i+1:], s.l[i:])
- s.l[i] = Sample{
- sample.Value,
- sample.Width,
- math.Max(sample.Delta, math.Floor(s.ƒ(s, r))-1),
- // TODO(beorn7): How to calculate delta correctly?
- }
- i++
- goto inserted
- }
- r += c.Width
- }
- s.l = append(s.l, Sample{sample.Value, sample.Width, 0})
- i++
- inserted:
- s.n += sample.Width
- r += sample.Width
- }
- s.compress()
-}
-
-func (s *stream) count() int {
- return int(s.n)
-}
-
-func (s *stream) query(q float64) float64 {
- t := math.Ceil(q * s.n)
- t += math.Ceil(s.ƒ(s, t) / 2)
- p := s.l[0]
- var r float64
- for _, c := range s.l[1:] {
- r += p.Width
- if r+c.Width+c.Delta > t {
- return p.Value
- }
- p = c
- }
- return p.Value
-}
-
-func (s *stream) compress() {
- if len(s.l) < 2 {
- return
- }
- x := s.l[len(s.l)-1]
- xi := len(s.l) - 1
- r := s.n - 1 - x.Width
-
- for i := len(s.l) - 2; i >= 0; i-- {
- c := s.l[i]
- if c.Width+x.Width+x.Delta <= s.ƒ(s, r) {
- x.Width += c.Width
- s.l[xi] = x
- // Remove element at i.
- copy(s.l[i:], s.l[i+1:])
- s.l = s.l[:len(s.l)-1]
- xi -= 1
- } else {
- x = c
- xi = i
- }
- r -= c.Width
- }
-}
-
-func (s *stream) samples() Samples {
- samples := make(Samples, len(s.l))
- copy(samples, s.l)
- return samples
-}
diff --git a/vendor/github.com/go-ini/ini/.editorconfig b/vendor/github.com/go-ini/ini/.editorconfig
deleted file mode 100644
index 4a2d9180f9..0000000000
--- a/vendor/github.com/go-ini/ini/.editorconfig
+++ /dev/null
@@ -1,12 +0,0 @@
-# http://editorconfig.org
-
-root = true
-
-[*]
-charset = utf-8
-end_of_line = lf
-insert_final_newline = true
-trim_trailing_whitespace = true
-
-[*_test.go]
-trim_trailing_whitespace = false
diff --git a/vendor/github.com/go-ini/ini/.gitignore b/vendor/github.com/go-ini/ini/.gitignore
deleted file mode 100644
index 588388bda2..0000000000
--- a/vendor/github.com/go-ini/ini/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-testdata/conf_out.ini
-ini.sublime-project
-ini.sublime-workspace
-testdata/conf_reflect.ini
-.idea
-/.vscode
-.DS_Store
diff --git a/vendor/github.com/go-ini/ini/.golangci.yml b/vendor/github.com/go-ini/ini/.golangci.yml
deleted file mode 100644
index 631e369254..0000000000
--- a/vendor/github.com/go-ini/ini/.golangci.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-linters-settings:
- staticcheck:
- checks: [
- "all",
- "-SA1019" # There are valid use cases of strings.Title
- ]
- nakedret:
- max-func-lines: 0 # Disallow any unnamed return statement
-
-linters:
- enable:
- - deadcode
- - errcheck
- - gosimple
- - govet
- - ineffassign
- - staticcheck
- - structcheck
- - typecheck
- - unused
- - varcheck
- - nakedret
- - gofmt
- - rowserrcheck
- - unconvert
- - goimports
- - unparam
diff --git a/vendor/github.com/go-ini/ini/LICENSE b/vendor/github.com/go-ini/ini/LICENSE
deleted file mode 100644
index d361bbcdf5..0000000000
--- a/vendor/github.com/go-ini/ini/LICENSE
+++ /dev/null
@@ -1,191 +0,0 @@
-Apache License
-Version 2.0, January 2004
-http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
-"License" shall mean the terms and conditions for use, reproduction, and
-distribution as defined by Sections 1 through 9 of this document.
-
-"Licensor" shall mean the copyright owner or entity authorized by the copyright
-owner that is granting the License.
-
-"Legal Entity" shall mean the union of the acting entity and all other entities
-that control, are controlled by, or are under common control with that entity.
-For the purposes of this definition, "control" means (i) the power, direct or
-indirect, to cause the direction or management of such entity, whether by
-contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
-outstanding shares, or (iii) beneficial ownership of such entity.
-
-"You" (or "Your") shall mean an individual or Legal Entity exercising
-permissions granted by this License.
-
-"Source" form shall mean the preferred form for making modifications, including
-but not limited to software source code, documentation source, and configuration
-files.
-
-"Object" form shall mean any form resulting from mechanical transformation or
-translation of a Source form, including but not limited to compiled object code,
-generated documentation, and conversions to other media types.
-
-"Work" shall mean the work of authorship, whether in Source or Object form, made
-available under the License, as indicated by a copyright notice that is included
-in or attached to the work (an example is provided in the Appendix below).
-
-"Derivative Works" shall mean any work, whether in Source or Object form, that
-is based on (or derived from) the Work and for which the editorial revisions,
-annotations, elaborations, or other modifications represent, as a whole, an
-original work of authorship. For the purposes of this License, Derivative Works
-shall not include works that remain separable from, or merely link (or bind by
-name) to the interfaces of, the Work and Derivative Works thereof.
-
-"Contribution" shall mean any work of authorship, including the original version
-of the Work and any modifications or additions to that Work or Derivative Works
-thereof, that is intentionally submitted to Licensor for inclusion in the Work
-by the copyright owner or by an individual or Legal Entity authorized to submit
-on behalf of the copyright owner. For the purposes of this definition,
-"submitted" means any form of electronic, verbal, or written communication sent
-to the Licensor or its representatives, including but not limited to
-communication on electronic mailing lists, source code control systems, and
-issue tracking systems that are managed by, or on behalf of, the Licensor for
-the purpose of discussing and improving the Work, but excluding communication
-that is conspicuously marked or otherwise designated in writing by the copyright
-owner as "Not a Contribution."
-
-"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
-of whom a Contribution has been received by Licensor and subsequently
-incorporated within the Work.
-
-2. Grant of Copyright License.
-
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable copyright license to reproduce, prepare Derivative Works of,
-publicly display, publicly perform, sublicense, and distribute the Work and such
-Derivative Works in Source or Object form.
-
-3. Grant of Patent License.
-
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable (except as stated in this section) patent license to make, have
-made, use, offer to sell, sell, import, and otherwise transfer the Work, where
-such license applies only to those patent claims licensable by such Contributor
-that are necessarily infringed by their Contribution(s) alone or by combination
-of their Contribution(s) with the Work to which such Contribution(s) was
-submitted. If You institute patent litigation against any entity (including a
-cross-claim or counterclaim in a lawsuit) alleging that the Work or a
-Contribution incorporated within the Work constitutes direct or contributory
-patent infringement, then any patent licenses granted to You under this License
-for that Work shall terminate as of the date such litigation is filed.
-
-4. Redistribution.
-
-You may reproduce and distribute copies of the Work or Derivative Works thereof
-in any medium, with or without modifications, and in Source or Object form,
-provided that You meet the following conditions:
-
-You must give any other recipients of the Work or Derivative Works a copy of
-this License; and
-You must cause any modified files to carry prominent notices stating that You
-changed the files; and
-You must retain, in the Source form of any Derivative Works that You distribute,
-all copyright, patent, trademark, and attribution notices from the Source form
-of the Work, excluding those notices that do not pertain to any part of the
-Derivative Works; and
-If the Work includes a "NOTICE" text file as part of its distribution, then any
-Derivative Works that You distribute must include a readable copy of the
-attribution notices contained within such NOTICE file, excluding those notices
-that do not pertain to any part of the Derivative Works, in at least one of the
-following places: within a NOTICE text file distributed as part of the
-Derivative Works; within the Source form or documentation, if provided along
-with the Derivative Works; or, within a display generated by the Derivative
-Works, if and wherever such third-party notices normally appear. The contents of
-the NOTICE file are for informational purposes only and do not modify the
-License. You may add Your own attribution notices within Derivative Works that
-You distribute, alongside or as an addendum to the NOTICE text from the Work,
-provided that such additional attribution notices cannot be construed as
-modifying the License.
-You may add Your own copyright statement to Your modifications and may provide
-additional or different license terms and conditions for use, reproduction, or
-distribution of Your modifications, or for any such Derivative Works as a whole,
-provided Your use, reproduction, and distribution of the Work otherwise complies
-with the conditions stated in this License.
-
-5. Submission of Contributions.
-
-Unless You explicitly state otherwise, any Contribution intentionally submitted
-for inclusion in the Work by You to the Licensor shall be under the terms and
-conditions of this License, without any additional terms or conditions.
-Notwithstanding the above, nothing herein shall supersede or modify the terms of
-any separate license agreement you may have executed with Licensor regarding
-such Contributions.
-
-6. Trademarks.
-
-This License does not grant permission to use the trade names, trademarks,
-service marks, or product names of the Licensor, except as required for
-reasonable and customary use in describing the origin of the Work and
-reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty.
-
-Unless required by applicable law or agreed to in writing, Licensor provides the
-Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
-including, without limitation, any warranties or conditions of TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
-solely responsible for determining the appropriateness of using or
-redistributing the Work and assume any risks associated with Your exercise of
-permissions under this License.
-
-8. Limitation of Liability.
-
-In no event and under no legal theory, whether in tort (including negligence),
-contract, or otherwise, unless required by applicable law (such as deliberate
-and grossly negligent acts) or agreed to in writing, shall any Contributor be
-liable to You for damages, including any direct, indirect, special, incidental,
-or consequential damages of any character arising as a result of this License or
-out of the use or inability to use the Work (including but not limited to
-damages for loss of goodwill, work stoppage, computer failure or malfunction, or
-any and all other commercial damages or losses), even if such Contributor has
-been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability.
-
-While redistributing the Work or Derivative Works thereof, You may choose to
-offer, and charge a fee for, acceptance of support, warranty, indemnity, or
-other liability obligations and/or rights consistent with this License. However,
-in accepting such obligations, You may act only on Your own behalf and on Your
-sole responsibility, not on behalf of any other Contributor, and only if You
-agree to indemnify, defend, and hold each Contributor harmless for any liability
-incurred by, or claims asserted against, such Contributor by reason of your
-accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work
-
-To apply the Apache License to your work, attach the following boilerplate
-notice, with the fields enclosed by brackets "[]" replaced with your own
-identifying information. (Don't include the brackets!) The text should be
-enclosed in the appropriate comment syntax for the file format. We also
-recommend that a file or class name and description of purpose be included on
-the same "printed page" as the copyright notice for easier identification within
-third-party archives.
-
- Copyright 2014 Unknwon
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/go-ini/ini/Makefile b/vendor/github.com/go-ini/ini/Makefile
deleted file mode 100644
index f3b0dae2d2..0000000000
--- a/vendor/github.com/go-ini/ini/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-.PHONY: build test bench vet coverage
-
-build: vet bench
-
-test:
- go test -v -cover -race
-
-bench:
- go test -v -cover -test.bench=. -test.benchmem
-
-vet:
- go vet
-
-coverage:
- go test -coverprofile=c.out && go tool cover -html=c.out && rm c.out
diff --git a/vendor/github.com/go-ini/ini/README.md b/vendor/github.com/go-ini/ini/README.md
deleted file mode 100644
index 30606d9700..0000000000
--- a/vendor/github.com/go-ini/ini/README.md
+++ /dev/null
@@ -1,43 +0,0 @@
-# INI
-
-[](https://github.com/go-ini/ini/actions?query=branch%3Amain)
-[](https://codecov.io/gh/go-ini/ini)
-[](https://pkg.go.dev/github.com/go-ini/ini?tab=doc)
-[](https://sourcegraph.com/github.com/go-ini/ini)
-
-
-
-Package ini provides INI file read and write functionality in Go.
-
-## Features
-
-- Load from multiple data sources(file, `[]byte`, `io.Reader` and `io.ReadCloser`) with overwrites.
-- Read with recursion values.
-- Read with parent-child sections.
-- Read with auto-increment key names.
-- Read with multiple-line values.
-- Read with tons of helper methods.
-- Read and convert values to Go types.
-- Read and **WRITE** comments of sections and keys.
-- Manipulate sections, keys and comments with ease.
-- Keep sections and keys in order as you parse and save.
-
-## Installation
-
-The minimum requirement of Go is **1.13**.
-
-```sh
-$ go get gopkg.in/ini.v1
-```
-
-Please add `-u` flag to update in the future.
-
-## Getting Help
-
-- [Getting Started](https://ini.unknwon.io/docs/intro/getting_started)
-- [API Documentation](https://gowalker.org/gopkg.in/ini.v1)
-- 中国大陆镜像:https://ini.unknwon.cn
-
-## License
-
-This project is under Apache v2 License. See the [LICENSE](LICENSE) file for the full license text.
diff --git a/vendor/github.com/go-ini/ini/codecov.yml b/vendor/github.com/go-ini/ini/codecov.yml
deleted file mode 100644
index e02ec84bc0..0000000000
--- a/vendor/github.com/go-ini/ini/codecov.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-coverage:
- range: "60...95"
- status:
- project:
- default:
- threshold: 1%
- informational: true
- patch:
- defualt:
- only_pulls: true
- informational: true
-
-comment:
- layout: 'diff'
-
-github_checks: false
diff --git a/vendor/github.com/go-ini/ini/data_source.go b/vendor/github.com/go-ini/ini/data_source.go
deleted file mode 100644
index c3a541f1d1..0000000000
--- a/vendor/github.com/go-ini/ini/data_source.go
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2019 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini
-
-import (
- "bytes"
- "fmt"
- "io"
- "io/ioutil"
- "os"
-)
-
-var (
- _ dataSource = (*sourceFile)(nil)
- _ dataSource = (*sourceData)(nil)
- _ dataSource = (*sourceReadCloser)(nil)
-)
-
-// dataSource is an interface that returns object which can be read and closed.
-type dataSource interface {
- ReadCloser() (io.ReadCloser, error)
-}
-
-// sourceFile represents an object that contains content on the local file system.
-type sourceFile struct {
- name string
-}
-
-func (s sourceFile) ReadCloser() (_ io.ReadCloser, err error) {
- return os.Open(s.name)
-}
-
-// sourceData represents an object that contains content in memory.
-type sourceData struct {
- data []byte
-}
-
-func (s *sourceData) ReadCloser() (io.ReadCloser, error) {
- return ioutil.NopCloser(bytes.NewReader(s.data)), nil
-}
-
-// sourceReadCloser represents an input stream with Close method.
-type sourceReadCloser struct {
- reader io.ReadCloser
-}
-
-func (s *sourceReadCloser) ReadCloser() (io.ReadCloser, error) {
- return s.reader, nil
-}
-
-func parseDataSource(source interface{}) (dataSource, error) {
- switch s := source.(type) {
- case string:
- return sourceFile{s}, nil
- case []byte:
- return &sourceData{s}, nil
- case io.ReadCloser:
- return &sourceReadCloser{s}, nil
- case io.Reader:
- return &sourceReadCloser{ioutil.NopCloser(s)}, nil
- default:
- return nil, fmt.Errorf("error parsing data source: unknown type %q", s)
- }
-}
diff --git a/vendor/github.com/go-ini/ini/deprecated.go b/vendor/github.com/go-ini/ini/deprecated.go
deleted file mode 100644
index 48b8e66d6d..0000000000
--- a/vendor/github.com/go-ini/ini/deprecated.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2019 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini
-
-var (
- // Deprecated: Use "DefaultSection" instead.
- DEFAULT_SECTION = DefaultSection
- // Deprecated: AllCapsUnderscore converts to format ALL_CAPS_UNDERSCORE.
- AllCapsUnderscore = SnackCase
-)
diff --git a/vendor/github.com/go-ini/ini/error.go b/vendor/github.com/go-ini/ini/error.go
deleted file mode 100644
index f66bc94b8b..0000000000
--- a/vendor/github.com/go-ini/ini/error.go
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2016 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini
-
-import (
- "fmt"
-)
-
-// ErrDelimiterNotFound indicates the error type of no delimiter is found which there should be one.
-type ErrDelimiterNotFound struct {
- Line string
-}
-
-// IsErrDelimiterNotFound returns true if the given error is an instance of ErrDelimiterNotFound.
-func IsErrDelimiterNotFound(err error) bool {
- _, ok := err.(ErrDelimiterNotFound)
- return ok
-}
-
-func (err ErrDelimiterNotFound) Error() string {
- return fmt.Sprintf("key-value delimiter not found: %s", err.Line)
-}
-
-// ErrEmptyKeyName indicates the error type of no key name is found which there should be one.
-type ErrEmptyKeyName struct {
- Line string
-}
-
-// IsErrEmptyKeyName returns true if the given error is an instance of ErrEmptyKeyName.
-func IsErrEmptyKeyName(err error) bool {
- _, ok := err.(ErrEmptyKeyName)
- return ok
-}
-
-func (err ErrEmptyKeyName) Error() string {
- return fmt.Sprintf("empty key name: %s", err.Line)
-}
diff --git a/vendor/github.com/go-ini/ini/file.go b/vendor/github.com/go-ini/ini/file.go
deleted file mode 100644
index f8b22408be..0000000000
--- a/vendor/github.com/go-ini/ini/file.go
+++ /dev/null
@@ -1,541 +0,0 @@
-// Copyright 2017 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "os"
- "strings"
- "sync"
-)
-
-// File represents a combination of one or more INI files in memory.
-type File struct {
- options LoadOptions
- dataSources []dataSource
-
- // Should make things safe, but sometimes doesn't matter.
- BlockMode bool
- lock sync.RWMutex
-
- // To keep data in order.
- sectionList []string
- // To keep track of the index of a section with same name.
- // This meta list is only used with non-unique section names are allowed.
- sectionIndexes []int
-
- // Actual data is stored here.
- sections map[string][]*Section
-
- NameMapper
- ValueMapper
-}
-
-// newFile initializes File object with given data sources.
-func newFile(dataSources []dataSource, opts LoadOptions) *File {
- if len(opts.KeyValueDelimiters) == 0 {
- opts.KeyValueDelimiters = "=:"
- }
- if len(opts.KeyValueDelimiterOnWrite) == 0 {
- opts.KeyValueDelimiterOnWrite = "="
- }
- if len(opts.ChildSectionDelimiter) == 0 {
- opts.ChildSectionDelimiter = "."
- }
-
- return &File{
- BlockMode: true,
- dataSources: dataSources,
- sections: make(map[string][]*Section),
- options: opts,
- }
-}
-
-// Empty returns an empty file object.
-func Empty(opts ...LoadOptions) *File {
- var opt LoadOptions
- if len(opts) > 0 {
- opt = opts[0]
- }
-
- // Ignore error here, we are sure our data is good.
- f, _ := LoadSources(opt, []byte(""))
- return f
-}
-
-// NewSection creates a new section.
-func (f *File) NewSection(name string) (*Section, error) {
- if len(name) == 0 {
- return nil, errors.New("empty section name")
- }
-
- if (f.options.Insensitive || f.options.InsensitiveSections) && name != DefaultSection {
- name = strings.ToLower(name)
- }
-
- if f.BlockMode {
- f.lock.Lock()
- defer f.lock.Unlock()
- }
-
- if !f.options.AllowNonUniqueSections && inSlice(name, f.sectionList) {
- return f.sections[name][0], nil
- }
-
- f.sectionList = append(f.sectionList, name)
-
- // NOTE: Append to indexes must happen before appending to sections,
- // otherwise index will have off-by-one problem.
- f.sectionIndexes = append(f.sectionIndexes, len(f.sections[name]))
-
- sec := newSection(f, name)
- f.sections[name] = append(f.sections[name], sec)
-
- return sec, nil
-}
-
-// NewRawSection creates a new section with an unparseable body.
-func (f *File) NewRawSection(name, body string) (*Section, error) {
- section, err := f.NewSection(name)
- if err != nil {
- return nil, err
- }
-
- section.isRawSection = true
- section.rawBody = body
- return section, nil
-}
-
-// NewSections creates a list of sections.
-func (f *File) NewSections(names ...string) (err error) {
- for _, name := range names {
- if _, err = f.NewSection(name); err != nil {
- return err
- }
- }
- return nil
-}
-
-// GetSection returns section by given name.
-func (f *File) GetSection(name string) (*Section, error) {
- secs, err := f.SectionsByName(name)
- if err != nil {
- return nil, err
- }
-
- return secs[0], err
-}
-
-// HasSection returns true if the file contains a section with given name.
-func (f *File) HasSection(name string) bool {
- section, _ := f.GetSection(name)
- return section != nil
-}
-
-// SectionsByName returns all sections with given name.
-func (f *File) SectionsByName(name string) ([]*Section, error) {
- if len(name) == 0 {
- name = DefaultSection
- }
- if f.options.Insensitive || f.options.InsensitiveSections {
- name = strings.ToLower(name)
- }
-
- if f.BlockMode {
- f.lock.RLock()
- defer f.lock.RUnlock()
- }
-
- secs := f.sections[name]
- if len(secs) == 0 {
- return nil, fmt.Errorf("section %q does not exist", name)
- }
-
- return secs, nil
-}
-
-// Section assumes named section exists and returns a zero-value when not.
-func (f *File) Section(name string) *Section {
- sec, err := f.GetSection(name)
- if err != nil {
- if name == "" {
- name = DefaultSection
- }
- sec, _ = f.NewSection(name)
- return sec
- }
- return sec
-}
-
-// SectionWithIndex assumes named section exists and returns a new section when not.
-func (f *File) SectionWithIndex(name string, index int) *Section {
- secs, err := f.SectionsByName(name)
- if err != nil || len(secs) <= index {
- // NOTE: It's OK here because the only possible error is empty section name,
- // but if it's empty, this piece of code won't be executed.
- newSec, _ := f.NewSection(name)
- return newSec
- }
-
- return secs[index]
-}
-
-// Sections returns a list of Section stored in the current instance.
-func (f *File) Sections() []*Section {
- if f.BlockMode {
- f.lock.RLock()
- defer f.lock.RUnlock()
- }
-
- sections := make([]*Section, len(f.sectionList))
- for i, name := range f.sectionList {
- sections[i] = f.sections[name][f.sectionIndexes[i]]
- }
- return sections
-}
-
-// ChildSections returns a list of child sections of given section name.
-func (f *File) ChildSections(name string) []*Section {
- return f.Section(name).ChildSections()
-}
-
-// SectionStrings returns list of section names.
-func (f *File) SectionStrings() []string {
- list := make([]string, len(f.sectionList))
- copy(list, f.sectionList)
- return list
-}
-
-// DeleteSection deletes a section or all sections with given name.
-func (f *File) DeleteSection(name string) {
- secs, err := f.SectionsByName(name)
- if err != nil {
- return
- }
-
- for i := 0; i < len(secs); i++ {
- // For non-unique sections, it is always needed to remove the first one so
- // in the next iteration, the subsequent section continue having index 0.
- // Ignoring the error as index 0 never returns an error.
- _ = f.DeleteSectionWithIndex(name, 0)
- }
-}
-
-// DeleteSectionWithIndex deletes a section with given name and index.
-func (f *File) DeleteSectionWithIndex(name string, index int) error {
- if !f.options.AllowNonUniqueSections && index != 0 {
- return fmt.Errorf("delete section with non-zero index is only allowed when non-unique sections is enabled")
- }
-
- if len(name) == 0 {
- name = DefaultSection
- }
- if f.options.Insensitive || f.options.InsensitiveSections {
- name = strings.ToLower(name)
- }
-
- if f.BlockMode {
- f.lock.Lock()
- defer f.lock.Unlock()
- }
-
- // Count occurrences of the sections
- occurrences := 0
-
- sectionListCopy := make([]string, len(f.sectionList))
- copy(sectionListCopy, f.sectionList)
-
- for i, s := range sectionListCopy {
- if s != name {
- continue
- }
-
- if occurrences == index {
- if len(f.sections[name]) <= 1 {
- delete(f.sections, name) // The last one in the map
- } else {
- f.sections[name] = append(f.sections[name][:index], f.sections[name][index+1:]...)
- }
-
- // Fix section lists
- f.sectionList = append(f.sectionList[:i], f.sectionList[i+1:]...)
- f.sectionIndexes = append(f.sectionIndexes[:i], f.sectionIndexes[i+1:]...)
-
- } else if occurrences > index {
- // Fix the indices of all following sections with this name.
- f.sectionIndexes[i-1]--
- }
-
- occurrences++
- }
-
- return nil
-}
-
-func (f *File) reload(s dataSource) error {
- r, err := s.ReadCloser()
- if err != nil {
- return err
- }
- defer r.Close()
-
- return f.parse(r)
-}
-
-// Reload reloads and parses all data sources.
-func (f *File) Reload() (err error) {
- for _, s := range f.dataSources {
- if err = f.reload(s); err != nil {
- // In loose mode, we create an empty default section for nonexistent files.
- if os.IsNotExist(err) && f.options.Loose {
- _ = f.parse(bytes.NewBuffer(nil))
- continue
- }
- return err
- }
- if f.options.ShortCircuit {
- return nil
- }
- }
- return nil
-}
-
-// Append appends one or more data sources and reloads automatically.
-func (f *File) Append(source interface{}, others ...interface{}) error {
- ds, err := parseDataSource(source)
- if err != nil {
- return err
- }
- f.dataSources = append(f.dataSources, ds)
- for _, s := range others {
- ds, err = parseDataSource(s)
- if err != nil {
- return err
- }
- f.dataSources = append(f.dataSources, ds)
- }
- return f.Reload()
-}
-
-func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
- equalSign := DefaultFormatLeft + f.options.KeyValueDelimiterOnWrite + DefaultFormatRight
-
- if PrettyFormat || PrettyEqual {
- equalSign = fmt.Sprintf(" %s ", f.options.KeyValueDelimiterOnWrite)
- }
-
- // Use buffer to make sure target is safe until finish encoding.
- buf := bytes.NewBuffer(nil)
- lastSectionIdx := len(f.sectionList) - 1
- for i, sname := range f.sectionList {
- sec := f.SectionWithIndex(sname, f.sectionIndexes[i])
- if len(sec.Comment) > 0 {
- // Support multiline comments
- lines := strings.Split(sec.Comment, LineBreak)
- for i := range lines {
- if lines[i][0] != '#' && lines[i][0] != ';' {
- lines[i] = "; " + lines[i]
- } else {
- lines[i] = lines[i][:1] + " " + strings.TrimSpace(lines[i][1:])
- }
-
- if _, err := buf.WriteString(lines[i] + LineBreak); err != nil {
- return nil, err
- }
- }
- }
-
- if i > 0 || DefaultHeader || (i == 0 && strings.ToUpper(sec.name) != DefaultSection) {
- if _, err := buf.WriteString("[" + sname + "]" + LineBreak); err != nil {
- return nil, err
- }
- } else {
- // Write nothing if default section is empty
- if len(sec.keyList) == 0 {
- continue
- }
- }
-
- isLastSection := i == lastSectionIdx
- if sec.isRawSection {
- if _, err := buf.WriteString(sec.rawBody); err != nil {
- return nil, err
- }
-
- if PrettySection && !isLastSection {
- // Put a line between sections
- if _, err := buf.WriteString(LineBreak); err != nil {
- return nil, err
- }
- }
- continue
- }
-
- // Count and generate alignment length and buffer spaces using the
- // longest key. Keys may be modified if they contain certain characters so
- // we need to take that into account in our calculation.
- alignLength := 0
- if PrettyFormat {
- for _, kname := range sec.keyList {
- keyLength := len(kname)
- // First case will surround key by ` and second by """
- if strings.Contains(kname, "\"") || strings.ContainsAny(kname, f.options.KeyValueDelimiters) {
- keyLength += 2
- } else if strings.Contains(kname, "`") {
- keyLength += 6
- }
-
- if keyLength > alignLength {
- alignLength = keyLength
- }
- }
- }
- alignSpaces := bytes.Repeat([]byte(" "), alignLength)
-
- KeyList:
- for _, kname := range sec.keyList {
- key := sec.Key(kname)
- if len(key.Comment) > 0 {
- if len(indent) > 0 && sname != DefaultSection {
- buf.WriteString(indent)
- }
-
- // Support multiline comments
- lines := strings.Split(key.Comment, LineBreak)
- for i := range lines {
- if lines[i][0] != '#' && lines[i][0] != ';' {
- lines[i] = "; " + strings.TrimSpace(lines[i])
- } else {
- lines[i] = lines[i][:1] + " " + strings.TrimSpace(lines[i][1:])
- }
-
- if _, err := buf.WriteString(lines[i] + LineBreak); err != nil {
- return nil, err
- }
- }
- }
-
- if len(indent) > 0 && sname != DefaultSection {
- buf.WriteString(indent)
- }
-
- switch {
- case key.isAutoIncrement:
- kname = "-"
- case strings.Contains(kname, "\"") || strings.ContainsAny(kname, f.options.KeyValueDelimiters):
- kname = "`" + kname + "`"
- case strings.Contains(kname, "`"):
- kname = `"""` + kname + `"""`
- }
-
- writeKeyValue := func(val string) (bool, error) {
- if _, err := buf.WriteString(kname); err != nil {
- return false, err
- }
-
- if key.isBooleanType {
- buf.WriteString(LineBreak)
- return true, nil
- }
-
- // Write out alignment spaces before "=" sign
- if PrettyFormat {
- buf.Write(alignSpaces[:alignLength-len(kname)])
- }
-
- // In case key value contains "\n", "`", "\"", "#" or ";"
- if strings.ContainsAny(val, "\n`") {
- val = `"""` + val + `"""`
- } else if !f.options.IgnoreInlineComment && strings.ContainsAny(val, "#;") {
- val = "`" + val + "`"
- } else if len(strings.TrimSpace(val)) != len(val) {
- val = `"` + val + `"`
- }
- if _, err := buf.WriteString(equalSign + val + LineBreak); err != nil {
- return false, err
- }
- return false, nil
- }
-
- shadows := key.ValueWithShadows()
- if len(shadows) == 0 {
- if _, err := writeKeyValue(""); err != nil {
- return nil, err
- }
- }
-
- for _, val := range shadows {
- exitLoop, err := writeKeyValue(val)
- if err != nil {
- return nil, err
- } else if exitLoop {
- continue KeyList
- }
- }
-
- for _, val := range key.nestedValues {
- if _, err := buf.WriteString(indent + " " + val + LineBreak); err != nil {
- return nil, err
- }
- }
- }
-
- if PrettySection && !isLastSection {
- // Put a line between sections
- if _, err := buf.WriteString(LineBreak); err != nil {
- return nil, err
- }
- }
- }
-
- return buf, nil
-}
-
-// WriteToIndent writes content into io.Writer with given indention.
-// If PrettyFormat has been set to be true,
-// it will align "=" sign with spaces under each section.
-func (f *File) WriteToIndent(w io.Writer, indent string) (int64, error) {
- buf, err := f.writeToBuffer(indent)
- if err != nil {
- return 0, err
- }
- return buf.WriteTo(w)
-}
-
-// WriteTo writes file content into io.Writer.
-func (f *File) WriteTo(w io.Writer) (int64, error) {
- return f.WriteToIndent(w, "")
-}
-
-// SaveToIndent writes content to file system with given value indention.
-func (f *File) SaveToIndent(filename, indent string) error {
- // Note: Because we are truncating with os.Create,
- // so it's safer to save to a temporary file location and rename after done.
- buf, err := f.writeToBuffer(indent)
- if err != nil {
- return err
- }
-
- return ioutil.WriteFile(filename, buf.Bytes(), 0666)
-}
-
-// SaveTo writes content to file system.
-func (f *File) SaveTo(filename string) error {
- return f.SaveToIndent(filename, "")
-}
diff --git a/vendor/github.com/go-ini/ini/helper.go b/vendor/github.com/go-ini/ini/helper.go
deleted file mode 100644
index f9d80a682a..0000000000
--- a/vendor/github.com/go-ini/ini/helper.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2019 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini
-
-func inSlice(str string, s []string) bool {
- for _, v := range s {
- if str == v {
- return true
- }
- }
- return false
-}
diff --git a/vendor/github.com/go-ini/ini/ini.go b/vendor/github.com/go-ini/ini/ini.go
deleted file mode 100644
index 99e7f86511..0000000000
--- a/vendor/github.com/go-ini/ini/ini.go
+++ /dev/null
@@ -1,176 +0,0 @@
-// Copyright 2014 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-// Package ini provides INI file read and write functionality in Go.
-package ini
-
-import (
- "os"
- "regexp"
- "runtime"
- "strings"
-)
-
-const (
- // Maximum allowed depth when recursively substituing variable names.
- depthValues = 99
-)
-
-var (
- // DefaultSection is the name of default section. You can use this var or the string literal.
- // In most of cases, an empty string is all you need to access the section.
- DefaultSection = "DEFAULT"
-
- // LineBreak is the delimiter to determine or compose a new line.
- // This variable will be changed to "\r\n" automatically on Windows at package init time.
- LineBreak = "\n"
-
- // Variable regexp pattern: %(variable)s
- varPattern = regexp.MustCompile(`%\(([^)]+)\)s`)
-
- // DefaultHeader explicitly writes default section header.
- DefaultHeader = false
-
- // PrettySection indicates whether to put a line between sections.
- PrettySection = true
- // PrettyFormat indicates whether to align "=" sign with spaces to produce pretty output
- // or reduce all possible spaces for compact format.
- PrettyFormat = true
- // PrettyEqual places spaces around "=" sign even when PrettyFormat is false.
- PrettyEqual = false
- // DefaultFormatLeft places custom spaces on the left when PrettyFormat and PrettyEqual are both disabled.
- DefaultFormatLeft = ""
- // DefaultFormatRight places custom spaces on the right when PrettyFormat and PrettyEqual are both disabled.
- DefaultFormatRight = ""
-)
-
-var inTest = len(os.Args) > 0 && strings.HasSuffix(strings.TrimSuffix(os.Args[0], ".exe"), ".test")
-
-func init() {
- if runtime.GOOS == "windows" && !inTest {
- LineBreak = "\r\n"
- }
-}
-
-// LoadOptions contains all customized options used for load data source(s).
-type LoadOptions struct {
- // Loose indicates whether the parser should ignore nonexistent files or return error.
- Loose bool
- // Insensitive indicates whether the parser forces all section and key names to lowercase.
- Insensitive bool
- // InsensitiveSections indicates whether the parser forces all section to lowercase.
- InsensitiveSections bool
- // InsensitiveKeys indicates whether the parser forces all key names to lowercase.
- InsensitiveKeys bool
- // IgnoreContinuation indicates whether to ignore continuation lines while parsing.
- IgnoreContinuation bool
- // IgnoreInlineComment indicates whether to ignore comments at the end of value and treat it as part of value.
- IgnoreInlineComment bool
- // SkipUnrecognizableLines indicates whether to skip unrecognizable lines that do not conform to key/value pairs.
- SkipUnrecognizableLines bool
- // ShortCircuit indicates whether to ignore other configuration sources after loaded the first available configuration source.
- ShortCircuit bool
- // AllowBooleanKeys indicates whether to allow boolean type keys or treat as value is missing.
- // This type of keys are mostly used in my.cnf.
- AllowBooleanKeys bool
- // AllowShadows indicates whether to keep track of keys with same name under same section.
- AllowShadows bool
- // AllowNestedValues indicates whether to allow AWS-like nested values.
- // Docs: http://docs.aws.amazon.com/cli/latest/topic/config-vars.html#nested-values
- AllowNestedValues bool
- // AllowPythonMultilineValues indicates whether to allow Python-like multi-line values.
- // Docs: https://docs.python.org/3/library/configparser.html#supported-ini-file-structure
- // Relevant quote: Values can also span multiple lines, as long as they are indented deeper
- // than the first line of the value.
- AllowPythonMultilineValues bool
- // SpaceBeforeInlineComment indicates whether to allow comment symbols (\# and \;) inside value.
- // Docs: https://docs.python.org/2/library/configparser.html
- // Quote: Comments may appear on their own in an otherwise empty line, or may be entered in lines holding values or section names.
- // In the latter case, they need to be preceded by a whitespace character to be recognized as a comment.
- SpaceBeforeInlineComment bool
- // UnescapeValueDoubleQuotes indicates whether to unescape double quotes inside value to regular format
- // when value is surrounded by double quotes, e.g. key="a \"value\"" => key=a "value"
- UnescapeValueDoubleQuotes bool
- // UnescapeValueCommentSymbols indicates to unescape comment symbols (\# and \;) inside value to regular format
- // when value is NOT surrounded by any quotes.
- // Note: UNSTABLE, behavior might change to only unescape inside double quotes but may noy necessary at all.
- UnescapeValueCommentSymbols bool
- // UnparseableSections stores a list of blocks that are allowed with raw content which do not otherwise
- // conform to key/value pairs. Specify the names of those blocks here.
- UnparseableSections []string
- // KeyValueDelimiters is the sequence of delimiters that are used to separate key and value. By default, it is "=:".
- KeyValueDelimiters string
- // KeyValueDelimiterOnWrite is the delimiter that are used to separate key and value output. By default, it is "=".
- KeyValueDelimiterOnWrite string
- // ChildSectionDelimiter is the delimiter that is used to separate child sections. By default, it is ".".
- ChildSectionDelimiter string
- // PreserveSurroundedQuote indicates whether to preserve surrounded quote (single and double quotes).
- PreserveSurroundedQuote bool
- // DebugFunc is called to collect debug information (currently only useful to debug parsing Python-style multiline values).
- DebugFunc DebugFunc
- // ReaderBufferSize is the buffer size of the reader in bytes.
- ReaderBufferSize int
- // AllowNonUniqueSections indicates whether to allow sections with the same name multiple times.
- AllowNonUniqueSections bool
- // AllowDuplicateShadowValues indicates whether values for shadowed keys should be deduplicated.
- AllowDuplicateShadowValues bool
-}
-
-// DebugFunc is the type of function called to log parse events.
-type DebugFunc func(message string)
-
-// LoadSources allows caller to apply customized options for loading from data source(s).
-func LoadSources(opts LoadOptions, source interface{}, others ...interface{}) (_ *File, err error) {
- sources := make([]dataSource, len(others)+1)
- sources[0], err = parseDataSource(source)
- if err != nil {
- return nil, err
- }
- for i := range others {
- sources[i+1], err = parseDataSource(others[i])
- if err != nil {
- return nil, err
- }
- }
- f := newFile(sources, opts)
- if err = f.Reload(); err != nil {
- return nil, err
- }
- return f, nil
-}
-
-// Load loads and parses from INI data sources.
-// Arguments can be mixed of file name with string type, or raw data in []byte.
-// It will return error if list contains nonexistent files.
-func Load(source interface{}, others ...interface{}) (*File, error) {
- return LoadSources(LoadOptions{}, source, others...)
-}
-
-// LooseLoad has exactly same functionality as Load function
-// except it ignores nonexistent files instead of returning error.
-func LooseLoad(source interface{}, others ...interface{}) (*File, error) {
- return LoadSources(LoadOptions{Loose: true}, source, others...)
-}
-
-// InsensitiveLoad has exactly same functionality as Load function
-// except it forces all section and key names to be lowercased.
-func InsensitiveLoad(source interface{}, others ...interface{}) (*File, error) {
- return LoadSources(LoadOptions{Insensitive: true}, source, others...)
-}
-
-// ShadowLoad has exactly same functionality as Load function
-// except it allows have shadow keys.
-func ShadowLoad(source interface{}, others ...interface{}) (*File, error) {
- return LoadSources(LoadOptions{AllowShadows: true}, source, others...)
-}
diff --git a/vendor/github.com/go-ini/ini/key.go b/vendor/github.com/go-ini/ini/key.go
deleted file mode 100644
index a19d9f38ef..0000000000
--- a/vendor/github.com/go-ini/ini/key.go
+++ /dev/null
@@ -1,837 +0,0 @@
-// Copyright 2014 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini
-
-import (
- "bytes"
- "errors"
- "fmt"
- "strconv"
- "strings"
- "time"
-)
-
-// Key represents a key under a section.
-type Key struct {
- s *Section
- Comment string
- name string
- value string
- isAutoIncrement bool
- isBooleanType bool
-
- isShadow bool
- shadows []*Key
-
- nestedValues []string
-}
-
-// newKey simply return a key object with given values.
-func newKey(s *Section, name, val string) *Key {
- return &Key{
- s: s,
- name: name,
- value: val,
- }
-}
-
-func (k *Key) addShadow(val string) error {
- if k.isShadow {
- return errors.New("cannot add shadow to another shadow key")
- } else if k.isAutoIncrement || k.isBooleanType {
- return errors.New("cannot add shadow to auto-increment or boolean key")
- }
-
- if !k.s.f.options.AllowDuplicateShadowValues {
- // Deduplicate shadows based on their values.
- if k.value == val {
- return nil
- }
- for i := range k.shadows {
- if k.shadows[i].value == val {
- return nil
- }
- }
- }
-
- shadow := newKey(k.s, k.name, val)
- shadow.isShadow = true
- k.shadows = append(k.shadows, shadow)
- return nil
-}
-
-// AddShadow adds a new shadow key to itself.
-func (k *Key) AddShadow(val string) error {
- if !k.s.f.options.AllowShadows {
- return errors.New("shadow key is not allowed")
- }
- return k.addShadow(val)
-}
-
-func (k *Key) addNestedValue(val string) error {
- if k.isAutoIncrement || k.isBooleanType {
- return errors.New("cannot add nested value to auto-increment or boolean key")
- }
-
- k.nestedValues = append(k.nestedValues, val)
- return nil
-}
-
-// AddNestedValue adds a nested value to the key.
-func (k *Key) AddNestedValue(val string) error {
- if !k.s.f.options.AllowNestedValues {
- return errors.New("nested value is not allowed")
- }
- return k.addNestedValue(val)
-}
-
-// ValueMapper represents a mapping function for values, e.g. os.ExpandEnv
-type ValueMapper func(string) string
-
-// Name returns name of key.
-func (k *Key) Name() string {
- return k.name
-}
-
-// Value returns raw value of key for performance purpose.
-func (k *Key) Value() string {
- return k.value
-}
-
-// ValueWithShadows returns raw values of key and its shadows if any. Shadow
-// keys with empty values are ignored from the returned list.
-func (k *Key) ValueWithShadows() []string {
- if len(k.shadows) == 0 {
- if k.value == "" {
- return []string{}
- }
- return []string{k.value}
- }
-
- vals := make([]string, 0, len(k.shadows)+1)
- if k.value != "" {
- vals = append(vals, k.value)
- }
- for _, s := range k.shadows {
- if s.value != "" {
- vals = append(vals, s.value)
- }
- }
- return vals
-}
-
-// NestedValues returns nested values stored in the key.
-// It is possible returned value is nil if no nested values stored in the key.
-func (k *Key) NestedValues() []string {
- return k.nestedValues
-}
-
-// transformValue takes a raw value and transforms to its final string.
-func (k *Key) transformValue(val string) string {
- if k.s.f.ValueMapper != nil {
- val = k.s.f.ValueMapper(val)
- }
-
- // Fail-fast if no indicate char found for recursive value
- if !strings.Contains(val, "%") {
- return val
- }
- for i := 0; i < depthValues; i++ {
- vr := varPattern.FindString(val)
- if len(vr) == 0 {
- break
- }
-
- // Take off leading '%(' and trailing ')s'.
- noption := vr[2 : len(vr)-2]
-
- // Search in the same section.
- // If not found or found the key itself, then search again in default section.
- nk, err := k.s.GetKey(noption)
- if err != nil || k == nk {
- nk, _ = k.s.f.Section("").GetKey(noption)
- if nk == nil {
- // Stop when no results found in the default section,
- // and returns the value as-is.
- break
- }
- }
-
- // Substitute by new value and take off leading '%(' and trailing ')s'.
- val = strings.Replace(val, vr, nk.value, -1)
- }
- return val
-}
-
-// String returns string representation of value.
-func (k *Key) String() string {
- return k.transformValue(k.value)
-}
-
-// Validate accepts a validate function which can
-// return modifed result as key value.
-func (k *Key) Validate(fn func(string) string) string {
- return fn(k.String())
-}
-
-// parseBool returns the boolean value represented by the string.
-//
-// It accepts 1, t, T, TRUE, true, True, YES, yes, Yes, y, ON, on, On,
-// 0, f, F, FALSE, false, False, NO, no, No, n, OFF, off, Off.
-// Any other value returns an error.
-func parseBool(str string) (value bool, err error) {
- switch str {
- case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "y", "ON", "on", "On":
- return true, nil
- case "0", "f", "F", "false", "FALSE", "False", "NO", "no", "No", "n", "OFF", "off", "Off":
- return false, nil
- }
- return false, fmt.Errorf("parsing \"%s\": invalid syntax", str)
-}
-
-// Bool returns bool type value.
-func (k *Key) Bool() (bool, error) {
- return parseBool(k.String())
-}
-
-// Float64 returns float64 type value.
-func (k *Key) Float64() (float64, error) {
- return strconv.ParseFloat(k.String(), 64)
-}
-
-// Int returns int type value.
-func (k *Key) Int() (int, error) {
- v, err := strconv.ParseInt(k.String(), 0, 64)
- return int(v), err
-}
-
-// Int64 returns int64 type value.
-func (k *Key) Int64() (int64, error) {
- return strconv.ParseInt(k.String(), 0, 64)
-}
-
-// Uint returns uint type valued.
-func (k *Key) Uint() (uint, error) {
- u, e := strconv.ParseUint(k.String(), 0, 64)
- return uint(u), e
-}
-
-// Uint64 returns uint64 type value.
-func (k *Key) Uint64() (uint64, error) {
- return strconv.ParseUint(k.String(), 0, 64)
-}
-
-// Duration returns time.Duration type value.
-func (k *Key) Duration() (time.Duration, error) {
- return time.ParseDuration(k.String())
-}
-
-// TimeFormat parses with given format and returns time.Time type value.
-func (k *Key) TimeFormat(format string) (time.Time, error) {
- return time.Parse(format, k.String())
-}
-
-// Time parses with RFC3339 format and returns time.Time type value.
-func (k *Key) Time() (time.Time, error) {
- return k.TimeFormat(time.RFC3339)
-}
-
-// MustString returns default value if key value is empty.
-func (k *Key) MustString(defaultVal string) string {
- val := k.String()
- if len(val) == 0 {
- k.value = defaultVal
- return defaultVal
- }
- return val
-}
-
-// MustBool always returns value without error,
-// it returns false if error occurs.
-func (k *Key) MustBool(defaultVal ...bool) bool {
- val, err := k.Bool()
- if len(defaultVal) > 0 && err != nil {
- k.value = strconv.FormatBool(defaultVal[0])
- return defaultVal[0]
- }
- return val
-}
-
-// MustFloat64 always returns value without error,
-// it returns 0.0 if error occurs.
-func (k *Key) MustFloat64(defaultVal ...float64) float64 {
- val, err := k.Float64()
- if len(defaultVal) > 0 && err != nil {
- k.value = strconv.FormatFloat(defaultVal[0], 'f', -1, 64)
- return defaultVal[0]
- }
- return val
-}
-
-// MustInt always returns value without error,
-// it returns 0 if error occurs.
-func (k *Key) MustInt(defaultVal ...int) int {
- val, err := k.Int()
- if len(defaultVal) > 0 && err != nil {
- k.value = strconv.FormatInt(int64(defaultVal[0]), 10)
- return defaultVal[0]
- }
- return val
-}
-
-// MustInt64 always returns value without error,
-// it returns 0 if error occurs.
-func (k *Key) MustInt64(defaultVal ...int64) int64 {
- val, err := k.Int64()
- if len(defaultVal) > 0 && err != nil {
- k.value = strconv.FormatInt(defaultVal[0], 10)
- return defaultVal[0]
- }
- return val
-}
-
-// MustUint always returns value without error,
-// it returns 0 if error occurs.
-func (k *Key) MustUint(defaultVal ...uint) uint {
- val, err := k.Uint()
- if len(defaultVal) > 0 && err != nil {
- k.value = strconv.FormatUint(uint64(defaultVal[0]), 10)
- return defaultVal[0]
- }
- return val
-}
-
-// MustUint64 always returns value without error,
-// it returns 0 if error occurs.
-func (k *Key) MustUint64(defaultVal ...uint64) uint64 {
- val, err := k.Uint64()
- if len(defaultVal) > 0 && err != nil {
- k.value = strconv.FormatUint(defaultVal[0], 10)
- return defaultVal[0]
- }
- return val
-}
-
-// MustDuration always returns value without error,
-// it returns zero value if error occurs.
-func (k *Key) MustDuration(defaultVal ...time.Duration) time.Duration {
- val, err := k.Duration()
- if len(defaultVal) > 0 && err != nil {
- k.value = defaultVal[0].String()
- return defaultVal[0]
- }
- return val
-}
-
-// MustTimeFormat always parses with given format and returns value without error,
-// it returns zero value if error occurs.
-func (k *Key) MustTimeFormat(format string, defaultVal ...time.Time) time.Time {
- val, err := k.TimeFormat(format)
- if len(defaultVal) > 0 && err != nil {
- k.value = defaultVal[0].Format(format)
- return defaultVal[0]
- }
- return val
-}
-
-// MustTime always parses with RFC3339 format and returns value without error,
-// it returns zero value if error occurs.
-func (k *Key) MustTime(defaultVal ...time.Time) time.Time {
- return k.MustTimeFormat(time.RFC3339, defaultVal...)
-}
-
-// In always returns value without error,
-// it returns default value if error occurs or doesn't fit into candidates.
-func (k *Key) In(defaultVal string, candidates []string) string {
- val := k.String()
- for _, cand := range candidates {
- if val == cand {
- return val
- }
- }
- return defaultVal
-}
-
-// InFloat64 always returns value without error,
-// it returns default value if error occurs or doesn't fit into candidates.
-func (k *Key) InFloat64(defaultVal float64, candidates []float64) float64 {
- val := k.MustFloat64()
- for _, cand := range candidates {
- if val == cand {
- return val
- }
- }
- return defaultVal
-}
-
-// InInt always returns value without error,
-// it returns default value if error occurs or doesn't fit into candidates.
-func (k *Key) InInt(defaultVal int, candidates []int) int {
- val := k.MustInt()
- for _, cand := range candidates {
- if val == cand {
- return val
- }
- }
- return defaultVal
-}
-
-// InInt64 always returns value without error,
-// it returns default value if error occurs or doesn't fit into candidates.
-func (k *Key) InInt64(defaultVal int64, candidates []int64) int64 {
- val := k.MustInt64()
- for _, cand := range candidates {
- if val == cand {
- return val
- }
- }
- return defaultVal
-}
-
-// InUint always returns value without error,
-// it returns default value if error occurs or doesn't fit into candidates.
-func (k *Key) InUint(defaultVal uint, candidates []uint) uint {
- val := k.MustUint()
- for _, cand := range candidates {
- if val == cand {
- return val
- }
- }
- return defaultVal
-}
-
-// InUint64 always returns value without error,
-// it returns default value if error occurs or doesn't fit into candidates.
-func (k *Key) InUint64(defaultVal uint64, candidates []uint64) uint64 {
- val := k.MustUint64()
- for _, cand := range candidates {
- if val == cand {
- return val
- }
- }
- return defaultVal
-}
-
-// InTimeFormat always parses with given format and returns value without error,
-// it returns default value if error occurs or doesn't fit into candidates.
-func (k *Key) InTimeFormat(format string, defaultVal time.Time, candidates []time.Time) time.Time {
- val := k.MustTimeFormat(format)
- for _, cand := range candidates {
- if val == cand {
- return val
- }
- }
- return defaultVal
-}
-
-// InTime always parses with RFC3339 format and returns value without error,
-// it returns default value if error occurs or doesn't fit into candidates.
-func (k *Key) InTime(defaultVal time.Time, candidates []time.Time) time.Time {
- return k.InTimeFormat(time.RFC3339, defaultVal, candidates)
-}
-
-// RangeFloat64 checks if value is in given range inclusively,
-// and returns default value if it's not.
-func (k *Key) RangeFloat64(defaultVal, min, max float64) float64 {
- val := k.MustFloat64()
- if val < min || val > max {
- return defaultVal
- }
- return val
-}
-
-// RangeInt checks if value is in given range inclusively,
-// and returns default value if it's not.
-func (k *Key) RangeInt(defaultVal, min, max int) int {
- val := k.MustInt()
- if val < min || val > max {
- return defaultVal
- }
- return val
-}
-
-// RangeInt64 checks if value is in given range inclusively,
-// and returns default value if it's not.
-func (k *Key) RangeInt64(defaultVal, min, max int64) int64 {
- val := k.MustInt64()
- if val < min || val > max {
- return defaultVal
- }
- return val
-}
-
-// RangeTimeFormat checks if value with given format is in given range inclusively,
-// and returns default value if it's not.
-func (k *Key) RangeTimeFormat(format string, defaultVal, min, max time.Time) time.Time {
- val := k.MustTimeFormat(format)
- if val.Unix() < min.Unix() || val.Unix() > max.Unix() {
- return defaultVal
- }
- return val
-}
-
-// RangeTime checks if value with RFC3339 format is in given range inclusively,
-// and returns default value if it's not.
-func (k *Key) RangeTime(defaultVal, min, max time.Time) time.Time {
- return k.RangeTimeFormat(time.RFC3339, defaultVal, min, max)
-}
-
-// Strings returns list of string divided by given delimiter.
-func (k *Key) Strings(delim string) []string {
- str := k.String()
- if len(str) == 0 {
- return []string{}
- }
-
- runes := []rune(str)
- vals := make([]string, 0, 2)
- var buf bytes.Buffer
- escape := false
- idx := 0
- for {
- if escape {
- escape = false
- if runes[idx] != '\\' && !strings.HasPrefix(string(runes[idx:]), delim) {
- buf.WriteRune('\\')
- }
- buf.WriteRune(runes[idx])
- } else {
- if runes[idx] == '\\' {
- escape = true
- } else if strings.HasPrefix(string(runes[idx:]), delim) {
- idx += len(delim) - 1
- vals = append(vals, strings.TrimSpace(buf.String()))
- buf.Reset()
- } else {
- buf.WriteRune(runes[idx])
- }
- }
- idx++
- if idx == len(runes) {
- break
- }
- }
-
- if buf.Len() > 0 {
- vals = append(vals, strings.TrimSpace(buf.String()))
- }
-
- return vals
-}
-
-// StringsWithShadows returns list of string divided by given delimiter.
-// Shadows will also be appended if any.
-func (k *Key) StringsWithShadows(delim string) []string {
- vals := k.ValueWithShadows()
- results := make([]string, 0, len(vals)*2)
- for i := range vals {
- if len(vals) == 0 {
- continue
- }
-
- results = append(results, strings.Split(vals[i], delim)...)
- }
-
- for i := range results {
- results[i] = k.transformValue(strings.TrimSpace(results[i]))
- }
- return results
-}
-
-// Float64s returns list of float64 divided by given delimiter. Any invalid input will be treated as zero value.
-func (k *Key) Float64s(delim string) []float64 {
- vals, _ := k.parseFloat64s(k.Strings(delim), true, false)
- return vals
-}
-
-// Ints returns list of int divided by given delimiter. Any invalid input will be treated as zero value.
-func (k *Key) Ints(delim string) []int {
- vals, _ := k.parseInts(k.Strings(delim), true, false)
- return vals
-}
-
-// Int64s returns list of int64 divided by given delimiter. Any invalid input will be treated as zero value.
-func (k *Key) Int64s(delim string) []int64 {
- vals, _ := k.parseInt64s(k.Strings(delim), true, false)
- return vals
-}
-
-// Uints returns list of uint divided by given delimiter. Any invalid input will be treated as zero value.
-func (k *Key) Uints(delim string) []uint {
- vals, _ := k.parseUints(k.Strings(delim), true, false)
- return vals
-}
-
-// Uint64s returns list of uint64 divided by given delimiter. Any invalid input will be treated as zero value.
-func (k *Key) Uint64s(delim string) []uint64 {
- vals, _ := k.parseUint64s(k.Strings(delim), true, false)
- return vals
-}
-
-// Bools returns list of bool divided by given delimiter. Any invalid input will be treated as zero value.
-func (k *Key) Bools(delim string) []bool {
- vals, _ := k.parseBools(k.Strings(delim), true, false)
- return vals
-}
-
-// TimesFormat parses with given format and returns list of time.Time divided by given delimiter.
-// Any invalid input will be treated as zero value (0001-01-01 00:00:00 +0000 UTC).
-func (k *Key) TimesFormat(format, delim string) []time.Time {
- vals, _ := k.parseTimesFormat(format, k.Strings(delim), true, false)
- return vals
-}
-
-// Times parses with RFC3339 format and returns list of time.Time divided by given delimiter.
-// Any invalid input will be treated as zero value (0001-01-01 00:00:00 +0000 UTC).
-func (k *Key) Times(delim string) []time.Time {
- return k.TimesFormat(time.RFC3339, delim)
-}
-
-// ValidFloat64s returns list of float64 divided by given delimiter. If some value is not float, then
-// it will not be included to result list.
-func (k *Key) ValidFloat64s(delim string) []float64 {
- vals, _ := k.parseFloat64s(k.Strings(delim), false, false)
- return vals
-}
-
-// ValidInts returns list of int divided by given delimiter. If some value is not integer, then it will
-// not be included to result list.
-func (k *Key) ValidInts(delim string) []int {
- vals, _ := k.parseInts(k.Strings(delim), false, false)
- return vals
-}
-
-// ValidInt64s returns list of int64 divided by given delimiter. If some value is not 64-bit integer,
-// then it will not be included to result list.
-func (k *Key) ValidInt64s(delim string) []int64 {
- vals, _ := k.parseInt64s(k.Strings(delim), false, false)
- return vals
-}
-
-// ValidUints returns list of uint divided by given delimiter. If some value is not unsigned integer,
-// then it will not be included to result list.
-func (k *Key) ValidUints(delim string) []uint {
- vals, _ := k.parseUints(k.Strings(delim), false, false)
- return vals
-}
-
-// ValidUint64s returns list of uint64 divided by given delimiter. If some value is not 64-bit unsigned
-// integer, then it will not be included to result list.
-func (k *Key) ValidUint64s(delim string) []uint64 {
- vals, _ := k.parseUint64s(k.Strings(delim), false, false)
- return vals
-}
-
-// ValidBools returns list of bool divided by given delimiter. If some value is not 64-bit unsigned
-// integer, then it will not be included to result list.
-func (k *Key) ValidBools(delim string) []bool {
- vals, _ := k.parseBools(k.Strings(delim), false, false)
- return vals
-}
-
-// ValidTimesFormat parses with given format and returns list of time.Time divided by given delimiter.
-func (k *Key) ValidTimesFormat(format, delim string) []time.Time {
- vals, _ := k.parseTimesFormat(format, k.Strings(delim), false, false)
- return vals
-}
-
-// ValidTimes parses with RFC3339 format and returns list of time.Time divided by given delimiter.
-func (k *Key) ValidTimes(delim string) []time.Time {
- return k.ValidTimesFormat(time.RFC3339, delim)
-}
-
-// StrictFloat64s returns list of float64 divided by given delimiter or error on first invalid input.
-func (k *Key) StrictFloat64s(delim string) ([]float64, error) {
- return k.parseFloat64s(k.Strings(delim), false, true)
-}
-
-// StrictInts returns list of int divided by given delimiter or error on first invalid input.
-func (k *Key) StrictInts(delim string) ([]int, error) {
- return k.parseInts(k.Strings(delim), false, true)
-}
-
-// StrictInt64s returns list of int64 divided by given delimiter or error on first invalid input.
-func (k *Key) StrictInt64s(delim string) ([]int64, error) {
- return k.parseInt64s(k.Strings(delim), false, true)
-}
-
-// StrictUints returns list of uint divided by given delimiter or error on first invalid input.
-func (k *Key) StrictUints(delim string) ([]uint, error) {
- return k.parseUints(k.Strings(delim), false, true)
-}
-
-// StrictUint64s returns list of uint64 divided by given delimiter or error on first invalid input.
-func (k *Key) StrictUint64s(delim string) ([]uint64, error) {
- return k.parseUint64s(k.Strings(delim), false, true)
-}
-
-// StrictBools returns list of bool divided by given delimiter or error on first invalid input.
-func (k *Key) StrictBools(delim string) ([]bool, error) {
- return k.parseBools(k.Strings(delim), false, true)
-}
-
-// StrictTimesFormat parses with given format and returns list of time.Time divided by given delimiter
-// or error on first invalid input.
-func (k *Key) StrictTimesFormat(format, delim string) ([]time.Time, error) {
- return k.parseTimesFormat(format, k.Strings(delim), false, true)
-}
-
-// StrictTimes parses with RFC3339 format and returns list of time.Time divided by given delimiter
-// or error on first invalid input.
-func (k *Key) StrictTimes(delim string) ([]time.Time, error) {
- return k.StrictTimesFormat(time.RFC3339, delim)
-}
-
-// parseBools transforms strings to bools.
-func (k *Key) parseBools(strs []string, addInvalid, returnOnInvalid bool) ([]bool, error) {
- vals := make([]bool, 0, len(strs))
- parser := func(str string) (interface{}, error) {
- val, err := parseBool(str)
- return val, err
- }
- rawVals, err := k.doParse(strs, addInvalid, returnOnInvalid, parser)
- if err == nil {
- for _, val := range rawVals {
- vals = append(vals, val.(bool))
- }
- }
- return vals, err
-}
-
-// parseFloat64s transforms strings to float64s.
-func (k *Key) parseFloat64s(strs []string, addInvalid, returnOnInvalid bool) ([]float64, error) {
- vals := make([]float64, 0, len(strs))
- parser := func(str string) (interface{}, error) {
- val, err := strconv.ParseFloat(str, 64)
- return val, err
- }
- rawVals, err := k.doParse(strs, addInvalid, returnOnInvalid, parser)
- if err == nil {
- for _, val := range rawVals {
- vals = append(vals, val.(float64))
- }
- }
- return vals, err
-}
-
-// parseInts transforms strings to ints.
-func (k *Key) parseInts(strs []string, addInvalid, returnOnInvalid bool) ([]int, error) {
- vals := make([]int, 0, len(strs))
- parser := func(str string) (interface{}, error) {
- val, err := strconv.ParseInt(str, 0, 64)
- return val, err
- }
- rawVals, err := k.doParse(strs, addInvalid, returnOnInvalid, parser)
- if err == nil {
- for _, val := range rawVals {
- vals = append(vals, int(val.(int64)))
- }
- }
- return vals, err
-}
-
-// parseInt64s transforms strings to int64s.
-func (k *Key) parseInt64s(strs []string, addInvalid, returnOnInvalid bool) ([]int64, error) {
- vals := make([]int64, 0, len(strs))
- parser := func(str string) (interface{}, error) {
- val, err := strconv.ParseInt(str, 0, 64)
- return val, err
- }
-
- rawVals, err := k.doParse(strs, addInvalid, returnOnInvalid, parser)
- if err == nil {
- for _, val := range rawVals {
- vals = append(vals, val.(int64))
- }
- }
- return vals, err
-}
-
-// parseUints transforms strings to uints.
-func (k *Key) parseUints(strs []string, addInvalid, returnOnInvalid bool) ([]uint, error) {
- vals := make([]uint, 0, len(strs))
- parser := func(str string) (interface{}, error) {
- val, err := strconv.ParseUint(str, 0, 64)
- return val, err
- }
-
- rawVals, err := k.doParse(strs, addInvalid, returnOnInvalid, parser)
- if err == nil {
- for _, val := range rawVals {
- vals = append(vals, uint(val.(uint64)))
- }
- }
- return vals, err
-}
-
-// parseUint64s transforms strings to uint64s.
-func (k *Key) parseUint64s(strs []string, addInvalid, returnOnInvalid bool) ([]uint64, error) {
- vals := make([]uint64, 0, len(strs))
- parser := func(str string) (interface{}, error) {
- val, err := strconv.ParseUint(str, 0, 64)
- return val, err
- }
- rawVals, err := k.doParse(strs, addInvalid, returnOnInvalid, parser)
- if err == nil {
- for _, val := range rawVals {
- vals = append(vals, val.(uint64))
- }
- }
- return vals, err
-}
-
-type Parser func(str string) (interface{}, error)
-
-// parseTimesFormat transforms strings to times in given format.
-func (k *Key) parseTimesFormat(format string, strs []string, addInvalid, returnOnInvalid bool) ([]time.Time, error) {
- vals := make([]time.Time, 0, len(strs))
- parser := func(str string) (interface{}, error) {
- val, err := time.Parse(format, str)
- return val, err
- }
- rawVals, err := k.doParse(strs, addInvalid, returnOnInvalid, parser)
- if err == nil {
- for _, val := range rawVals {
- vals = append(vals, val.(time.Time))
- }
- }
- return vals, err
-}
-
-// doParse transforms strings to different types
-func (k *Key) doParse(strs []string, addInvalid, returnOnInvalid bool, parser Parser) ([]interface{}, error) {
- vals := make([]interface{}, 0, len(strs))
- for _, str := range strs {
- val, err := parser(str)
- if err != nil && returnOnInvalid {
- return nil, err
- }
- if err == nil || addInvalid {
- vals = append(vals, val)
- }
- }
- return vals, nil
-}
-
-// SetValue changes key value.
-func (k *Key) SetValue(v string) {
- if k.s.f.BlockMode {
- k.s.f.lock.Lock()
- defer k.s.f.lock.Unlock()
- }
-
- k.value = v
- k.s.keysHash[k.name] = v
-}
diff --git a/vendor/github.com/go-ini/ini/parser.go b/vendor/github.com/go-ini/ini/parser.go
deleted file mode 100644
index 44fc526c2c..0000000000
--- a/vendor/github.com/go-ini/ini/parser.go
+++ /dev/null
@@ -1,520 +0,0 @@
-// Copyright 2015 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "regexp"
- "strconv"
- "strings"
- "unicode"
-)
-
-const minReaderBufferSize = 4096
-
-var pythonMultiline = regexp.MustCompile(`^([\t\f ]+)(.*)`)
-
-type parserOptions struct {
- IgnoreContinuation bool
- IgnoreInlineComment bool
- AllowPythonMultilineValues bool
- SpaceBeforeInlineComment bool
- UnescapeValueDoubleQuotes bool
- UnescapeValueCommentSymbols bool
- PreserveSurroundedQuote bool
- DebugFunc DebugFunc
- ReaderBufferSize int
-}
-
-type parser struct {
- buf *bufio.Reader
- options parserOptions
-
- isEOF bool
- count int
- comment *bytes.Buffer
-}
-
-func (p *parser) debug(format string, args ...interface{}) {
- if p.options.DebugFunc != nil {
- p.options.DebugFunc(fmt.Sprintf(format, args...))
- }
-}
-
-func newParser(r io.Reader, opts parserOptions) *parser {
- size := opts.ReaderBufferSize
- if size < minReaderBufferSize {
- size = minReaderBufferSize
- }
-
- return &parser{
- buf: bufio.NewReaderSize(r, size),
- options: opts,
- count: 1,
- comment: &bytes.Buffer{},
- }
-}
-
-// BOM handles header of UTF-8, UTF-16 LE and UTF-16 BE's BOM format.
-// http://en.wikipedia.org/wiki/Byte_order_mark#Representations_of_byte_order_marks_by_encoding
-func (p *parser) BOM() error {
- mask, err := p.buf.Peek(2)
- if err != nil && err != io.EOF {
- return err
- } else if len(mask) < 2 {
- return nil
- }
-
- switch {
- case mask[0] == 254 && mask[1] == 255:
- fallthrough
- case mask[0] == 255 && mask[1] == 254:
- _, err = p.buf.Read(mask)
- if err != nil {
- return err
- }
- case mask[0] == 239 && mask[1] == 187:
- mask, err := p.buf.Peek(3)
- if err != nil && err != io.EOF {
- return err
- } else if len(mask) < 3 {
- return nil
- }
- if mask[2] == 191 {
- _, err = p.buf.Read(mask)
- if err != nil {
- return err
- }
- }
- }
- return nil
-}
-
-func (p *parser) readUntil(delim byte) ([]byte, error) {
- data, err := p.buf.ReadBytes(delim)
- if err != nil {
- if err == io.EOF {
- p.isEOF = true
- } else {
- return nil, err
- }
- }
- return data, nil
-}
-
-func cleanComment(in []byte) ([]byte, bool) {
- i := bytes.IndexAny(in, "#;")
- if i == -1 {
- return nil, false
- }
- return in[i:], true
-}
-
-func readKeyName(delimiters string, in []byte) (string, int, error) {
- line := string(in)
-
- // Check if key name surrounded by quotes.
- var keyQuote string
- if line[0] == '"' {
- if len(line) > 6 && line[0:3] == `"""` {
- keyQuote = `"""`
- } else {
- keyQuote = `"`
- }
- } else if line[0] == '`' {
- keyQuote = "`"
- }
-
- // Get out key name
- var endIdx int
- if len(keyQuote) > 0 {
- startIdx := len(keyQuote)
- // FIXME: fail case -> """"""name"""=value
- pos := strings.Index(line[startIdx:], keyQuote)
- if pos == -1 {
- return "", -1, fmt.Errorf("missing closing key quote: %s", line)
- }
- pos += startIdx
-
- // Find key-value delimiter
- i := strings.IndexAny(line[pos+startIdx:], delimiters)
- if i < 0 {
- return "", -1, ErrDelimiterNotFound{line}
- }
- endIdx = pos + i
- return strings.TrimSpace(line[startIdx:pos]), endIdx + startIdx + 1, nil
- }
-
- endIdx = strings.IndexAny(line, delimiters)
- if endIdx < 0 {
- return "", -1, ErrDelimiterNotFound{line}
- }
- if endIdx == 0 {
- return "", -1, ErrEmptyKeyName{line}
- }
-
- return strings.TrimSpace(line[0:endIdx]), endIdx + 1, nil
-}
-
-func (p *parser) readMultilines(line, val, valQuote string) (string, error) {
- for {
- data, err := p.readUntil('\n')
- if err != nil {
- return "", err
- }
- next := string(data)
-
- pos := strings.LastIndex(next, valQuote)
- if pos > -1 {
- val += next[:pos]
-
- comment, has := cleanComment([]byte(next[pos:]))
- if has {
- p.comment.Write(bytes.TrimSpace(comment))
- }
- break
- }
- val += next
- if p.isEOF {
- return "", fmt.Errorf("missing closing key quote from %q to %q", line, next)
- }
- }
- return val, nil
-}
-
-func (p *parser) readContinuationLines(val string) (string, error) {
- for {
- data, err := p.readUntil('\n')
- if err != nil {
- return "", err
- }
- next := strings.TrimSpace(string(data))
-
- if len(next) == 0 {
- break
- }
- val += next
- if val[len(val)-1] != '\\' {
- break
- }
- val = val[:len(val)-1]
- }
- return val, nil
-}
-
-// hasSurroundedQuote check if and only if the first and last characters
-// are quotes \" or \'.
-// It returns false if any other parts also contain same kind of quotes.
-func hasSurroundedQuote(in string, quote byte) bool {
- return len(in) >= 2 && in[0] == quote && in[len(in)-1] == quote &&
- strings.IndexByte(in[1:], quote) == len(in)-2
-}
-
-func (p *parser) readValue(in []byte, bufferSize int) (string, error) {
-
- line := strings.TrimLeftFunc(string(in), unicode.IsSpace)
- if len(line) == 0 {
- if p.options.AllowPythonMultilineValues && len(in) > 0 && in[len(in)-1] == '\n' {
- return p.readPythonMultilines(line, bufferSize)
- }
- return "", nil
- }
-
- var valQuote string
- if len(line) > 3 && line[0:3] == `"""` {
- valQuote = `"""`
- } else if line[0] == '`' {
- valQuote = "`"
- } else if p.options.UnescapeValueDoubleQuotes && line[0] == '"' {
- valQuote = `"`
- }
-
- if len(valQuote) > 0 {
- startIdx := len(valQuote)
- pos := strings.LastIndex(line[startIdx:], valQuote)
- // Check for multi-line value
- if pos == -1 {
- return p.readMultilines(line, line[startIdx:], valQuote)
- }
-
- if p.options.UnescapeValueDoubleQuotes && valQuote == `"` {
- return strings.Replace(line[startIdx:pos+startIdx], `\"`, `"`, -1), nil
- }
- return line[startIdx : pos+startIdx], nil
- }
-
- lastChar := line[len(line)-1]
- // Won't be able to reach here if value only contains whitespace
- line = strings.TrimSpace(line)
- trimmedLastChar := line[len(line)-1]
-
- // Check continuation lines when desired
- if !p.options.IgnoreContinuation && trimmedLastChar == '\\' {
- return p.readContinuationLines(line[:len(line)-1])
- }
-
- // Check if ignore inline comment
- if !p.options.IgnoreInlineComment {
- var i int
- if p.options.SpaceBeforeInlineComment {
- i = strings.Index(line, " #")
- if i == -1 {
- i = strings.Index(line, " ;")
- }
-
- } else {
- i = strings.IndexAny(line, "#;")
- }
-
- if i > -1 {
- p.comment.WriteString(line[i:])
- line = strings.TrimSpace(line[:i])
- }
-
- }
-
- // Trim single and double quotes
- if (hasSurroundedQuote(line, '\'') ||
- hasSurroundedQuote(line, '"')) && !p.options.PreserveSurroundedQuote {
- line = line[1 : len(line)-1]
- } else if len(valQuote) == 0 && p.options.UnescapeValueCommentSymbols {
- line = strings.ReplaceAll(line, `\;`, ";")
- line = strings.ReplaceAll(line, `\#`, "#")
- } else if p.options.AllowPythonMultilineValues && lastChar == '\n' {
- return p.readPythonMultilines(line, bufferSize)
- }
-
- return line, nil
-}
-
-func (p *parser) readPythonMultilines(line string, bufferSize int) (string, error) {
- parserBufferPeekResult, _ := p.buf.Peek(bufferSize)
- peekBuffer := bytes.NewBuffer(parserBufferPeekResult)
-
- for {
- peekData, peekErr := peekBuffer.ReadBytes('\n')
- if peekErr != nil && peekErr != io.EOF {
- p.debug("readPythonMultilines: failed to peek with error: %v", peekErr)
- return "", peekErr
- }
-
- p.debug("readPythonMultilines: parsing %q", string(peekData))
-
- peekMatches := pythonMultiline.FindStringSubmatch(string(peekData))
- p.debug("readPythonMultilines: matched %d parts", len(peekMatches))
- for n, v := range peekMatches {
- p.debug(" %d: %q", n, v)
- }
-
- // Return if not a Python multiline value.
- if len(peekMatches) != 3 {
- p.debug("readPythonMultilines: end of value, got: %q", line)
- return line, nil
- }
-
- // Advance the parser reader (buffer) in-sync with the peek buffer.
- _, err := p.buf.Discard(len(peekData))
- if err != nil {
- p.debug("readPythonMultilines: failed to skip to the end, returning error")
- return "", err
- }
-
- line += "\n" + peekMatches[0]
- }
-}
-
-// parse parses data through an io.Reader.
-func (f *File) parse(reader io.Reader) (err error) {
- p := newParser(reader, parserOptions{
- IgnoreContinuation: f.options.IgnoreContinuation,
- IgnoreInlineComment: f.options.IgnoreInlineComment,
- AllowPythonMultilineValues: f.options.AllowPythonMultilineValues,
- SpaceBeforeInlineComment: f.options.SpaceBeforeInlineComment,
- UnescapeValueDoubleQuotes: f.options.UnescapeValueDoubleQuotes,
- UnescapeValueCommentSymbols: f.options.UnescapeValueCommentSymbols,
- PreserveSurroundedQuote: f.options.PreserveSurroundedQuote,
- DebugFunc: f.options.DebugFunc,
- ReaderBufferSize: f.options.ReaderBufferSize,
- })
- if err = p.BOM(); err != nil {
- return fmt.Errorf("BOM: %v", err)
- }
-
- // Ignore error because default section name is never empty string.
- name := DefaultSection
- if f.options.Insensitive || f.options.InsensitiveSections {
- name = strings.ToLower(DefaultSection)
- }
- section, _ := f.NewSection(name)
-
- // This "last" is not strictly equivalent to "previous one" if current key is not the first nested key
- var isLastValueEmpty bool
- var lastRegularKey *Key
-
- var line []byte
- var inUnparseableSection bool
-
- // NOTE: Iterate and increase `currentPeekSize` until
- // the size of the parser buffer is found.
- // TODO(unknwon): When Golang 1.10 is the lowest version supported, replace with `parserBufferSize := p.buf.Size()`.
- parserBufferSize := 0
- // NOTE: Peek 4kb at a time.
- currentPeekSize := minReaderBufferSize
-
- if f.options.AllowPythonMultilineValues {
- for {
- peekBytes, _ := p.buf.Peek(currentPeekSize)
- peekBytesLength := len(peekBytes)
-
- if parserBufferSize >= peekBytesLength {
- break
- }
-
- currentPeekSize *= 2
- parserBufferSize = peekBytesLength
- }
- }
-
- for !p.isEOF {
- line, err = p.readUntil('\n')
- if err != nil {
- return err
- }
-
- if f.options.AllowNestedValues &&
- isLastValueEmpty && len(line) > 0 {
- if line[0] == ' ' || line[0] == '\t' {
- err = lastRegularKey.addNestedValue(string(bytes.TrimSpace(line)))
- if err != nil {
- return err
- }
- continue
- }
- }
-
- line = bytes.TrimLeftFunc(line, unicode.IsSpace)
- if len(line) == 0 {
- continue
- }
-
- // Comments
- if line[0] == '#' || line[0] == ';' {
- // Note: we do not care ending line break,
- // it is needed for adding second line,
- // so just clean it once at the end when set to value.
- p.comment.Write(line)
- continue
- }
-
- // Section
- if line[0] == '[' {
- // Read to the next ']' (TODO: support quoted strings)
- closeIdx := bytes.LastIndexByte(line, ']')
- if closeIdx == -1 {
- return fmt.Errorf("unclosed section: %s", line)
- }
-
- name := string(line[1:closeIdx])
- section, err = f.NewSection(name)
- if err != nil {
- return err
- }
-
- comment, has := cleanComment(line[closeIdx+1:])
- if has {
- p.comment.Write(comment)
- }
-
- section.Comment = strings.TrimSpace(p.comment.String())
-
- // Reset auto-counter and comments
- p.comment.Reset()
- p.count = 1
- // Nested values can't span sections
- isLastValueEmpty = false
-
- inUnparseableSection = false
- for i := range f.options.UnparseableSections {
- if f.options.UnparseableSections[i] == name ||
- ((f.options.Insensitive || f.options.InsensitiveSections) && strings.EqualFold(f.options.UnparseableSections[i], name)) {
- inUnparseableSection = true
- continue
- }
- }
- continue
- }
-
- if inUnparseableSection {
- section.isRawSection = true
- section.rawBody += string(line)
- continue
- }
-
- kname, offset, err := readKeyName(f.options.KeyValueDelimiters, line)
- if err != nil {
- switch {
- // Treat as boolean key when desired, and whole line is key name.
- case IsErrDelimiterNotFound(err):
- switch {
- case f.options.AllowBooleanKeys:
- kname, err := p.readValue(line, parserBufferSize)
- if err != nil {
- return err
- }
- key, err := section.NewBooleanKey(kname)
- if err != nil {
- return err
- }
- key.Comment = strings.TrimSpace(p.comment.String())
- p.comment.Reset()
- continue
-
- case f.options.SkipUnrecognizableLines:
- continue
- }
- case IsErrEmptyKeyName(err) && f.options.SkipUnrecognizableLines:
- continue
- }
- return err
- }
-
- // Auto increment.
- isAutoIncr := false
- if kname == "-" {
- isAutoIncr = true
- kname = "#" + strconv.Itoa(p.count)
- p.count++
- }
-
- value, err := p.readValue(line[offset:], parserBufferSize)
- if err != nil {
- return err
- }
- isLastValueEmpty = len(value) == 0
-
- key, err := section.NewKey(kname, value)
- if err != nil {
- return err
- }
- key.isAutoIncrement = isAutoIncr
- key.Comment = strings.TrimSpace(p.comment.String())
- p.comment.Reset()
- lastRegularKey = key
- }
- return nil
-}
diff --git a/vendor/github.com/go-ini/ini/section.go b/vendor/github.com/go-ini/ini/section.go
deleted file mode 100644
index a3615d820b..0000000000
--- a/vendor/github.com/go-ini/ini/section.go
+++ /dev/null
@@ -1,256 +0,0 @@
-// Copyright 2014 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini
-
-import (
- "errors"
- "fmt"
- "strings"
-)
-
-// Section represents a config section.
-type Section struct {
- f *File
- Comment string
- name string
- keys map[string]*Key
- keyList []string
- keysHash map[string]string
-
- isRawSection bool
- rawBody string
-}
-
-func newSection(f *File, name string) *Section {
- return &Section{
- f: f,
- name: name,
- keys: make(map[string]*Key),
- keyList: make([]string, 0, 10),
- keysHash: make(map[string]string),
- }
-}
-
-// Name returns name of Section.
-func (s *Section) Name() string {
- return s.name
-}
-
-// Body returns rawBody of Section if the section was marked as unparseable.
-// It still follows the other rules of the INI format surrounding leading/trailing whitespace.
-func (s *Section) Body() string {
- return strings.TrimSpace(s.rawBody)
-}
-
-// SetBody updates body content only if section is raw.
-func (s *Section) SetBody(body string) {
- if !s.isRawSection {
- return
- }
- s.rawBody = body
-}
-
-// NewKey creates a new key to given section.
-func (s *Section) NewKey(name, val string) (*Key, error) {
- if len(name) == 0 {
- return nil, errors.New("error creating new key: empty key name")
- } else if s.f.options.Insensitive || s.f.options.InsensitiveKeys {
- name = strings.ToLower(name)
- }
-
- if s.f.BlockMode {
- s.f.lock.Lock()
- defer s.f.lock.Unlock()
- }
-
- if inSlice(name, s.keyList) {
- if s.f.options.AllowShadows {
- if err := s.keys[name].addShadow(val); err != nil {
- return nil, err
- }
- } else {
- s.keys[name].value = val
- s.keysHash[name] = val
- }
- return s.keys[name], nil
- }
-
- s.keyList = append(s.keyList, name)
- s.keys[name] = newKey(s, name, val)
- s.keysHash[name] = val
- return s.keys[name], nil
-}
-
-// NewBooleanKey creates a new boolean type key to given section.
-func (s *Section) NewBooleanKey(name string) (*Key, error) {
- key, err := s.NewKey(name, "true")
- if err != nil {
- return nil, err
- }
-
- key.isBooleanType = true
- return key, nil
-}
-
-// GetKey returns key in section by given name.
-func (s *Section) GetKey(name string) (*Key, error) {
- if s.f.BlockMode {
- s.f.lock.RLock()
- }
- if s.f.options.Insensitive || s.f.options.InsensitiveKeys {
- name = strings.ToLower(name)
- }
- key := s.keys[name]
- if s.f.BlockMode {
- s.f.lock.RUnlock()
- }
-
- if key == nil {
- // Check if it is a child-section.
- sname := s.name
- for {
- if i := strings.LastIndex(sname, s.f.options.ChildSectionDelimiter); i > -1 {
- sname = sname[:i]
- sec, err := s.f.GetSection(sname)
- if err != nil {
- continue
- }
- return sec.GetKey(name)
- }
- break
- }
- return nil, fmt.Errorf("error when getting key of section %q: key %q not exists", s.name, name)
- }
- return key, nil
-}
-
-// HasKey returns true if section contains a key with given name.
-func (s *Section) HasKey(name string) bool {
- key, _ := s.GetKey(name)
- return key != nil
-}
-
-// Deprecated: Use "HasKey" instead.
-func (s *Section) Haskey(name string) bool {
- return s.HasKey(name)
-}
-
-// HasValue returns true if section contains given raw value.
-func (s *Section) HasValue(value string) bool {
- if s.f.BlockMode {
- s.f.lock.RLock()
- defer s.f.lock.RUnlock()
- }
-
- for _, k := range s.keys {
- if value == k.value {
- return true
- }
- }
- return false
-}
-
-// Key assumes named Key exists in section and returns a zero-value when not.
-func (s *Section) Key(name string) *Key {
- key, err := s.GetKey(name)
- if err != nil {
- // It's OK here because the only possible error is empty key name,
- // but if it's empty, this piece of code won't be executed.
- key, _ = s.NewKey(name, "")
- return key
- }
- return key
-}
-
-// Keys returns list of keys of section.
-func (s *Section) Keys() []*Key {
- keys := make([]*Key, len(s.keyList))
- for i := range s.keyList {
- keys[i] = s.Key(s.keyList[i])
- }
- return keys
-}
-
-// ParentKeys returns list of keys of parent section.
-func (s *Section) ParentKeys() []*Key {
- var parentKeys []*Key
- sname := s.name
- for {
- if i := strings.LastIndex(sname, s.f.options.ChildSectionDelimiter); i > -1 {
- sname = sname[:i]
- sec, err := s.f.GetSection(sname)
- if err != nil {
- continue
- }
- parentKeys = append(parentKeys, sec.Keys()...)
- } else {
- break
- }
-
- }
- return parentKeys
-}
-
-// KeyStrings returns list of key names of section.
-func (s *Section) KeyStrings() []string {
- list := make([]string, len(s.keyList))
- copy(list, s.keyList)
- return list
-}
-
-// KeysHash returns keys hash consisting of names and values.
-func (s *Section) KeysHash() map[string]string {
- if s.f.BlockMode {
- s.f.lock.RLock()
- defer s.f.lock.RUnlock()
- }
-
- hash := make(map[string]string, len(s.keysHash))
- for key, value := range s.keysHash {
- hash[key] = value
- }
- return hash
-}
-
-// DeleteKey deletes a key from section.
-func (s *Section) DeleteKey(name string) {
- if s.f.BlockMode {
- s.f.lock.Lock()
- defer s.f.lock.Unlock()
- }
-
- for i, k := range s.keyList {
- if k == name {
- s.keyList = append(s.keyList[:i], s.keyList[i+1:]...)
- delete(s.keys, name)
- delete(s.keysHash, name)
- return
- }
- }
-}
-
-// ChildSections returns a list of child sections of current section.
-// For example, "[parent.child1]" and "[parent.child12]" are child sections
-// of section "[parent]".
-func (s *Section) ChildSections() []*Section {
- prefix := s.name + s.f.options.ChildSectionDelimiter
- children := make([]*Section, 0, 3)
- for _, name := range s.f.sectionList {
- if strings.HasPrefix(name, prefix) {
- children = append(children, s.f.sections[name]...)
- }
- }
- return children
-}
diff --git a/vendor/github.com/go-ini/ini/struct.go b/vendor/github.com/go-ini/ini/struct.go
deleted file mode 100644
index a486b2fe0f..0000000000
--- a/vendor/github.com/go-ini/ini/struct.go
+++ /dev/null
@@ -1,747 +0,0 @@
-// Copyright 2014 Unknwon
-//
-// Licensed under the Apache License, Version 2.0 (the "License"): you may
-// not use this file except in compliance with the License. You may obtain
-// a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
-// under the License.
-
-package ini
-
-import (
- "bytes"
- "errors"
- "fmt"
- "reflect"
- "strings"
- "time"
- "unicode"
-)
-
-// NameMapper represents a ini tag name mapper.
-type NameMapper func(string) string
-
-// Built-in name getters.
-var (
- // SnackCase converts to format SNACK_CASE.
- SnackCase NameMapper = func(raw string) string {
- newstr := make([]rune, 0, len(raw))
- for i, chr := range raw {
- if isUpper := 'A' <= chr && chr <= 'Z'; isUpper {
- if i > 0 {
- newstr = append(newstr, '_')
- }
- }
- newstr = append(newstr, unicode.ToUpper(chr))
- }
- return string(newstr)
- }
- // TitleUnderscore converts to format title_underscore.
- TitleUnderscore NameMapper = func(raw string) string {
- newstr := make([]rune, 0, len(raw))
- for i, chr := range raw {
- if isUpper := 'A' <= chr && chr <= 'Z'; isUpper {
- if i > 0 {
- newstr = append(newstr, '_')
- }
- chr -= 'A' - 'a'
- }
- newstr = append(newstr, chr)
- }
- return string(newstr)
- }
-)
-
-func (s *Section) parseFieldName(raw, actual string) string {
- if len(actual) > 0 {
- return actual
- }
- if s.f.NameMapper != nil {
- return s.f.NameMapper(raw)
- }
- return raw
-}
-
-func parseDelim(actual string) string {
- if len(actual) > 0 {
- return actual
- }
- return ","
-}
-
-var reflectTime = reflect.TypeOf(time.Now()).Kind()
-
-// setSliceWithProperType sets proper values to slice based on its type.
-func setSliceWithProperType(key *Key, field reflect.Value, delim string, allowShadow, isStrict bool) error {
- var strs []string
- if allowShadow {
- strs = key.StringsWithShadows(delim)
- } else {
- strs = key.Strings(delim)
- }
-
- numVals := len(strs)
- if numVals == 0 {
- return nil
- }
-
- var vals interface{}
- var err error
-
- sliceOf := field.Type().Elem().Kind()
- switch sliceOf {
- case reflect.String:
- vals = strs
- case reflect.Int:
- vals, err = key.parseInts(strs, true, false)
- case reflect.Int64:
- vals, err = key.parseInt64s(strs, true, false)
- case reflect.Uint:
- vals, err = key.parseUints(strs, true, false)
- case reflect.Uint64:
- vals, err = key.parseUint64s(strs, true, false)
- case reflect.Float64:
- vals, err = key.parseFloat64s(strs, true, false)
- case reflect.Bool:
- vals, err = key.parseBools(strs, true, false)
- case reflectTime:
- vals, err = key.parseTimesFormat(time.RFC3339, strs, true, false)
- default:
- return fmt.Errorf("unsupported type '[]%s'", sliceOf)
- }
- if err != nil && isStrict {
- return err
- }
-
- slice := reflect.MakeSlice(field.Type(), numVals, numVals)
- for i := 0; i < numVals; i++ {
- switch sliceOf {
- case reflect.String:
- slice.Index(i).Set(reflect.ValueOf(vals.([]string)[i]))
- case reflect.Int:
- slice.Index(i).Set(reflect.ValueOf(vals.([]int)[i]))
- case reflect.Int64:
- slice.Index(i).Set(reflect.ValueOf(vals.([]int64)[i]))
- case reflect.Uint:
- slice.Index(i).Set(reflect.ValueOf(vals.([]uint)[i]))
- case reflect.Uint64:
- slice.Index(i).Set(reflect.ValueOf(vals.([]uint64)[i]))
- case reflect.Float64:
- slice.Index(i).Set(reflect.ValueOf(vals.([]float64)[i]))
- case reflect.Bool:
- slice.Index(i).Set(reflect.ValueOf(vals.([]bool)[i]))
- case reflectTime:
- slice.Index(i).Set(reflect.ValueOf(vals.([]time.Time)[i]))
- }
- }
- field.Set(slice)
- return nil
-}
-
-func wrapStrictError(err error, isStrict bool) error {
- if isStrict {
- return err
- }
- return nil
-}
-
-// setWithProperType sets proper value to field based on its type,
-// but it does not return error for failing parsing,
-// because we want to use default value that is already assigned to struct.
-func setWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string, allowShadow, isStrict bool) error {
- vt := t
- isPtr := t.Kind() == reflect.Ptr
- if isPtr {
- vt = t.Elem()
- }
- switch vt.Kind() {
- case reflect.String:
- stringVal := key.String()
- if isPtr {
- field.Set(reflect.ValueOf(&stringVal))
- } else if len(stringVal) > 0 {
- field.SetString(key.String())
- }
- case reflect.Bool:
- boolVal, err := key.Bool()
- if err != nil {
- return wrapStrictError(err, isStrict)
- }
- if isPtr {
- field.Set(reflect.ValueOf(&boolVal))
- } else {
- field.SetBool(boolVal)
- }
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- // ParseDuration will not return err for `0`, so check the type name
- if vt.Name() == "Duration" {
- durationVal, err := key.Duration()
- if err != nil {
- if intVal, err := key.Int64(); err == nil {
- field.SetInt(intVal)
- return nil
- }
- return wrapStrictError(err, isStrict)
- }
- if isPtr {
- field.Set(reflect.ValueOf(&durationVal))
- } else if int64(durationVal) > 0 {
- field.Set(reflect.ValueOf(durationVal))
- }
- return nil
- }
-
- intVal, err := key.Int64()
- if err != nil {
- return wrapStrictError(err, isStrict)
- }
- if isPtr {
- pv := reflect.New(t.Elem())
- pv.Elem().SetInt(intVal)
- field.Set(pv)
- } else {
- field.SetInt(intVal)
- }
- // byte is an alias for uint8, so supporting uint8 breaks support for byte
- case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64:
- durationVal, err := key.Duration()
- // Skip zero value
- if err == nil && uint64(durationVal) > 0 {
- if isPtr {
- field.Set(reflect.ValueOf(&durationVal))
- } else {
- field.Set(reflect.ValueOf(durationVal))
- }
- return nil
- }
-
- uintVal, err := key.Uint64()
- if err != nil {
- return wrapStrictError(err, isStrict)
- }
- if isPtr {
- pv := reflect.New(t.Elem())
- pv.Elem().SetUint(uintVal)
- field.Set(pv)
- } else {
- field.SetUint(uintVal)
- }
-
- case reflect.Float32, reflect.Float64:
- floatVal, err := key.Float64()
- if err != nil {
- return wrapStrictError(err, isStrict)
- }
- if isPtr {
- pv := reflect.New(t.Elem())
- pv.Elem().SetFloat(floatVal)
- field.Set(pv)
- } else {
- field.SetFloat(floatVal)
- }
- case reflectTime:
- timeVal, err := key.Time()
- if err != nil {
- return wrapStrictError(err, isStrict)
- }
- if isPtr {
- field.Set(reflect.ValueOf(&timeVal))
- } else {
- field.Set(reflect.ValueOf(timeVal))
- }
- case reflect.Slice:
- return setSliceWithProperType(key, field, delim, allowShadow, isStrict)
- default:
- return fmt.Errorf("unsupported type %q", t)
- }
- return nil
-}
-
-func parseTagOptions(tag string) (rawName string, omitEmpty bool, allowShadow bool, allowNonUnique bool, extends bool) {
- opts := strings.SplitN(tag, ",", 5)
- rawName = opts[0]
- for _, opt := range opts[1:] {
- omitEmpty = omitEmpty || (opt == "omitempty")
- allowShadow = allowShadow || (opt == "allowshadow")
- allowNonUnique = allowNonUnique || (opt == "nonunique")
- extends = extends || (opt == "extends")
- }
- return rawName, omitEmpty, allowShadow, allowNonUnique, extends
-}
-
-// mapToField maps the given value to the matching field of the given section.
-// The sectionIndex is the index (if non unique sections are enabled) to which the value should be added.
-func (s *Section) mapToField(val reflect.Value, isStrict bool, sectionIndex int, sectionName string) error {
- if val.Kind() == reflect.Ptr {
- val = val.Elem()
- }
- typ := val.Type()
-
- for i := 0; i < typ.NumField(); i++ {
- field := val.Field(i)
- tpField := typ.Field(i)
-
- tag := tpField.Tag.Get("ini")
- if tag == "-" {
- continue
- }
-
- rawName, _, allowShadow, allowNonUnique, extends := parseTagOptions(tag)
- fieldName := s.parseFieldName(tpField.Name, rawName)
- if len(fieldName) == 0 || !field.CanSet() {
- continue
- }
-
- isStruct := tpField.Type.Kind() == reflect.Struct
- isStructPtr := tpField.Type.Kind() == reflect.Ptr && tpField.Type.Elem().Kind() == reflect.Struct
- isAnonymousPtr := tpField.Type.Kind() == reflect.Ptr && tpField.Anonymous
- if isAnonymousPtr {
- field.Set(reflect.New(tpField.Type.Elem()))
- }
-
- if extends && (isAnonymousPtr || (isStruct && tpField.Anonymous)) {
- if isStructPtr && field.IsNil() {
- field.Set(reflect.New(tpField.Type.Elem()))
- }
- fieldSection := s
- if rawName != "" {
- sectionName = s.name + s.f.options.ChildSectionDelimiter + rawName
- if secs, err := s.f.SectionsByName(sectionName); err == nil && sectionIndex < len(secs) {
- fieldSection = secs[sectionIndex]
- }
- }
- if err := fieldSection.mapToField(field, isStrict, sectionIndex, sectionName); err != nil {
- return fmt.Errorf("map to field %q: %v", fieldName, err)
- }
- } else if isAnonymousPtr || isStruct || isStructPtr {
- if secs, err := s.f.SectionsByName(fieldName); err == nil {
- if len(secs) <= sectionIndex {
- return fmt.Errorf("there are not enough sections (%d <= %d) for the field %q", len(secs), sectionIndex, fieldName)
- }
- // Only set the field to non-nil struct value if we have a section for it.
- // Otherwise, we end up with a non-nil struct ptr even though there is no data.
- if isStructPtr && field.IsNil() {
- field.Set(reflect.New(tpField.Type.Elem()))
- }
- if err = secs[sectionIndex].mapToField(field, isStrict, sectionIndex, fieldName); err != nil {
- return fmt.Errorf("map to field %q: %v", fieldName, err)
- }
- continue
- }
- }
-
- // Map non-unique sections
- if allowNonUnique && tpField.Type.Kind() == reflect.Slice {
- newField, err := s.mapToSlice(fieldName, field, isStrict)
- if err != nil {
- return fmt.Errorf("map to slice %q: %v", fieldName, err)
- }
-
- field.Set(newField)
- continue
- }
-
- if key, err := s.GetKey(fieldName); err == nil {
- delim := parseDelim(tpField.Tag.Get("delim"))
- if err = setWithProperType(tpField.Type, key, field, delim, allowShadow, isStrict); err != nil {
- return fmt.Errorf("set field %q: %v", fieldName, err)
- }
- }
- }
- return nil
-}
-
-// mapToSlice maps all sections with the same name and returns the new value.
-// The type of the Value must be a slice.
-func (s *Section) mapToSlice(secName string, val reflect.Value, isStrict bool) (reflect.Value, error) {
- secs, err := s.f.SectionsByName(secName)
- if err != nil {
- return reflect.Value{}, err
- }
-
- typ := val.Type().Elem()
- for i, sec := range secs {
- elem := reflect.New(typ)
- if err = sec.mapToField(elem, isStrict, i, sec.name); err != nil {
- return reflect.Value{}, fmt.Errorf("map to field from section %q: %v", secName, err)
- }
-
- val = reflect.Append(val, elem.Elem())
- }
- return val, nil
-}
-
-// mapTo maps a section to object v.
-func (s *Section) mapTo(v interface{}, isStrict bool) error {
- typ := reflect.TypeOf(v)
- val := reflect.ValueOf(v)
- if typ.Kind() == reflect.Ptr {
- typ = typ.Elem()
- val = val.Elem()
- } else {
- return errors.New("not a pointer to a struct")
- }
-
- if typ.Kind() == reflect.Slice {
- newField, err := s.mapToSlice(s.name, val, isStrict)
- if err != nil {
- return err
- }
-
- val.Set(newField)
- return nil
- }
-
- return s.mapToField(val, isStrict, 0, s.name)
-}
-
-// MapTo maps section to given struct.
-func (s *Section) MapTo(v interface{}) error {
- return s.mapTo(v, false)
-}
-
-// StrictMapTo maps section to given struct in strict mode,
-// which returns all possible error including value parsing error.
-func (s *Section) StrictMapTo(v interface{}) error {
- return s.mapTo(v, true)
-}
-
-// MapTo maps file to given struct.
-func (f *File) MapTo(v interface{}) error {
- return f.Section("").MapTo(v)
-}
-
-// StrictMapTo maps file to given struct in strict mode,
-// which returns all possible error including value parsing error.
-func (f *File) StrictMapTo(v interface{}) error {
- return f.Section("").StrictMapTo(v)
-}
-
-// MapToWithMapper maps data sources to given struct with name mapper.
-func MapToWithMapper(v interface{}, mapper NameMapper, source interface{}, others ...interface{}) error {
- cfg, err := Load(source, others...)
- if err != nil {
- return err
- }
- cfg.NameMapper = mapper
- return cfg.MapTo(v)
-}
-
-// StrictMapToWithMapper maps data sources to given struct with name mapper in strict mode,
-// which returns all possible error including value parsing error.
-func StrictMapToWithMapper(v interface{}, mapper NameMapper, source interface{}, others ...interface{}) error {
- cfg, err := Load(source, others...)
- if err != nil {
- return err
- }
- cfg.NameMapper = mapper
- return cfg.StrictMapTo(v)
-}
-
-// MapTo maps data sources to given struct.
-func MapTo(v, source interface{}, others ...interface{}) error {
- return MapToWithMapper(v, nil, source, others...)
-}
-
-// StrictMapTo maps data sources to given struct in strict mode,
-// which returns all possible error including value parsing error.
-func StrictMapTo(v, source interface{}, others ...interface{}) error {
- return StrictMapToWithMapper(v, nil, source, others...)
-}
-
-// reflectSliceWithProperType does the opposite thing as setSliceWithProperType.
-func reflectSliceWithProperType(key *Key, field reflect.Value, delim string, allowShadow bool) error {
- slice := field.Slice(0, field.Len())
- if field.Len() == 0 {
- return nil
- }
- sliceOf := field.Type().Elem().Kind()
-
- if allowShadow {
- var keyWithShadows *Key
- for i := 0; i < field.Len(); i++ {
- var val string
- switch sliceOf {
- case reflect.String:
- val = slice.Index(i).String()
- case reflect.Int, reflect.Int64:
- val = fmt.Sprint(slice.Index(i).Int())
- case reflect.Uint, reflect.Uint64:
- val = fmt.Sprint(slice.Index(i).Uint())
- case reflect.Float64:
- val = fmt.Sprint(slice.Index(i).Float())
- case reflect.Bool:
- val = fmt.Sprint(slice.Index(i).Bool())
- case reflectTime:
- val = slice.Index(i).Interface().(time.Time).Format(time.RFC3339)
- default:
- return fmt.Errorf("unsupported type '[]%s'", sliceOf)
- }
-
- if i == 0 {
- keyWithShadows = newKey(key.s, key.name, val)
- } else {
- _ = keyWithShadows.AddShadow(val)
- }
- }
- *key = *keyWithShadows
- return nil
- }
-
- var buf bytes.Buffer
- for i := 0; i < field.Len(); i++ {
- switch sliceOf {
- case reflect.String:
- buf.WriteString(slice.Index(i).String())
- case reflect.Int, reflect.Int64:
- buf.WriteString(fmt.Sprint(slice.Index(i).Int()))
- case reflect.Uint, reflect.Uint64:
- buf.WriteString(fmt.Sprint(slice.Index(i).Uint()))
- case reflect.Float64:
- buf.WriteString(fmt.Sprint(slice.Index(i).Float()))
- case reflect.Bool:
- buf.WriteString(fmt.Sprint(slice.Index(i).Bool()))
- case reflectTime:
- buf.WriteString(slice.Index(i).Interface().(time.Time).Format(time.RFC3339))
- default:
- return fmt.Errorf("unsupported type '[]%s'", sliceOf)
- }
- buf.WriteString(delim)
- }
- key.SetValue(buf.String()[:buf.Len()-len(delim)])
- return nil
-}
-
-// reflectWithProperType does the opposite thing as setWithProperType.
-func reflectWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string, allowShadow bool) error {
- switch t.Kind() {
- case reflect.String:
- key.SetValue(field.String())
- case reflect.Bool:
- key.SetValue(fmt.Sprint(field.Bool()))
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- key.SetValue(fmt.Sprint(field.Int()))
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
- key.SetValue(fmt.Sprint(field.Uint()))
- case reflect.Float32, reflect.Float64:
- key.SetValue(fmt.Sprint(field.Float()))
- case reflectTime:
- key.SetValue(fmt.Sprint(field.Interface().(time.Time).Format(time.RFC3339)))
- case reflect.Slice:
- return reflectSliceWithProperType(key, field, delim, allowShadow)
- case reflect.Ptr:
- if !field.IsNil() {
- return reflectWithProperType(t.Elem(), key, field.Elem(), delim, allowShadow)
- }
- default:
- return fmt.Errorf("unsupported type %q", t)
- }
- return nil
-}
-
-// CR: copied from encoding/json/encode.go with modifications of time.Time support.
-// TODO: add more test coverage.
-func isEmptyValue(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
- return v.Len() == 0
- case reflect.Bool:
- return !v.Bool()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return v.Float() == 0
- case reflect.Interface, reflect.Ptr:
- return v.IsNil()
- case reflectTime:
- t, ok := v.Interface().(time.Time)
- return ok && t.IsZero()
- }
- return false
-}
-
-// StructReflector is the interface implemented by struct types that can extract themselves into INI objects.
-type StructReflector interface {
- ReflectINIStruct(*File) error
-}
-
-func (s *Section) reflectFrom(val reflect.Value) error {
- if val.Kind() == reflect.Ptr {
- val = val.Elem()
- }
- typ := val.Type()
-
- for i := 0; i < typ.NumField(); i++ {
- if !val.Field(i).CanInterface() {
- continue
- }
-
- field := val.Field(i)
- tpField := typ.Field(i)
-
- tag := tpField.Tag.Get("ini")
- if tag == "-" {
- continue
- }
-
- rawName, omitEmpty, allowShadow, allowNonUnique, extends := parseTagOptions(tag)
- if omitEmpty && isEmptyValue(field) {
- continue
- }
-
- if r, ok := field.Interface().(StructReflector); ok {
- return r.ReflectINIStruct(s.f)
- }
-
- fieldName := s.parseFieldName(tpField.Name, rawName)
- if len(fieldName) == 0 || !field.CanSet() {
- continue
- }
-
- if extends && tpField.Anonymous && (tpField.Type.Kind() == reflect.Ptr || tpField.Type.Kind() == reflect.Struct) {
- if err := s.reflectFrom(field); err != nil {
- return fmt.Errorf("reflect from field %q: %v", fieldName, err)
- }
- continue
- }
-
- if (tpField.Type.Kind() == reflect.Ptr && tpField.Type.Elem().Kind() == reflect.Struct) ||
- (tpField.Type.Kind() == reflect.Struct && tpField.Type.Name() != "Time") {
- // Note: The only error here is section doesn't exist.
- sec, err := s.f.GetSection(fieldName)
- if err != nil {
- // Note: fieldName can never be empty here, ignore error.
- sec, _ = s.f.NewSection(fieldName)
- }
-
- // Add comment from comment tag
- if len(sec.Comment) == 0 {
- sec.Comment = tpField.Tag.Get("comment")
- }
-
- if err = sec.reflectFrom(field); err != nil {
- return fmt.Errorf("reflect from field %q: %v", fieldName, err)
- }
- continue
- }
-
- if allowNonUnique && tpField.Type.Kind() == reflect.Slice {
- slice := field.Slice(0, field.Len())
- if field.Len() == 0 {
- return nil
- }
- sliceOf := field.Type().Elem().Kind()
-
- for i := 0; i < field.Len(); i++ {
- if sliceOf != reflect.Struct && sliceOf != reflect.Ptr {
- return fmt.Errorf("field %q is not a slice of pointer or struct", fieldName)
- }
-
- sec, err := s.f.NewSection(fieldName)
- if err != nil {
- return err
- }
-
- // Add comment from comment tag
- if len(sec.Comment) == 0 {
- sec.Comment = tpField.Tag.Get("comment")
- }
-
- if err := sec.reflectFrom(slice.Index(i)); err != nil {
- return fmt.Errorf("reflect from field %q: %v", fieldName, err)
- }
- }
- continue
- }
-
- // Note: Same reason as section.
- key, err := s.GetKey(fieldName)
- if err != nil {
- key, _ = s.NewKey(fieldName, "")
- }
-
- // Add comment from comment tag
- if len(key.Comment) == 0 {
- key.Comment = tpField.Tag.Get("comment")
- }
-
- delim := parseDelim(tpField.Tag.Get("delim"))
- if err = reflectWithProperType(tpField.Type, key, field, delim, allowShadow); err != nil {
- return fmt.Errorf("reflect field %q: %v", fieldName, err)
- }
-
- }
- return nil
-}
-
-// ReflectFrom reflects section from given struct. It overwrites existing ones.
-func (s *Section) ReflectFrom(v interface{}) error {
- typ := reflect.TypeOf(v)
- val := reflect.ValueOf(v)
-
- if s.name != DefaultSection && s.f.options.AllowNonUniqueSections &&
- (typ.Kind() == reflect.Slice || typ.Kind() == reflect.Ptr) {
- // Clear sections to make sure none exists before adding the new ones
- s.f.DeleteSection(s.name)
-
- if typ.Kind() == reflect.Ptr {
- sec, err := s.f.NewSection(s.name)
- if err != nil {
- return err
- }
- return sec.reflectFrom(val.Elem())
- }
-
- slice := val.Slice(0, val.Len())
- sliceOf := val.Type().Elem().Kind()
- if sliceOf != reflect.Ptr {
- return fmt.Errorf("not a slice of pointers")
- }
-
- for i := 0; i < slice.Len(); i++ {
- sec, err := s.f.NewSection(s.name)
- if err != nil {
- return err
- }
-
- err = sec.reflectFrom(slice.Index(i))
- if err != nil {
- return fmt.Errorf("reflect from %dth field: %v", i, err)
- }
- }
-
- return nil
- }
-
- if typ.Kind() == reflect.Ptr {
- val = val.Elem()
- } else {
- return errors.New("not a pointer to a struct")
- }
-
- return s.reflectFrom(val)
-}
-
-// ReflectFrom reflects file from given struct.
-func (f *File) ReflectFrom(v interface{}) error {
- return f.Section("").ReflectFrom(v)
-}
-
-// ReflectFromWithMapper reflects data sources from given struct with name mapper.
-func ReflectFromWithMapper(cfg *File, v interface{}, mapper NameMapper) error {
- cfg.NameMapper = mapper
- return cfg.ReflectFrom(v)
-}
-
-// ReflectFrom reflects data sources from given struct.
-func ReflectFrom(cfg *File, v interface{}) error {
- return ReflectFromWithMapper(cfg, v, nil)
-}
diff --git a/vendor/github.com/go-logr/logr/.golangci.yaml b/vendor/github.com/go-logr/logr/.golangci.yaml
deleted file mode 100644
index 0ed62c1a18..0000000000
--- a/vendor/github.com/go-logr/logr/.golangci.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
-version: "2"
-
-run:
- timeout: 1m
- tests: true
-
-linters:
- default: none
- enable: # please keep this alphabetized
- - asasalint
- - asciicheck
- - copyloopvar
- - dupl
- - errcheck
- - forcetypeassert
- - goconst
- - gocritic
- - govet
- - ineffassign
- - misspell
- - musttag
- - revive
- - staticcheck
- - unused
-
-issues:
- max-issues-per-linter: 0
- max-same-issues: 10
diff --git a/vendor/github.com/go-logr/logr/CHANGELOG.md b/vendor/github.com/go-logr/logr/CHANGELOG.md
deleted file mode 100644
index c356960046..0000000000
--- a/vendor/github.com/go-logr/logr/CHANGELOG.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# CHANGELOG
-
-## v1.0.0-rc1
-
-This is the first logged release. Major changes (including breaking changes)
-have occurred since earlier tags.
diff --git a/vendor/github.com/go-logr/logr/CONTRIBUTING.md b/vendor/github.com/go-logr/logr/CONTRIBUTING.md
deleted file mode 100644
index 5d37e294c5..0000000000
--- a/vendor/github.com/go-logr/logr/CONTRIBUTING.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# Contributing
-
-Logr is open to pull-requests, provided they fit within the intended scope of
-the project. Specifically, this library aims to be VERY small and minimalist,
-with no external dependencies.
-
-## Compatibility
-
-This project intends to follow [semantic versioning](http://semver.org) and
-is very strict about compatibility. Any proposed changes MUST follow those
-rules.
-
-## Performance
-
-As a logging library, logr must be as light-weight as possible. Any proposed
-code change must include results of running the [benchmark](./benchmark)
-before and after the change.
diff --git a/vendor/github.com/go-logr/logr/LICENSE b/vendor/github.com/go-logr/logr/LICENSE
deleted file mode 100644
index 8dada3edaf..0000000000
--- a/vendor/github.com/go-logr/logr/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/go-logr/logr/README.md b/vendor/github.com/go-logr/logr/README.md
deleted file mode 100644
index 7c7f0c69cd..0000000000
--- a/vendor/github.com/go-logr/logr/README.md
+++ /dev/null
@@ -1,407 +0,0 @@
-# A minimal logging API for Go
-
-[](https://pkg.go.dev/github.com/go-logr/logr)
-[](https://goreportcard.com/report/github.com/go-logr/logr)
-[](https://securityscorecards.dev/viewer/?platform=github.com&org=go-logr&repo=logr)
-
-logr offers an(other) opinion on how Go programs and libraries can do logging
-without becoming coupled to a particular logging implementation. This is not
-an implementation of logging - it is an API. In fact it is two APIs with two
-different sets of users.
-
-The `Logger` type is intended for application and library authors. It provides
-a relatively small API which can be used everywhere you want to emit logs. It
-defers the actual act of writing logs (to files, to stdout, or whatever) to the
-`LogSink` interface.
-
-The `LogSink` interface is intended for logging library implementers. It is a
-pure interface which can be implemented by logging frameworks to provide the actual logging
-functionality.
-
-This decoupling allows application and library developers to write code in
-terms of `logr.Logger` (which has very low dependency fan-out) while the
-implementation of logging is managed "up stack" (e.g. in or near `main()`.)
-Application developers can then switch out implementations as necessary.
-
-Many people assert that libraries should not be logging, and as such efforts
-like this are pointless. Those people are welcome to convince the authors of
-the tens-of-thousands of libraries that *DO* write logs that they are all
-wrong. In the meantime, logr takes a more practical approach.
-
-## Typical usage
-
-Somewhere, early in an application's life, it will make a decision about which
-logging library (implementation) it actually wants to use. Something like:
-
-```
- func main() {
- // ... other setup code ...
-
- // Create the "root" logger. We have chosen the "logimpl" implementation,
- // which takes some initial parameters and returns a logr.Logger.
- logger := logimpl.New(param1, param2)
-
- // ... other setup code ...
-```
-
-Most apps will call into other libraries, create structures to govern the flow,
-etc. The `logr.Logger` object can be passed to these other libraries, stored
-in structs, or even used as a package-global variable, if needed. For example:
-
-```
- app := createTheAppObject(logger)
- app.Run()
-```
-
-Outside of this early setup, no other packages need to know about the choice of
-implementation. They write logs in terms of the `logr.Logger` that they
-received:
-
-```
- type appObject struct {
- // ... other fields ...
- logger logr.Logger
- // ... other fields ...
- }
-
- func (app *appObject) Run() {
- app.logger.Info("starting up", "timestamp", time.Now())
-
- // ... app code ...
-```
-
-## Background
-
-If the Go standard library had defined an interface for logging, this project
-probably would not be needed. Alas, here we are.
-
-When the Go developers started developing such an interface with
-[slog](https://github.com/golang/go/issues/56345), they adopted some of the
-logr design but also left out some parts and changed others:
-
-| Feature | logr | slog |
-|---------|------|------|
-| High-level API | `Logger` (passed by value) | `Logger` (passed by [pointer](https://github.com/golang/go/issues/59126)) |
-| Low-level API | `LogSink` | `Handler` |
-| Stack unwinding | done by `LogSink` | done by `Logger` |
-| Skipping helper functions | `WithCallDepth`, `WithCallStackHelper` | [not supported by Logger](https://github.com/golang/go/issues/59145) |
-| Generating a value for logging on demand | `Marshaler` | `LogValuer` |
-| Log levels | >= 0, higher meaning "less important" | positive and negative, with 0 for "info" and higher meaning "more important" |
-| Error log entries | always logged, don't have a verbosity level | normal log entries with level >= `LevelError` |
-| Passing logger via context | `NewContext`, `FromContext` | no API |
-| Adding a name to a logger | `WithName` | no API |
-| Modify verbosity of log entries in a call chain | `V` | no API |
-| Grouping of key/value pairs | not supported | `WithGroup`, `GroupValue` |
-| Pass context for extracting additional values | no API | API variants like `InfoCtx` |
-
-The high-level slog API is explicitly meant to be one of many different APIs
-that can be layered on top of a shared `slog.Handler`. logr is one such
-alternative API, with [interoperability](#slog-interoperability) provided by
-some conversion functions.
-
-### Inspiration
-
-Before you consider this package, please read [this blog post by the
-inimitable Dave Cheney][warning-makes-no-sense]. We really appreciate what
-he has to say, and it largely aligns with our own experiences.
-
-### Differences from Dave's ideas
-
-The main differences are:
-
-1. Dave basically proposes doing away with the notion of a logging API in favor
-of `fmt.Printf()`. We disagree, especially when you consider things like output
-locations, timestamps, file and line decorations, and structured logging. This
-package restricts the logging API to just 2 types of logs: info and error.
-
-Info logs are things you want to tell the user which are not errors. Error
-logs are, well, errors. If your code receives an `error` from a subordinate
-function call and is logging that `error` *and not returning it*, use error
-logs.
-
-2. Verbosity-levels on info logs. This gives developers a chance to indicate
-arbitrary grades of importance for info logs, without assigning names with
-semantic meaning such as "warning", "trace", and "debug." Superficially this
-may feel very similar, but the primary difference is the lack of semantics.
-Because verbosity is a numerical value, it's safe to assume that an app running
-with higher verbosity means more (and less important) logs will be generated.
-
-## Implementations (non-exhaustive)
-
-There are implementations for the following logging libraries:
-
-- **a function** (can bridge to non-structured libraries): [funcr](https://github.com/go-logr/logr/tree/master/funcr)
-- **a testing.T** (for use in Go tests, with JSON-like output): [testr](https://github.com/go-logr/logr/tree/master/testr)
-- **github.com/google/glog**: [glogr](https://github.com/go-logr/glogr)
-- **k8s.io/klog** (for Kubernetes): [klogr](https://git.k8s.io/klog/klogr)
-- **a testing.T** (with klog-like text output): [ktesting](https://git.k8s.io/klog/ktesting)
-- **go.uber.org/zap**: [zapr](https://github.com/go-logr/zapr)
-- **log** (the Go standard library logger): [stdr](https://github.com/go-logr/stdr)
-- **github.com/sirupsen/logrus**: [logrusr](https://github.com/bombsimon/logrusr)
-- **github.com/wojas/genericr**: [genericr](https://github.com/wojas/genericr) (makes it easy to implement your own backend)
-- **logfmt** (Heroku style [logging](https://www.brandur.org/logfmt)): [logfmtr](https://github.com/iand/logfmtr)
-- **github.com/rs/zerolog**: [zerologr](https://github.com/go-logr/zerologr)
-- **github.com/go-kit/log**: [gokitlogr](https://github.com/tonglil/gokitlogr) (also compatible with github.com/go-kit/kit/log since v0.12.0)
-- **bytes.Buffer** (writing to a buffer): [bufrlogr](https://github.com/tonglil/buflogr) (useful for ensuring values were logged, like during testing)
-
-## slog interoperability
-
-Interoperability goes both ways, using the `logr.Logger` API with a `slog.Handler`
-and using the `slog.Logger` API with a `logr.LogSink`. `FromSlogHandler` and
-`ToSlogHandler` convert between a `logr.Logger` and a `slog.Handler`.
-As usual, `slog.New` can be used to wrap such a `slog.Handler` in the high-level
-slog API.
-
-### Using a `logr.LogSink` as backend for slog
-
-Ideally, a logr sink implementation should support both logr and slog by
-implementing both the normal logr interface(s) and `SlogSink`. Because
-of a conflict in the parameters of the common `Enabled` method, it is [not
-possible to implement both slog.Handler and logr.Sink in the same
-type](https://github.com/golang/go/issues/59110).
-
-If both are supported, log calls can go from the high-level APIs to the backend
-without the need to convert parameters. `FromSlogHandler` and `ToSlogHandler` can
-convert back and forth without adding additional wrappers, with one exception:
-when `Logger.V` was used to adjust the verbosity for a `slog.Handler`, then
-`ToSlogHandler` has to use a wrapper which adjusts the verbosity for future
-log calls.
-
-Such an implementation should also support values that implement specific
-interfaces from both packages for logging (`logr.Marshaler`, `slog.LogValuer`,
-`slog.GroupValue`). logr does not convert those.
-
-Not supporting slog has several drawbacks:
-- Recording source code locations works correctly if the handler gets called
- through `slog.Logger`, but may be wrong in other cases. That's because a
- `logr.Sink` does its own stack unwinding instead of using the program counter
- provided by the high-level API.
-- slog levels <= 0 can be mapped to logr levels by negating the level without a
- loss of information. But all slog levels > 0 (e.g. `slog.LevelWarning` as
- used by `slog.Logger.Warn`) must be mapped to 0 before calling the sink
- because logr does not support "more important than info" levels.
-- The slog group concept is supported by prefixing each key in a key/value
- pair with the group names, separated by a dot. For structured output like
- JSON it would be better to group the key/value pairs inside an object.
-- Special slog values and interfaces don't work as expected.
-- The overhead is likely to be higher.
-
-These drawbacks are severe enough that applications using a mixture of slog and
-logr should switch to a different backend.
-
-### Using a `slog.Handler` as backend for logr
-
-Using a plain `slog.Handler` without support for logr works better than the
-other direction:
-- All logr verbosity levels can be mapped 1:1 to their corresponding slog level
- by negating them.
-- Stack unwinding is done by the `SlogSink` and the resulting program
- counter is passed to the `slog.Handler`.
-- Names added via `Logger.WithName` are gathered and recorded in an additional
- attribute with `logger` as key and the names separated by slash as value.
-- `Logger.Error` is turned into a log record with `slog.LevelError` as level
- and an additional attribute with `err` as key, if an error was provided.
-
-The main drawback is that `logr.Marshaler` will not be supported. Types should
-ideally support both `logr.Marshaler` and `slog.Valuer`. If compatibility
-with logr implementations without slog support is not important, then
-`slog.Valuer` is sufficient.
-
-### Context support for slog
-
-Storing a logger in a `context.Context` is not supported by
-slog. `NewContextWithSlogLogger` and `FromContextAsSlogLogger` can be
-used to fill this gap. They store and retrieve a `slog.Logger` pointer
-under the same context key that is also used by `NewContext` and
-`FromContext` for `logr.Logger` value.
-
-When `NewContextWithSlogLogger` is followed by `FromContext`, the latter will
-automatically convert the `slog.Logger` to a
-`logr.Logger`. `FromContextAsSlogLogger` does the same for the other direction.
-
-With this approach, binaries which use either slog or logr are as efficient as
-possible with no unnecessary allocations. This is also why the API stores a
-`slog.Logger` pointer: when storing a `slog.Handler`, creating a `slog.Logger`
-on retrieval would need to allocate one.
-
-The downside is that switching back and forth needs more allocations. Because
-logr is the API that is already in use by different packages, in particular
-Kubernetes, the recommendation is to use the `logr.Logger` API in code which
-uses contextual logging.
-
-An alternative to adding values to a logger and storing that logger in the
-context is to store the values in the context and to configure a logging
-backend to extract those values when emitting log entries. This only works when
-log calls are passed the context, which is not supported by the logr API.
-
-With the slog API, it is possible, but not
-required. https://github.com/veqryn/slog-context is a package for slog which
-provides additional support code for this approach. It also contains wrappers
-for the context functions in logr, so developers who prefer to not use the logr
-APIs directly can use those instead and the resulting code will still be
-interoperable with logr.
-
-## FAQ
-
-### Conceptual
-
-#### Why structured logging?
-
-- **Structured logs are more easily queryable**: Since you've got
- key-value pairs, it's much easier to query your structured logs for
- particular values by filtering on the contents of a particular key --
- think searching request logs for error codes, Kubernetes reconcilers for
- the name and namespace of the reconciled object, etc.
-
-- **Structured logging makes it easier to have cross-referenceable logs**:
- Similarly to searchability, if you maintain conventions around your
- keys, it becomes easy to gather all log lines related to a particular
- concept.
-
-- **Structured logs allow better dimensions of filtering**: if you have
- structure to your logs, you've got more precise control over how much
- information is logged -- you might choose in a particular configuration
- to log certain keys but not others, only log lines where a certain key
- matches a certain value, etc., instead of just having v-levels and names
- to key off of.
-
-- **Structured logs better represent structured data**: sometimes, the
- data that you want to log is inherently structured (think tuple-link
- objects.) Structured logs allow you to preserve that structure when
- outputting.
-
-#### Why V-levels?
-
-**V-levels give operators an easy way to control the chattiness of log
-operations**. V-levels provide a way for a given package to distinguish
-the relative importance or verbosity of a given log message. Then, if
-a particular logger or package is logging too many messages, the user
-of the package can simply change the v-levels for that library.
-
-#### Why not named levels, like Info/Warning/Error?
-
-Read [Dave Cheney's post][warning-makes-no-sense]. Then read [Differences
-from Dave's ideas](#differences-from-daves-ideas).
-
-#### Why not allow format strings, too?
-
-**Format strings negate many of the benefits of structured logs**:
-
-- They're not easily searchable without resorting to fuzzy searching,
- regular expressions, etc.
-
-- They don't store structured data well, since contents are flattened into
- a string.
-
-- They're not cross-referenceable.
-
-- They don't compress easily, since the message is not constant.
-
-(Unless you turn positional parameters into key-value pairs with numerical
-keys, at which point you've gotten key-value logging with meaningless
-keys.)
-
-### Practical
-
-#### Why key-value pairs, and not a map?
-
-Key-value pairs are *much* easier to optimize, especially around
-allocations. Zap (a structured logger that inspired logr's interface) has
-[performance measurements](https://github.com/uber-go/zap#performance)
-that show this quite nicely.
-
-While the interface ends up being a little less obvious, you get
-potentially better performance, plus avoid making users type
-`map[string]string{}` every time they want to log.
-
-#### What if my V-levels differ between libraries?
-
-That's fine. Control your V-levels on a per-logger basis, and use the
-`WithName` method to pass different loggers to different libraries.
-
-Generally, you should take care to ensure that you have relatively
-consistent V-levels within a given logger, however, as this makes deciding
-on what verbosity of logs to request easier.
-
-#### But I really want to use a format string!
-
-That's not actually a question. Assuming your question is "how do
-I convert my mental model of logging with format strings to logging with
-constant messages":
-
-1. Figure out what the error actually is, as you'd write in a TL;DR style,
- and use that as a message.
-
-2. For every place you'd write a format specifier, look to the word before
- it, and add that as a key value pair.
-
-For instance, consider the following examples (all taken from spots in the
-Kubernetes codebase):
-
-- `klog.V(4).Infof("Client is returning errors: code %v, error %v",
- responseCode, err)` becomes `logger.Error(err, "client returned an
- error", "code", responseCode)`
-
-- `klog.V(4).Infof("Got a Retry-After %ds response for attempt %d to %v",
- seconds, retries, url)` becomes `logger.V(4).Info("got a retry-after
- response when requesting url", "attempt", retries, "after
- seconds", seconds, "url", url)`
-
-If you *really* must use a format string, use it in a key's value, and
-call `fmt.Sprintf` yourself. For instance: `log.Printf("unable to
-reflect over type %T")` becomes `logger.Info("unable to reflect over
-type", "type", fmt.Sprintf("%T"))`. In general though, the cases where
-this is necessary should be few and far between.
-
-#### How do I choose my V-levels?
-
-This is basically the only hard constraint: increase V-levels to denote
-more verbose or more debug-y logs.
-
-Otherwise, you can start out with `0` as "you always want to see this",
-`1` as "common logging that you might *possibly* want to turn off", and
-`10` as "I would like to performance-test your log collection stack."
-
-Then gradually choose levels in between as you need them, working your way
-down from 10 (for debug and trace style logs) and up from 1 (for chattier
-info-type logs). For reference, slog pre-defines -4 for debug logs
-(corresponds to 4 in logr), which matches what is
-[recommended for Kubernetes](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md#what-method-to-use).
-
-#### How do I choose my keys?
-
-Keys are fairly flexible, and can hold more or less any string
-value. For best compatibility with implementations and consistency
-with existing code in other projects, there are a few conventions you
-should consider.
-
-- Make your keys human-readable.
-- Constant keys are generally a good idea.
-- Be consistent across your codebase.
-- Keys should naturally match parts of the message string.
-- Use lower case for simple keys and
- [lowerCamelCase](https://en.wiktionary.org/wiki/lowerCamelCase) for
- more complex ones. Kubernetes is one example of a project that has
- [adopted that
- convention](https://github.com/kubernetes/community/blob/HEAD/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments).
-
-While key names are mostly unrestricted (and spaces are acceptable),
-it's generally a good idea to stick to printable ascii characters, or at
-least match the general character set of your log lines.
-
-#### Why should keys be constant values?
-
-The point of structured logging is to make later log processing easier. Your
-keys are, effectively, the schema of each log message. If you use different
-keys across instances of the same log line, you will make your structured logs
-much harder to use. `Sprintf()` is for values, not for keys!
-
-#### Why is this not a pure interface?
-
-The Logger type is implemented as a struct in order to allow the Go compiler to
-optimize things like high-V `Info` logs that are not triggered. Not all of
-these implementations are implemented yet, but this structure was suggested as
-a way to ensure they *can* be implemented. All of the real work is behind the
-`LogSink` interface.
-
-[warning-makes-no-sense]: http://dave.cheney.net/2015/11/05/lets-talk-about-logging
diff --git a/vendor/github.com/go-logr/logr/SECURITY.md b/vendor/github.com/go-logr/logr/SECURITY.md
deleted file mode 100644
index 1ca756fc7b..0000000000
--- a/vendor/github.com/go-logr/logr/SECURITY.md
+++ /dev/null
@@ -1,18 +0,0 @@
-# Security Policy
-
-If you have discovered a security vulnerability in this project, please report it
-privately. **Do not disclose it as a public issue.** This gives us time to work with you
-to fix the issue before public exposure, reducing the chance that the exploit will be
-used before a patch is released.
-
-You may submit the report in the following ways:
-
-- send an email to go-logr-security@googlegroups.com
-- send us a [private vulnerability report](https://github.com/go-logr/logr/security/advisories/new)
-
-Please provide the following information in your report:
-
-- A description of the vulnerability and its impact
-- How to reproduce the issue
-
-We ask that you give us 90 days to work on a fix before public exposure.
diff --git a/vendor/github.com/go-logr/logr/context.go b/vendor/github.com/go-logr/logr/context.go
deleted file mode 100644
index de8bcc3ad8..0000000000
--- a/vendor/github.com/go-logr/logr/context.go
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-Copyright 2023 The logr Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package logr
-
-// contextKey is how we find Loggers in a context.Context. With Go < 1.21,
-// the value is always a Logger value. With Go >= 1.21, the value can be a
-// Logger value or a slog.Logger pointer.
-type contextKey struct{}
-
-// notFoundError exists to carry an IsNotFound method.
-type notFoundError struct{}
-
-func (notFoundError) Error() string {
- return "no logr.Logger was present"
-}
-
-func (notFoundError) IsNotFound() bool {
- return true
-}
diff --git a/vendor/github.com/go-logr/logr/context_noslog.go b/vendor/github.com/go-logr/logr/context_noslog.go
deleted file mode 100644
index f012f9a18e..0000000000
--- a/vendor/github.com/go-logr/logr/context_noslog.go
+++ /dev/null
@@ -1,49 +0,0 @@
-//go:build !go1.21
-// +build !go1.21
-
-/*
-Copyright 2019 The logr Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package logr
-
-import (
- "context"
-)
-
-// FromContext returns a Logger from ctx or an error if no Logger is found.
-func FromContext(ctx context.Context) (Logger, error) {
- if v, ok := ctx.Value(contextKey{}).(Logger); ok {
- return v, nil
- }
-
- return Logger{}, notFoundError{}
-}
-
-// FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this
-// returns a Logger that discards all log messages.
-func FromContextOrDiscard(ctx context.Context) Logger {
- if v, ok := ctx.Value(contextKey{}).(Logger); ok {
- return v
- }
-
- return Discard()
-}
-
-// NewContext returns a new Context, derived from ctx, which carries the
-// provided Logger.
-func NewContext(ctx context.Context, logger Logger) context.Context {
- return context.WithValue(ctx, contextKey{}, logger)
-}
diff --git a/vendor/github.com/go-logr/logr/context_slog.go b/vendor/github.com/go-logr/logr/context_slog.go
deleted file mode 100644
index 065ef0b828..0000000000
--- a/vendor/github.com/go-logr/logr/context_slog.go
+++ /dev/null
@@ -1,83 +0,0 @@
-//go:build go1.21
-// +build go1.21
-
-/*
-Copyright 2019 The logr Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package logr
-
-import (
- "context"
- "fmt"
- "log/slog"
-)
-
-// FromContext returns a Logger from ctx or an error if no Logger is found.
-func FromContext(ctx context.Context) (Logger, error) {
- v := ctx.Value(contextKey{})
- if v == nil {
- return Logger{}, notFoundError{}
- }
-
- switch v := v.(type) {
- case Logger:
- return v, nil
- case *slog.Logger:
- return FromSlogHandler(v.Handler()), nil
- default:
- // Not reached.
- panic(fmt.Sprintf("unexpected value type for logr context key: %T", v))
- }
-}
-
-// FromContextAsSlogLogger returns a slog.Logger from ctx or nil if no such Logger is found.
-func FromContextAsSlogLogger(ctx context.Context) *slog.Logger {
- v := ctx.Value(contextKey{})
- if v == nil {
- return nil
- }
-
- switch v := v.(type) {
- case Logger:
- return slog.New(ToSlogHandler(v))
- case *slog.Logger:
- return v
- default:
- // Not reached.
- panic(fmt.Sprintf("unexpected value type for logr context key: %T", v))
- }
-}
-
-// FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this
-// returns a Logger that discards all log messages.
-func FromContextOrDiscard(ctx context.Context) Logger {
- if logger, err := FromContext(ctx); err == nil {
- return logger
- }
- return Discard()
-}
-
-// NewContext returns a new Context, derived from ctx, which carries the
-// provided Logger.
-func NewContext(ctx context.Context, logger Logger) context.Context {
- return context.WithValue(ctx, contextKey{}, logger)
-}
-
-// NewContextWithSlogLogger returns a new Context, derived from ctx, which carries the
-// provided slog.Logger.
-func NewContextWithSlogLogger(ctx context.Context, logger *slog.Logger) context.Context {
- return context.WithValue(ctx, contextKey{}, logger)
-}
diff --git a/vendor/github.com/go-logr/logr/discard.go b/vendor/github.com/go-logr/logr/discard.go
deleted file mode 100644
index 99fe8be93c..0000000000
--- a/vendor/github.com/go-logr/logr/discard.go
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
-Copyright 2020 The logr Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package logr
-
-// Discard returns a Logger that discards all messages logged to it. It can be
-// used whenever the caller is not interested in the logs. Logger instances
-// produced by this function always compare as equal.
-func Discard() Logger {
- return New(nil)
-}
diff --git a/vendor/github.com/go-logr/logr/funcr/funcr.go b/vendor/github.com/go-logr/logr/funcr/funcr.go
deleted file mode 100644
index b22c57d713..0000000000
--- a/vendor/github.com/go-logr/logr/funcr/funcr.go
+++ /dev/null
@@ -1,914 +0,0 @@
-/*
-Copyright 2021 The logr Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package funcr implements formatting of structured log messages and
-// optionally captures the call site and timestamp.
-//
-// The simplest way to use it is via its implementation of a
-// github.com/go-logr/logr.LogSink with output through an arbitrary
-// "write" function. See New and NewJSON for details.
-//
-// # Custom LogSinks
-//
-// For users who need more control, a funcr.Formatter can be embedded inside
-// your own custom LogSink implementation. This is useful when the LogSink
-// needs to implement additional methods, for example.
-//
-// # Formatting
-//
-// This will respect logr.Marshaler, fmt.Stringer, and error interfaces for
-// values which are being logged. When rendering a struct, funcr will use Go's
-// standard JSON tags (all except "string").
-package funcr
-
-import (
- "bytes"
- "encoding"
- "encoding/json"
- "fmt"
- "path/filepath"
- "reflect"
- "runtime"
- "strconv"
- "strings"
- "time"
-
- "github.com/go-logr/logr"
-)
-
-// New returns a logr.Logger which is implemented by an arbitrary function.
-func New(fn func(prefix, args string), opts Options) logr.Logger {
- return logr.New(newSink(fn, NewFormatter(opts)))
-}
-
-// NewJSON returns a logr.Logger which is implemented by an arbitrary function
-// and produces JSON output.
-func NewJSON(fn func(obj string), opts Options) logr.Logger {
- fnWrapper := func(_, obj string) {
- fn(obj)
- }
- return logr.New(newSink(fnWrapper, NewFormatterJSON(opts)))
-}
-
-// Underlier exposes access to the underlying logging function. Since
-// callers only have a logr.Logger, they have to know which
-// implementation is in use, so this interface is less of an
-// abstraction and more of a way to test type conversion.
-type Underlier interface {
- GetUnderlying() func(prefix, args string)
-}
-
-func newSink(fn func(prefix, args string), formatter Formatter) logr.LogSink {
- l := &fnlogger{
- Formatter: formatter,
- write: fn,
- }
- // For skipping fnlogger.Info and fnlogger.Error.
- l.AddCallDepth(1) // via Formatter
- return l
-}
-
-// Options carries parameters which influence the way logs are generated.
-type Options struct {
- // LogCaller tells funcr to add a "caller" key to some or all log lines.
- // This has some overhead, so some users might not want it.
- LogCaller MessageClass
-
- // LogCallerFunc tells funcr to also log the calling function name. This
- // has no effect if caller logging is not enabled (see Options.LogCaller).
- LogCallerFunc bool
-
- // LogTimestamp tells funcr to add a "ts" key to log lines. This has some
- // overhead, so some users might not want it.
- LogTimestamp bool
-
- // TimestampFormat tells funcr how to render timestamps when LogTimestamp
- // is enabled. If not specified, a default format will be used. For more
- // details, see docs for Go's time.Layout.
- TimestampFormat string
-
- // LogInfoLevel tells funcr what key to use to log the info level.
- // If not specified, the info level will be logged as "level".
- // If this is set to "", the info level will not be logged at all.
- LogInfoLevel *string
-
- // Verbosity tells funcr which V logs to produce. Higher values enable
- // more logs. Info logs at or below this level will be written, while logs
- // above this level will be discarded.
- Verbosity int
-
- // RenderBuiltinsHook allows users to mutate the list of key-value pairs
- // while a log line is being rendered. The kvList argument follows logr
- // conventions - each pair of slice elements is comprised of a string key
- // and an arbitrary value (verified and sanitized before calling this
- // hook). The value returned must follow the same conventions. This hook
- // can be used to audit or modify logged data. For example, you might want
- // to prefix all of funcr's built-in keys with some string. This hook is
- // only called for built-in (provided by funcr itself) key-value pairs.
- // Equivalent hooks are offered for key-value pairs saved via
- // logr.Logger.WithValues or Formatter.AddValues (see RenderValuesHook) and
- // for user-provided pairs (see RenderArgsHook).
- RenderBuiltinsHook func(kvList []any) []any
-
- // RenderValuesHook is the same as RenderBuiltinsHook, except that it is
- // only called for key-value pairs saved via logr.Logger.WithValues. See
- // RenderBuiltinsHook for more details.
- RenderValuesHook func(kvList []any) []any
-
- // RenderArgsHook is the same as RenderBuiltinsHook, except that it is only
- // called for key-value pairs passed directly to Info and Error. See
- // RenderBuiltinsHook for more details.
- RenderArgsHook func(kvList []any) []any
-
- // MaxLogDepth tells funcr how many levels of nested fields (e.g. a struct
- // that contains a struct, etc.) it may log. Every time it finds a struct,
- // slice, array, or map the depth is increased by one. When the maximum is
- // reached, the value will be converted to a string indicating that the max
- // depth has been exceeded. If this field is not specified, a default
- // value will be used.
- MaxLogDepth int
-}
-
-// MessageClass indicates which category or categories of messages to consider.
-type MessageClass int
-
-const (
- // None ignores all message classes.
- None MessageClass = iota
- // All considers all message classes.
- All
- // Info only considers info messages.
- Info
- // Error only considers error messages.
- Error
-)
-
-// fnlogger inherits some of its LogSink implementation from Formatter
-// and just needs to add some glue code.
-type fnlogger struct {
- Formatter
- write func(prefix, args string)
-}
-
-func (l fnlogger) WithName(name string) logr.LogSink {
- l.AddName(name) // via Formatter
- return &l
-}
-
-func (l fnlogger) WithValues(kvList ...any) logr.LogSink {
- l.AddValues(kvList) // via Formatter
- return &l
-}
-
-func (l fnlogger) WithCallDepth(depth int) logr.LogSink {
- l.AddCallDepth(depth) // via Formatter
- return &l
-}
-
-func (l fnlogger) Info(level int, msg string, kvList ...any) {
- prefix, args := l.FormatInfo(level, msg, kvList)
- l.write(prefix, args)
-}
-
-func (l fnlogger) Error(err error, msg string, kvList ...any) {
- prefix, args := l.FormatError(err, msg, kvList)
- l.write(prefix, args)
-}
-
-func (l fnlogger) GetUnderlying() func(prefix, args string) {
- return l.write
-}
-
-// Assert conformance to the interfaces.
-var _ logr.LogSink = &fnlogger{}
-var _ logr.CallDepthLogSink = &fnlogger{}
-var _ Underlier = &fnlogger{}
-
-// NewFormatter constructs a Formatter which emits a JSON-like key=value format.
-func NewFormatter(opts Options) Formatter {
- return newFormatter(opts, outputKeyValue)
-}
-
-// NewFormatterJSON constructs a Formatter which emits strict JSON.
-func NewFormatterJSON(opts Options) Formatter {
- return newFormatter(opts, outputJSON)
-}
-
-// Defaults for Options.
-const defaultTimestampFormat = "2006-01-02 15:04:05.000000"
-const defaultMaxLogDepth = 16
-
-func newFormatter(opts Options, outfmt outputFormat) Formatter {
- if opts.TimestampFormat == "" {
- opts.TimestampFormat = defaultTimestampFormat
- }
- if opts.MaxLogDepth == 0 {
- opts.MaxLogDepth = defaultMaxLogDepth
- }
- if opts.LogInfoLevel == nil {
- opts.LogInfoLevel = new(string)
- *opts.LogInfoLevel = "level"
- }
- f := Formatter{
- outputFormat: outfmt,
- prefix: "",
- values: nil,
- depth: 0,
- opts: &opts,
- }
- return f
-}
-
-// Formatter is an opaque struct which can be embedded in a LogSink
-// implementation. It should be constructed with NewFormatter. Some of
-// its methods directly implement logr.LogSink.
-type Formatter struct {
- outputFormat outputFormat
- prefix string
- values []any
- valuesStr string
- depth int
- opts *Options
- groupName string // for slog groups
- groups []groupDef
-}
-
-// outputFormat indicates which outputFormat to use.
-type outputFormat int
-
-const (
- // outputKeyValue emits a JSON-like key=value format, but not strict JSON.
- outputKeyValue outputFormat = iota
- // outputJSON emits strict JSON.
- outputJSON
-)
-
-// groupDef represents a saved group. The values may be empty, but we don't
-// know if we need to render the group until the final record is rendered.
-type groupDef struct {
- name string
- values string
-}
-
-// PseudoStruct is a list of key-value pairs that gets logged as a struct.
-type PseudoStruct []any
-
-// render produces a log line, ready to use.
-func (f Formatter) render(builtins, args []any) string {
- // Empirically bytes.Buffer is faster than strings.Builder for this.
- buf := bytes.NewBuffer(make([]byte, 0, 1024))
-
- if f.outputFormat == outputJSON {
- buf.WriteByte('{') // for the whole record
- }
-
- // Render builtins
- vals := builtins
- if hook := f.opts.RenderBuiltinsHook; hook != nil {
- vals = hook(f.sanitize(vals))
- }
- f.flatten(buf, vals, false) // keys are ours, no need to escape
- continuing := len(builtins) > 0
-
- // Turn the inner-most group into a string
- argsStr := func() string {
- buf := bytes.NewBuffer(make([]byte, 0, 1024))
-
- vals = args
- if hook := f.opts.RenderArgsHook; hook != nil {
- vals = hook(f.sanitize(vals))
- }
- f.flatten(buf, vals, true) // escape user-provided keys
-
- return buf.String()
- }()
-
- // Render the stack of groups from the inside out.
- bodyStr := f.renderGroup(f.groupName, f.valuesStr, argsStr)
- for i := len(f.groups) - 1; i >= 0; i-- {
- grp := &f.groups[i]
- if grp.values == "" && bodyStr == "" {
- // no contents, so we must elide the whole group
- continue
- }
- bodyStr = f.renderGroup(grp.name, grp.values, bodyStr)
- }
-
- if bodyStr != "" {
- if continuing {
- buf.WriteByte(f.comma())
- }
- buf.WriteString(bodyStr)
- }
-
- if f.outputFormat == outputJSON {
- buf.WriteByte('}') // for the whole record
- }
-
- return buf.String()
-}
-
-// renderGroup returns a string representation of the named group with rendered
-// values and args. If the name is empty, this will return the values and args,
-// joined. If the name is not empty, this will return a single key-value pair,
-// where the value is a grouping of the values and args. If the values and
-// args are both empty, this will return an empty string, even if the name was
-// specified.
-func (f Formatter) renderGroup(name string, values string, args string) string {
- buf := bytes.NewBuffer(make([]byte, 0, 1024))
-
- needClosingBrace := false
- if name != "" && (values != "" || args != "") {
- buf.WriteString(f.quoted(name, true)) // escape user-provided keys
- buf.WriteByte(f.colon())
- buf.WriteByte('{')
- needClosingBrace = true
- }
-
- continuing := false
- if values != "" {
- buf.WriteString(values)
- continuing = true
- }
-
- if args != "" {
- if continuing {
- buf.WriteByte(f.comma())
- }
- buf.WriteString(args)
- }
-
- if needClosingBrace {
- buf.WriteByte('}')
- }
-
- return buf.String()
-}
-
-// flatten renders a list of key-value pairs into a buffer. If escapeKeys is
-// true, the keys are assumed to have non-JSON-compatible characters in them
-// and must be evaluated for escapes.
-//
-// This function returns a potentially modified version of kvList, which
-// ensures that there is a value for every key (adding a value if needed) and
-// that each key is a string (substituting a key if needed).
-func (f Formatter) flatten(buf *bytes.Buffer, kvList []any, escapeKeys bool) []any {
- // This logic overlaps with sanitize() but saves one type-cast per key,
- // which can be measurable.
- if len(kvList)%2 != 0 {
- kvList = append(kvList, noValue)
- }
- copied := false
- for i := 0; i < len(kvList); i += 2 {
- k, ok := kvList[i].(string)
- if !ok {
- if !copied {
- newList := make([]any, len(kvList))
- copy(newList, kvList)
- kvList = newList
- copied = true
- }
- k = f.nonStringKey(kvList[i])
- kvList[i] = k
- }
- v := kvList[i+1]
-
- if i > 0 {
- if f.outputFormat == outputJSON {
- buf.WriteByte(f.comma())
- } else {
- // In theory the format could be something we don't understand. In
- // practice, we control it, so it won't be.
- buf.WriteByte(' ')
- }
- }
-
- buf.WriteString(f.quoted(k, escapeKeys))
- buf.WriteByte(f.colon())
- buf.WriteString(f.pretty(v))
- }
- return kvList
-}
-
-func (f Formatter) quoted(str string, escape bool) string {
- if escape {
- return prettyString(str)
- }
- // this is faster
- return `"` + str + `"`
-}
-
-func (f Formatter) comma() byte {
- if f.outputFormat == outputJSON {
- return ','
- }
- return ' '
-}
-
-func (f Formatter) colon() byte {
- if f.outputFormat == outputJSON {
- return ':'
- }
- return '='
-}
-
-func (f Formatter) pretty(value any) string {
- return f.prettyWithFlags(value, 0, 0)
-}
-
-const (
- flagRawStruct = 0x1 // do not print braces on structs
-)
-
-// TODO: This is not fast. Most of the overhead goes here.
-func (f Formatter) prettyWithFlags(value any, flags uint32, depth int) string {
- if depth > f.opts.MaxLogDepth {
- return `""`
- }
-
- // Handle types that take full control of logging.
- if v, ok := value.(logr.Marshaler); ok {
- // Replace the value with what the type wants to get logged.
- // That then gets handled below via reflection.
- value = invokeMarshaler(v)
- }
-
- // Handle types that want to format themselves.
- switch v := value.(type) {
- case fmt.Stringer:
- value = invokeStringer(v)
- case error:
- value = invokeError(v)
- }
-
- // Handling the most common types without reflect is a small perf win.
- switch v := value.(type) {
- case bool:
- return strconv.FormatBool(v)
- case string:
- return prettyString(v)
- case int:
- return strconv.FormatInt(int64(v), 10)
- case int8:
- return strconv.FormatInt(int64(v), 10)
- case int16:
- return strconv.FormatInt(int64(v), 10)
- case int32:
- return strconv.FormatInt(int64(v), 10)
- case int64:
- return strconv.FormatInt(int64(v), 10)
- case uint:
- return strconv.FormatUint(uint64(v), 10)
- case uint8:
- return strconv.FormatUint(uint64(v), 10)
- case uint16:
- return strconv.FormatUint(uint64(v), 10)
- case uint32:
- return strconv.FormatUint(uint64(v), 10)
- case uint64:
- return strconv.FormatUint(v, 10)
- case uintptr:
- return strconv.FormatUint(uint64(v), 10)
- case float32:
- return strconv.FormatFloat(float64(v), 'f', -1, 32)
- case float64:
- return strconv.FormatFloat(v, 'f', -1, 64)
- case complex64:
- return `"` + strconv.FormatComplex(complex128(v), 'f', -1, 64) + `"`
- case complex128:
- return `"` + strconv.FormatComplex(v, 'f', -1, 128) + `"`
- case PseudoStruct:
- buf := bytes.NewBuffer(make([]byte, 0, 1024))
- v = f.sanitize(v)
- if flags&flagRawStruct == 0 {
- buf.WriteByte('{')
- }
- for i := 0; i < len(v); i += 2 {
- if i > 0 {
- buf.WriteByte(f.comma())
- }
- k, _ := v[i].(string) // sanitize() above means no need to check success
- // arbitrary keys might need escaping
- buf.WriteString(prettyString(k))
- buf.WriteByte(f.colon())
- buf.WriteString(f.prettyWithFlags(v[i+1], 0, depth+1))
- }
- if flags&flagRawStruct == 0 {
- buf.WriteByte('}')
- }
- return buf.String()
- }
-
- buf := bytes.NewBuffer(make([]byte, 0, 256))
- t := reflect.TypeOf(value)
- if t == nil {
- return "null"
- }
- v := reflect.ValueOf(value)
- switch t.Kind() {
- case reflect.Bool:
- return strconv.FormatBool(v.Bool())
- case reflect.String:
- return prettyString(v.String())
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return strconv.FormatInt(int64(v.Int()), 10)
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return strconv.FormatUint(uint64(v.Uint()), 10)
- case reflect.Float32:
- return strconv.FormatFloat(float64(v.Float()), 'f', -1, 32)
- case reflect.Float64:
- return strconv.FormatFloat(v.Float(), 'f', -1, 64)
- case reflect.Complex64:
- return `"` + strconv.FormatComplex(complex128(v.Complex()), 'f', -1, 64) + `"`
- case reflect.Complex128:
- return `"` + strconv.FormatComplex(v.Complex(), 'f', -1, 128) + `"`
- case reflect.Struct:
- if flags&flagRawStruct == 0 {
- buf.WriteByte('{')
- }
- printComma := false // testing i>0 is not enough because of JSON omitted fields
- for i := 0; i < t.NumField(); i++ {
- fld := t.Field(i)
- if fld.PkgPath != "" {
- // reflect says this field is only defined for non-exported fields.
- continue
- }
- if !v.Field(i).CanInterface() {
- // reflect isn't clear exactly what this means, but we can't use it.
- continue
- }
- name := ""
- omitempty := false
- if tag, found := fld.Tag.Lookup("json"); found {
- if tag == "-" {
- continue
- }
- if comma := strings.Index(tag, ","); comma != -1 {
- if n := tag[:comma]; n != "" {
- name = n
- }
- rest := tag[comma:]
- if strings.Contains(rest, ",omitempty,") || strings.HasSuffix(rest, ",omitempty") {
- omitempty = true
- }
- } else {
- name = tag
- }
- }
- if omitempty && isEmpty(v.Field(i)) {
- continue
- }
- if printComma {
- buf.WriteByte(f.comma())
- }
- printComma = true // if we got here, we are rendering a field
- if fld.Anonymous && fld.Type.Kind() == reflect.Struct && name == "" {
- buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), flags|flagRawStruct, depth+1))
- continue
- }
- if name == "" {
- name = fld.Name
- }
- // field names can't contain characters which need escaping
- buf.WriteString(f.quoted(name, false))
- buf.WriteByte(f.colon())
- buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), 0, depth+1))
- }
- if flags&flagRawStruct == 0 {
- buf.WriteByte('}')
- }
- return buf.String()
- case reflect.Slice, reflect.Array:
- // If this is outputing as JSON make sure this isn't really a json.RawMessage.
- // If so just emit "as-is" and don't pretty it as that will just print
- // it as [X,Y,Z,...] which isn't terribly useful vs the string form you really want.
- if f.outputFormat == outputJSON {
- if rm, ok := value.(json.RawMessage); ok {
- // If it's empty make sure we emit an empty value as the array style would below.
- if len(rm) > 0 {
- buf.Write(rm)
- } else {
- buf.WriteString("null")
- }
- return buf.String()
- }
- }
- buf.WriteByte('[')
- for i := 0; i < v.Len(); i++ {
- if i > 0 {
- buf.WriteByte(f.comma())
- }
- e := v.Index(i)
- buf.WriteString(f.prettyWithFlags(e.Interface(), 0, depth+1))
- }
- buf.WriteByte(']')
- return buf.String()
- case reflect.Map:
- buf.WriteByte('{')
- // This does not sort the map keys, for best perf.
- it := v.MapRange()
- i := 0
- for it.Next() {
- if i > 0 {
- buf.WriteByte(f.comma())
- }
- // If a map key supports TextMarshaler, use it.
- keystr := ""
- if m, ok := it.Key().Interface().(encoding.TextMarshaler); ok {
- txt, err := m.MarshalText()
- if err != nil {
- keystr = fmt.Sprintf("", err.Error())
- } else {
- keystr = string(txt)
- }
- keystr = prettyString(keystr)
- } else {
- // prettyWithFlags will produce already-escaped values
- keystr = f.prettyWithFlags(it.Key().Interface(), 0, depth+1)
- if t.Key().Kind() != reflect.String {
- // JSON only does string keys. Unlike Go's standard JSON, we'll
- // convert just about anything to a string.
- keystr = prettyString(keystr)
- }
- }
- buf.WriteString(keystr)
- buf.WriteByte(f.colon())
- buf.WriteString(f.prettyWithFlags(it.Value().Interface(), 0, depth+1))
- i++
- }
- buf.WriteByte('}')
- return buf.String()
- case reflect.Ptr, reflect.Interface:
- if v.IsNil() {
- return "null"
- }
- return f.prettyWithFlags(v.Elem().Interface(), 0, depth)
- }
- return fmt.Sprintf(`""`, t.Kind().String())
-}
-
-func prettyString(s string) string {
- // Avoid escaping (which does allocations) if we can.
- if needsEscape(s) {
- return strconv.Quote(s)
- }
- b := bytes.NewBuffer(make([]byte, 0, 1024))
- b.WriteByte('"')
- b.WriteString(s)
- b.WriteByte('"')
- return b.String()
-}
-
-// needsEscape determines whether the input string needs to be escaped or not,
-// without doing any allocations.
-func needsEscape(s string) bool {
- for _, r := range s {
- if !strconv.IsPrint(r) || r == '\\' || r == '"' {
- return true
- }
- }
- return false
-}
-
-func isEmpty(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
- return v.Len() == 0
- case reflect.Bool:
- return !v.Bool()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return v.Float() == 0
- case reflect.Complex64, reflect.Complex128:
- return v.Complex() == 0
- case reflect.Interface, reflect.Ptr:
- return v.IsNil()
- }
- return false
-}
-
-func invokeMarshaler(m logr.Marshaler) (ret any) {
- defer func() {
- if r := recover(); r != nil {
- ret = fmt.Sprintf("", r)
- }
- }()
- return m.MarshalLog()
-}
-
-func invokeStringer(s fmt.Stringer) (ret string) {
- defer func() {
- if r := recover(); r != nil {
- ret = fmt.Sprintf("", r)
- }
- }()
- return s.String()
-}
-
-func invokeError(e error) (ret string) {
- defer func() {
- if r := recover(); r != nil {
- ret = fmt.Sprintf("", r)
- }
- }()
- return e.Error()
-}
-
-// Caller represents the original call site for a log line, after considering
-// logr.Logger.WithCallDepth and logr.Logger.WithCallStackHelper. The File and
-// Line fields will always be provided, while the Func field is optional.
-// Users can set the render hook fields in Options to examine logged key-value
-// pairs, one of which will be {"caller", Caller} if the Options.LogCaller
-// field is enabled for the given MessageClass.
-type Caller struct {
- // File is the basename of the file for this call site.
- File string `json:"file"`
- // Line is the line number in the file for this call site.
- Line int `json:"line"`
- // Func is the function name for this call site, or empty if
- // Options.LogCallerFunc is not enabled.
- Func string `json:"function,omitempty"`
-}
-
-func (f Formatter) caller() Caller {
- // +1 for this frame, +1 for Info/Error.
- pc, file, line, ok := runtime.Caller(f.depth + 2)
- if !ok {
- return Caller{"", 0, ""}
- }
- fn := ""
- if f.opts.LogCallerFunc {
- if fp := runtime.FuncForPC(pc); fp != nil {
- fn = fp.Name()
- }
- }
-
- return Caller{filepath.Base(file), line, fn}
-}
-
-const noValue = ""
-
-func (f Formatter) nonStringKey(v any) string {
- return fmt.Sprintf("", f.snippet(v))
-}
-
-// snippet produces a short snippet string of an arbitrary value.
-func (f Formatter) snippet(v any) string {
- const snipLen = 16
-
- snip := f.pretty(v)
- if len(snip) > snipLen {
- snip = snip[:snipLen]
- }
- return snip
-}
-
-// sanitize ensures that a list of key-value pairs has a value for every key
-// (adding a value if needed) and that each key is a string (substituting a key
-// if needed).
-func (f Formatter) sanitize(kvList []any) []any {
- if len(kvList)%2 != 0 {
- kvList = append(kvList, noValue)
- }
- for i := 0; i < len(kvList); i += 2 {
- _, ok := kvList[i].(string)
- if !ok {
- kvList[i] = f.nonStringKey(kvList[i])
- }
- }
- return kvList
-}
-
-// startGroup opens a new group scope (basically a sub-struct), which locks all
-// the current saved values and starts them anew. This is needed to satisfy
-// slog.
-func (f *Formatter) startGroup(name string) {
- // Unnamed groups are just inlined.
- if name == "" {
- return
- }
-
- n := len(f.groups)
- f.groups = append(f.groups[:n:n], groupDef{f.groupName, f.valuesStr})
-
- // Start collecting new values.
- f.groupName = name
- f.valuesStr = ""
- f.values = nil
-}
-
-// Init configures this Formatter from runtime info, such as the call depth
-// imposed by logr itself.
-// Note that this receiver is a pointer, so depth can be saved.
-func (f *Formatter) Init(info logr.RuntimeInfo) {
- f.depth += info.CallDepth
-}
-
-// Enabled checks whether an info message at the given level should be logged.
-func (f Formatter) Enabled(level int) bool {
- return level <= f.opts.Verbosity
-}
-
-// GetDepth returns the current depth of this Formatter. This is useful for
-// implementations which do their own caller attribution.
-func (f Formatter) GetDepth() int {
- return f.depth
-}
-
-// FormatInfo renders an Info log message into strings. The prefix will be
-// empty when no names were set (via AddNames), or when the output is
-// configured for JSON.
-func (f Formatter) FormatInfo(level int, msg string, kvList []any) (prefix, argsStr string) {
- args := make([]any, 0, 64) // using a constant here impacts perf
- prefix = f.prefix
- if f.outputFormat == outputJSON {
- args = append(args, "logger", prefix)
- prefix = ""
- }
- if f.opts.LogTimestamp {
- args = append(args, "ts", time.Now().Format(f.opts.TimestampFormat))
- }
- if policy := f.opts.LogCaller; policy == All || policy == Info {
- args = append(args, "caller", f.caller())
- }
- if key := *f.opts.LogInfoLevel; key != "" {
- args = append(args, key, level)
- }
- args = append(args, "msg", msg)
- return prefix, f.render(args, kvList)
-}
-
-// FormatError renders an Error log message into strings. The prefix will be
-// empty when no names were set (via AddNames), or when the output is
-// configured for JSON.
-func (f Formatter) FormatError(err error, msg string, kvList []any) (prefix, argsStr string) {
- args := make([]any, 0, 64) // using a constant here impacts perf
- prefix = f.prefix
- if f.outputFormat == outputJSON {
- args = append(args, "logger", prefix)
- prefix = ""
- }
- if f.opts.LogTimestamp {
- args = append(args, "ts", time.Now().Format(f.opts.TimestampFormat))
- }
- if policy := f.opts.LogCaller; policy == All || policy == Error {
- args = append(args, "caller", f.caller())
- }
- args = append(args, "msg", msg)
- var loggableErr any
- if err != nil {
- loggableErr = err.Error()
- }
- args = append(args, "error", loggableErr)
- return prefix, f.render(args, kvList)
-}
-
-// AddName appends the specified name. funcr uses '/' characters to separate
-// name elements. Callers should not pass '/' in the provided name string, but
-// this library does not actually enforce that.
-func (f *Formatter) AddName(name string) {
- if len(f.prefix) > 0 {
- f.prefix += "/"
- }
- f.prefix += name
-}
-
-// AddValues adds key-value pairs to the set of saved values to be logged with
-// each log line.
-func (f *Formatter) AddValues(kvList []any) {
- // Three slice args forces a copy.
- n := len(f.values)
- f.values = append(f.values[:n:n], kvList...)
-
- vals := f.values
- if hook := f.opts.RenderValuesHook; hook != nil {
- vals = hook(f.sanitize(vals))
- }
-
- // Pre-render values, so we don't have to do it on each Info/Error call.
- buf := bytes.NewBuffer(make([]byte, 0, 1024))
- f.flatten(buf, vals, true) // escape user-provided keys
- f.valuesStr = buf.String()
-}
-
-// AddCallDepth increases the number of stack-frames to skip when attributing
-// the log line to a file and line.
-func (f *Formatter) AddCallDepth(depth int) {
- f.depth += depth
-}
diff --git a/vendor/github.com/go-logr/logr/funcr/slogsink.go b/vendor/github.com/go-logr/logr/funcr/slogsink.go
deleted file mode 100644
index 7bd84761e2..0000000000
--- a/vendor/github.com/go-logr/logr/funcr/slogsink.go
+++ /dev/null
@@ -1,105 +0,0 @@
-//go:build go1.21
-// +build go1.21
-
-/*
-Copyright 2023 The logr Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package funcr
-
-import (
- "context"
- "log/slog"
-
- "github.com/go-logr/logr"
-)
-
-var _ logr.SlogSink = &fnlogger{}
-
-const extraSlogSinkDepth = 3 // 2 for slog, 1 for SlogSink
-
-func (l fnlogger) Handle(_ context.Context, record slog.Record) error {
- kvList := make([]any, 0, 2*record.NumAttrs())
- record.Attrs(func(attr slog.Attr) bool {
- kvList = attrToKVs(attr, kvList)
- return true
- })
-
- if record.Level >= slog.LevelError {
- l.WithCallDepth(extraSlogSinkDepth).Error(nil, record.Message, kvList...)
- } else {
- level := l.levelFromSlog(record.Level)
- l.WithCallDepth(extraSlogSinkDepth).Info(level, record.Message, kvList...)
- }
- return nil
-}
-
-func (l fnlogger) WithAttrs(attrs []slog.Attr) logr.SlogSink {
- kvList := make([]any, 0, 2*len(attrs))
- for _, attr := range attrs {
- kvList = attrToKVs(attr, kvList)
- }
- l.AddValues(kvList)
- return &l
-}
-
-func (l fnlogger) WithGroup(name string) logr.SlogSink {
- l.startGroup(name)
- return &l
-}
-
-// attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups
-// and other details of slog.
-func attrToKVs(attr slog.Attr, kvList []any) []any {
- attrVal := attr.Value.Resolve()
- if attrVal.Kind() == slog.KindGroup {
- groupVal := attrVal.Group()
- grpKVs := make([]any, 0, 2*len(groupVal))
- for _, attr := range groupVal {
- grpKVs = attrToKVs(attr, grpKVs)
- }
- if attr.Key == "" {
- // slog says we have to inline these
- kvList = append(kvList, grpKVs...)
- } else {
- kvList = append(kvList, attr.Key, PseudoStruct(grpKVs))
- }
- } else if attr.Key != "" {
- kvList = append(kvList, attr.Key, attrVal.Any())
- }
-
- return kvList
-}
-
-// levelFromSlog adjusts the level by the logger's verbosity and negates it.
-// It ensures that the result is >= 0. This is necessary because the result is
-// passed to a LogSink and that API did not historically document whether
-// levels could be negative or what that meant.
-//
-// Some example usage:
-//
-// logrV0 := getMyLogger()
-// logrV2 := logrV0.V(2)
-// slogV2 := slog.New(logr.ToSlogHandler(logrV2))
-// slogV2.Debug("msg") // =~ logrV2.V(4) =~ logrV0.V(6)
-// slogV2.Info("msg") // =~ logrV2.V(0) =~ logrV0.V(2)
-// slogv2.Warn("msg") // =~ logrV2.V(-4) =~ logrV0.V(0)
-func (l fnlogger) levelFromSlog(level slog.Level) int {
- result := -level
- if result < 0 {
- result = 0 // because LogSink doesn't expect negative V levels
- }
- return int(result)
-}
diff --git a/vendor/github.com/go-logr/logr/logr.go b/vendor/github.com/go-logr/logr/logr.go
deleted file mode 100644
index b4428e105b..0000000000
--- a/vendor/github.com/go-logr/logr/logr.go
+++ /dev/null
@@ -1,520 +0,0 @@
-/*
-Copyright 2019 The logr Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// This design derives from Dave Cheney's blog:
-// http://dave.cheney.net/2015/11/05/lets-talk-about-logging
-
-// Package logr defines a general-purpose logging API and abstract interfaces
-// to back that API. Packages in the Go ecosystem can depend on this package,
-// while callers can implement logging with whatever backend is appropriate.
-//
-// # Usage
-//
-// Logging is done using a Logger instance. Logger is a concrete type with
-// methods, which defers the actual logging to a LogSink interface. The main
-// methods of Logger are Info() and Error(). Arguments to Info() and Error()
-// are key/value pairs rather than printf-style formatted strings, emphasizing
-// "structured logging".
-//
-// With Go's standard log package, we might write:
-//
-// log.Printf("setting target value %s", targetValue)
-//
-// With logr's structured logging, we'd write:
-//
-// logger.Info("setting target", "value", targetValue)
-//
-// Errors are much the same. Instead of:
-//
-// log.Printf("failed to open the pod bay door for user %s: %v", user, err)
-//
-// We'd write:
-//
-// logger.Error(err, "failed to open the pod bay door", "user", user)
-//
-// Info() and Error() are very similar, but they are separate methods so that
-// LogSink implementations can choose to do things like attach additional
-// information (such as stack traces) on calls to Error(). Error() messages are
-// always logged, regardless of the current verbosity. If there is no error
-// instance available, passing nil is valid.
-//
-// # Verbosity
-//
-// Often we want to log information only when the application in "verbose
-// mode". To write log lines that are more verbose, Logger has a V() method.
-// The higher the V-level of a log line, the less critical it is considered.
-// Log-lines with V-levels that are not enabled (as per the LogSink) will not
-// be written. Level V(0) is the default, and logger.V(0).Info() has the same
-// meaning as logger.Info(). Negative V-levels have the same meaning as V(0).
-// Error messages do not have a verbosity level and are always logged.
-//
-// Where we might have written:
-//
-// if flVerbose >= 2 {
-// log.Printf("an unusual thing happened")
-// }
-//
-// We can write:
-//
-// logger.V(2).Info("an unusual thing happened")
-//
-// # Logger Names
-//
-// Logger instances can have name strings so that all messages logged through
-// that instance have additional context. For example, you might want to add
-// a subsystem name:
-//
-// logger.WithName("compactor").Info("started", "time", time.Now())
-//
-// The WithName() method returns a new Logger, which can be passed to
-// constructors or other functions for further use. Repeated use of WithName()
-// will accumulate name "segments". These name segments will be joined in some
-// way by the LogSink implementation. It is strongly recommended that name
-// segments contain simple identifiers (letters, digits, and hyphen), and do
-// not contain characters that could muddle the log output or confuse the
-// joining operation (e.g. whitespace, commas, periods, slashes, brackets,
-// quotes, etc).
-//
-// # Saved Values
-//
-// Logger instances can store any number of key/value pairs, which will be
-// logged alongside all messages logged through that instance. For example,
-// you might want to create a Logger instance per managed object:
-//
-// With the standard log package, we might write:
-//
-// log.Printf("decided to set field foo to value %q for object %s/%s",
-// targetValue, object.Namespace, object.Name)
-//
-// With logr we'd write:
-//
-// // Elsewhere: set up the logger to log the object name.
-// obj.logger = mainLogger.WithValues(
-// "name", obj.name, "namespace", obj.namespace)
-//
-// // later on...
-// obj.logger.Info("setting foo", "value", targetValue)
-//
-// # Best Practices
-//
-// Logger has very few hard rules, with the goal that LogSink implementations
-// might have a lot of freedom to differentiate. There are, however, some
-// things to consider.
-//
-// The log message consists of a constant message attached to the log line.
-// This should generally be a simple description of what's occurring, and should
-// never be a format string. Variable information can then be attached using
-// named values.
-//
-// Keys are arbitrary strings, but should generally be constant values. Values
-// may be any Go value, but how the value is formatted is determined by the
-// LogSink implementation.
-//
-// Logger instances are meant to be passed around by value. Code that receives
-// such a value can call its methods without having to check whether the
-// instance is ready for use.
-//
-// The zero logger (= Logger{}) is identical to Discard() and discards all log
-// entries. Code that receives a Logger by value can simply call it, the methods
-// will never crash. For cases where passing a logger is optional, a pointer to Logger
-// should be used.
-//
-// # Key Naming Conventions
-//
-// Keys are not strictly required to conform to any specification or regex, but
-// it is recommended that they:
-// - be human-readable and meaningful (not auto-generated or simple ordinals)
-// - be constant (not dependent on input data)
-// - contain only printable characters
-// - not contain whitespace or punctuation
-// - use lower case for simple keys and lowerCamelCase for more complex ones
-//
-// These guidelines help ensure that log data is processed properly regardless
-// of the log implementation. For example, log implementations will try to
-// output JSON data or will store data for later database (e.g. SQL) queries.
-//
-// While users are generally free to use key names of their choice, it's
-// generally best to avoid using the following keys, as they're frequently used
-// by implementations:
-// - "caller": the calling information (file/line) of a particular log line
-// - "error": the underlying error value in the `Error` method
-// - "level": the log level
-// - "logger": the name of the associated logger
-// - "msg": the log message
-// - "stacktrace": the stack trace associated with a particular log line or
-// error (often from the `Error` message)
-// - "ts": the timestamp for a log line
-//
-// Implementations are encouraged to make use of these keys to represent the
-// above concepts, when necessary (for example, in a pure-JSON output form, it
-// would be necessary to represent at least message and timestamp as ordinary
-// named values).
-//
-// # Break Glass
-//
-// Implementations may choose to give callers access to the underlying
-// logging implementation. The recommended pattern for this is:
-//
-// // Underlier exposes access to the underlying logging implementation.
-// // Since callers only have a logr.Logger, they have to know which
-// // implementation is in use, so this interface is less of an abstraction
-// // and more of way to test type conversion.
-// type Underlier interface {
-// GetUnderlying()
-// }
-//
-// Logger grants access to the sink to enable type assertions like this:
-//
-// func DoSomethingWithImpl(log logr.Logger) {
-// if underlier, ok := log.GetSink().(impl.Underlier); ok {
-// implLogger := underlier.GetUnderlying()
-// ...
-// }
-// }
-//
-// Custom `With*` functions can be implemented by copying the complete
-// Logger struct and replacing the sink in the copy:
-//
-// // WithFooBar changes the foobar parameter in the log sink and returns a
-// // new logger with that modified sink. It does nothing for loggers where
-// // the sink doesn't support that parameter.
-// func WithFoobar(log logr.Logger, foobar int) logr.Logger {
-// if foobarLogSink, ok := log.GetSink().(FoobarSink); ok {
-// log = log.WithSink(foobarLogSink.WithFooBar(foobar))
-// }
-// return log
-// }
-//
-// Don't use New to construct a new Logger with a LogSink retrieved from an
-// existing Logger. Source code attribution might not work correctly and
-// unexported fields in Logger get lost.
-//
-// Beware that the same LogSink instance may be shared by different logger
-// instances. Calling functions that modify the LogSink will affect all of
-// those.
-package logr
-
-// New returns a new Logger instance. This is primarily used by libraries
-// implementing LogSink, rather than end users. Passing a nil sink will create
-// a Logger which discards all log lines.
-func New(sink LogSink) Logger {
- logger := Logger{}
- logger.setSink(sink)
- if sink != nil {
- sink.Init(runtimeInfo)
- }
- return logger
-}
-
-// setSink stores the sink and updates any related fields. It mutates the
-// logger and thus is only safe to use for loggers that are not currently being
-// used concurrently.
-func (l *Logger) setSink(sink LogSink) {
- l.sink = sink
-}
-
-// GetSink returns the stored sink.
-func (l Logger) GetSink() LogSink {
- return l.sink
-}
-
-// WithSink returns a copy of the logger with the new sink.
-func (l Logger) WithSink(sink LogSink) Logger {
- l.setSink(sink)
- return l
-}
-
-// Logger is an interface to an abstract logging implementation. This is a
-// concrete type for performance reasons, but all the real work is passed on to
-// a LogSink. Implementations of LogSink should provide their own constructors
-// that return Logger, not LogSink.
-//
-// The underlying sink can be accessed through GetSink and be modified through
-// WithSink. This enables the implementation of custom extensions (see "Break
-// Glass" in the package documentation). Normally the sink should be used only
-// indirectly.
-type Logger struct {
- sink LogSink
- level int
-}
-
-// Enabled tests whether this Logger is enabled. For example, commandline
-// flags might be used to set the logging verbosity and disable some info logs.
-func (l Logger) Enabled() bool {
- // Some implementations of LogSink look at the caller in Enabled (e.g.
- // different verbosity levels per package or file), but we only pass one
- // CallDepth in (via Init). This means that all calls from Logger to the
- // LogSink's Enabled, Info, and Error methods must have the same number of
- // frames. In other words, Logger methods can't call other Logger methods
- // which call these LogSink methods unless we do it the same in all paths.
- return l.sink != nil && l.sink.Enabled(l.level)
-}
-
-// Info logs a non-error message with the given key/value pairs as context.
-//
-// The msg argument should be used to add some constant description to the log
-// line. The key/value pairs can then be used to add additional variable
-// information. The key/value pairs must alternate string keys and arbitrary
-// values.
-func (l Logger) Info(msg string, keysAndValues ...any) {
- if l.sink == nil {
- return
- }
- if l.sink.Enabled(l.level) { // see comment in Enabled
- if withHelper, ok := l.sink.(CallStackHelperLogSink); ok {
- withHelper.GetCallStackHelper()()
- }
- l.sink.Info(l.level, msg, keysAndValues...)
- }
-}
-
-// Error logs an error, with the given message and key/value pairs as context.
-// It functions similarly to Info, but may have unique behavior, and should be
-// preferred for logging errors (see the package documentations for more
-// information). The log message will always be emitted, regardless of
-// verbosity level.
-//
-// The msg argument should be used to add context to any underlying error,
-// while the err argument should be used to attach the actual error that
-// triggered this log line, if present. The err parameter is optional
-// and nil may be passed instead of an error instance.
-func (l Logger) Error(err error, msg string, keysAndValues ...any) {
- if l.sink == nil {
- return
- }
- if withHelper, ok := l.sink.(CallStackHelperLogSink); ok {
- withHelper.GetCallStackHelper()()
- }
- l.sink.Error(err, msg, keysAndValues...)
-}
-
-// V returns a new Logger instance for a specific verbosity level, relative to
-// this Logger. In other words, V-levels are additive. A higher verbosity
-// level means a log message is less important. Negative V-levels are treated
-// as 0.
-func (l Logger) V(level int) Logger {
- if l.sink == nil {
- return l
- }
- if level < 0 {
- level = 0
- }
- l.level += level
- return l
-}
-
-// GetV returns the verbosity level of the logger. If the logger's LogSink is
-// nil as in the Discard logger, this will always return 0.
-func (l Logger) GetV() int {
- // 0 if l.sink nil because of the if check in V above.
- return l.level
-}
-
-// WithValues returns a new Logger instance with additional key/value pairs.
-// See Info for documentation on how key/value pairs work.
-func (l Logger) WithValues(keysAndValues ...any) Logger {
- if l.sink == nil {
- return l
- }
- l.setSink(l.sink.WithValues(keysAndValues...))
- return l
-}
-
-// WithName returns a new Logger instance with the specified name element added
-// to the Logger's name. Successive calls with WithName append additional
-// suffixes to the Logger's name. It's strongly recommended that name segments
-// contain only letters, digits, and hyphens (see the package documentation for
-// more information).
-func (l Logger) WithName(name string) Logger {
- if l.sink == nil {
- return l
- }
- l.setSink(l.sink.WithName(name))
- return l
-}
-
-// WithCallDepth returns a Logger instance that offsets the call stack by the
-// specified number of frames when logging call site information, if possible.
-// This is useful for users who have helper functions between the "real" call
-// site and the actual calls to Logger methods. If depth is 0 the attribution
-// should be to the direct caller of this function. If depth is 1 the
-// attribution should skip 1 call frame, and so on. Successive calls to this
-// are additive.
-//
-// If the underlying log implementation supports a WithCallDepth(int) method,
-// it will be called and the result returned. If the implementation does not
-// support CallDepthLogSink, the original Logger will be returned.
-//
-// To skip one level, WithCallStackHelper() should be used instead of
-// WithCallDepth(1) because it works with implementions that support the
-// CallDepthLogSink and/or CallStackHelperLogSink interfaces.
-func (l Logger) WithCallDepth(depth int) Logger {
- if l.sink == nil {
- return l
- }
- if withCallDepth, ok := l.sink.(CallDepthLogSink); ok {
- l.setSink(withCallDepth.WithCallDepth(depth))
- }
- return l
-}
-
-// WithCallStackHelper returns a new Logger instance that skips the direct
-// caller when logging call site information, if possible. This is useful for
-// users who have helper functions between the "real" call site and the actual
-// calls to Logger methods and want to support loggers which depend on marking
-// each individual helper function, like loggers based on testing.T.
-//
-// In addition to using that new logger instance, callers also must call the
-// returned function.
-//
-// If the underlying log implementation supports a WithCallDepth(int) method,
-// WithCallDepth(1) will be called to produce a new logger. If it supports a
-// WithCallStackHelper() method, that will be also called. If the
-// implementation does not support either of these, the original Logger will be
-// returned.
-func (l Logger) WithCallStackHelper() (func(), Logger) {
- if l.sink == nil {
- return func() {}, l
- }
- var helper func()
- if withCallDepth, ok := l.sink.(CallDepthLogSink); ok {
- l.setSink(withCallDepth.WithCallDepth(1))
- }
- if withHelper, ok := l.sink.(CallStackHelperLogSink); ok {
- helper = withHelper.GetCallStackHelper()
- } else {
- helper = func() {}
- }
- return helper, l
-}
-
-// IsZero returns true if this logger is an uninitialized zero value
-func (l Logger) IsZero() bool {
- return l.sink == nil
-}
-
-// RuntimeInfo holds information that the logr "core" library knows which
-// LogSinks might want to know.
-type RuntimeInfo struct {
- // CallDepth is the number of call frames the logr library adds between the
- // end-user and the LogSink. LogSink implementations which choose to print
- // the original logging site (e.g. file & line) should climb this many
- // additional frames to find it.
- CallDepth int
-}
-
-// runtimeInfo is a static global. It must not be changed at run time.
-var runtimeInfo = RuntimeInfo{
- CallDepth: 1,
-}
-
-// LogSink represents a logging implementation. End-users will generally not
-// interact with this type.
-type LogSink interface {
- // Init receives optional information about the logr library for LogSink
- // implementations that need it.
- Init(info RuntimeInfo)
-
- // Enabled tests whether this LogSink is enabled at the specified V-level.
- // For example, commandline flags might be used to set the logging
- // verbosity and disable some info logs.
- Enabled(level int) bool
-
- // Info logs a non-error message with the given key/value pairs as context.
- // The level argument is provided for optional logging. This method will
- // only be called when Enabled(level) is true. See Logger.Info for more
- // details.
- Info(level int, msg string, keysAndValues ...any)
-
- // Error logs an error, with the given message and key/value pairs as
- // context. See Logger.Error for more details.
- Error(err error, msg string, keysAndValues ...any)
-
- // WithValues returns a new LogSink with additional key/value pairs. See
- // Logger.WithValues for more details.
- WithValues(keysAndValues ...any) LogSink
-
- // WithName returns a new LogSink with the specified name appended. See
- // Logger.WithName for more details.
- WithName(name string) LogSink
-}
-
-// CallDepthLogSink represents a LogSink that knows how to climb the call stack
-// to identify the original call site and can offset the depth by a specified
-// number of frames. This is useful for users who have helper functions
-// between the "real" call site and the actual calls to Logger methods.
-// Implementations that log information about the call site (such as file,
-// function, or line) would otherwise log information about the intermediate
-// helper functions.
-//
-// This is an optional interface and implementations are not required to
-// support it.
-type CallDepthLogSink interface {
- // WithCallDepth returns a LogSink that will offset the call
- // stack by the specified number of frames when logging call
- // site information.
- //
- // If depth is 0, the LogSink should skip exactly the number
- // of call frames defined in RuntimeInfo.CallDepth when Info
- // or Error are called, i.e. the attribution should be to the
- // direct caller of Logger.Info or Logger.Error.
- //
- // If depth is 1 the attribution should skip 1 call frame, and so on.
- // Successive calls to this are additive.
- WithCallDepth(depth int) LogSink
-}
-
-// CallStackHelperLogSink represents a LogSink that knows how to climb
-// the call stack to identify the original call site and can skip
-// intermediate helper functions if they mark themselves as
-// helper. Go's testing package uses that approach.
-//
-// This is useful for users who have helper functions between the
-// "real" call site and the actual calls to Logger methods.
-// Implementations that log information about the call site (such as
-// file, function, or line) would otherwise log information about the
-// intermediate helper functions.
-//
-// This is an optional interface and implementations are not required
-// to support it. Implementations that choose to support this must not
-// simply implement it as WithCallDepth(1), because
-// Logger.WithCallStackHelper will call both methods if they are
-// present. This should only be implemented for LogSinks that actually
-// need it, as with testing.T.
-type CallStackHelperLogSink interface {
- // GetCallStackHelper returns a function that must be called
- // to mark the direct caller as helper function when logging
- // call site information.
- GetCallStackHelper() func()
-}
-
-// Marshaler is an optional interface that logged values may choose to
-// implement. Loggers with structured output, such as JSON, should
-// log the object return by the MarshalLog method instead of the
-// original value.
-type Marshaler interface {
- // MarshalLog can be used to:
- // - ensure that structs are not logged as strings when the original
- // value has a String method: return a different type without a
- // String method
- // - select which fields of a complex type should get logged:
- // return a simpler struct with fewer fields
- // - log unexported fields: return a different struct
- // with exported fields
- //
- // It may return any value of any type.
- MarshalLog() any
-}
diff --git a/vendor/github.com/go-logr/logr/sloghandler.go b/vendor/github.com/go-logr/logr/sloghandler.go
deleted file mode 100644
index 82d1ba4948..0000000000
--- a/vendor/github.com/go-logr/logr/sloghandler.go
+++ /dev/null
@@ -1,192 +0,0 @@
-//go:build go1.21
-// +build go1.21
-
-/*
-Copyright 2023 The logr Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package logr
-
-import (
- "context"
- "log/slog"
-)
-
-type slogHandler struct {
- // May be nil, in which case all logs get discarded.
- sink LogSink
- // Non-nil if sink is non-nil and implements SlogSink.
- slogSink SlogSink
-
- // groupPrefix collects values from WithGroup calls. It gets added as
- // prefix to value keys when handling a log record.
- groupPrefix string
-
- // levelBias can be set when constructing the handler to influence the
- // slog.Level of log records. A positive levelBias reduces the
- // slog.Level value. slog has no API to influence this value after the
- // handler got created, so it can only be set indirectly through
- // Logger.V.
- levelBias slog.Level
-}
-
-var _ slog.Handler = &slogHandler{}
-
-// groupSeparator is used to concatenate WithGroup names and attribute keys.
-const groupSeparator = "."
-
-// GetLevel is used for black box unit testing.
-func (l *slogHandler) GetLevel() slog.Level {
- return l.levelBias
-}
-
-func (l *slogHandler) Enabled(_ context.Context, level slog.Level) bool {
- return l.sink != nil && (level >= slog.LevelError || l.sink.Enabled(l.levelFromSlog(level)))
-}
-
-func (l *slogHandler) Handle(ctx context.Context, record slog.Record) error {
- if l.slogSink != nil {
- // Only adjust verbosity level of log entries < slog.LevelError.
- if record.Level < slog.LevelError {
- record.Level -= l.levelBias
- }
- return l.slogSink.Handle(ctx, record)
- }
-
- // No need to check for nil sink here because Handle will only be called
- // when Enabled returned true.
-
- kvList := make([]any, 0, 2*record.NumAttrs())
- record.Attrs(func(attr slog.Attr) bool {
- kvList = attrToKVs(attr, l.groupPrefix, kvList)
- return true
- })
- if record.Level >= slog.LevelError {
- l.sinkWithCallDepth().Error(nil, record.Message, kvList...)
- } else {
- level := l.levelFromSlog(record.Level)
- l.sinkWithCallDepth().Info(level, record.Message, kvList...)
- }
- return nil
-}
-
-// sinkWithCallDepth adjusts the stack unwinding so that when Error or Info
-// are called by Handle, code in slog gets skipped.
-//
-// This offset currently (Go 1.21.0) works for calls through
-// slog.New(ToSlogHandler(...)). There's no guarantee that the call
-// chain won't change. Wrapping the handler will also break unwinding. It's
-// still better than not adjusting at all....
-//
-// This cannot be done when constructing the handler because FromSlogHandler needs
-// access to the original sink without this adjustment. A second copy would
-// work, but then WithAttrs would have to be called for both of them.
-func (l *slogHandler) sinkWithCallDepth() LogSink {
- if sink, ok := l.sink.(CallDepthLogSink); ok {
- return sink.WithCallDepth(2)
- }
- return l.sink
-}
-
-func (l *slogHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
- if l.sink == nil || len(attrs) == 0 {
- return l
- }
-
- clone := *l
- if l.slogSink != nil {
- clone.slogSink = l.slogSink.WithAttrs(attrs)
- clone.sink = clone.slogSink
- } else {
- kvList := make([]any, 0, 2*len(attrs))
- for _, attr := range attrs {
- kvList = attrToKVs(attr, l.groupPrefix, kvList)
- }
- clone.sink = l.sink.WithValues(kvList...)
- }
- return &clone
-}
-
-func (l *slogHandler) WithGroup(name string) slog.Handler {
- if l.sink == nil {
- return l
- }
- if name == "" {
- // slog says to inline empty groups
- return l
- }
- clone := *l
- if l.slogSink != nil {
- clone.slogSink = l.slogSink.WithGroup(name)
- clone.sink = clone.slogSink
- } else {
- clone.groupPrefix = addPrefix(clone.groupPrefix, name)
- }
- return &clone
-}
-
-// attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups
-// and other details of slog.
-func attrToKVs(attr slog.Attr, groupPrefix string, kvList []any) []any {
- attrVal := attr.Value.Resolve()
- if attrVal.Kind() == slog.KindGroup {
- groupVal := attrVal.Group()
- grpKVs := make([]any, 0, 2*len(groupVal))
- prefix := groupPrefix
- if attr.Key != "" {
- prefix = addPrefix(groupPrefix, attr.Key)
- }
- for _, attr := range groupVal {
- grpKVs = attrToKVs(attr, prefix, grpKVs)
- }
- kvList = append(kvList, grpKVs...)
- } else if attr.Key != "" {
- kvList = append(kvList, addPrefix(groupPrefix, attr.Key), attrVal.Any())
- }
-
- return kvList
-}
-
-func addPrefix(prefix, name string) string {
- if prefix == "" {
- return name
- }
- if name == "" {
- return prefix
- }
- return prefix + groupSeparator + name
-}
-
-// levelFromSlog adjusts the level by the logger's verbosity and negates it.
-// It ensures that the result is >= 0. This is necessary because the result is
-// passed to a LogSink and that API did not historically document whether
-// levels could be negative or what that meant.
-//
-// Some example usage:
-//
-// logrV0 := getMyLogger()
-// logrV2 := logrV0.V(2)
-// slogV2 := slog.New(logr.ToSlogHandler(logrV2))
-// slogV2.Debug("msg") // =~ logrV2.V(4) =~ logrV0.V(6)
-// slogV2.Info("msg") // =~ logrV2.V(0) =~ logrV0.V(2)
-// slogv2.Warn("msg") // =~ logrV2.V(-4) =~ logrV0.V(0)
-func (l *slogHandler) levelFromSlog(level slog.Level) int {
- result := -level
- result += l.levelBias // in case the original Logger had a V level
- if result < 0 {
- result = 0 // because LogSink doesn't expect negative V levels
- }
- return int(result)
-}
diff --git a/vendor/github.com/go-logr/logr/slogr.go b/vendor/github.com/go-logr/logr/slogr.go
deleted file mode 100644
index 28a83d0243..0000000000
--- a/vendor/github.com/go-logr/logr/slogr.go
+++ /dev/null
@@ -1,100 +0,0 @@
-//go:build go1.21
-// +build go1.21
-
-/*
-Copyright 2023 The logr Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package logr
-
-import (
- "context"
- "log/slog"
-)
-
-// FromSlogHandler returns a Logger which writes to the slog.Handler.
-//
-// The logr verbosity level is mapped to slog levels such that V(0) becomes
-// slog.LevelInfo and V(4) becomes slog.LevelDebug.
-func FromSlogHandler(handler slog.Handler) Logger {
- if handler, ok := handler.(*slogHandler); ok {
- if handler.sink == nil {
- return Discard()
- }
- return New(handler.sink).V(int(handler.levelBias))
- }
- return New(&slogSink{handler: handler})
-}
-
-// ToSlogHandler returns a slog.Handler which writes to the same sink as the Logger.
-//
-// The returned logger writes all records with level >= slog.LevelError as
-// error log entries with LogSink.Error, regardless of the verbosity level of
-// the Logger:
-//
-// logger :=
-// slog.New(ToSlogHandler(logger.V(10))).Error(...) -> logSink.Error(...)
-//
-// The level of all other records gets reduced by the verbosity
-// level of the Logger and the result is negated. If it happens
-// to be negative, then it gets replaced by zero because a LogSink
-// is not expected to handled negative levels:
-//
-// slog.New(ToSlogHandler(logger)).Debug(...) -> logger.GetSink().Info(level=4, ...)
-// slog.New(ToSlogHandler(logger)).Warning(...) -> logger.GetSink().Info(level=0, ...)
-// slog.New(ToSlogHandler(logger)).Info(...) -> logger.GetSink().Info(level=0, ...)
-// slog.New(ToSlogHandler(logger.V(4))).Info(...) -> logger.GetSink().Info(level=4, ...)
-func ToSlogHandler(logger Logger) slog.Handler {
- if sink, ok := logger.GetSink().(*slogSink); ok && logger.GetV() == 0 {
- return sink.handler
- }
-
- handler := &slogHandler{sink: logger.GetSink(), levelBias: slog.Level(logger.GetV())}
- if slogSink, ok := handler.sink.(SlogSink); ok {
- handler.slogSink = slogSink
- }
- return handler
-}
-
-// SlogSink is an optional interface that a LogSink can implement to support
-// logging through the slog.Logger or slog.Handler APIs better. It then should
-// also support special slog values like slog.Group. When used as a
-// slog.Handler, the advantages are:
-//
-// - stack unwinding gets avoided in favor of logging the pre-recorded PC,
-// as intended by slog
-// - proper grouping of key/value pairs via WithGroup
-// - verbosity levels > slog.LevelInfo can be recorded
-// - less overhead
-//
-// Both APIs (Logger and slog.Logger/Handler) then are supported equally
-// well. Developers can pick whatever API suits them better and/or mix
-// packages which use either API in the same binary with a common logging
-// implementation.
-//
-// This interface is necessary because the type implementing the LogSink
-// interface cannot also implement the slog.Handler interface due to the
-// different prototype of the common Enabled method.
-//
-// An implementation could support both interfaces in two different types, but then
-// additional interfaces would be needed to convert between those types in FromSlogHandler
-// and ToSlogHandler.
-type SlogSink interface {
- LogSink
-
- Handle(ctx context.Context, record slog.Record) error
- WithAttrs(attrs []slog.Attr) SlogSink
- WithGroup(name string) SlogSink
-}
diff --git a/vendor/github.com/go-logr/logr/slogsink.go b/vendor/github.com/go-logr/logr/slogsink.go
deleted file mode 100644
index 4060fcbc2b..0000000000
--- a/vendor/github.com/go-logr/logr/slogsink.go
+++ /dev/null
@@ -1,120 +0,0 @@
-//go:build go1.21
-// +build go1.21
-
-/*
-Copyright 2023 The logr Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package logr
-
-import (
- "context"
- "log/slog"
- "runtime"
- "time"
-)
-
-var (
- _ LogSink = &slogSink{}
- _ CallDepthLogSink = &slogSink{}
- _ Underlier = &slogSink{}
-)
-
-// Underlier is implemented by the LogSink returned by NewFromLogHandler.
-type Underlier interface {
- // GetUnderlying returns the Handler used by the LogSink.
- GetUnderlying() slog.Handler
-}
-
-const (
- // nameKey is used to log the `WithName` values as an additional attribute.
- nameKey = "logger"
-
- // errKey is used to log the error parameter of Error as an additional attribute.
- errKey = "err"
-)
-
-type slogSink struct {
- callDepth int
- name string
- handler slog.Handler
-}
-
-func (l *slogSink) Init(info RuntimeInfo) {
- l.callDepth = info.CallDepth
-}
-
-func (l *slogSink) GetUnderlying() slog.Handler {
- return l.handler
-}
-
-func (l *slogSink) WithCallDepth(depth int) LogSink {
- newLogger := *l
- newLogger.callDepth += depth
- return &newLogger
-}
-
-func (l *slogSink) Enabled(level int) bool {
- return l.handler.Enabled(context.Background(), slog.Level(-level))
-}
-
-func (l *slogSink) Info(level int, msg string, kvList ...interface{}) {
- l.log(nil, msg, slog.Level(-level), kvList...)
-}
-
-func (l *slogSink) Error(err error, msg string, kvList ...interface{}) {
- l.log(err, msg, slog.LevelError, kvList...)
-}
-
-func (l *slogSink) log(err error, msg string, level slog.Level, kvList ...interface{}) {
- var pcs [1]uintptr
- // skip runtime.Callers, this function, Info/Error, and all helper functions above that.
- runtime.Callers(3+l.callDepth, pcs[:])
-
- record := slog.NewRecord(time.Now(), level, msg, pcs[0])
- if l.name != "" {
- record.AddAttrs(slog.String(nameKey, l.name))
- }
- if err != nil {
- record.AddAttrs(slog.Any(errKey, err))
- }
- record.Add(kvList...)
- _ = l.handler.Handle(context.Background(), record)
-}
-
-func (l slogSink) WithName(name string) LogSink {
- if l.name != "" {
- l.name += "/"
- }
- l.name += name
- return &l
-}
-
-func (l slogSink) WithValues(kvList ...interface{}) LogSink {
- l.handler = l.handler.WithAttrs(kvListToAttrs(kvList...))
- return &l
-}
-
-func kvListToAttrs(kvList ...interface{}) []slog.Attr {
- // We don't need the record itself, only its Add method.
- record := slog.NewRecord(time.Time{}, 0, "", 0)
- record.Add(kvList...)
- attrs := make([]slog.Attr, 0, record.NumAttrs())
- record.Attrs(func(attr slog.Attr) bool {
- attrs = append(attrs, attr)
- return true
- })
- return attrs
-}
diff --git a/vendor/github.com/go-logr/stdr/LICENSE b/vendor/github.com/go-logr/stdr/LICENSE
deleted file mode 100644
index 261eeb9e9f..0000000000
--- a/vendor/github.com/go-logr/stdr/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/go-logr/stdr/README.md b/vendor/github.com/go-logr/stdr/README.md
deleted file mode 100644
index 5158667890..0000000000
--- a/vendor/github.com/go-logr/stdr/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# Minimal Go logging using logr and Go's standard library
-
-[](https://pkg.go.dev/github.com/go-logr/stdr)
-
-This package implements the [logr interface](https://github.com/go-logr/logr)
-in terms of Go's standard log package(https://pkg.go.dev/log).
diff --git a/vendor/github.com/go-logr/stdr/stdr.go b/vendor/github.com/go-logr/stdr/stdr.go
deleted file mode 100644
index 93a8aab51b..0000000000
--- a/vendor/github.com/go-logr/stdr/stdr.go
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
-Copyright 2019 The logr Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package stdr implements github.com/go-logr/logr.Logger in terms of
-// Go's standard log package.
-package stdr
-
-import (
- "log"
- "os"
-
- "github.com/go-logr/logr"
- "github.com/go-logr/logr/funcr"
-)
-
-// The global verbosity level. See SetVerbosity().
-var globalVerbosity int
-
-// SetVerbosity sets the global level against which all info logs will be
-// compared. If this is greater than or equal to the "V" of the logger, the
-// message will be logged. A higher value here means more logs will be written.
-// The previous verbosity value is returned. This is not concurrent-safe -
-// callers must be sure to call it from only one goroutine.
-func SetVerbosity(v int) int {
- old := globalVerbosity
- globalVerbosity = v
- return old
-}
-
-// New returns a logr.Logger which is implemented by Go's standard log package,
-// or something like it. If std is nil, this will use a default logger
-// instead.
-//
-// Example: stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile)))
-func New(std StdLogger) logr.Logger {
- return NewWithOptions(std, Options{})
-}
-
-// NewWithOptions returns a logr.Logger which is implemented by Go's standard
-// log package, or something like it. See New for details.
-func NewWithOptions(std StdLogger, opts Options) logr.Logger {
- if std == nil {
- // Go's log.Default() is only available in 1.16 and higher.
- std = log.New(os.Stderr, "", log.LstdFlags)
- }
-
- if opts.Depth < 0 {
- opts.Depth = 0
- }
-
- fopts := funcr.Options{
- LogCaller: funcr.MessageClass(opts.LogCaller),
- }
-
- sl := &logger{
- Formatter: funcr.NewFormatter(fopts),
- std: std,
- }
-
- // For skipping our own logger.Info/Error.
- sl.Formatter.AddCallDepth(1 + opts.Depth)
-
- return logr.New(sl)
-}
-
-// Options carries parameters which influence the way logs are generated.
-type Options struct {
- // Depth biases the assumed number of call frames to the "true" caller.
- // This is useful when the calling code calls a function which then calls
- // stdr (e.g. a logging shim to another API). Values less than zero will
- // be treated as zero.
- Depth int
-
- // LogCaller tells stdr to add a "caller" key to some or all log lines.
- // Go's log package has options to log this natively, too.
- LogCaller MessageClass
-
- // TODO: add an option to log the date/time
-}
-
-// MessageClass indicates which category or categories of messages to consider.
-type MessageClass int
-
-const (
- // None ignores all message classes.
- None MessageClass = iota
- // All considers all message classes.
- All
- // Info only considers info messages.
- Info
- // Error only considers error messages.
- Error
-)
-
-// StdLogger is the subset of the Go stdlib log.Logger API that is needed for
-// this adapter.
-type StdLogger interface {
- // Output is the same as log.Output and log.Logger.Output.
- Output(calldepth int, logline string) error
-}
-
-type logger struct {
- funcr.Formatter
- std StdLogger
-}
-
-var _ logr.LogSink = &logger{}
-var _ logr.CallDepthLogSink = &logger{}
-
-func (l logger) Enabled(level int) bool {
- return globalVerbosity >= level
-}
-
-func (l logger) Info(level int, msg string, kvList ...interface{}) {
- prefix, args := l.FormatInfo(level, msg, kvList)
- if prefix != "" {
- args = prefix + ": " + args
- }
- _ = l.std.Output(l.Formatter.GetDepth()+1, args)
-}
-
-func (l logger) Error(err error, msg string, kvList ...interface{}) {
- prefix, args := l.FormatError(err, msg, kvList)
- if prefix != "" {
- args = prefix + ": " + args
- }
- _ = l.std.Output(l.Formatter.GetDepth()+1, args)
-}
-
-func (l logger) WithName(name string) logr.LogSink {
- l.Formatter.AddName(name)
- return &l
-}
-
-func (l logger) WithValues(kvList ...interface{}) logr.LogSink {
- l.Formatter.AddValues(kvList)
- return &l
-}
-
-func (l logger) WithCallDepth(depth int) logr.LogSink {
- l.Formatter.AddCallDepth(depth)
- return &l
-}
-
-// Underlier exposes access to the underlying logging implementation. Since
-// callers only have a logr.Logger, they have to know which implementation is
-// in use, so this interface is less of an abstraction and more of way to test
-// type conversion.
-type Underlier interface {
- GetUnderlying() StdLogger
-}
-
-// GetUnderlying returns the StdLogger underneath this logger. Since StdLogger
-// is itself an interface, the result may or may not be a Go log.Logger.
-func (l logger) GetUnderlying() StdLogger {
- return l.std
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/compile.go b/vendor/github.com/goccy/go-json/internal/decoder/compile.go
index fab6437647..8ad50936c0 100644
--- a/vendor/github.com/goccy/go-json/internal/decoder/compile.go
+++ b/vendor/github.com/goccy/go-json/internal/decoder/compile.go
@@ -5,6 +5,7 @@ import (
"fmt"
"reflect"
"strings"
+ "sync"
"sync/atomic"
"unicode"
"unsafe"
@@ -17,22 +18,27 @@ var (
typeAddr *runtime.TypeAddr
cachedDecoderMap unsafe.Pointer // map[uintptr]decoder
cachedDecoder []Decoder
+ initOnce sync.Once
)
-func init() {
- typeAddr = runtime.AnalyzeTypeAddr()
- if typeAddr == nil {
- typeAddr = &runtime.TypeAddr{}
- }
- cachedDecoder = make([]Decoder, typeAddr.AddrRange>>typeAddr.AddrShift+1)
+func initDecoder() {
+ initOnce.Do(func() {
+ typeAddr = runtime.AnalyzeTypeAddr()
+ if typeAddr == nil {
+ typeAddr = &runtime.TypeAddr{}
+ }
+ cachedDecoder = make([]Decoder, typeAddr.AddrRange>>typeAddr.AddrShift+1)
+ })
}
func loadDecoderMap() map[uintptr]Decoder {
+ initDecoder()
p := atomic.LoadPointer(&cachedDecoderMap)
return *(*map[uintptr]Decoder)(unsafe.Pointer(&p))
}
func storeDecoder(typ uintptr, dec Decoder, m map[uintptr]Decoder) {
+ initDecoder()
newDecoderMap := make(map[uintptr]Decoder, len(m)+1)
newDecoderMap[typ] = dec
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/compile_norace.go b/vendor/github.com/goccy/go-json/internal/decoder/compile_norace.go
index eb7e2b1345..025ca85b5e 100644
--- a/vendor/github.com/goccy/go-json/internal/decoder/compile_norace.go
+++ b/vendor/github.com/goccy/go-json/internal/decoder/compile_norace.go
@@ -10,6 +10,7 @@ import (
)
func CompileToGetDecoder(typ *runtime.Type) (Decoder, error) {
+ initDecoder()
typeptr := uintptr(unsafe.Pointer(typ))
if typeptr > typeAddr.MaxTypeAddr {
return compileToGetDecoderSlowPath(typeptr, typ)
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/compile_race.go b/vendor/github.com/goccy/go-json/internal/decoder/compile_race.go
index 49cdda4a17..023b817c36 100644
--- a/vendor/github.com/goccy/go-json/internal/decoder/compile_race.go
+++ b/vendor/github.com/goccy/go-json/internal/decoder/compile_race.go
@@ -13,6 +13,7 @@ import (
var decMu sync.RWMutex
func CompileToGetDecoder(typ *runtime.Type) (Decoder, error) {
+ initDecoder()
typeptr := uintptr(unsafe.Pointer(typ))
if typeptr > typeAddr.MaxTypeAddr {
return compileToGetDecoderSlowPath(typeptr, typ)
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/compiler.go b/vendor/github.com/goccy/go-json/internal/encoder/compiler.go
index 37b7aa38e2..b107636890 100644
--- a/vendor/github.com/goccy/go-json/internal/encoder/compiler.go
+++ b/vendor/github.com/goccy/go-json/internal/encoder/compiler.go
@@ -5,6 +5,7 @@ import (
"encoding"
"encoding/json"
"reflect"
+ "sync"
"sync/atomic"
"unsafe"
@@ -24,14 +25,17 @@ var (
cachedOpcodeSets []*OpcodeSet
cachedOpcodeMap unsafe.Pointer // map[uintptr]*OpcodeSet
typeAddr *runtime.TypeAddr
+ initEncoderOnce sync.Once
)
-func init() {
- typeAddr = runtime.AnalyzeTypeAddr()
- if typeAddr == nil {
- typeAddr = &runtime.TypeAddr{}
- }
- cachedOpcodeSets = make([]*OpcodeSet, typeAddr.AddrRange>>typeAddr.AddrShift+1)
+func initEncoder() {
+ initEncoderOnce.Do(func() {
+ typeAddr = runtime.AnalyzeTypeAddr()
+ if typeAddr == nil {
+ typeAddr = &runtime.TypeAddr{}
+ }
+ cachedOpcodeSets = make([]*OpcodeSet, typeAddr.AddrRange>>typeAddr.AddrShift+1)
+ })
}
func loadOpcodeMap() map[uintptr]*OpcodeSet {
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/compiler_norace.go b/vendor/github.com/goccy/go-json/internal/encoder/compiler_norace.go
index 20c93cbf70..b6f45a49b0 100644
--- a/vendor/github.com/goccy/go-json/internal/encoder/compiler_norace.go
+++ b/vendor/github.com/goccy/go-json/internal/encoder/compiler_norace.go
@@ -4,6 +4,7 @@
package encoder
func CompileToGetCodeSet(ctx *RuntimeContext, typeptr uintptr) (*OpcodeSet, error) {
+ initEncoder()
if typeptr > typeAddr.MaxTypeAddr || typeptr < typeAddr.BaseTypeAddr {
codeSet, err := compileToGetCodeSetSlowPath(typeptr)
if err != nil {
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/compiler_race.go b/vendor/github.com/goccy/go-json/internal/encoder/compiler_race.go
index 13ba23fdff..47b482f7fb 100644
--- a/vendor/github.com/goccy/go-json/internal/encoder/compiler_race.go
+++ b/vendor/github.com/goccy/go-json/internal/encoder/compiler_race.go
@@ -10,6 +10,7 @@ import (
var setsMu sync.RWMutex
func CompileToGetCodeSet(ctx *RuntimeContext, typeptr uintptr) (*OpcodeSet, error) {
+ initEncoder()
if typeptr > typeAddr.MaxTypeAddr || typeptr < typeAddr.BaseTypeAddr {
codeSet, err := compileToGetCodeSetSlowPath(typeptr)
if err != nil {
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/encoder.go b/vendor/github.com/goccy/go-json/internal/encoder/encoder.go
index 14eb6a0d64..b436f5b21f 100644
--- a/vendor/github.com/goccy/go-json/internal/encoder/encoder.go
+++ b/vendor/github.com/goccy/go-json/internal/encoder/encoder.go
@@ -406,6 +406,11 @@ func AppendMarshalJSON(ctx *RuntimeContext, code *Opcode, b []byte, v interface{
rv = newV
}
}
+
+ if rv.Kind() == reflect.Ptr && rv.IsNil() {
+ return AppendNull(ctx, b), nil
+ }
+
v = rv.Interface()
var bb []byte
if (code.Flags & MarshalerContextFlags) != 0 {
diff --git a/vendor/github.com/goccy/go-json/internal/runtime/type.go b/vendor/github.com/goccy/go-json/internal/runtime/type.go
index 0167cd2c01..4b693cb0bb 100644
--- a/vendor/github.com/goccy/go-json/internal/runtime/type.go
+++ b/vendor/github.com/goccy/go-json/internal/runtime/type.go
@@ -2,6 +2,7 @@ package runtime
import (
"reflect"
+ "sync"
"unsafe"
)
@@ -23,8 +24,8 @@ type TypeAddr struct {
}
var (
- typeAddr *TypeAddr
- alreadyAnalyzed bool
+ typeAddr *TypeAddr
+ once sync.Once
)
//go:linkname typelinks reflect.typelinks
@@ -34,67 +35,64 @@ func typelinks() ([]unsafe.Pointer, [][]int32)
func rtypeOff(unsafe.Pointer, int32) unsafe.Pointer
func AnalyzeTypeAddr() *TypeAddr {
- defer func() {
- alreadyAnalyzed = true
- }()
- if alreadyAnalyzed {
- return typeAddr
- }
- sections, offsets := typelinks()
- if len(sections) != 1 {
- return nil
- }
- if len(offsets) != 1 {
- return nil
- }
- section := sections[0]
- offset := offsets[0]
- var (
- min uintptr = uintptr(^uint(0))
- max uintptr = 0
- isAligned64 = true
- isAligned32 = true
- )
- for i := 0; i < len(offset); i++ {
- typ := (*Type)(rtypeOff(section, offset[i]))
- addr := uintptr(unsafe.Pointer(typ))
- if min > addr {
- min = addr
+ once.Do(func() {
+ sections, offsets := typelinks()
+ if len(sections) != 1 {
+ return
}
- if max < addr {
- max = addr
+ if len(offsets) != 1 {
+ return
}
- if typ.Kind() == reflect.Ptr {
- addr = uintptr(unsafe.Pointer(typ.Elem()))
+ section := sections[0]
+ offset := offsets[0]
+ var (
+ min uintptr = uintptr(^uint(0))
+ max uintptr = 0
+ isAligned64 = true
+ isAligned32 = true
+ )
+ for i := 0; i < len(offset); i++ {
+ typ := (*Type)(rtypeOff(section, offset[i]))
+ addr := uintptr(unsafe.Pointer(typ))
if min > addr {
min = addr
}
if max < addr {
max = addr
}
+ if typ.Kind() == reflect.Ptr {
+ addr = uintptr(unsafe.Pointer(typ.Elem()))
+ if min > addr {
+ min = addr
+ }
+ if max < addr {
+ max = addr
+ }
+ }
+ isAligned64 = isAligned64 && (addr-min)&63 == 0
+ isAligned32 = isAligned32 && (addr-min)&31 == 0
+ }
+ addrRange := max - min
+ if addrRange == 0 {
+ return
+ }
+ var addrShift uintptr
+ if isAligned64 {
+ addrShift = 6
+ } else if isAligned32 {
+ addrShift = 5
}
- isAligned64 = isAligned64 && (addr-min)&63 == 0
- isAligned32 = isAligned32 && (addr-min)&31 == 0
- }
- addrRange := max - min
- if addrRange == 0 {
- return nil
- }
- var addrShift uintptr
- if isAligned64 {
- addrShift = 6
- } else if isAligned32 {
- addrShift = 5
- }
- cacheSize := addrRange >> addrShift
- if cacheSize > maxAcceptableTypeAddrRange {
- return nil
- }
- typeAddr = &TypeAddr{
- BaseTypeAddr: min,
- MaxTypeAddr: max,
- AddrRange: addrRange,
- AddrShift: addrShift,
- }
+ cacheSize := addrRange >> addrShift
+ if cacheSize > maxAcceptableTypeAddrRange {
+ return
+ }
+ typeAddr = &TypeAddr{
+ BaseTypeAddr: min,
+ MaxTypeAddr: max,
+ AddrRange: addrRange,
+ AddrShift: addrShift,
+ }
+ })
+
return typeAddr
}
diff --git a/vendor/github.com/gorilla/mux/.editorconfig b/vendor/github.com/gorilla/mux/.editorconfig
deleted file mode 100644
index c6b74c3e0d..0000000000
--- a/vendor/github.com/gorilla/mux/.editorconfig
+++ /dev/null
@@ -1,20 +0,0 @@
-; https://editorconfig.org/
-
-root = true
-
-[*]
-insert_final_newline = true
-charset = utf-8
-trim_trailing_whitespace = true
-indent_style = space
-indent_size = 2
-
-[{Makefile,go.mod,go.sum,*.go,.gitmodules}]
-indent_style = tab
-indent_size = 4
-
-[*.md]
-indent_size = 4
-trim_trailing_whitespace = false
-
-eclint_indent_style = unset
\ No newline at end of file
diff --git a/vendor/github.com/gorilla/mux/.gitignore b/vendor/github.com/gorilla/mux/.gitignore
deleted file mode 100644
index 84039fec68..0000000000
--- a/vendor/github.com/gorilla/mux/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-coverage.coverprofile
diff --git a/vendor/github.com/gorilla/mux/LICENSE b/vendor/github.com/gorilla/mux/LICENSE
deleted file mode 100644
index bb9d80bc9b..0000000000
--- a/vendor/github.com/gorilla/mux/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2023 The Gorilla Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/gorilla/mux/Makefile b/vendor/github.com/gorilla/mux/Makefile
deleted file mode 100644
index 98f5ab75f9..0000000000
--- a/vendor/github.com/gorilla/mux/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-GO_LINT=$(shell which golangci-lint 2> /dev/null || echo '')
-GO_LINT_URI=github.com/golangci/golangci-lint/cmd/golangci-lint@latest
-
-GO_SEC=$(shell which gosec 2> /dev/null || echo '')
-GO_SEC_URI=github.com/securego/gosec/v2/cmd/gosec@latest
-
-GO_VULNCHECK=$(shell which govulncheck 2> /dev/null || echo '')
-GO_VULNCHECK_URI=golang.org/x/vuln/cmd/govulncheck@latest
-
-.PHONY: golangci-lint
-golangci-lint:
- $(if $(GO_LINT), ,go install $(GO_LINT_URI))
- @echo "##### Running golangci-lint"
- golangci-lint run -v
-
-.PHONY: gosec
-gosec:
- $(if $(GO_SEC), ,go install $(GO_SEC_URI))
- @echo "##### Running gosec"
- gosec ./...
-
-.PHONY: govulncheck
-govulncheck:
- $(if $(GO_VULNCHECK), ,go install $(GO_VULNCHECK_URI))
- @echo "##### Running govulncheck"
- govulncheck ./...
-
-.PHONY: verify
-verify: golangci-lint gosec govulncheck
-
-.PHONY: test
-test:
- @echo "##### Running tests"
- go test -race -cover -coverprofile=coverage.coverprofile -covermode=atomic -v ./...
\ No newline at end of file
diff --git a/vendor/github.com/gorilla/mux/README.md b/vendor/github.com/gorilla/mux/README.md
deleted file mode 100644
index 382513d57c..0000000000
--- a/vendor/github.com/gorilla/mux/README.md
+++ /dev/null
@@ -1,812 +0,0 @@
-# gorilla/mux
-
-
-[](https://codecov.io/github/gorilla/mux)
-[](https://godoc.org/github.com/gorilla/mux)
-[](https://sourcegraph.com/github.com/gorilla/mux?badge)
-
-
-
-
-Package `gorilla/mux` implements a request router and dispatcher for matching incoming requests to
-their respective handler.
-
-The name mux stands for "HTTP request multiplexer". Like the standard `http.ServeMux`, `mux.Router` matches incoming requests against a list of registered routes and calls a handler for the route that matches the URL or other conditions. The main features are:
-
-* It implements the `http.Handler` interface so it is compatible with the standard `http.ServeMux`.
-* Requests can be matched based on URL host, path, path prefix, schemes, header and query values, HTTP methods or using custom matchers.
-* URL hosts, paths and query values can have variables with an optional regular expression.
-* Registered URLs can be built, or "reversed", which helps maintaining references to resources.
-* Routes can be used as subrouters: nested routes are only tested if the parent route matches. This is useful to define groups of routes that share common conditions like a host, a path prefix or other repeated attributes. As a bonus, this optimizes request matching.
-
----
-
-* [Install](#install)
-* [Examples](#examples)
-* [Matching Routes](#matching-routes)
-* [Static Files](#static-files)
-* [Serving Single Page Applications](#serving-single-page-applications) (e.g. React, Vue, Ember.js, etc.)
-* [Registered URLs](#registered-urls)
-* [Walking Routes](#walking-routes)
-* [Graceful Shutdown](#graceful-shutdown)
-* [Middleware](#middleware)
-* [Handling CORS Requests](#handling-cors-requests)
-* [Testing Handlers](#testing-handlers)
-* [Full Example](#full-example)
-
----
-
-## Install
-
-With a [correctly configured](https://golang.org/doc/install#testing) Go toolchain:
-
-```sh
-go get -u github.com/gorilla/mux
-```
-
-## Examples
-
-Let's start registering a couple of URL paths and handlers:
-
-```go
-func main() {
- r := mux.NewRouter()
- r.HandleFunc("/", HomeHandler)
- r.HandleFunc("/products", ProductsHandler)
- r.HandleFunc("/articles", ArticlesHandler)
- http.Handle("/", r)
-}
-```
-
-Here we register three routes mapping URL paths to handlers. This is equivalent to how `http.HandleFunc()` works: if an incoming request URL matches one of the paths, the corresponding handler is called passing (`http.ResponseWriter`, `*http.Request`) as parameters.
-
-Paths can have variables. They are defined using the format `{name}` or `{name:pattern}`. If a regular expression pattern is not defined, the matched variable will be anything until the next slash. For example:
-
-```go
-r := mux.NewRouter()
-r.HandleFunc("/products/{key}", ProductHandler)
-r.HandleFunc("/articles/{category}/", ArticlesCategoryHandler)
-r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler)
-```
-
-The names are used to create a map of route variables which can be retrieved calling `mux.Vars()`:
-
-```go
-func ArticlesCategoryHandler(w http.ResponseWriter, r *http.Request) {
- vars := mux.Vars(r)
- w.WriteHeader(http.StatusOK)
- fmt.Fprintf(w, "Category: %v\n", vars["category"])
-}
-```
-
-And this is all you need to know about the basic usage. More advanced options are explained below.
-
-### Matching Routes
-
-Routes can also be restricted to a domain or subdomain. Just define a host pattern to be matched. They can also have variables:
-
-```go
-r := mux.NewRouter()
-// Only matches if domain is "www.example.com".
-r.Host("www.example.com")
-// Matches a dynamic subdomain.
-r.Host("{subdomain:[a-z]+}.example.com")
-```
-
-There are several other matchers that can be added. To match path prefixes:
-
-```go
-r.PathPrefix("/products/")
-```
-
-...or HTTP methods:
-
-```go
-r.Methods("GET", "POST")
-```
-
-...or URL schemes:
-
-```go
-r.Schemes("https")
-```
-
-...or header values:
-
-```go
-r.Headers("X-Requested-With", "XMLHttpRequest")
-```
-
-...or query values:
-
-```go
-r.Queries("key", "value")
-```
-
-...or to use a custom matcher function:
-
-```go
-r.MatcherFunc(func(r *http.Request, rm *RouteMatch) bool {
- return r.ProtoMajor == 0
-})
-```
-
-...and finally, it is possible to combine several matchers in a single route:
-
-```go
-r.HandleFunc("/products", ProductsHandler).
- Host("www.example.com").
- Methods("GET").
- Schemes("http")
-```
-
-Routes are tested in the order they were added to the router. If two routes match, the first one wins:
-
-```go
-r := mux.NewRouter()
-r.HandleFunc("/specific", specificHandler)
-r.PathPrefix("/").Handler(catchAllHandler)
-```
-
-Setting the same matching conditions again and again can be boring, so we have a way to group several routes that share the same requirements. We call it "subrouting".
-
-For example, let's say we have several URLs that should only match when the host is `www.example.com`. Create a route for that host and get a "subrouter" from it:
-
-```go
-r := mux.NewRouter()
-s := r.Host("www.example.com").Subrouter()
-```
-
-Then register routes in the subrouter:
-
-```go
-s.HandleFunc("/products/", ProductsHandler)
-s.HandleFunc("/products/{key}", ProductHandler)
-s.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler)
-```
-
-The three URL paths we registered above will only be tested if the domain is `www.example.com`, because the subrouter is tested first. This is not only convenient, but also optimizes request matching. You can create subrouters combining any attribute matchers accepted by a route.
-
-Subrouters can be used to create domain or path "namespaces": you define subrouters in a central place and then parts of the app can register its paths relatively to a given subrouter.
-
-There's one more thing about subroutes. When a subrouter has a path prefix, the inner routes use it as base for their paths:
-
-```go
-r := mux.NewRouter()
-s := r.PathPrefix("/products").Subrouter()
-// "/products/"
-s.HandleFunc("/", ProductsHandler)
-// "/products/{key}/"
-s.HandleFunc("/{key}/", ProductHandler)
-// "/products/{key}/details"
-s.HandleFunc("/{key}/details", ProductDetailsHandler)
-```
-
-
-### Static Files
-
-Note that the path provided to `PathPrefix()` represents a "wildcard": calling
-`PathPrefix("/static/").Handler(...)` means that the handler will be passed any
-request that matches "/static/\*". This makes it easy to serve static files with mux:
-
-```go
-func main() {
- var dir string
-
- flag.StringVar(&dir, "dir", ".", "the directory to serve files from. Defaults to the current dir")
- flag.Parse()
- r := mux.NewRouter()
-
- // This will serve files under http://localhost:8000/static/
- r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir(dir))))
-
- srv := &http.Server{
- Handler: r,
- Addr: "127.0.0.1:8000",
- // Good practice: enforce timeouts for servers you create!
- WriteTimeout: 15 * time.Second,
- ReadTimeout: 15 * time.Second,
- }
-
- log.Fatal(srv.ListenAndServe())
-}
-```
-
-### Serving Single Page Applications
-
-Most of the time it makes sense to serve your SPA on a separate web server from your API,
-but sometimes it's desirable to serve them both from one place. It's possible to write a simple
-handler for serving your SPA (for use with React Router's [BrowserRouter](https://reacttraining.com/react-router/web/api/BrowserRouter) for example), and leverage
-mux's powerful routing for your API endpoints.
-
-```go
-package main
-
-import (
- "encoding/json"
- "log"
- "net/http"
- "os"
- "path/filepath"
- "time"
-
- "github.com/gorilla/mux"
-)
-
-// spaHandler implements the http.Handler interface, so we can use it
-// to respond to HTTP requests. The path to the static directory and
-// path to the index file within that static directory are used to
-// serve the SPA in the given static directory.
-type spaHandler struct {
- staticPath string
- indexPath string
-}
-
-// ServeHTTP inspects the URL path to locate a file within the static dir
-// on the SPA handler. If a file is found, it will be served. If not, the
-// file located at the index path on the SPA handler will be served. This
-// is suitable behavior for serving an SPA (single page application).
-func (h spaHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
- // Join internally call path.Clean to prevent directory traversal
- path := filepath.Join(h.staticPath, r.URL.Path)
-
- // check whether a file exists or is a directory at the given path
- fi, err := os.Stat(path)
- if os.IsNotExist(err) || fi.IsDir() {
- // file does not exist or path is a directory, serve index.html
- http.ServeFile(w, r, filepath.Join(h.staticPath, h.indexPath))
- return
- }
-
- if err != nil {
- // if we got an error (that wasn't that the file doesn't exist) stating the
- // file, return a 500 internal server error and stop
- http.Error(w, err.Error(), http.StatusInternalServerError)
- return
- }
-
- // otherwise, use http.FileServer to serve the static file
- http.FileServer(http.Dir(h.staticPath)).ServeHTTP(w, r)
-}
-
-func main() {
- router := mux.NewRouter()
-
- router.HandleFunc("/api/health", func(w http.ResponseWriter, r *http.Request) {
- // an example API handler
- json.NewEncoder(w).Encode(map[string]bool{"ok": true})
- })
-
- spa := spaHandler{staticPath: "build", indexPath: "index.html"}
- router.PathPrefix("/").Handler(spa)
-
- srv := &http.Server{
- Handler: router,
- Addr: "127.0.0.1:8000",
- // Good practice: enforce timeouts for servers you create!
- WriteTimeout: 15 * time.Second,
- ReadTimeout: 15 * time.Second,
- }
-
- log.Fatal(srv.ListenAndServe())
-}
-```
-
-### Registered URLs
-
-Now let's see how to build registered URLs.
-
-Routes can be named. All routes that define a name can have their URLs built, or "reversed". We define a name calling `Name()` on a route. For example:
-
-```go
-r := mux.NewRouter()
-r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler).
- Name("article")
-```
-
-To build a URL, get the route and call the `URL()` method, passing a sequence of key/value pairs for the route variables. For the previous route, we would do:
-
-```go
-url, err := r.Get("article").URL("category", "technology", "id", "42")
-```
-
-...and the result will be a `url.URL` with the following path:
-
-```
-"/articles/technology/42"
-```
-
-This also works for host and query value variables:
-
-```go
-r := mux.NewRouter()
-r.Host("{subdomain}.example.com").
- Path("/articles/{category}/{id:[0-9]+}").
- Queries("filter", "{filter}").
- HandlerFunc(ArticleHandler).
- Name("article")
-
-// url.String() will be "http://news.example.com/articles/technology/42?filter=gorilla"
-url, err := r.Get("article").URL("subdomain", "news",
- "category", "technology",
- "id", "42",
- "filter", "gorilla")
-```
-
-All variables defined in the route are required, and their values must conform to the corresponding patterns. These requirements guarantee that a generated URL will always match a registered route -- the only exception is for explicitly defined "build-only" routes which never match.
-
-Regex support also exists for matching Headers within a route. For example, we could do:
-
-```go
-r.HeadersRegexp("Content-Type", "application/(text|json)")
-```
-
-...and the route will match both requests with a Content-Type of `application/json` as well as `application/text`
-
-There's also a way to build only the URL host or path for a route: use the methods `URLHost()` or `URLPath()` instead. For the previous route, we would do:
-
-```go
-// "http://news.example.com/"
-host, err := r.Get("article").URLHost("subdomain", "news")
-
-// "/articles/technology/42"
-path, err := r.Get("article").URLPath("category", "technology", "id", "42")
-```
-
-And if you use subrouters, host and path defined separately can be built as well:
-
-```go
-r := mux.NewRouter()
-s := r.Host("{subdomain}.example.com").Subrouter()
-s.Path("/articles/{category}/{id:[0-9]+}").
- HandlerFunc(ArticleHandler).
- Name("article")
-
-// "http://news.example.com/articles/technology/42"
-url, err := r.Get("article").URL("subdomain", "news",
- "category", "technology",
- "id", "42")
-```
-
-To find all the required variables for a given route when calling `URL()`, the method `GetVarNames()` is available:
-```go
-r := mux.NewRouter()
-r.Host("{domain}").
- Path("/{group}/{item_id}").
- Queries("some_data1", "{some_data1}").
- Queries("some_data2", "{some_data2}").
- Name("article")
-
-// Will print [domain group item_id some_data1 some_data2]
-fmt.Println(r.Get("article").GetVarNames())
-
-```
-### Walking Routes
-
-The `Walk` function on `mux.Router` can be used to visit all of the routes that are registered on a router. For example,
-the following prints all of the registered routes:
-
-```go
-package main
-
-import (
- "fmt"
- "net/http"
- "strings"
-
- "github.com/gorilla/mux"
-)
-
-func handler(w http.ResponseWriter, r *http.Request) {
- return
-}
-
-func main() {
- r := mux.NewRouter()
- r.HandleFunc("/", handler)
- r.HandleFunc("/products", handler).Methods("POST")
- r.HandleFunc("/articles", handler).Methods("GET")
- r.HandleFunc("/articles/{id}", handler).Methods("GET", "PUT")
- r.HandleFunc("/authors", handler).Queries("surname", "{surname}")
- err := r.Walk(func(route *mux.Route, router *mux.Router, ancestors []*mux.Route) error {
- pathTemplate, err := route.GetPathTemplate()
- if err == nil {
- fmt.Println("ROUTE:", pathTemplate)
- }
- pathRegexp, err := route.GetPathRegexp()
- if err == nil {
- fmt.Println("Path regexp:", pathRegexp)
- }
- queriesTemplates, err := route.GetQueriesTemplates()
- if err == nil {
- fmt.Println("Queries templates:", strings.Join(queriesTemplates, ","))
- }
- queriesRegexps, err := route.GetQueriesRegexp()
- if err == nil {
- fmt.Println("Queries regexps:", strings.Join(queriesRegexps, ","))
- }
- methods, err := route.GetMethods()
- if err == nil {
- fmt.Println("Methods:", strings.Join(methods, ","))
- }
- fmt.Println()
- return nil
- })
-
- if err != nil {
- fmt.Println(err)
- }
-
- http.Handle("/", r)
-}
-```
-
-### Graceful Shutdown
-
-Go 1.8 introduced the ability to [gracefully shutdown](https://golang.org/doc/go1.8#http_shutdown) a `*http.Server`. Here's how to do that alongside `mux`:
-
-```go
-package main
-
-import (
- "context"
- "flag"
- "log"
- "net/http"
- "os"
- "os/signal"
- "time"
-
- "github.com/gorilla/mux"
-)
-
-func main() {
- var wait time.Duration
- flag.DurationVar(&wait, "graceful-timeout", time.Second * 15, "the duration for which the server gracefully wait for existing connections to finish - e.g. 15s or 1m")
- flag.Parse()
-
- r := mux.NewRouter()
- // Add your routes as needed
-
- srv := &http.Server{
- Addr: "0.0.0.0:8080",
- // Good practice to set timeouts to avoid Slowloris attacks.
- WriteTimeout: time.Second * 15,
- ReadTimeout: time.Second * 15,
- IdleTimeout: time.Second * 60,
- Handler: r, // Pass our instance of gorilla/mux in.
- }
-
- // Run our server in a goroutine so that it doesn't block.
- go func() {
- if err := srv.ListenAndServe(); err != nil {
- log.Println(err)
- }
- }()
-
- c := make(chan os.Signal, 1)
- // We'll accept graceful shutdowns when quit via SIGINT (Ctrl+C)
- // SIGKILL, SIGQUIT or SIGTERM (Ctrl+/) will not be caught.
- signal.Notify(c, os.Interrupt)
-
- // Block until we receive our signal.
- <-c
-
- // Create a deadline to wait for.
- ctx, cancel := context.WithTimeout(context.Background(), wait)
- defer cancel()
- // Doesn't block if no connections, but will otherwise wait
- // until the timeout deadline.
- srv.Shutdown(ctx)
- // Optionally, you could run srv.Shutdown in a goroutine and block on
- // <-ctx.Done() if your application should wait for other services
- // to finalize based on context cancellation.
- log.Println("shutting down")
- os.Exit(0)
-}
-```
-
-### Middleware
-
-Mux supports the addition of middlewares to a [Router](https://godoc.org/github.com/gorilla/mux#Router), which are executed in the order they are added if a match is found, including its subrouters.
-Middlewares are (typically) small pieces of code which take one request, do something with it, and pass it down to another middleware or the final handler. Some common use cases for middleware are request logging, header manipulation, or `ResponseWriter` hijacking.
-
-Mux middlewares are defined using the de facto standard type:
-
-```go
-type MiddlewareFunc func(http.Handler) http.Handler
-```
-
-Typically, the returned handler is a closure which does something with the http.ResponseWriter and http.Request passed to it, and then calls the handler passed as parameter to the MiddlewareFunc. This takes advantage of closures being able access variables from the context where they are created, while retaining the signature enforced by the receivers.
-
-A very basic middleware which logs the URI of the request being handled could be written as:
-
-```go
-func loggingMiddleware(next http.Handler) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- // Do stuff here
- log.Println(r.RequestURI)
- // Call the next handler, which can be another middleware in the chain, or the final handler.
- next.ServeHTTP(w, r)
- })
-}
-```
-
-Middlewares can be added to a router using `Router.Use()`:
-
-```go
-r := mux.NewRouter()
-r.HandleFunc("/", handler)
-r.Use(loggingMiddleware)
-```
-
-A more complex authentication middleware, which maps session token to users, could be written as:
-
-```go
-// Define our struct
-type authenticationMiddleware struct {
- tokenUsers map[string]string
-}
-
-// Initialize it somewhere
-func (amw *authenticationMiddleware) Populate() {
- amw.tokenUsers["00000000"] = "user0"
- amw.tokenUsers["aaaaaaaa"] = "userA"
- amw.tokenUsers["05f717e5"] = "randomUser"
- amw.tokenUsers["deadbeef"] = "user0"
-}
-
-// Middleware function, which will be called for each request
-func (amw *authenticationMiddleware) Middleware(next http.Handler) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- token := r.Header.Get("X-Session-Token")
-
- if user, found := amw.tokenUsers[token]; found {
- // We found the token in our map
- log.Printf("Authenticated user %s\n", user)
- // Pass down the request to the next middleware (or final handler)
- next.ServeHTTP(w, r)
- } else {
- // Write an error and stop the handler chain
- http.Error(w, "Forbidden", http.StatusForbidden)
- }
- })
-}
-```
-
-```go
-r := mux.NewRouter()
-r.HandleFunc("/", handler)
-
-amw := authenticationMiddleware{tokenUsers: make(map[string]string)}
-amw.Populate()
-
-r.Use(amw.Middleware)
-```
-
-Note: The handler chain will be stopped if your middleware doesn't call `next.ServeHTTP()` with the corresponding parameters. This can be used to abort a request if the middleware writer wants to. Middlewares _should_ write to `ResponseWriter` if they _are_ going to terminate the request, and they _should not_ write to `ResponseWriter` if they _are not_ going to terminate it.
-
-### Handling CORS Requests
-
-[CORSMethodMiddleware](https://godoc.org/github.com/gorilla/mux#CORSMethodMiddleware) intends to make it easier to strictly set the `Access-Control-Allow-Methods` response header.
-
-* You will still need to use your own CORS handler to set the other CORS headers such as `Access-Control-Allow-Origin`
-* The middleware will set the `Access-Control-Allow-Methods` header to all the method matchers (e.g. `r.Methods(http.MethodGet, http.MethodPut, http.MethodOptions)` -> `Access-Control-Allow-Methods: GET,PUT,OPTIONS`) on a route
-* If you do not specify any methods, then:
-> _Important_: there must be an `OPTIONS` method matcher for the middleware to set the headers.
-
-Here is an example of using `CORSMethodMiddleware` along with a custom `OPTIONS` handler to set all the required CORS headers:
-
-```go
-package main
-
-import (
- "net/http"
- "github.com/gorilla/mux"
-)
-
-func main() {
- r := mux.NewRouter()
-
- // IMPORTANT: you must specify an OPTIONS method matcher for the middleware to set CORS headers
- r.HandleFunc("/foo", fooHandler).Methods(http.MethodGet, http.MethodPut, http.MethodPatch, http.MethodOptions)
- r.Use(mux.CORSMethodMiddleware(r))
-
- http.ListenAndServe(":8080", r)
-}
-
-func fooHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Access-Control-Allow-Origin", "*")
- if r.Method == http.MethodOptions {
- return
- }
-
- w.Write([]byte("foo"))
-}
-```
-
-And an request to `/foo` using something like:
-
-```bash
-curl localhost:8080/foo -v
-```
-
-Would look like:
-
-```bash
-* Trying ::1...
-* TCP_NODELAY set
-* Connected to localhost (::1) port 8080 (#0)
-> GET /foo HTTP/1.1
-> Host: localhost:8080
-> User-Agent: curl/7.59.0
-> Accept: */*
->
-< HTTP/1.1 200 OK
-< Access-Control-Allow-Methods: GET,PUT,PATCH,OPTIONS
-< Access-Control-Allow-Origin: *
-< Date: Fri, 28 Jun 2019 20:13:30 GMT
-< Content-Length: 3
-< Content-Type: text/plain; charset=utf-8
-<
-* Connection #0 to host localhost left intact
-foo
-```
-
-### Testing Handlers
-
-Testing handlers in a Go web application is straightforward, and _mux_ doesn't complicate this any further. Given two files: `endpoints.go` and `endpoints_test.go`, here's how we'd test an application using _mux_.
-
-First, our simple HTTP handler:
-
-```go
-// endpoints.go
-package main
-
-func HealthCheckHandler(w http.ResponseWriter, r *http.Request) {
- // A very simple health check.
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
-
- // In the future we could report back on the status of our DB, or our cache
- // (e.g. Redis) by performing a simple PING, and include them in the response.
- io.WriteString(w, `{"alive": true}`)
-}
-
-func main() {
- r := mux.NewRouter()
- r.HandleFunc("/health", HealthCheckHandler)
-
- log.Fatal(http.ListenAndServe("localhost:8080", r))
-}
-```
-
-Our test code:
-
-```go
-// endpoints_test.go
-package main
-
-import (
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestHealthCheckHandler(t *testing.T) {
- // Create a request to pass to our handler. We don't have any query parameters for now, so we'll
- // pass 'nil' as the third parameter.
- req, err := http.NewRequest("GET", "/health", nil)
- if err != nil {
- t.Fatal(err)
- }
-
- // We create a ResponseRecorder (which satisfies http.ResponseWriter) to record the response.
- rr := httptest.NewRecorder()
- handler := http.HandlerFunc(HealthCheckHandler)
-
- // Our handlers satisfy http.Handler, so we can call their ServeHTTP method
- // directly and pass in our Request and ResponseRecorder.
- handler.ServeHTTP(rr, req)
-
- // Check the status code is what we expect.
- if status := rr.Code; status != http.StatusOK {
- t.Errorf("handler returned wrong status code: got %v want %v",
- status, http.StatusOK)
- }
-
- // Check the response body is what we expect.
- expected := `{"alive": true}`
- if rr.Body.String() != expected {
- t.Errorf("handler returned unexpected body: got %v want %v",
- rr.Body.String(), expected)
- }
-}
-```
-
-In the case that our routes have [variables](#examples), we can pass those in the request. We could write
-[table-driven tests](https://dave.cheney.net/2013/06/09/writing-table-driven-tests-in-go) to test multiple
-possible route variables as needed.
-
-```go
-// endpoints.go
-func main() {
- r := mux.NewRouter()
- // A route with a route variable:
- r.HandleFunc("/metrics/{type}", MetricsHandler)
-
- log.Fatal(http.ListenAndServe("localhost:8080", r))
-}
-```
-
-Our test file, with a table-driven test of `routeVariables`:
-
-```go
-// endpoints_test.go
-func TestMetricsHandler(t *testing.T) {
- tt := []struct{
- routeVariable string
- shouldPass bool
- }{
- {"goroutines", true},
- {"heap", true},
- {"counters", true},
- {"queries", true},
- {"adhadaeqm3k", false},
- }
-
- for _, tc := range tt {
- path := fmt.Sprintf("/metrics/%s", tc.routeVariable)
- req, err := http.NewRequest("GET", path, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- rr := httptest.NewRecorder()
-
- // To add the vars to the context,
- // we need to create a router through which we can pass the request.
- router := mux.NewRouter()
- router.HandleFunc("/metrics/{type}", MetricsHandler)
- router.ServeHTTP(rr, req)
-
- // In this case, our MetricsHandler returns a non-200 response
- // for a route variable it doesn't know about.
- if rr.Code == http.StatusOK && !tc.shouldPass {
- t.Errorf("handler should have failed on routeVariable %s: got %v want %v",
- tc.routeVariable, rr.Code, http.StatusOK)
- }
- }
-}
-```
-
-## Full Example
-
-Here's a complete, runnable example of a small `mux` based server:
-
-```go
-package main
-
-import (
- "net/http"
- "log"
- "github.com/gorilla/mux"
-)
-
-func YourHandler(w http.ResponseWriter, r *http.Request) {
- w.Write([]byte("Gorilla!\n"))
-}
-
-func main() {
- r := mux.NewRouter()
- // Routes consist of a path and a handler function.
- r.HandleFunc("/", YourHandler)
-
- // Bind to a port and pass our router in
- log.Fatal(http.ListenAndServe(":8000", r))
-}
-```
-
-## License
-
-BSD licensed. See the LICENSE file for details.
diff --git a/vendor/github.com/gorilla/mux/doc.go b/vendor/github.com/gorilla/mux/doc.go
deleted file mode 100644
index 80601351fd..0000000000
--- a/vendor/github.com/gorilla/mux/doc.go
+++ /dev/null
@@ -1,305 +0,0 @@
-// Copyright 2012 The Gorilla Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Package mux implements a request router and dispatcher.
-
-The name mux stands for "HTTP request multiplexer". Like the standard
-http.ServeMux, mux.Router matches incoming requests against a list of
-registered routes and calls a handler for the route that matches the URL
-or other conditions. The main features are:
-
- - Requests can be matched based on URL host, path, path prefix, schemes,
- header and query values, HTTP methods or using custom matchers.
- - URL hosts, paths and query values can have variables with an optional
- regular expression.
- - Registered URLs can be built, or "reversed", which helps maintaining
- references to resources.
- - Routes can be used as subrouters: nested routes are only tested if the
- parent route matches. This is useful to define groups of routes that
- share common conditions like a host, a path prefix or other repeated
- attributes. As a bonus, this optimizes request matching.
- - It implements the http.Handler interface so it is compatible with the
- standard http.ServeMux.
-
-Let's start registering a couple of URL paths and handlers:
-
- func main() {
- r := mux.NewRouter()
- r.HandleFunc("/", HomeHandler)
- r.HandleFunc("/products", ProductsHandler)
- r.HandleFunc("/articles", ArticlesHandler)
- http.Handle("/", r)
- }
-
-Here we register three routes mapping URL paths to handlers. This is
-equivalent to how http.HandleFunc() works: if an incoming request URL matches
-one of the paths, the corresponding handler is called passing
-(http.ResponseWriter, *http.Request) as parameters.
-
-Paths can have variables. They are defined using the format {name} or
-{name:pattern}. If a regular expression pattern is not defined, the matched
-variable will be anything until the next slash. For example:
-
- r := mux.NewRouter()
- r.HandleFunc("/products/{key}", ProductHandler)
- r.HandleFunc("/articles/{category}/", ArticlesCategoryHandler)
- r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler)
-
-Groups can be used inside patterns, as long as they are non-capturing (?:re). For example:
-
- r.HandleFunc("/articles/{category}/{sort:(?:asc|desc|new)}", ArticlesCategoryHandler)
-
-The names are used to create a map of route variables which can be retrieved
-calling mux.Vars():
-
- vars := mux.Vars(request)
- category := vars["category"]
-
-Note that if any capturing groups are present, mux will panic() during parsing. To prevent
-this, convert any capturing groups to non-capturing, e.g. change "/{sort:(asc|desc)}" to
-"/{sort:(?:asc|desc)}". This is a change from prior versions which behaved unpredictably
-when capturing groups were present.
-
-And this is all you need to know about the basic usage. More advanced options
-are explained below.
-
-Routes can also be restricted to a domain or subdomain. Just define a host
-pattern to be matched. They can also have variables:
-
- r := mux.NewRouter()
- // Only matches if domain is "www.example.com".
- r.Host("www.example.com")
- // Matches a dynamic subdomain.
- r.Host("{subdomain:[a-z]+}.domain.com")
-
-There are several other matchers that can be added. To match path prefixes:
-
- r.PathPrefix("/products/")
-
-...or HTTP methods:
-
- r.Methods("GET", "POST")
-
-...or URL schemes:
-
- r.Schemes("https")
-
-...or header values:
-
- r.Headers("X-Requested-With", "XMLHttpRequest")
-
-...or query values:
-
- r.Queries("key", "value")
-
-...or to use a custom matcher function:
-
- r.MatcherFunc(func(r *http.Request, rm *RouteMatch) bool {
- return r.ProtoMajor == 0
- })
-
-...and finally, it is possible to combine several matchers in a single route:
-
- r.HandleFunc("/products", ProductsHandler).
- Host("www.example.com").
- Methods("GET").
- Schemes("http")
-
-Setting the same matching conditions again and again can be boring, so we have
-a way to group several routes that share the same requirements.
-We call it "subrouting".
-
-For example, let's say we have several URLs that should only match when the
-host is "www.example.com". Create a route for that host and get a "subrouter"
-from it:
-
- r := mux.NewRouter()
- s := r.Host("www.example.com").Subrouter()
-
-Then register routes in the subrouter:
-
- s.HandleFunc("/products/", ProductsHandler)
- s.HandleFunc("/products/{key}", ProductHandler)
- s.HandleFunc("/articles/{category}/{id:[0-9]+}"), ArticleHandler)
-
-The three URL paths we registered above will only be tested if the domain is
-"www.example.com", because the subrouter is tested first. This is not
-only convenient, but also optimizes request matching. You can create
-subrouters combining any attribute matchers accepted by a route.
-
-Subrouters can be used to create domain or path "namespaces": you define
-subrouters in a central place and then parts of the app can register its
-paths relatively to a given subrouter.
-
-There's one more thing about subroutes. When a subrouter has a path prefix,
-the inner routes use it as base for their paths:
-
- r := mux.NewRouter()
- s := r.PathPrefix("/products").Subrouter()
- // "/products/"
- s.HandleFunc("/", ProductsHandler)
- // "/products/{key}/"
- s.HandleFunc("/{key}/", ProductHandler)
- // "/products/{key}/details"
- s.HandleFunc("/{key}/details", ProductDetailsHandler)
-
-Note that the path provided to PathPrefix() represents a "wildcard": calling
-PathPrefix("/static/").Handler(...) means that the handler will be passed any
-request that matches "/static/*". This makes it easy to serve static files with mux:
-
- func main() {
- var dir string
-
- flag.StringVar(&dir, "dir", ".", "the directory to serve files from. Defaults to the current dir")
- flag.Parse()
- r := mux.NewRouter()
-
- // This will serve files under http://localhost:8000/static/
- r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir(dir))))
-
- srv := &http.Server{
- Handler: r,
- Addr: "127.0.0.1:8000",
- // Good practice: enforce timeouts for servers you create!
- WriteTimeout: 15 * time.Second,
- ReadTimeout: 15 * time.Second,
- }
-
- log.Fatal(srv.ListenAndServe())
- }
-
-Now let's see how to build registered URLs.
-
-Routes can be named. All routes that define a name can have their URLs built,
-or "reversed". We define a name calling Name() on a route. For example:
-
- r := mux.NewRouter()
- r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler).
- Name("article")
-
-To build a URL, get the route and call the URL() method, passing a sequence of
-key/value pairs for the route variables. For the previous route, we would do:
-
- url, err := r.Get("article").URL("category", "technology", "id", "42")
-
-...and the result will be a url.URL with the following path:
-
- "/articles/technology/42"
-
-This also works for host and query value variables:
-
- r := mux.NewRouter()
- r.Host("{subdomain}.domain.com").
- Path("/articles/{category}/{id:[0-9]+}").
- Queries("filter", "{filter}").
- HandlerFunc(ArticleHandler).
- Name("article")
-
- // url.String() will be "http://news.domain.com/articles/technology/42?filter=gorilla"
- url, err := r.Get("article").URL("subdomain", "news",
- "category", "technology",
- "id", "42",
- "filter", "gorilla")
-
-All variables defined in the route are required, and their values must
-conform to the corresponding patterns. These requirements guarantee that a
-generated URL will always match a registered route -- the only exception is
-for explicitly defined "build-only" routes which never match.
-
-Regex support also exists for matching Headers within a route. For example, we could do:
-
- r.HeadersRegexp("Content-Type", "application/(text|json)")
-
-...and the route will match both requests with a Content-Type of `application/json` as well as
-`application/text`
-
-There's also a way to build only the URL host or path for a route:
-use the methods URLHost() or URLPath() instead. For the previous route,
-we would do:
-
- // "http://news.domain.com/"
- host, err := r.Get("article").URLHost("subdomain", "news")
-
- // "/articles/technology/42"
- path, err := r.Get("article").URLPath("category", "technology", "id", "42")
-
-And if you use subrouters, host and path defined separately can be built
-as well:
-
- r := mux.NewRouter()
- s := r.Host("{subdomain}.domain.com").Subrouter()
- s.Path("/articles/{category}/{id:[0-9]+}").
- HandlerFunc(ArticleHandler).
- Name("article")
-
- // "http://news.domain.com/articles/technology/42"
- url, err := r.Get("article").URL("subdomain", "news",
- "category", "technology",
- "id", "42")
-
-Mux supports the addition of middlewares to a Router, which are executed in the order they are added if a match is found, including its subrouters. Middlewares are (typically) small pieces of code which take one request, do something with it, and pass it down to another middleware or the final handler. Some common use cases for middleware are request logging, header manipulation, or ResponseWriter hijacking.
-
- type MiddlewareFunc func(http.Handler) http.Handler
-
-Typically, the returned handler is a closure which does something with the http.ResponseWriter and http.Request passed to it, and then calls the handler passed as parameter to the MiddlewareFunc (closures can access variables from the context where they are created).
-
-A very basic middleware which logs the URI of the request being handled could be written as:
-
- func simpleMw(next http.Handler) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- // Do stuff here
- log.Println(r.RequestURI)
- // Call the next handler, which can be another middleware in the chain, or the final handler.
- next.ServeHTTP(w, r)
- })
- }
-
-Middlewares can be added to a router using `Router.Use()`:
-
- r := mux.NewRouter()
- r.HandleFunc("/", handler)
- r.Use(simpleMw)
-
-A more complex authentication middleware, which maps session token to users, could be written as:
-
- // Define our struct
- type authenticationMiddleware struct {
- tokenUsers map[string]string
- }
-
- // Initialize it somewhere
- func (amw *authenticationMiddleware) Populate() {
- amw.tokenUsers["00000000"] = "user0"
- amw.tokenUsers["aaaaaaaa"] = "userA"
- amw.tokenUsers["05f717e5"] = "randomUser"
- amw.tokenUsers["deadbeef"] = "user0"
- }
-
- // Middleware function, which will be called for each request
- func (amw *authenticationMiddleware) Middleware(next http.Handler) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- token := r.Header.Get("X-Session-Token")
-
- if user, found := amw.tokenUsers[token]; found {
- // We found the token in our map
- log.Printf("Authenticated user %s\n", user)
- next.ServeHTTP(w, r)
- } else {
- http.Error(w, "Forbidden", http.StatusForbidden)
- }
- })
- }
-
- r := mux.NewRouter()
- r.HandleFunc("/", handler)
-
- amw := authenticationMiddleware{tokenUsers: make(map[string]string)}
- amw.Populate()
-
- r.Use(amw.Middleware)
-
-Note: The handler chain will be stopped if your middleware doesn't call `next.ServeHTTP()` with the corresponding parameters. This can be used to abort a request if the middleware writer wants to.
-*/
-package mux
diff --git a/vendor/github.com/gorilla/mux/middleware.go b/vendor/github.com/gorilla/mux/middleware.go
deleted file mode 100644
index cb51c565eb..0000000000
--- a/vendor/github.com/gorilla/mux/middleware.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package mux
-
-import (
- "net/http"
- "strings"
-)
-
-// MiddlewareFunc is a function which receives an http.Handler and returns another http.Handler.
-// Typically, the returned handler is a closure which does something with the http.ResponseWriter and http.Request passed
-// to it, and then calls the handler passed as parameter to the MiddlewareFunc.
-type MiddlewareFunc func(http.Handler) http.Handler
-
-// middleware interface is anything which implements a MiddlewareFunc named Middleware.
-type middleware interface {
- Middleware(handler http.Handler) http.Handler
-}
-
-// Middleware allows MiddlewareFunc to implement the middleware interface.
-func (mw MiddlewareFunc) Middleware(handler http.Handler) http.Handler {
- return mw(handler)
-}
-
-// Use appends a MiddlewareFunc to the chain. Middleware can be used to intercept or otherwise modify requests and/or responses, and are executed in the order that they are applied to the Router.
-func (r *Router) Use(mwf ...MiddlewareFunc) {
- for _, fn := range mwf {
- r.middlewares = append(r.middlewares, fn)
- }
-}
-
-// useInterface appends a middleware to the chain. Middleware can be used to intercept or otherwise modify requests and/or responses, and are executed in the order that they are applied to the Router.
-func (r *Router) useInterface(mw middleware) {
- r.middlewares = append(r.middlewares, mw)
-}
-
-// CORSMethodMiddleware automatically sets the Access-Control-Allow-Methods response header
-// on requests for routes that have an OPTIONS method matcher to all the method matchers on
-// the route. Routes that do not explicitly handle OPTIONS requests will not be processed
-// by the middleware. See examples for usage.
-func CORSMethodMiddleware(r *Router) MiddlewareFunc {
- return func(next http.Handler) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- allMethods, err := getAllMethodsForRoute(r, req)
- if err == nil {
- for _, v := range allMethods {
- if v == http.MethodOptions {
- w.Header().Set("Access-Control-Allow-Methods", strings.Join(allMethods, ","))
- }
- }
- }
-
- next.ServeHTTP(w, req)
- })
- }
-}
-
-// getAllMethodsForRoute returns all the methods from method matchers matching a given
-// request.
-func getAllMethodsForRoute(r *Router, req *http.Request) ([]string, error) {
- var allMethods []string
-
- for _, route := range r.routes {
- var match RouteMatch
- if route.Match(req, &match) || match.MatchErr == ErrMethodMismatch {
- methods, err := route.GetMethods()
- if err != nil {
- return nil, err
- }
-
- allMethods = append(allMethods, methods...)
- }
- }
-
- return allMethods, nil
-}
diff --git a/vendor/github.com/gorilla/mux/mux.go b/vendor/github.com/gorilla/mux/mux.go
deleted file mode 100644
index 1e089906fa..0000000000
--- a/vendor/github.com/gorilla/mux/mux.go
+++ /dev/null
@@ -1,608 +0,0 @@
-// Copyright 2012 The Gorilla Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package mux
-
-import (
- "context"
- "errors"
- "fmt"
- "net/http"
- "path"
- "regexp"
-)
-
-var (
- // ErrMethodMismatch is returned when the method in the request does not match
- // the method defined against the route.
- ErrMethodMismatch = errors.New("method is not allowed")
- // ErrNotFound is returned when no route match is found.
- ErrNotFound = errors.New("no matching route was found")
-)
-
-// NewRouter returns a new router instance.
-func NewRouter() *Router {
- return &Router{namedRoutes: make(map[string]*Route)}
-}
-
-// Router registers routes to be matched and dispatches a handler.
-//
-// It implements the http.Handler interface, so it can be registered to serve
-// requests:
-//
-// var router = mux.NewRouter()
-//
-// func main() {
-// http.Handle("/", router)
-// }
-//
-// Or, for Google App Engine, register it in a init() function:
-//
-// func init() {
-// http.Handle("/", router)
-// }
-//
-// This will send all incoming requests to the router.
-type Router struct {
- // Configurable Handler to be used when no route matches.
- // This can be used to render your own 404 Not Found errors.
- NotFoundHandler http.Handler
-
- // Configurable Handler to be used when the request method does not match the route.
- // This can be used to render your own 405 Method Not Allowed errors.
- MethodNotAllowedHandler http.Handler
-
- // Routes to be matched, in order.
- routes []*Route
-
- // Routes by name for URL building.
- namedRoutes map[string]*Route
-
- // If true, do not clear the request context after handling the request.
- //
- // Deprecated: No effect, since the context is stored on the request itself.
- KeepContext bool
-
- // Slice of middlewares to be called after a match is found
- middlewares []middleware
-
- // configuration shared with `Route`
- routeConf
-}
-
-// common route configuration shared between `Router` and `Route`
-type routeConf struct {
- // If true, "/path/foo%2Fbar/to" will match the path "/path/{var}/to"
- useEncodedPath bool
-
- // If true, when the path pattern is "/path/", accessing "/path" will
- // redirect to the former and vice versa.
- strictSlash bool
-
- // If true, when the path pattern is "/path//to", accessing "/path//to"
- // will not redirect
- skipClean bool
-
- // Manager for the variables from host and path.
- regexp routeRegexpGroup
-
- // List of matchers.
- matchers []matcher
-
- // The scheme used when building URLs.
- buildScheme string
-
- buildVarsFunc BuildVarsFunc
-}
-
-// returns an effective deep copy of `routeConf`
-func copyRouteConf(r routeConf) routeConf {
- c := r
-
- if r.regexp.path != nil {
- c.regexp.path = copyRouteRegexp(r.regexp.path)
- }
-
- if r.regexp.host != nil {
- c.regexp.host = copyRouteRegexp(r.regexp.host)
- }
-
- c.regexp.queries = make([]*routeRegexp, 0, len(r.regexp.queries))
- for _, q := range r.regexp.queries {
- c.regexp.queries = append(c.regexp.queries, copyRouteRegexp(q))
- }
-
- c.matchers = make([]matcher, len(r.matchers))
- copy(c.matchers, r.matchers)
-
- return c
-}
-
-func copyRouteRegexp(r *routeRegexp) *routeRegexp {
- c := *r
- return &c
-}
-
-// Match attempts to match the given request against the router's registered routes.
-//
-// If the request matches a route of this router or one of its subrouters the Route,
-// Handler, and Vars fields of the the match argument are filled and this function
-// returns true.
-//
-// If the request does not match any of this router's or its subrouters' routes
-// then this function returns false. If available, a reason for the match failure
-// will be filled in the match argument's MatchErr field. If the match failure type
-// (eg: not found) has a registered handler, the handler is assigned to the Handler
-// field of the match argument.
-func (r *Router) Match(req *http.Request, match *RouteMatch) bool {
- for _, route := range r.routes {
- if route.Match(req, match) {
- // Build middleware chain if no error was found
- if match.MatchErr == nil {
- for i := len(r.middlewares) - 1; i >= 0; i-- {
- match.Handler = r.middlewares[i].Middleware(match.Handler)
- }
- }
- return true
- }
- }
-
- if match.MatchErr == ErrMethodMismatch {
- if r.MethodNotAllowedHandler != nil {
- match.Handler = r.MethodNotAllowedHandler
- return true
- }
-
- return false
- }
-
- // Closest match for a router (includes sub-routers)
- if r.NotFoundHandler != nil {
- match.Handler = r.NotFoundHandler
- match.MatchErr = ErrNotFound
- return true
- }
-
- match.MatchErr = ErrNotFound
- return false
-}
-
-// ServeHTTP dispatches the handler registered in the matched route.
-//
-// When there is a match, the route variables can be retrieved calling
-// mux.Vars(request).
-func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
- if !r.skipClean {
- path := req.URL.Path
- if r.useEncodedPath {
- path = req.URL.EscapedPath()
- }
- // Clean path to canonical form and redirect.
- if p := cleanPath(path); p != path {
-
- // Added 3 lines (Philip Schlump) - It was dropping the query string and #whatever from query.
- // This matches with fix in go 1.2 r.c. 4 for same problem. Go Issue:
- // http://code.google.com/p/go/issues/detail?id=5252
- url := *req.URL
- url.Path = p
- p = url.String()
-
- w.Header().Set("Location", p)
- w.WriteHeader(http.StatusMovedPermanently)
- return
- }
- }
- var match RouteMatch
- var handler http.Handler
- if r.Match(req, &match) {
- handler = match.Handler
- req = requestWithVars(req, match.Vars)
- req = requestWithRoute(req, match.Route)
- }
-
- if handler == nil && match.MatchErr == ErrMethodMismatch {
- handler = methodNotAllowedHandler()
- }
-
- if handler == nil {
- handler = http.NotFoundHandler()
- }
-
- handler.ServeHTTP(w, req)
-}
-
-// Get returns a route registered with the given name.
-func (r *Router) Get(name string) *Route {
- return r.namedRoutes[name]
-}
-
-// GetRoute returns a route registered with the given name. This method
-// was renamed to Get() and remains here for backwards compatibility.
-func (r *Router) GetRoute(name string) *Route {
- return r.namedRoutes[name]
-}
-
-// StrictSlash defines the trailing slash behavior for new routes. The initial
-// value is false.
-//
-// When true, if the route path is "/path/", accessing "/path" will perform a redirect
-// to the former and vice versa. In other words, your application will always
-// see the path as specified in the route.
-//
-// When false, if the route path is "/path", accessing "/path/" will not match
-// this route and vice versa.
-//
-// The re-direct is a HTTP 301 (Moved Permanently). Note that when this is set for
-// routes with a non-idempotent method (e.g. POST, PUT), the subsequent re-directed
-// request will be made as a GET by most clients. Use middleware or client settings
-// to modify this behaviour as needed.
-//
-// Special case: when a route sets a path prefix using the PathPrefix() method,
-// strict slash is ignored for that route because the redirect behavior can't
-// be determined from a prefix alone. However, any subrouters created from that
-// route inherit the original StrictSlash setting.
-func (r *Router) StrictSlash(value bool) *Router {
- r.strictSlash = value
- return r
-}
-
-// SkipClean defines the path cleaning behaviour for new routes. The initial
-// value is false. Users should be careful about which routes are not cleaned
-//
-// When true, if the route path is "/path//to", it will remain with the double
-// slash. This is helpful if you have a route like: /fetch/http://xkcd.com/534/
-//
-// When false, the path will be cleaned, so /fetch/http://xkcd.com/534/ will
-// become /fetch/http/xkcd.com/534
-func (r *Router) SkipClean(value bool) *Router {
- r.skipClean = value
- return r
-}
-
-// UseEncodedPath tells the router to match the encoded original path
-// to the routes.
-// For eg. "/path/foo%2Fbar/to" will match the path "/path/{var}/to".
-//
-// If not called, the router will match the unencoded path to the routes.
-// For eg. "/path/foo%2Fbar/to" will match the path "/path/foo/bar/to"
-func (r *Router) UseEncodedPath() *Router {
- r.useEncodedPath = true
- return r
-}
-
-// ----------------------------------------------------------------------------
-// Route factories
-// ----------------------------------------------------------------------------
-
-// NewRoute registers an empty route.
-func (r *Router) NewRoute() *Route {
- // initialize a route with a copy of the parent router's configuration
- route := &Route{routeConf: copyRouteConf(r.routeConf), namedRoutes: r.namedRoutes}
- r.routes = append(r.routes, route)
- return route
-}
-
-// Name registers a new route with a name.
-// See Route.Name().
-func (r *Router) Name(name string) *Route {
- return r.NewRoute().Name(name)
-}
-
-// Handle registers a new route with a matcher for the URL path.
-// See Route.Path() and Route.Handler().
-func (r *Router) Handle(path string, handler http.Handler) *Route {
- return r.NewRoute().Path(path).Handler(handler)
-}
-
-// HandleFunc registers a new route with a matcher for the URL path.
-// See Route.Path() and Route.HandlerFunc().
-func (r *Router) HandleFunc(path string, f func(http.ResponseWriter,
- *http.Request)) *Route {
- return r.NewRoute().Path(path).HandlerFunc(f)
-}
-
-// Headers registers a new route with a matcher for request header values.
-// See Route.Headers().
-func (r *Router) Headers(pairs ...string) *Route {
- return r.NewRoute().Headers(pairs...)
-}
-
-// Host registers a new route with a matcher for the URL host.
-// See Route.Host().
-func (r *Router) Host(tpl string) *Route {
- return r.NewRoute().Host(tpl)
-}
-
-// MatcherFunc registers a new route with a custom matcher function.
-// See Route.MatcherFunc().
-func (r *Router) MatcherFunc(f MatcherFunc) *Route {
- return r.NewRoute().MatcherFunc(f)
-}
-
-// Methods registers a new route with a matcher for HTTP methods.
-// See Route.Methods().
-func (r *Router) Methods(methods ...string) *Route {
- return r.NewRoute().Methods(methods...)
-}
-
-// Path registers a new route with a matcher for the URL path.
-// See Route.Path().
-func (r *Router) Path(tpl string) *Route {
- return r.NewRoute().Path(tpl)
-}
-
-// PathPrefix registers a new route with a matcher for the URL path prefix.
-// See Route.PathPrefix().
-func (r *Router) PathPrefix(tpl string) *Route {
- return r.NewRoute().PathPrefix(tpl)
-}
-
-// Queries registers a new route with a matcher for URL query values.
-// See Route.Queries().
-func (r *Router) Queries(pairs ...string) *Route {
- return r.NewRoute().Queries(pairs...)
-}
-
-// Schemes registers a new route with a matcher for URL schemes.
-// See Route.Schemes().
-func (r *Router) Schemes(schemes ...string) *Route {
- return r.NewRoute().Schemes(schemes...)
-}
-
-// BuildVarsFunc registers a new route with a custom function for modifying
-// route variables before building a URL.
-func (r *Router) BuildVarsFunc(f BuildVarsFunc) *Route {
- return r.NewRoute().BuildVarsFunc(f)
-}
-
-// Walk walks the router and all its sub-routers, calling walkFn for each route
-// in the tree. The routes are walked in the order they were added. Sub-routers
-// are explored depth-first.
-func (r *Router) Walk(walkFn WalkFunc) error {
- return r.walk(walkFn, []*Route{})
-}
-
-// SkipRouter is used as a return value from WalkFuncs to indicate that the
-// router that walk is about to descend down to should be skipped.
-var SkipRouter = errors.New("skip this router")
-
-// WalkFunc is the type of the function called for each route visited by Walk.
-// At every invocation, it is given the current route, and the current router,
-// and a list of ancestor routes that lead to the current route.
-type WalkFunc func(route *Route, router *Router, ancestors []*Route) error
-
-func (r *Router) walk(walkFn WalkFunc, ancestors []*Route) error {
- for _, t := range r.routes {
- err := walkFn(t, r, ancestors)
- if err == SkipRouter {
- continue
- }
- if err != nil {
- return err
- }
- for _, sr := range t.matchers {
- if h, ok := sr.(*Router); ok {
- ancestors = append(ancestors, t)
- err := h.walk(walkFn, ancestors)
- if err != nil {
- return err
- }
- ancestors = ancestors[:len(ancestors)-1]
- }
- }
- if h, ok := t.handler.(*Router); ok {
- ancestors = append(ancestors, t)
- err := h.walk(walkFn, ancestors)
- if err != nil {
- return err
- }
- ancestors = ancestors[:len(ancestors)-1]
- }
- }
- return nil
-}
-
-// ----------------------------------------------------------------------------
-// Context
-// ----------------------------------------------------------------------------
-
-// RouteMatch stores information about a matched route.
-type RouteMatch struct {
- Route *Route
- Handler http.Handler
- Vars map[string]string
-
- // MatchErr is set to appropriate matching error
- // It is set to ErrMethodMismatch if there is a mismatch in
- // the request method and route method
- MatchErr error
-}
-
-type contextKey int
-
-const (
- varsKey contextKey = iota
- routeKey
-)
-
-// Vars returns the route variables for the current request, if any.
-func Vars(r *http.Request) map[string]string {
- if rv := r.Context().Value(varsKey); rv != nil {
- return rv.(map[string]string)
- }
- return nil
-}
-
-// CurrentRoute returns the matched route for the current request, if any.
-// This only works when called inside the handler of the matched route
-// because the matched route is stored in the request context which is cleared
-// after the handler returns.
-func CurrentRoute(r *http.Request) *Route {
- if rv := r.Context().Value(routeKey); rv != nil {
- return rv.(*Route)
- }
- return nil
-}
-
-func requestWithVars(r *http.Request, vars map[string]string) *http.Request {
- ctx := context.WithValue(r.Context(), varsKey, vars)
- return r.WithContext(ctx)
-}
-
-func requestWithRoute(r *http.Request, route *Route) *http.Request {
- ctx := context.WithValue(r.Context(), routeKey, route)
- return r.WithContext(ctx)
-}
-
-// ----------------------------------------------------------------------------
-// Helpers
-// ----------------------------------------------------------------------------
-
-// cleanPath returns the canonical path for p, eliminating . and .. elements.
-// Borrowed from the net/http package.
-func cleanPath(p string) string {
- if p == "" {
- return "/"
- }
- if p[0] != '/' {
- p = "/" + p
- }
- np := path.Clean(p)
- // path.Clean removes trailing slash except for root;
- // put the trailing slash back if necessary.
- if p[len(p)-1] == '/' && np != "/" {
- np += "/"
- }
-
- return np
-}
-
-// uniqueVars returns an error if two slices contain duplicated strings.
-func uniqueVars(s1, s2 []string) error {
- for _, v1 := range s1 {
- for _, v2 := range s2 {
- if v1 == v2 {
- return fmt.Errorf("mux: duplicated route variable %q", v2)
- }
- }
- }
- return nil
-}
-
-// checkPairs returns the count of strings passed in, and an error if
-// the count is not an even number.
-func checkPairs(pairs ...string) (int, error) {
- length := len(pairs)
- if length%2 != 0 {
- return length, fmt.Errorf(
- "mux: number of parameters must be multiple of 2, got %v", pairs)
- }
- return length, nil
-}
-
-// mapFromPairsToString converts variadic string parameters to a
-// string to string map.
-func mapFromPairsToString(pairs ...string) (map[string]string, error) {
- length, err := checkPairs(pairs...)
- if err != nil {
- return nil, err
- }
- m := make(map[string]string, length/2)
- for i := 0; i < length; i += 2 {
- m[pairs[i]] = pairs[i+1]
- }
- return m, nil
-}
-
-// mapFromPairsToRegex converts variadic string parameters to a
-// string to regex map.
-func mapFromPairsToRegex(pairs ...string) (map[string]*regexp.Regexp, error) {
- length, err := checkPairs(pairs...)
- if err != nil {
- return nil, err
- }
- m := make(map[string]*regexp.Regexp, length/2)
- for i := 0; i < length; i += 2 {
- regex, err := regexp.Compile(pairs[i+1])
- if err != nil {
- return nil, err
- }
- m[pairs[i]] = regex
- }
- return m, nil
-}
-
-// matchInArray returns true if the given string value is in the array.
-func matchInArray(arr []string, value string) bool {
- for _, v := range arr {
- if v == value {
- return true
- }
- }
- return false
-}
-
-// matchMapWithString returns true if the given key/value pairs exist in a given map.
-func matchMapWithString(toCheck map[string]string, toMatch map[string][]string, canonicalKey bool) bool {
- for k, v := range toCheck {
- // Check if key exists.
- if canonicalKey {
- k = http.CanonicalHeaderKey(k)
- }
- if values := toMatch[k]; values == nil {
- return false
- } else if v != "" {
- // If value was defined as an empty string we only check that the
- // key exists. Otherwise we also check for equality.
- valueExists := false
- for _, value := range values {
- if v == value {
- valueExists = true
- break
- }
- }
- if !valueExists {
- return false
- }
- }
- }
- return true
-}
-
-// matchMapWithRegex returns true if the given key/value pairs exist in a given map compiled against
-// the given regex
-func matchMapWithRegex(toCheck map[string]*regexp.Regexp, toMatch map[string][]string, canonicalKey bool) bool {
- for k, v := range toCheck {
- // Check if key exists.
- if canonicalKey {
- k = http.CanonicalHeaderKey(k)
- }
- if values := toMatch[k]; values == nil {
- return false
- } else if v != nil {
- // If value was defined as an empty string we only check that the
- // key exists. Otherwise we also check for equality.
- valueExists := false
- for _, value := range values {
- if v.MatchString(value) {
- valueExists = true
- break
- }
- }
- if !valueExists {
- return false
- }
- }
- }
- return true
-}
-
-// methodNotAllowed replies to the request with an HTTP status code 405.
-func methodNotAllowed(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusMethodNotAllowed)
-}
-
-// methodNotAllowedHandler returns a simple request handler
-// that replies to each request with a status code 405.
-func methodNotAllowedHandler() http.Handler { return http.HandlerFunc(methodNotAllowed) }
diff --git a/vendor/github.com/gorilla/mux/regexp.go b/vendor/github.com/gorilla/mux/regexp.go
deleted file mode 100644
index 5d05cfa0e9..0000000000
--- a/vendor/github.com/gorilla/mux/regexp.go
+++ /dev/null
@@ -1,388 +0,0 @@
-// Copyright 2012 The Gorilla Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package mux
-
-import (
- "bytes"
- "fmt"
- "net/http"
- "net/url"
- "regexp"
- "strconv"
- "strings"
-)
-
-type routeRegexpOptions struct {
- strictSlash bool
- useEncodedPath bool
-}
-
-type regexpType int
-
-const (
- regexpTypePath regexpType = iota
- regexpTypeHost
- regexpTypePrefix
- regexpTypeQuery
-)
-
-// newRouteRegexp parses a route template and returns a routeRegexp,
-// used to match a host, a path or a query string.
-//
-// It will extract named variables, assemble a regexp to be matched, create
-// a "reverse" template to build URLs and compile regexps to validate variable
-// values used in URL building.
-//
-// Previously we accepted only Python-like identifiers for variable
-// names ([a-zA-Z_][a-zA-Z0-9_]*), but currently the only restriction is that
-// name and pattern can't be empty, and names can't contain a colon.
-func newRouteRegexp(tpl string, typ regexpType, options routeRegexpOptions) (*routeRegexp, error) {
- // Check if it is well-formed.
- idxs, errBraces := braceIndices(tpl)
- if errBraces != nil {
- return nil, errBraces
- }
- // Backup the original.
- template := tpl
- // Now let's parse it.
- defaultPattern := "[^/]+"
- if typ == regexpTypeQuery {
- defaultPattern = ".*"
- } else if typ == regexpTypeHost {
- defaultPattern = "[^.]+"
- }
- // Only match strict slash if not matching
- if typ != regexpTypePath {
- options.strictSlash = false
- }
- // Set a flag for strictSlash.
- endSlash := false
- if options.strictSlash && strings.HasSuffix(tpl, "/") {
- tpl = tpl[:len(tpl)-1]
- endSlash = true
- }
- varsN := make([]string, len(idxs)/2)
- varsR := make([]*regexp.Regexp, len(idxs)/2)
- pattern := bytes.NewBufferString("")
- pattern.WriteByte('^')
- reverse := bytes.NewBufferString("")
- var end int
- var err error
- for i := 0; i < len(idxs); i += 2 {
- // Set all values we are interested in.
- raw := tpl[end:idxs[i]]
- end = idxs[i+1]
- parts := strings.SplitN(tpl[idxs[i]+1:end-1], ":", 2)
- name := parts[0]
- patt := defaultPattern
- if len(parts) == 2 {
- patt = parts[1]
- }
- // Name or pattern can't be empty.
- if name == "" || patt == "" {
- return nil, fmt.Errorf("mux: missing name or pattern in %q",
- tpl[idxs[i]:end])
- }
- // Build the regexp pattern.
- fmt.Fprintf(pattern, "%s(?P<%s>%s)", regexp.QuoteMeta(raw), varGroupName(i/2), patt)
-
- // Build the reverse template.
- fmt.Fprintf(reverse, "%s%%s", raw)
-
- // Append variable name and compiled pattern.
- varsN[i/2] = name
- varsR[i/2], err = regexp.Compile(fmt.Sprintf("^%s$", patt))
- if err != nil {
- return nil, err
- }
- }
- // Add the remaining.
- raw := tpl[end:]
- pattern.WriteString(regexp.QuoteMeta(raw))
- if options.strictSlash {
- pattern.WriteString("[/]?")
- }
- if typ == regexpTypeQuery {
- // Add the default pattern if the query value is empty
- if queryVal := strings.SplitN(template, "=", 2)[1]; queryVal == "" {
- pattern.WriteString(defaultPattern)
- }
- }
- if typ != regexpTypePrefix {
- pattern.WriteByte('$')
- }
-
- var wildcardHostPort bool
- if typ == regexpTypeHost {
- if !strings.Contains(pattern.String(), ":") {
- wildcardHostPort = true
- }
- }
- reverse.WriteString(raw)
- if endSlash {
- reverse.WriteByte('/')
- }
- // Compile full regexp.
- reg, errCompile := regexp.Compile(pattern.String())
- if errCompile != nil {
- return nil, errCompile
- }
-
- // Check for capturing groups which used to work in older versions
- if reg.NumSubexp() != len(idxs)/2 {
- panic(fmt.Sprintf("route %s contains capture groups in its regexp. ", template) +
- "Only non-capturing groups are accepted: e.g. (?:pattern) instead of (pattern)")
- }
-
- // Done!
- return &routeRegexp{
- template: template,
- regexpType: typ,
- options: options,
- regexp: reg,
- reverse: reverse.String(),
- varsN: varsN,
- varsR: varsR,
- wildcardHostPort: wildcardHostPort,
- }, nil
-}
-
-// routeRegexp stores a regexp to match a host or path and information to
-// collect and validate route variables.
-type routeRegexp struct {
- // The unmodified template.
- template string
- // The type of match
- regexpType regexpType
- // Options for matching
- options routeRegexpOptions
- // Expanded regexp.
- regexp *regexp.Regexp
- // Reverse template.
- reverse string
- // Variable names.
- varsN []string
- // Variable regexps (validators).
- varsR []*regexp.Regexp
- // Wildcard host-port (no strict port match in hostname)
- wildcardHostPort bool
-}
-
-// Match matches the regexp against the URL host or path.
-func (r *routeRegexp) Match(req *http.Request, match *RouteMatch) bool {
- if r.regexpType == regexpTypeHost {
- host := getHost(req)
- if r.wildcardHostPort {
- // Don't be strict on the port match
- if i := strings.Index(host, ":"); i != -1 {
- host = host[:i]
- }
- }
- return r.regexp.MatchString(host)
- }
-
- if r.regexpType == regexpTypeQuery {
- return r.matchQueryString(req)
- }
- path := req.URL.Path
- if r.options.useEncodedPath {
- path = req.URL.EscapedPath()
- }
- return r.regexp.MatchString(path)
-}
-
-// url builds a URL part using the given values.
-func (r *routeRegexp) url(values map[string]string) (string, error) {
- urlValues := make([]interface{}, len(r.varsN))
- for k, v := range r.varsN {
- value, ok := values[v]
- if !ok {
- return "", fmt.Errorf("mux: missing route variable %q", v)
- }
- if r.regexpType == regexpTypeQuery {
- value = url.QueryEscape(value)
- }
- urlValues[k] = value
- }
- rv := fmt.Sprintf(r.reverse, urlValues...)
- if !r.regexp.MatchString(rv) {
- // The URL is checked against the full regexp, instead of checking
- // individual variables. This is faster but to provide a good error
- // message, we check individual regexps if the URL doesn't match.
- for k, v := range r.varsN {
- if !r.varsR[k].MatchString(values[v]) {
- return "", fmt.Errorf(
- "mux: variable %q doesn't match, expected %q", values[v],
- r.varsR[k].String())
- }
- }
- }
- return rv, nil
-}
-
-// getURLQuery returns a single query parameter from a request URL.
-// For a URL with foo=bar&baz=ding, we return only the relevant key
-// value pair for the routeRegexp.
-func (r *routeRegexp) getURLQuery(req *http.Request) string {
- if r.regexpType != regexpTypeQuery {
- return ""
- }
- templateKey := strings.SplitN(r.template, "=", 2)[0]
- val, ok := findFirstQueryKey(req.URL.RawQuery, templateKey)
- if ok {
- return templateKey + "=" + val
- }
- return ""
-}
-
-// findFirstQueryKey returns the same result as (*url.URL).Query()[key][0].
-// If key was not found, empty string and false is returned.
-func findFirstQueryKey(rawQuery, key string) (value string, ok bool) {
- query := []byte(rawQuery)
- for len(query) > 0 {
- foundKey := query
- if i := bytes.IndexAny(foundKey, "&;"); i >= 0 {
- foundKey, query = foundKey[:i], foundKey[i+1:]
- } else {
- query = query[:0]
- }
- if len(foundKey) == 0 {
- continue
- }
- var value []byte
- if i := bytes.IndexByte(foundKey, '='); i >= 0 {
- foundKey, value = foundKey[:i], foundKey[i+1:]
- }
- if len(foundKey) < len(key) {
- // Cannot possibly be key.
- continue
- }
- keyString, err := url.QueryUnescape(string(foundKey))
- if err != nil {
- continue
- }
- if keyString != key {
- continue
- }
- valueString, err := url.QueryUnescape(string(value))
- if err != nil {
- continue
- }
- return valueString, true
- }
- return "", false
-}
-
-func (r *routeRegexp) matchQueryString(req *http.Request) bool {
- return r.regexp.MatchString(r.getURLQuery(req))
-}
-
-// braceIndices returns the first level curly brace indices from a string.
-// It returns an error in case of unbalanced braces.
-func braceIndices(s string) ([]int, error) {
- var level, idx int
- var idxs []int
- for i := 0; i < len(s); i++ {
- switch s[i] {
- case '{':
- if level++; level == 1 {
- idx = i
- }
- case '}':
- if level--; level == 0 {
- idxs = append(idxs, idx, i+1)
- } else if level < 0 {
- return nil, fmt.Errorf("mux: unbalanced braces in %q", s)
- }
- }
- }
- if level != 0 {
- return nil, fmt.Errorf("mux: unbalanced braces in %q", s)
- }
- return idxs, nil
-}
-
-// varGroupName builds a capturing group name for the indexed variable.
-func varGroupName(idx int) string {
- return "v" + strconv.Itoa(idx)
-}
-
-// ----------------------------------------------------------------------------
-// routeRegexpGroup
-// ----------------------------------------------------------------------------
-
-// routeRegexpGroup groups the route matchers that carry variables.
-type routeRegexpGroup struct {
- host *routeRegexp
- path *routeRegexp
- queries []*routeRegexp
-}
-
-// setMatch extracts the variables from the URL once a route matches.
-func (v routeRegexpGroup) setMatch(req *http.Request, m *RouteMatch, r *Route) {
- // Store host variables.
- if v.host != nil {
- host := getHost(req)
- if v.host.wildcardHostPort {
- // Don't be strict on the port match
- if i := strings.Index(host, ":"); i != -1 {
- host = host[:i]
- }
- }
- matches := v.host.regexp.FindStringSubmatchIndex(host)
- if len(matches) > 0 {
- extractVars(host, matches, v.host.varsN, m.Vars)
- }
- }
- path := req.URL.Path
- if r.useEncodedPath {
- path = req.URL.EscapedPath()
- }
- // Store path variables.
- if v.path != nil {
- matches := v.path.regexp.FindStringSubmatchIndex(path)
- if len(matches) > 0 {
- extractVars(path, matches, v.path.varsN, m.Vars)
- // Check if we should redirect.
- if v.path.options.strictSlash {
- p1 := strings.HasSuffix(path, "/")
- p2 := strings.HasSuffix(v.path.template, "/")
- if p1 != p2 {
- u, _ := url.Parse(req.URL.String())
- if p1 {
- u.Path = u.Path[:len(u.Path)-1]
- } else {
- u.Path += "/"
- }
- m.Handler = http.RedirectHandler(u.String(), http.StatusMovedPermanently)
- }
- }
- }
- }
- // Store query string variables.
- for _, q := range v.queries {
- queryURL := q.getURLQuery(req)
- matches := q.regexp.FindStringSubmatchIndex(queryURL)
- if len(matches) > 0 {
- extractVars(queryURL, matches, q.varsN, m.Vars)
- }
- }
-}
-
-// getHost tries its best to return the request host.
-// According to section 14.23 of RFC 2616 the Host header
-// can include the port number if the default value of 80 is not used.
-func getHost(r *http.Request) string {
- if r.URL.IsAbs() {
- return r.URL.Host
- }
- return r.Host
-}
-
-func extractVars(input string, matches []int, names []string, output map[string]string) {
- for i, name := range names {
- output[name] = input[matches[2*i+2]:matches[2*i+3]]
- }
-}
diff --git a/vendor/github.com/gorilla/mux/route.go b/vendor/github.com/gorilla/mux/route.go
deleted file mode 100644
index e8f11df221..0000000000
--- a/vendor/github.com/gorilla/mux/route.go
+++ /dev/null
@@ -1,765 +0,0 @@
-// Copyright 2012 The Gorilla Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package mux
-
-import (
- "errors"
- "fmt"
- "net/http"
- "net/url"
- "regexp"
- "strings"
-)
-
-// Route stores information to match a request and build URLs.
-type Route struct {
- // Request handler for the route.
- handler http.Handler
- // If true, this route never matches: it is only used to build URLs.
- buildOnly bool
- // The name used to build URLs.
- name string
- // Error resulted from building a route.
- err error
-
- // "global" reference to all named routes
- namedRoutes map[string]*Route
-
- // config possibly passed in from `Router`
- routeConf
-}
-
-// SkipClean reports whether path cleaning is enabled for this route via
-// Router.SkipClean.
-func (r *Route) SkipClean() bool {
- return r.skipClean
-}
-
-// Match matches the route against the request.
-func (r *Route) Match(req *http.Request, match *RouteMatch) bool {
- if r.buildOnly || r.err != nil {
- return false
- }
-
- var matchErr error
-
- // Match everything.
- for _, m := range r.matchers {
- if matched := m.Match(req, match); !matched {
- if _, ok := m.(methodMatcher); ok {
- matchErr = ErrMethodMismatch
- continue
- }
-
- // Ignore ErrNotFound errors. These errors arise from match call
- // to Subrouters.
- //
- // This prevents subsequent matching subrouters from failing to
- // run middleware. If not ignored, the middleware would see a
- // non-nil MatchErr and be skipped, even when there was a
- // matching route.
- if match.MatchErr == ErrNotFound {
- match.MatchErr = nil
- }
-
- matchErr = nil // nolint:ineffassign
- return false
- } else {
- // Multiple routes may share the same path but use different HTTP methods. For instance:
- // Route 1: POST "/users/{id}".
- // Route 2: GET "/users/{id}", parameters: "id": "[0-9]+".
- //
- // The router must handle these cases correctly. For a GET request to "/users/abc" with "id" as "-2",
- // The router should return a "Not Found" error as no route fully matches this request.
- if match.MatchErr == ErrMethodMismatch {
- match.MatchErr = nil
- }
- }
- }
-
- if matchErr != nil {
- match.MatchErr = matchErr
- return false
- }
-
- if match.MatchErr == ErrMethodMismatch && r.handler != nil {
- // We found a route which matches request method, clear MatchErr
- match.MatchErr = nil
- // Then override the mis-matched handler
- match.Handler = r.handler
- }
-
- // Yay, we have a match. Let's collect some info about it.
- if match.Route == nil {
- match.Route = r
- }
- if match.Handler == nil {
- match.Handler = r.handler
- }
- if match.Vars == nil {
- match.Vars = make(map[string]string)
- }
-
- // Set variables.
- r.regexp.setMatch(req, match, r)
- return true
-}
-
-// ----------------------------------------------------------------------------
-// Route attributes
-// ----------------------------------------------------------------------------
-
-// GetError returns an error resulted from building the route, if any.
-func (r *Route) GetError() error {
- return r.err
-}
-
-// BuildOnly sets the route to never match: it is only used to build URLs.
-func (r *Route) BuildOnly() *Route {
- r.buildOnly = true
- return r
-}
-
-// Handler --------------------------------------------------------------------
-
-// Handler sets a handler for the route.
-func (r *Route) Handler(handler http.Handler) *Route {
- if r.err == nil {
- r.handler = handler
- }
- return r
-}
-
-// HandlerFunc sets a handler function for the route.
-func (r *Route) HandlerFunc(f func(http.ResponseWriter, *http.Request)) *Route {
- return r.Handler(http.HandlerFunc(f))
-}
-
-// GetHandler returns the handler for the route, if any.
-func (r *Route) GetHandler() http.Handler {
- return r.handler
-}
-
-// Name -----------------------------------------------------------------------
-
-// Name sets the name for the route, used to build URLs.
-// It is an error to call Name more than once on a route.
-func (r *Route) Name(name string) *Route {
- if r.name != "" {
- r.err = fmt.Errorf("mux: route already has name %q, can't set %q",
- r.name, name)
- }
- if r.err == nil {
- r.name = name
- r.namedRoutes[name] = r
- }
- return r
-}
-
-// GetName returns the name for the route, if any.
-func (r *Route) GetName() string {
- return r.name
-}
-
-// ----------------------------------------------------------------------------
-// Matchers
-// ----------------------------------------------------------------------------
-
-// matcher types try to match a request.
-type matcher interface {
- Match(*http.Request, *RouteMatch) bool
-}
-
-// addMatcher adds a matcher to the route.
-func (r *Route) addMatcher(m matcher) *Route {
- if r.err == nil {
- r.matchers = append(r.matchers, m)
- }
- return r
-}
-
-// addRegexpMatcher adds a host or path matcher and builder to a route.
-func (r *Route) addRegexpMatcher(tpl string, typ regexpType) error {
- if r.err != nil {
- return r.err
- }
- if typ == regexpTypePath || typ == regexpTypePrefix {
- if len(tpl) > 0 && tpl[0] != '/' {
- return fmt.Errorf("mux: path must start with a slash, got %q", tpl)
- }
- if r.regexp.path != nil {
- tpl = strings.TrimRight(r.regexp.path.template, "/") + tpl
- }
- }
- rr, err := newRouteRegexp(tpl, typ, routeRegexpOptions{
- strictSlash: r.strictSlash,
- useEncodedPath: r.useEncodedPath,
- })
- if err != nil {
- return err
- }
- for _, q := range r.regexp.queries {
- if err = uniqueVars(rr.varsN, q.varsN); err != nil {
- return err
- }
- }
- if typ == regexpTypeHost {
- if r.regexp.path != nil {
- if err = uniqueVars(rr.varsN, r.regexp.path.varsN); err != nil {
- return err
- }
- }
- r.regexp.host = rr
- } else {
- if r.regexp.host != nil {
- if err = uniqueVars(rr.varsN, r.regexp.host.varsN); err != nil {
- return err
- }
- }
- if typ == regexpTypeQuery {
- r.regexp.queries = append(r.regexp.queries, rr)
- } else {
- r.regexp.path = rr
- }
- }
- r.addMatcher(rr)
- return nil
-}
-
-// Headers --------------------------------------------------------------------
-
-// headerMatcher matches the request against header values.
-type headerMatcher map[string]string
-
-func (m headerMatcher) Match(r *http.Request, match *RouteMatch) bool {
- return matchMapWithString(m, r.Header, true)
-}
-
-// Headers adds a matcher for request header values.
-// It accepts a sequence of key/value pairs to be matched. For example:
-//
-// r := mux.NewRouter().NewRoute()
-// r.Headers("Content-Type", "application/json",
-// "X-Requested-With", "XMLHttpRequest")
-//
-// The above route will only match if both request header values match.
-// If the value is an empty string, it will match any value if the key is set.
-func (r *Route) Headers(pairs ...string) *Route {
- if r.err == nil {
- var headers map[string]string
- headers, r.err = mapFromPairsToString(pairs...)
- return r.addMatcher(headerMatcher(headers))
- }
- return r
-}
-
-// headerRegexMatcher matches the request against the route given a regex for the header
-type headerRegexMatcher map[string]*regexp.Regexp
-
-func (m headerRegexMatcher) Match(r *http.Request, match *RouteMatch) bool {
- return matchMapWithRegex(m, r.Header, true)
-}
-
-// HeadersRegexp accepts a sequence of key/value pairs, where the value has regex
-// support. For example:
-//
-// r := mux.NewRouter().NewRoute()
-// r.HeadersRegexp("Content-Type", "application/(text|json)",
-// "X-Requested-With", "XMLHttpRequest")
-//
-// The above route will only match if both the request header matches both regular expressions.
-// If the value is an empty string, it will match any value if the key is set.
-// Use the start and end of string anchors (^ and $) to match an exact value.
-func (r *Route) HeadersRegexp(pairs ...string) *Route {
- if r.err == nil {
- var headers map[string]*regexp.Regexp
- headers, r.err = mapFromPairsToRegex(pairs...)
- return r.addMatcher(headerRegexMatcher(headers))
- }
- return r
-}
-
-// Host -----------------------------------------------------------------------
-
-// Host adds a matcher for the URL host.
-// It accepts a template with zero or more URL variables enclosed by {}.
-// Variables can define an optional regexp pattern to be matched:
-//
-// - {name} matches anything until the next dot.
-//
-// - {name:pattern} matches the given regexp pattern.
-//
-// For example:
-//
-// r := mux.NewRouter().NewRoute()
-// r.Host("www.example.com")
-// r.Host("{subdomain}.domain.com")
-// r.Host("{subdomain:[a-z]+}.domain.com")
-//
-// Variable names must be unique in a given route. They can be retrieved
-// calling mux.Vars(request).
-func (r *Route) Host(tpl string) *Route {
- r.err = r.addRegexpMatcher(tpl, regexpTypeHost)
- return r
-}
-
-// MatcherFunc ----------------------------------------------------------------
-
-// MatcherFunc is the function signature used by custom matchers.
-type MatcherFunc func(*http.Request, *RouteMatch) bool
-
-// Match returns the match for a given request.
-func (m MatcherFunc) Match(r *http.Request, match *RouteMatch) bool {
- return m(r, match)
-}
-
-// MatcherFunc adds a custom function to be used as request matcher.
-func (r *Route) MatcherFunc(f MatcherFunc) *Route {
- return r.addMatcher(f)
-}
-
-// Methods --------------------------------------------------------------------
-
-// methodMatcher matches the request against HTTP methods.
-type methodMatcher []string
-
-func (m methodMatcher) Match(r *http.Request, match *RouteMatch) bool {
- return matchInArray(m, r.Method)
-}
-
-// Methods adds a matcher for HTTP methods.
-// It accepts a sequence of one or more methods to be matched, e.g.:
-// "GET", "POST", "PUT".
-func (r *Route) Methods(methods ...string) *Route {
- for k, v := range methods {
- methods[k] = strings.ToUpper(v)
- }
- return r.addMatcher(methodMatcher(methods))
-}
-
-// Path -----------------------------------------------------------------------
-
-// Path adds a matcher for the URL path.
-// It accepts a template with zero or more URL variables enclosed by {}. The
-// template must start with a "/".
-// Variables can define an optional regexp pattern to be matched:
-//
-// - {name} matches anything until the next slash.
-//
-// - {name:pattern} matches the given regexp pattern.
-//
-// For example:
-//
-// r := mux.NewRouter().NewRoute()
-// r.Path("/products/").Handler(ProductsHandler)
-// r.Path("/products/{key}").Handler(ProductsHandler)
-// r.Path("/articles/{category}/{id:[0-9]+}").
-// Handler(ArticleHandler)
-//
-// Variable names must be unique in a given route. They can be retrieved
-// calling mux.Vars(request).
-func (r *Route) Path(tpl string) *Route {
- r.err = r.addRegexpMatcher(tpl, regexpTypePath)
- return r
-}
-
-// PathPrefix -----------------------------------------------------------------
-
-// PathPrefix adds a matcher for the URL path prefix. This matches if the given
-// template is a prefix of the full URL path. See Route.Path() for details on
-// the tpl argument.
-//
-// Note that it does not treat slashes specially ("/foobar/" will be matched by
-// the prefix "/foo") so you may want to use a trailing slash here.
-//
-// Also note that the setting of Router.StrictSlash() has no effect on routes
-// with a PathPrefix matcher.
-func (r *Route) PathPrefix(tpl string) *Route {
- r.err = r.addRegexpMatcher(tpl, regexpTypePrefix)
- return r
-}
-
-// Query ----------------------------------------------------------------------
-
-// Queries adds a matcher for URL query values.
-// It accepts a sequence of key/value pairs. Values may define variables.
-// For example:
-//
-// r := mux.NewRouter().NewRoute()
-// r.Queries("foo", "bar", "id", "{id:[0-9]+}")
-//
-// The above route will only match if the URL contains the defined queries
-// values, e.g.: ?foo=bar&id=42.
-//
-// If the value is an empty string, it will match any value if the key is set.
-//
-// Variables can define an optional regexp pattern to be matched:
-//
-// - {name} matches anything until the next slash.
-//
-// - {name:pattern} matches the given regexp pattern.
-func (r *Route) Queries(pairs ...string) *Route {
- length := len(pairs)
- if length%2 != 0 {
- r.err = fmt.Errorf(
- "mux: number of parameters must be multiple of 2, got %v", pairs)
- return nil
- }
- for i := 0; i < length; i += 2 {
- if r.err = r.addRegexpMatcher(pairs[i]+"="+pairs[i+1], regexpTypeQuery); r.err != nil {
- return r
- }
- }
-
- return r
-}
-
-// Schemes --------------------------------------------------------------------
-
-// schemeMatcher matches the request against URL schemes.
-type schemeMatcher []string
-
-func (m schemeMatcher) Match(r *http.Request, match *RouteMatch) bool {
- scheme := r.URL.Scheme
- // https://golang.org/pkg/net/http/#Request
- // "For [most] server requests, fields other than Path and RawQuery will be
- // empty."
- // Since we're an http muxer, the scheme is either going to be http or https
- // though, so we can just set it based on the tls termination state.
- if scheme == "" {
- if r.TLS == nil {
- scheme = "http"
- } else {
- scheme = "https"
- }
- }
- return matchInArray(m, scheme)
-}
-
-// Schemes adds a matcher for URL schemes.
-// It accepts a sequence of schemes to be matched, e.g.: "http", "https".
-// If the request's URL has a scheme set, it will be matched against.
-// Generally, the URL scheme will only be set if a previous handler set it,
-// such as the ProxyHeaders handler from gorilla/handlers.
-// If unset, the scheme will be determined based on the request's TLS
-// termination state.
-// The first argument to Schemes will be used when constructing a route URL.
-func (r *Route) Schemes(schemes ...string) *Route {
- for k, v := range schemes {
- schemes[k] = strings.ToLower(v)
- }
- if len(schemes) > 0 {
- r.buildScheme = schemes[0]
- }
- return r.addMatcher(schemeMatcher(schemes))
-}
-
-// BuildVarsFunc --------------------------------------------------------------
-
-// BuildVarsFunc is the function signature used by custom build variable
-// functions (which can modify route variables before a route's URL is built).
-type BuildVarsFunc func(map[string]string) map[string]string
-
-// BuildVarsFunc adds a custom function to be used to modify build variables
-// before a route's URL is built.
-func (r *Route) BuildVarsFunc(f BuildVarsFunc) *Route {
- if r.buildVarsFunc != nil {
- // compose the old and new functions
- old := r.buildVarsFunc
- r.buildVarsFunc = func(m map[string]string) map[string]string {
- return f(old(m))
- }
- } else {
- r.buildVarsFunc = f
- }
- return r
-}
-
-// Subrouter ------------------------------------------------------------------
-
-// Subrouter creates a subrouter for the route.
-//
-// It will test the inner routes only if the parent route matched. For example:
-//
-// r := mux.NewRouter().NewRoute()
-// s := r.Host("www.example.com").Subrouter()
-// s.HandleFunc("/products/", ProductsHandler)
-// s.HandleFunc("/products/{key}", ProductHandler)
-// s.HandleFunc("/articles/{category}/{id:[0-9]+}"), ArticleHandler)
-//
-// Here, the routes registered in the subrouter won't be tested if the host
-// doesn't match.
-func (r *Route) Subrouter() *Router {
- // initialize a subrouter with a copy of the parent route's configuration
- router := &Router{routeConf: copyRouteConf(r.routeConf), namedRoutes: r.namedRoutes}
- r.addMatcher(router)
- return router
-}
-
-// ----------------------------------------------------------------------------
-// URL building
-// ----------------------------------------------------------------------------
-
-// URL builds a URL for the route.
-//
-// It accepts a sequence of key/value pairs for the route variables. For
-// example, given this route:
-//
-// r := mux.NewRouter()
-// r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler).
-// Name("article")
-//
-// ...a URL for it can be built using:
-//
-// url, err := r.Get("article").URL("category", "technology", "id", "42")
-//
-// ...which will return an url.URL with the following path:
-//
-// "/articles/technology/42"
-//
-// This also works for host variables:
-//
-// r := mux.NewRouter()
-// r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler).
-// Host("{subdomain}.domain.com").
-// Name("article")
-//
-// // url.String() will be "http://news.domain.com/articles/technology/42"
-// url, err := r.Get("article").URL("subdomain", "news",
-// "category", "technology",
-// "id", "42")
-//
-// The scheme of the resulting url will be the first argument that was passed to Schemes:
-//
-// // url.String() will be "https://example.com"
-// r := mux.NewRouter().NewRoute()
-// url, err := r.Host("example.com")
-// .Schemes("https", "http").URL()
-//
-// All variables defined in the route are required, and their values must
-// conform to the corresponding patterns.
-func (r *Route) URL(pairs ...string) (*url.URL, error) {
- if r.err != nil {
- return nil, r.err
- }
- values, err := r.prepareVars(pairs...)
- if err != nil {
- return nil, err
- }
- var scheme, host, path string
- queries := make([]string, 0, len(r.regexp.queries))
- if r.regexp.host != nil {
- if host, err = r.regexp.host.url(values); err != nil {
- return nil, err
- }
- scheme = "http"
- if r.buildScheme != "" {
- scheme = r.buildScheme
- }
- }
- if r.regexp.path != nil {
- if path, err = r.regexp.path.url(values); err != nil {
- return nil, err
- }
- }
- for _, q := range r.regexp.queries {
- var query string
- if query, err = q.url(values); err != nil {
- return nil, err
- }
- queries = append(queries, query)
- }
- return &url.URL{
- Scheme: scheme,
- Host: host,
- Path: path,
- RawQuery: strings.Join(queries, "&"),
- }, nil
-}
-
-// URLHost builds the host part of the URL for a route. See Route.URL().
-//
-// The route must have a host defined.
-func (r *Route) URLHost(pairs ...string) (*url.URL, error) {
- if r.err != nil {
- return nil, r.err
- }
- if r.regexp.host == nil {
- return nil, errors.New("mux: route doesn't have a host")
- }
- values, err := r.prepareVars(pairs...)
- if err != nil {
- return nil, err
- }
- host, err := r.regexp.host.url(values)
- if err != nil {
- return nil, err
- }
- u := &url.URL{
- Scheme: "http",
- Host: host,
- }
- if r.buildScheme != "" {
- u.Scheme = r.buildScheme
- }
- return u, nil
-}
-
-// URLPath builds the path part of the URL for a route. See Route.URL().
-//
-// The route must have a path defined.
-func (r *Route) URLPath(pairs ...string) (*url.URL, error) {
- if r.err != nil {
- return nil, r.err
- }
- if r.regexp.path == nil {
- return nil, errors.New("mux: route doesn't have a path")
- }
- values, err := r.prepareVars(pairs...)
- if err != nil {
- return nil, err
- }
- path, err := r.regexp.path.url(values)
- if err != nil {
- return nil, err
- }
- return &url.URL{
- Path: path,
- }, nil
-}
-
-// GetPathTemplate returns the template used to build the
-// route match.
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if the route does not define a path.
-func (r *Route) GetPathTemplate() (string, error) {
- if r.err != nil {
- return "", r.err
- }
- if r.regexp.path == nil {
- return "", errors.New("mux: route doesn't have a path")
- }
- return r.regexp.path.template, nil
-}
-
-// GetPathRegexp returns the expanded regular expression used to match route path.
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if the route does not define a path.
-func (r *Route) GetPathRegexp() (string, error) {
- if r.err != nil {
- return "", r.err
- }
- if r.regexp.path == nil {
- return "", errors.New("mux: route does not have a path")
- }
- return r.regexp.path.regexp.String(), nil
-}
-
-// GetQueriesRegexp returns the expanded regular expressions used to match the
-// route queries.
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if the route does not have queries.
-func (r *Route) GetQueriesRegexp() ([]string, error) {
- if r.err != nil {
- return nil, r.err
- }
- if r.regexp.queries == nil {
- return nil, errors.New("mux: route doesn't have queries")
- }
- queries := make([]string, 0, len(r.regexp.queries))
- for _, query := range r.regexp.queries {
- queries = append(queries, query.regexp.String())
- }
- return queries, nil
-}
-
-// GetQueriesTemplates returns the templates used to build the
-// query matching.
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if the route does not define queries.
-func (r *Route) GetQueriesTemplates() ([]string, error) {
- if r.err != nil {
- return nil, r.err
- }
- if r.regexp.queries == nil {
- return nil, errors.New("mux: route doesn't have queries")
- }
- queries := make([]string, 0, len(r.regexp.queries))
- for _, query := range r.regexp.queries {
- queries = append(queries, query.template)
- }
- return queries, nil
-}
-
-// GetMethods returns the methods the route matches against
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if route does not have methods.
-func (r *Route) GetMethods() ([]string, error) {
- if r.err != nil {
- return nil, r.err
- }
- for _, m := range r.matchers {
- if methods, ok := m.(methodMatcher); ok {
- return []string(methods), nil
- }
- }
- return nil, errors.New("mux: route doesn't have methods")
-}
-
-// GetHostTemplate returns the template used to build the
-// route match.
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if the route does not define a host.
-func (r *Route) GetHostTemplate() (string, error) {
- if r.err != nil {
- return "", r.err
- }
- if r.regexp.host == nil {
- return "", errors.New("mux: route doesn't have a host")
- }
- return r.regexp.host.template, nil
-}
-
-// GetVarNames returns the names of all variables added by regexp matchers
-// These can be used to know which route variables should be passed into r.URL()
-func (r *Route) GetVarNames() ([]string, error) {
- if r.err != nil {
- return nil, r.err
- }
- var varNames []string
- if r.regexp.host != nil {
- varNames = append(varNames, r.regexp.host.varsN...)
- }
- if r.regexp.path != nil {
- varNames = append(varNames, r.regexp.path.varsN...)
- }
- for _, regx := range r.regexp.queries {
- varNames = append(varNames, regx.varsN...)
- }
- return varNames, nil
-}
-
-// prepareVars converts the route variable pairs into a map. If the route has a
-// BuildVarsFunc, it is invoked.
-func (r *Route) prepareVars(pairs ...string) (map[string]string, error) {
- m, err := mapFromPairsToString(pairs...)
- if err != nil {
- return nil, err
- }
- return r.buildVars(m), nil
-}
-
-func (r *Route) buildVars(m map[string]string) map[string]string {
- if r.buildVarsFunc != nil {
- m = r.buildVarsFunc(m)
- }
- return m
-}
diff --git a/vendor/github.com/gorilla/mux/test_helpers.go b/vendor/github.com/gorilla/mux/test_helpers.go
deleted file mode 100644
index 5f5c496de0..0000000000
--- a/vendor/github.com/gorilla/mux/test_helpers.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2012 The Gorilla Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package mux
-
-import "net/http"
-
-// SetURLVars sets the URL variables for the given request, to be accessed via
-// mux.Vars for testing route behaviour. Arguments are not modified, a shallow
-// copy is returned.
-//
-// This API should only be used for testing purposes; it provides a way to
-// inject variables into the request context. Alternatively, URL variables
-// can be set by making a route that captures the required variables,
-// starting a server and sending the request to that server.
-func SetURLVars(r *http.Request, val map[string]string) *http.Request {
- return requestWithVars(r, val)
-}
diff --git a/vendor/github.com/lestrrat-go/blackmagic/blackmagic.go b/vendor/github.com/lestrrat-go/blackmagic/blackmagic.go
index aa5704a21a..9c98ac8483 100644
--- a/vendor/github.com/lestrrat-go/blackmagic/blackmagic.go
+++ b/vendor/github.com/lestrrat-go/blackmagic/blackmagic.go
@@ -5,6 +5,20 @@ import (
"reflect"
)
+type errInvalidValue struct{}
+
+func (*errInvalidValue) Error() string {
+ return "invalid value (probably an untyped nil)"
+}
+
+// InvalidValueError is a sentinel error that can be used to
+// indicate that a value is invalid. This can happen when the
+// source value is an untyped nil, and we have no further information
+// about the type of the value, obstructing the assignment.
+func InvalidValueError() error {
+ return &errInvalidValue{}
+}
+
// AssignField is a convenience function to assign a value to
// an optional struct field. In Go, an optional struct field is
// usually denoted by a pointer to T instead of T:
@@ -32,7 +46,7 @@ func AssignOptionalField(dst, src interface{}) error {
if !dstRV.Elem().CanSet() {
return fmt.Errorf(`dst (%T) is not assignable`, dstRV.Elem().Interface())
}
- if !reflect.PtrTo(srcRV.Type()).AssignableTo(dstRV.Elem().Type()) {
+ if !reflect.PointerTo(srcRV.Type()).AssignableTo(dstRV.Elem().Type()) {
return fmt.Errorf(`cannot assign src (%T) to dst (%T)`, src, dst)
}
@@ -50,15 +64,15 @@ func AssignIfCompatible(dst, src interface{}) error {
orv := reflect.ValueOf(src) // save this value for error reporting
result := orv
- // t can be a pointer or a slice, and the code will slightly change
+ // src can be a pointer or a slice, and the code will slightly change
// depending on this
- var isPtr bool
- var isSlice bool
+ var srcIsPtr bool
+ var srcIsSlice bool
switch result.Kind() {
case reflect.Ptr:
- isPtr = true
+ srcIsPtr = true
case reflect.Slice:
- isSlice = true
+ srcIsSlice = true
}
rv := reflect.ValueOf(dst)
@@ -66,17 +80,38 @@ func AssignIfCompatible(dst, src interface{}) error {
return fmt.Errorf(`destination argument to AssignIfCompatible() must be a pointer: %T`, dst)
}
- actualDst := rv.Elem()
+ actualDst := rv
+ for {
+ if !actualDst.IsValid() {
+ return fmt.Errorf(`could not find a valid destination for AssignIfCompatible() (%T)`, dst)
+ }
+ if actualDst.CanSet() {
+ break
+ }
+ actualDst = actualDst.Elem()
+ }
+
switch actualDst.Kind() {
case reflect.Interface:
// If it's an interface, we can just assign the pointer to the interface{}
default:
// If it's a pointer to the struct we're looking for, we need to set
// the de-referenced struct
- if !isSlice && isPtr {
+ if !srcIsSlice && srcIsPtr {
result = result.Elem()
}
}
+
+ if !result.IsValid() {
+ // At this point there's nothing we can do. return an error
+ return fmt.Errorf(`source value is invalid (%T): %w`, src, InvalidValueError())
+ }
+
+ if actualDst.Kind() == reflect.Ptr {
+ actualDst.Set(result.Addr())
+ return nil
+ }
+
if !result.Type().AssignableTo(actualDst.Type()) {
return fmt.Errorf(`argument to AssignIfCompatible() must be compatible with %T (was %T)`, orv.Interface(), dst)
}
diff --git a/vendor/github.com/lestrrat-go/dsig-secp256k1/.gitignore b/vendor/github.com/lestrrat-go/dsig-secp256k1/.gitignore
new file mode 100644
index 0000000000..aaadf736e5
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig-secp256k1/.gitignore
@@ -0,0 +1,32 @@
+# If you prefer the allow list template instead of the deny list, see community template:
+# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
+#
+# Binaries for programs and plugins
+*.exe
+*.exe~
+*.dll
+*.so
+*.dylib
+
+# Test binary, built with `go test -c`
+*.test
+
+# Code coverage profiles and other test artifacts
+*.out
+coverage.*
+*.coverprofile
+profile.cov
+
+# Dependency directories (remove the comment below to include it)
+# vendor/
+
+# Go workspace file
+go.work
+go.work.sum
+
+# env file
+.env
+
+# Editor/IDE
+# .idea/
+# .vscode/
diff --git a/vendor/github.com/lestrrat-go/dsig-secp256k1/Changes b/vendor/github.com/lestrrat-go/dsig-secp256k1/Changes
new file mode 100644
index 0000000000..4dd588a006
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig-secp256k1/Changes
@@ -0,0 +1,5 @@
+Changes
+=======
+
+v1.0.0 18 Aug 2025
+* Initial release
\ No newline at end of file
diff --git a/vendor/github.com/lestrrat-go/dsig-secp256k1/LICENSE b/vendor/github.com/lestrrat-go/dsig-secp256k1/LICENSE
new file mode 100644
index 0000000000..1e1f5d199e
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig-secp256k1/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2025 lestrrat-go
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/github.com/lestrrat-go/dsig-secp256k1/secp256k1.go b/vendor/github.com/lestrrat-go/dsig-secp256k1/secp256k1.go
new file mode 100644
index 0000000000..85650efa1c
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig-secp256k1/secp256k1.go
@@ -0,0 +1,29 @@
+package dsigsecp256k1
+
+import (
+ "crypto"
+
+ "github.com/decred/dcrd/dcrec/secp256k1/v4"
+ "github.com/lestrrat-go/dsig"
+)
+
+const ECDSAWithSecp256k1AndSHA256 = "ECDSA_WITH_SECP256K1_AND_SHA256"
+
+// init adds secp256k1 support when the dsig_secp256k1 build tag is used.
+func init() {
+ // Register ES256K (secp256k1 + SHA256) support using the new API
+ err := dsig.RegisterAlgorithm(ECDSAWithSecp256k1AndSHA256, dsig.AlgorithmInfo{
+ Family: dsig.ECDSA,
+ Meta: dsig.ECDSAFamilyMeta{
+ Hash: crypto.SHA256,
+ },
+ })
+ if err != nil {
+ panic("failed to register secp256k1 algorithm: " + err.Error())
+ }
+}
+
+// secp256k1Curve returns the secp256k1 curve.
+func Curve() *secp256k1.KoblitzCurve {
+ return secp256k1.S256()
+}
diff --git a/vendor/github.com/lestrrat-go/dsig/.gitignore b/vendor/github.com/lestrrat-go/dsig/.gitignore
new file mode 100644
index 0000000000..aaadf736e5
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig/.gitignore
@@ -0,0 +1,32 @@
+# If you prefer the allow list template instead of the deny list, see community template:
+# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
+#
+# Binaries for programs and plugins
+*.exe
+*.exe~
+*.dll
+*.so
+*.dylib
+
+# Test binary, built with `go test -c`
+*.test
+
+# Code coverage profiles and other test artifacts
+*.out
+coverage.*
+*.coverprofile
+profile.cov
+
+# Dependency directories (remove the comment below to include it)
+# vendor/
+
+# Go workspace file
+go.work
+go.work.sum
+
+# env file
+.env
+
+# Editor/IDE
+# .idea/
+# .vscode/
diff --git a/vendor/github.com/lestrrat-go/dsig/Changes b/vendor/github.com/lestrrat-go/dsig/Changes
new file mode 100644
index 0000000000..bccce97613
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig/Changes
@@ -0,0 +1,5 @@
+Changes
+=======
+
+v1.0.0 - 18 Aug 2025
+* Initial release
\ No newline at end of file
diff --git a/vendor/github.com/lestrrat-go/dsig/LICENSE b/vendor/github.com/lestrrat-go/dsig/LICENSE
new file mode 100644
index 0000000000..1e1f5d199e
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2025 lestrrat-go
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/github.com/lestrrat-go/dsig/README.md b/vendor/github.com/lestrrat-go/dsig/README.md
new file mode 100644
index 0000000000..37c194579e
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig/README.md
@@ -0,0 +1,163 @@
+# github.com/lestrrat-go/dsig [](https://github.com/lestrrat-go/dsig/actions/workflows/ci.yml) [](https://pkg.go.dev/github.com/lestrrat-go/dsig) [](https://codecov.io/github/lestrrat-go/dsig?branch=v1)
+
+Go module providing low-level digital signature operations.
+
+While there are many standards for generating and verifying digital signatures, the core operations are virtually the same. This module implements the core functionality of digital signature generation / verifications in a framework agnostic way.
+
+# Features
+
+* RSA signatures (PKCS1v15 and PSS)
+* ECDSA signatures (P-256, P-384, P-521)
+* EdDSA signatures (Ed25519, Ed448)
+* HMAC signatures (SHA-256, SHA-384, SHA-512)
+* Support for crypto.Signer interface
+* Allows for dynamic additions of algorithms in limited cases.
+
+# SYNOPSIS
+
+
+```go
+package examples_test
+
+import (
+ "crypto/ecdsa"
+ "crypto/ed25519"
+ "crypto/elliptic"
+ "crypto/rand"
+ "crypto/rsa"
+ "fmt"
+
+ "github.com/lestrrat-go/dsig"
+)
+
+func Example() {
+ payload := []byte("hello world")
+
+ // RSA signing and verification
+ {
+ privKey, err := rsa.GenerateKey(rand.Reader, 2048)
+ if err != nil {
+ fmt.Printf("failed to generate RSA key: %s\n", err)
+ return
+ }
+
+ // Sign with RSA-PSS SHA256
+ signature, err := dsig.Sign(privKey, dsig.RSAPSSWithSHA256, payload, nil)
+ if err != nil {
+ fmt.Printf("failed to sign with RSA: %s\n", err)
+ return
+ }
+
+ // Verify with RSA-PSS SHA256
+ err = dsig.Verify(&privKey.PublicKey, dsig.RSAPSSWithSHA256, payload, signature)
+ if err != nil {
+ fmt.Printf("failed to verify RSA signature: %s\n", err)
+ return
+ }
+ }
+
+ // ECDSA signing and verification
+ {
+ privKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
+ if err != nil {
+ fmt.Printf("failed to generate ECDSA key: %s\n", err)
+ return
+ }
+
+ // Sign with ECDSA P-256 SHA256
+ signature, err := dsig.Sign(privKey, dsig.ECDSAWithP256AndSHA256, payload, nil)
+ if err != nil {
+ fmt.Printf("failed to sign with ECDSA: %s\n", err)
+ return
+ }
+
+ // Verify with ECDSA P-256 SHA256
+ err = dsig.Verify(&privKey.PublicKey, dsig.ECDSAWithP256AndSHA256, payload, signature)
+ if err != nil {
+ fmt.Printf("failed to verify ECDSA signature: %s\n", err)
+ return
+ }
+ }
+
+ // EdDSA signing and verification
+ {
+ pubKey, privKey, err := ed25519.GenerateKey(rand.Reader)
+ if err != nil {
+ fmt.Printf("failed to generate Ed25519 key: %s\n", err)
+ return
+ }
+
+ // Sign with EdDSA
+ signature, err := dsig.Sign(privKey, dsig.EdDSA, payload, nil)
+ if err != nil {
+ fmt.Printf("failed to sign with EdDSA: %s\n", err)
+ return
+ }
+
+ // Verify with EdDSA
+ err = dsig.Verify(pubKey, dsig.EdDSA, payload, signature)
+ if err != nil {
+ fmt.Printf("failed to verify EdDSA signature: %s\n", err)
+ return
+ }
+ }
+
+ // HMAC signing and verification
+ {
+ key := []byte("secret-key")
+
+ // Sign with HMAC SHA256
+ signature, err := dsig.Sign(key, dsig.HMACWithSHA256, payload, nil)
+ if err != nil {
+ fmt.Printf("failed to sign with HMAC: %s\n", err)
+ return
+ }
+
+ // Verify with HMAC SHA256
+ err = dsig.Verify(key, dsig.HMACWithSHA256, payload, signature)
+ if err != nil {
+ fmt.Printf("failed to verify HMAC signature: %s\n", err)
+ return
+ }
+ }
+ // OUTPUT:
+}
+```
+source: [examples/dsig_readme_example_test.go](https://github.com/lestrrat-go/dsig/blob/v1/examples/dsig_readme_example_test.go)
+
+
+# Supported Algorithms
+
+| Constant | Algorithm | Key Type |
+|----------|-----------|----------|
+| `HMACWithSHA256` | HMAC using SHA-256 | []byte |
+| `HMACWithSHA384` | HMAC using SHA-384 | []byte |
+| `HMACWithSHA512` | HMAC using SHA-512 | []byte |
+| `RSAPKCS1v15WithSHA256` | RSA PKCS#1 v1.5 using SHA-256 | *rsa.PrivateKey / *rsa.PublicKey |
+| `RSAPKCS1v15WithSHA384` | RSA PKCS#1 v1.5 using SHA-384 | *rsa.PrivateKey / *rsa.PublicKey |
+| `RSAPKCS1v15WithSHA512` | RSA PKCS#1 v1.5 using SHA-512 | *rsa.PrivateKey / *rsa.PublicKey |
+| `RSAPSSWithSHA256` | RSA PSS using SHA-256 | *rsa.PrivateKey / *rsa.PublicKey |
+| `RSAPSSWithSHA384` | RSA PSS using SHA-384 | *rsa.PrivateKey / *rsa.PublicKey |
+| `RSAPSSWithSHA512` | RSA PSS using SHA-512 | *rsa.PrivateKey / *rsa.PublicKey |
+| `ECDSAWithP256AndSHA256` | ECDSA using P-256 and SHA-256 | *ecdsa.PrivateKey / *ecdsa.PublicKey |
+| `ECDSAWithP384AndSHA384` | ECDSA using P-384 and SHA-384 | *ecdsa.PrivateKey / *ecdsa.PublicKey |
+| `ECDSAWithP521AndSHA512` | ECDSA using P-521 and SHA-512 | *ecdsa.PrivateKey / *ecdsa.PublicKey |
+| `EdDSA` | EdDSA using Ed25519 or Ed448 | ed25519.PrivateKey / ed25519.PublicKey |
+
+# Description
+
+This library provides low-level digital signature operations. It does minimal parameter validation for performance, uses strongly typed APIs, and has minimal dependencies.
+
+# Contributions
+
+## Issues
+
+For bug reports and feature requests, please include failing tests when possible.
+
+## Pull Requests
+
+Please include tests that exercise your changes.
+
+# Related Libraries
+
+* [github.com/lestrrat-go/jwx](https://github.com/lestrrat-go/jwx) - JOSE (JWA/JWE/JWK/JWS/JWT) implementation
\ No newline at end of file
diff --git a/vendor/github.com/lestrrat-go/dsig/algorithms.go b/vendor/github.com/lestrrat-go/dsig/algorithms.go
new file mode 100644
index 0000000000..0895c64764
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig/algorithms.go
@@ -0,0 +1,37 @@
+package dsig
+
+// This file defines verbose algorithm name constants that can be mapped to by
+// different standards (RFC7518, FIDO, etc.) for interoperability.
+//
+// The algorithm names are intentionally verbose to avoid any ambiguity about
+// the exact cryptographic operations being performed.
+
+const (
+ // HMAC signature algorithms
+ // These use Hash-based Message Authentication Code with specified hash functions
+ HMACWithSHA256 = "HMAC_WITH_SHA256"
+ HMACWithSHA384 = "HMAC_WITH_SHA384"
+ HMACWithSHA512 = "HMAC_WITH_SHA512"
+
+ // RSA signature algorithms with PKCS#1 v1.5 padding
+ // These use RSA signatures with PKCS#1 v1.5 padding and specified hash functions
+ RSAPKCS1v15WithSHA256 = "RSA_PKCS1v15_WITH_SHA256"
+ RSAPKCS1v15WithSHA384 = "RSA_PKCS1v15_WITH_SHA384"
+ RSAPKCS1v15WithSHA512 = "RSA_PKCS1v15_WITH_SHA512"
+
+ // RSA signature algorithms with PSS padding
+ // These use RSA signatures with Probabilistic Signature Scheme (PSS) padding
+ RSAPSSWithSHA256 = "RSA_PSS_WITH_SHA256"
+ RSAPSSWithSHA384 = "RSA_PSS_WITH_SHA384"
+ RSAPSSWithSHA512 = "RSA_PSS_WITH_SHA512"
+
+ // ECDSA signature algorithms
+ // These use Elliptic Curve Digital Signature Algorithm with specified curves and hash functions
+ ECDSAWithP256AndSHA256 = "ECDSA_WITH_P256_AND_SHA256"
+ ECDSAWithP384AndSHA384 = "ECDSA_WITH_P384_AND_SHA384"
+ ECDSAWithP521AndSHA512 = "ECDSA_WITH_P521_AND_SHA512"
+
+ // EdDSA signature algorithms
+ // These use Edwards-curve Digital Signature Algorithm (supports Ed25519 and Ed448)
+ EdDSA = "EDDSA"
+)
\ No newline at end of file
diff --git a/vendor/github.com/lestrrat-go/dsig/crypto_signer.go b/vendor/github.com/lestrrat-go/dsig/crypto_signer.go
new file mode 100644
index 0000000000..f81666708b
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig/crypto_signer.go
@@ -0,0 +1,45 @@
+package dsig
+
+import (
+ "crypto"
+ "crypto/rand"
+ "fmt"
+ "io"
+)
+
+// cryptosign is a low-level function that signs a payload using a crypto.Signer.
+// If hash is crypto.Hash(0), the payload is signed directly without hashing.
+// Otherwise, the payload is hashed using the specified hash function before signing.
+//
+// rr is an io.Reader that provides randomness for signing. If rr is nil, it defaults to rand.Reader.
+func cryptosign(signer crypto.Signer, payload []byte, hash crypto.Hash, opts crypto.SignerOpts, rr io.Reader) ([]byte, error) {
+ if rr == nil {
+ rr = rand.Reader
+ }
+
+ var digest []byte
+ if hash == crypto.Hash(0) {
+ digest = payload
+ } else {
+ h := hash.New()
+ if _, err := h.Write(payload); err != nil {
+ return nil, fmt.Errorf(`failed to write payload to hash: %w`, err)
+ }
+ digest = h.Sum(nil)
+ }
+ return signer.Sign(rr, digest, opts)
+}
+
+// SignCryptoSigner generates a signature using a crypto.Signer interface.
+// This function can be used for hardware security modules, smart cards,
+// and other implementations of the crypto.Signer interface.
+//
+// rr is an io.Reader that provides randomness for signing. If rr is nil, it defaults to rand.Reader.
+//
+// Returns the signature bytes or an error if signing fails.
+func SignCryptoSigner(signer crypto.Signer, raw []byte, h crypto.Hash, opts crypto.SignerOpts, rr io.Reader) ([]byte, error) {
+ if signer == nil {
+ return nil, fmt.Errorf("dsig.SignCryptoSigner: signer is nil")
+ }
+ return cryptosign(signer, raw, h, opts, rr)
+}
diff --git a/vendor/github.com/lestrrat-go/dsig/dsig.go b/vendor/github.com/lestrrat-go/dsig/dsig.go
new file mode 100644
index 0000000000..de6cbdec45
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig/dsig.go
@@ -0,0 +1,224 @@
+// Package dsig provides digital signature operations for Go.
+// It contains low-level signature generation and verification tools that
+// can be used by other signing libraries
+//
+// The package follows these design principles:
+// 1. Does minimal checking of input parameters (for performance); callers need to ensure that the parameters are valid.
+// 2. All exported functions are strongly typed (i.e. they do not take `any` types unless they absolutely have to).
+// 3. Does not rely on other high-level packages (standalone, except for internal packages).
+package dsig
+
+import (
+ "crypto"
+ "crypto/sha256"
+ "crypto/sha512"
+ "fmt"
+ "hash"
+ "sync"
+)
+
+// Family represents the cryptographic algorithm family
+type Family int
+
+const (
+ InvalidFamily Family = iota
+ HMAC
+ RSA
+ ECDSA
+ EdDSAFamily
+ maxFamily
+)
+
+// String returns the string representation of the Family
+func (f Family) String() string {
+ switch f {
+ case HMAC:
+ return "HMAC"
+ case RSA:
+ return "RSA"
+ case ECDSA:
+ return "ECDSA"
+ case EdDSAFamily:
+ return "EdDSA"
+ default:
+ return "InvalidFamily"
+ }
+}
+
+// AlgorithmInfo contains metadata about a digital signature algorithm
+type AlgorithmInfo struct {
+ Family Family // The cryptographic family (HMAC, RSA, ECDSA, EdDSA)
+ Meta any // Family-specific metadata
+}
+
+// HMACFamilyMeta contains metadata specific to HMAC algorithms
+type HMACFamilyMeta struct {
+ HashFunc func() hash.Hash // Hash function constructor
+}
+
+// RSAFamilyMeta contains metadata specific to RSA algorithms
+type RSAFamilyMeta struct {
+ Hash crypto.Hash // Hash algorithm
+ PSS bool // Whether to use PSS padding (false = PKCS#1 v1.5)
+}
+
+// ECDSAFamilyMeta contains metadata specific to ECDSA algorithms
+type ECDSAFamilyMeta struct {
+ Hash crypto.Hash // Hash algorithm
+}
+
+// EdDSAFamilyMeta contains metadata specific to EdDSA algorithms
+// Currently EdDSA doesn't need specific metadata, but this provides extensibility
+type EdDSAFamilyMeta struct {
+ // Reserved for future use
+}
+
+var algorithms = make(map[string]AlgorithmInfo)
+var muAlgorithms sync.RWMutex
+
+// RegisterAlgorithm registers a new digital signature algorithm with the specified family and metadata.
+//
+// info.Meta should contain extra metadata for some algorithms. Currently HMAC, RSA,
+// and ECDSA family of algorithms need their respective metadata (HMACFamilyMeta,
+// RSAFamilyMeta, and ECDSAFamilyMeta). Metadata for other families are ignored.
+func RegisterAlgorithm(name string, info AlgorithmInfo) error {
+ muAlgorithms.Lock()
+ defer muAlgorithms.Unlock()
+
+ // Validate the metadata matches the family
+ switch info.Family {
+ case HMAC:
+ if _, ok := info.Meta.(HMACFamilyMeta); !ok {
+ return fmt.Errorf("invalid HMAC metadata for algorithm %s", name)
+ }
+ case RSA:
+ if _, ok := info.Meta.(RSAFamilyMeta); !ok {
+ return fmt.Errorf("invalid RSA metadata for algorithm %s", name)
+ }
+ case ECDSA:
+ if _, ok := info.Meta.(ECDSAFamilyMeta); !ok {
+ return fmt.Errorf("invalid ECDSA metadata for algorithm %s", name)
+ }
+ case EdDSAFamily:
+ // EdDSA metadata is optional for now
+ default:
+ return fmt.Errorf("unsupported algorithm family %s for algorithm %s", info.Family, name)
+ }
+
+ algorithms[name] = info
+ return nil
+}
+
+// GetAlgorithmInfo retrieves the algorithm information for a given algorithm name.
+// Returns the info and true if found, zero value and false if not found.
+func GetAlgorithmInfo(name string) (AlgorithmInfo, bool) {
+ muAlgorithms.RLock()
+ defer muAlgorithms.RUnlock()
+
+ info, ok := algorithms[name]
+ return info, ok
+}
+
+func init() {
+ // Register all standard algorithms with their metadata
+ toRegister := map[string]AlgorithmInfo{
+ // HMAC algorithms
+ HMACWithSHA256: {
+ Family: HMAC,
+ Meta: HMACFamilyMeta{
+ HashFunc: sha256.New,
+ },
+ },
+ HMACWithSHA384: {
+ Family: HMAC,
+ Meta: HMACFamilyMeta{
+ HashFunc: sha512.New384,
+ },
+ },
+ HMACWithSHA512: {
+ Family: HMAC,
+ Meta: HMACFamilyMeta{
+ HashFunc: sha512.New,
+ },
+ },
+
+ // RSA PKCS#1 v1.5 algorithms
+ RSAPKCS1v15WithSHA256: {
+ Family: RSA,
+ Meta: RSAFamilyMeta{
+ Hash: crypto.SHA256,
+ PSS: false,
+ },
+ },
+ RSAPKCS1v15WithSHA384: {
+ Family: RSA,
+ Meta: RSAFamilyMeta{
+ Hash: crypto.SHA384,
+ PSS: false,
+ },
+ },
+ RSAPKCS1v15WithSHA512: {
+ Family: RSA,
+ Meta: RSAFamilyMeta{
+ Hash: crypto.SHA512,
+ PSS: false,
+ },
+ },
+
+ // RSA PSS algorithms
+ RSAPSSWithSHA256: {
+ Family: RSA,
+ Meta: RSAFamilyMeta{
+ Hash: crypto.SHA256,
+ PSS: true,
+ },
+ },
+ RSAPSSWithSHA384: {
+ Family: RSA,
+ Meta: RSAFamilyMeta{
+ Hash: crypto.SHA384,
+ PSS: true,
+ },
+ },
+ RSAPSSWithSHA512: {
+ Family: RSA,
+ Meta: RSAFamilyMeta{
+ Hash: crypto.SHA512,
+ PSS: true,
+ },
+ },
+
+ // ECDSA algorithms
+ ECDSAWithP256AndSHA256: {
+ Family: ECDSA,
+ Meta: ECDSAFamilyMeta{
+ Hash: crypto.SHA256,
+ },
+ },
+ ECDSAWithP384AndSHA384: {
+ Family: ECDSA,
+ Meta: ECDSAFamilyMeta{
+ Hash: crypto.SHA384,
+ },
+ },
+ ECDSAWithP521AndSHA512: {
+ Family: ECDSA,
+ Meta: ECDSAFamilyMeta{
+ Hash: crypto.SHA512,
+ },
+ },
+
+ // EdDSA algorithm
+ EdDSA: {
+ Family: EdDSAFamily,
+ Meta: EdDSAFamilyMeta{},
+ },
+ }
+
+ for name, info := range toRegister {
+ if err := RegisterAlgorithm(name, info); err != nil {
+ panic(fmt.Sprintf("failed to register algorithm %s: %v", name, err))
+ }
+ }
+}
+
diff --git a/vendor/github.com/lestrrat-go/dsig/ecdsa.go b/vendor/github.com/lestrrat-go/dsig/ecdsa.go
new file mode 100644
index 0000000000..a04a266919
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig/ecdsa.go
@@ -0,0 +1,200 @@
+package dsig
+
+import (
+ "crypto"
+ "crypto/ecdsa"
+ "crypto/rand"
+ "encoding/asn1"
+ "fmt"
+ "io"
+ "math/big"
+
+ "github.com/lestrrat-go/dsig/internal/ecutil"
+)
+
+
+func ecdsaGetSignerKey(key any) (*ecdsa.PrivateKey, crypto.Signer, bool, error) {
+ cs, isCryptoSigner := key.(crypto.Signer)
+ if isCryptoSigner {
+ if !isValidECDSAKey(key) {
+ return nil, nil, false, fmt.Errorf(`invalid key type %T for ECDSA algorithm`, key)
+ }
+
+ switch key.(type) {
+ case ecdsa.PrivateKey, *ecdsa.PrivateKey:
+ // if it's ecdsa.PrivateKey, it's more efficient to
+ // go through the non-crypto.Signer route. Set isCryptoSigner to false
+ isCryptoSigner = false
+ }
+ }
+
+ if isCryptoSigner {
+ return nil, cs, true, nil
+ }
+
+ privkey, ok := key.(*ecdsa.PrivateKey)
+ if !ok {
+ return nil, nil, false, fmt.Errorf(`invalid key type %T. *ecdsa.PrivateKey is required`, key)
+ }
+ return privkey, nil, false, nil
+}
+
+// UnpackASN1ECDSASignature unpacks an ASN.1 encoded ECDSA signature into r and s values.
+// This is typically used when working with crypto.Signer interfaces that return ASN.1 encoded signatures.
+func UnpackASN1ECDSASignature(signed []byte, r, s *big.Int) error {
+ // Okay, this is silly, but hear me out. When we use the
+ // crypto.Signer interface, the PrivateKey is hidden.
+ // But we need some information about the key (its bit size).
+ //
+ // So while silly, we're going to have to make another call
+ // here and fetch the Public key.
+ // (This probably means that this information should be cached somewhere)
+ var p struct {
+ R *big.Int // TODO: get this from a pool?
+ S *big.Int
+ }
+ if _, err := asn1.Unmarshal(signed, &p); err != nil {
+ return fmt.Errorf(`failed to unmarshal ASN1 encoded signature: %w`, err)
+ }
+
+ r.Set(p.R)
+ s.Set(p.S)
+ return nil
+}
+
+// UnpackECDSASignature unpacks a JWS-format ECDSA signature into r and s values.
+// The signature should be in the format specified by RFC 7515 (r||s as fixed-length byte arrays).
+func UnpackECDSASignature(signature []byte, pubkey *ecdsa.PublicKey, r, s *big.Int) error {
+ keySize := ecutil.CalculateKeySize(pubkey.Curve)
+ if len(signature) != keySize*2 {
+ return fmt.Errorf(`invalid signature length for curve %q`, pubkey.Curve.Params().Name)
+ }
+
+ r.SetBytes(signature[:keySize])
+ s.SetBytes(signature[keySize:])
+
+ return nil
+}
+
+// PackECDSASignature packs the r and s values from an ECDSA signature into a JWS-format byte slice.
+// The output format follows RFC 7515: r||s as fixed-length byte arrays.
+func PackECDSASignature(r *big.Int, sbig *big.Int, curveBits int) ([]byte, error) {
+ keyBytes := curveBits / 8
+ if curveBits%8 > 0 {
+ keyBytes++
+ }
+
+ // Serialize r and s into fixed-length bytes
+ rBytes := r.Bytes()
+ rBytesPadded := make([]byte, keyBytes)
+ copy(rBytesPadded[keyBytes-len(rBytes):], rBytes)
+
+ sBytes := sbig.Bytes()
+ sBytesPadded := make([]byte, keyBytes)
+ copy(sBytesPadded[keyBytes-len(sBytes):], sBytes)
+
+ // Output as r||s
+ return append(rBytesPadded, sBytesPadded...), nil
+}
+
+// SignECDSA generates an ECDSA signature for the given payload using the specified private key and hash.
+// The raw parameter should be the pre-computed signing input (typically header.payload).
+//
+// rr is an io.Reader that provides randomness for signing. if rr is nil, it defaults to rand.Reader.
+func SignECDSA(key *ecdsa.PrivateKey, payload []byte, h crypto.Hash, rr io.Reader) ([]byte, error) {
+ if !isValidECDSAKey(key) {
+ return nil, fmt.Errorf(`invalid key type %T for ECDSA algorithm`, key)
+ }
+ hh := h.New()
+ if _, err := hh.Write(payload); err != nil {
+ return nil, fmt.Errorf(`failed to write payload using ecdsa: %w`, err)
+ }
+ digest := hh.Sum(nil)
+
+ if rr == nil {
+ rr = rand.Reader
+ }
+
+ // Sign and get r, s values
+ r, s, err := ecdsa.Sign(rr, key, digest)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to sign payload using ecdsa: %w`, err)
+ }
+
+ return PackECDSASignature(r, s, key.Curve.Params().BitSize)
+}
+
+// SignECDSACryptoSigner generates an ECDSA signature using a crypto.Signer interface.
+// This function works with hardware security modules and other crypto.Signer implementations.
+// The signature is converted from ASN.1 format to JWS format (r||s).
+//
+// rr is an io.Reader that provides randomness for signing. If rr is nil, it defaults to rand.Reader.
+func SignECDSACryptoSigner(signer crypto.Signer, raw []byte, h crypto.Hash, rr io.Reader) ([]byte, error) {
+ signed, err := SignCryptoSigner(signer, raw, h, h, rr)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to sign payload using crypto.Signer: %w`, err)
+ }
+
+ return signECDSACryptoSigner(signer, signed)
+}
+
+func signECDSACryptoSigner(signer crypto.Signer, signed []byte) ([]byte, error) {
+ cpub := signer.Public()
+ pubkey, ok := cpub.(*ecdsa.PublicKey)
+ if !ok {
+ return nil, fmt.Errorf(`expected *ecdsa.PublicKey, got %T`, pubkey)
+ }
+ curveBits := pubkey.Curve.Params().BitSize
+
+ var r, s big.Int
+ if err := UnpackASN1ECDSASignature(signed, &r, &s); err != nil {
+ return nil, fmt.Errorf(`failed to unpack ASN1 encoded signature: %w`, err)
+ }
+
+ return PackECDSASignature(&r, &s, curveBits)
+}
+
+func ecdsaVerify(key *ecdsa.PublicKey, buf []byte, h crypto.Hash, r, s *big.Int) error {
+ hasher := h.New()
+ hasher.Write(buf)
+ digest := hasher.Sum(nil)
+ if !ecdsa.Verify(key, digest, r, s) {
+ return NewVerificationError("invalid ECDSA signature")
+ }
+ return nil
+}
+
+// VerifyECDSA verifies an ECDSA signature for the given payload.
+// This function verifies the signature using the specified public key and hash algorithm.
+// The payload parameter should be the pre-computed signing input (typically header.payload).
+func VerifyECDSA(key *ecdsa.PublicKey, payload, signature []byte, h crypto.Hash) error {
+ var r, s big.Int
+ if err := UnpackECDSASignature(signature, key, &r, &s); err != nil {
+ return fmt.Errorf("dsig.VerifyECDSA: failed to unpack ECDSA signature: %w", err)
+ }
+
+ return ecdsaVerify(key, payload, h, &r, &s)
+}
+
+// VerifyECDSACryptoSigner verifies an ECDSA signature for crypto.Signer implementations.
+// This function is useful for verifying signatures created by hardware security modules
+// or other implementations of the crypto.Signer interface.
+// The payload parameter should be the pre-computed signing input (typically header.payload).
+func VerifyECDSACryptoSigner(signer crypto.Signer, payload, signature []byte, h crypto.Hash) error {
+ var pubkey *ecdsa.PublicKey
+ switch cpub := signer.Public(); cpub := cpub.(type) {
+ case ecdsa.PublicKey:
+ pubkey = &cpub
+ case *ecdsa.PublicKey:
+ pubkey = cpub
+ default:
+ return fmt.Errorf(`dsig.VerifyECDSACryptoSigner: expected *ecdsa.PublicKey, got %T`, cpub)
+ }
+
+ var r, s big.Int
+ if err := UnpackECDSASignature(signature, pubkey, &r, &s); err != nil {
+ return fmt.Errorf("dsig.VerifyECDSACryptoSigner: failed to unpack ASN.1 encoded ECDSA signature: %w", err)
+ }
+
+ return ecdsaVerify(pubkey, payload, h, &r, &s)
+}
diff --git a/vendor/github.com/lestrrat-go/dsig/eddsa.go b/vendor/github.com/lestrrat-go/dsig/eddsa.go
new file mode 100644
index 0000000000..6562da37b8
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig/eddsa.go
@@ -0,0 +1,44 @@
+package dsig
+
+import (
+ "crypto"
+ "crypto/ed25519"
+ "fmt"
+)
+
+func eddsaGetSigner(key any) (crypto.Signer, error) {
+ // The ed25519.PrivateKey object implements crypto.Signer, so we should
+ // simply accept a crypto.Signer here.
+ signer, ok := key.(crypto.Signer)
+ if ok {
+ if !isValidEDDSAKey(key) {
+ return nil, fmt.Errorf(`invalid key type %T for EdDSA algorithm`, key)
+ }
+ return signer, nil
+ }
+
+ // This fallback exists for cases when users give us a pointer instead of non-pointer, etc.
+ privkey, ok := key.(ed25519.PrivateKey)
+ if !ok {
+ return nil, fmt.Errorf(`failed to retrieve ed25519.PrivateKey out of %T`, key)
+ }
+ return privkey, nil
+}
+
+// SignEdDSA generates an EdDSA (Ed25519) signature for the given payload.
+// The raw parameter should be the pre-computed signing input (typically header.payload).
+// EdDSA is deterministic and doesn't require additional hashing of the input.
+func SignEdDSA(key ed25519.PrivateKey, payload []byte) ([]byte, error) {
+ return ed25519.Sign(key, payload), nil
+}
+
+// VerifyEdDSA verifies an EdDSA (Ed25519) signature for the given payload.
+// This function verifies the signature using Ed25519 verification algorithm.
+// The payload parameter should be the pre-computed signing input (typically header.payload).
+// EdDSA is deterministic and provides strong security guarantees without requiring hash function selection.
+func VerifyEdDSA(key ed25519.PublicKey, payload, signature []byte) error {
+ if !ed25519.Verify(key, payload, signature) {
+ return fmt.Errorf("invalid EdDSA signature")
+ }
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/dsig/hmac.go b/vendor/github.com/lestrrat-go/dsig/hmac.go
new file mode 100644
index 0000000000..8b2612279d
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig/hmac.go
@@ -0,0 +1,45 @@
+package dsig
+
+import (
+ "crypto/hmac"
+ "fmt"
+ "hash"
+)
+
+func toHMACKey(dst *[]byte, key any) error {
+ keyBytes, ok := key.([]byte)
+ if !ok {
+ return fmt.Errorf(`dsig.toHMACKey: invalid key type %T. []byte is required`, key)
+ }
+
+ if len(keyBytes) == 0 {
+ return fmt.Errorf(`dsig.toHMACKey: missing key while signing payload`)
+ }
+
+ *dst = keyBytes
+ return nil
+}
+
+// SignHMAC generates an HMAC signature for the given payload using the specified hash function and key.
+// The raw parameter should be the pre-computed signing input (typically header.payload).
+func SignHMAC(key, payload []byte, hfunc func() hash.Hash) ([]byte, error) {
+ h := hmac.New(hfunc, key)
+ if _, err := h.Write(payload); err != nil {
+ return nil, fmt.Errorf(`failed to write payload using hmac: %w`, err)
+ }
+ return h.Sum(nil), nil
+}
+
+// VerifyHMAC verifies an HMAC signature for the given payload.
+// This function verifies the signature using the specified key and hash function.
+// The payload parameter should be the pre-computed signing input (typically header.payload).
+func VerifyHMAC(key, payload, signature []byte, hfunc func() hash.Hash) error {
+ expected, err := SignHMAC(key, payload, hfunc)
+ if err != nil {
+ return fmt.Errorf("failed to sign payload for verification: %w", err)
+ }
+ if !hmac.Equal(signature, expected) {
+ return NewVerificationError("invalid HMAC signature")
+ }
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/dsig/internal/ecutil/ecutil.go b/vendor/github.com/lestrrat-go/dsig/internal/ecutil/ecutil.go
new file mode 100644
index 0000000000..cf0bd4ac48
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig/internal/ecutil/ecutil.go
@@ -0,0 +1,76 @@
+// Package ecutil defines tools that help with elliptic curve related
+// computation
+package ecutil
+
+import (
+ "crypto/elliptic"
+ "math/big"
+ "sync"
+)
+
+const (
+ // size of buffer that needs to be allocated for EC521 curve
+ ec521BufferSize = 66 // (521 / 8) + 1
+)
+
+var ecpointBufferPool = sync.Pool{
+ New: func() any {
+ // In most cases the curve bit size will be less than this length
+ // so allocate the maximum, and keep reusing
+ buf := make([]byte, 0, ec521BufferSize)
+ return &buf
+ },
+}
+
+func getCrvFixedBuffer(size int) []byte {
+ //nolint:forcetypeassert
+ buf := *(ecpointBufferPool.Get().(*[]byte))
+ if size > ec521BufferSize && cap(buf) < size {
+ buf = append(buf, make([]byte, size-cap(buf))...)
+ }
+ return buf[:size]
+}
+
+// ReleaseECPointBuffer releases the []byte buffer allocated.
+func ReleaseECPointBuffer(buf []byte) {
+ buf = buf[:cap(buf)]
+ buf[0] = 0x0
+ for i := 1; i < len(buf); i *= 2 {
+ copy(buf[i:], buf[:i])
+ }
+ buf = buf[:0]
+ ecpointBufferPool.Put(&buf)
+}
+
+func CalculateKeySize(crv elliptic.Curve) int {
+ // We need to create a buffer that fits the entire curve.
+ // If the curve size is 66, that fits in 9 bytes. If the curve
+ // size is 64, it fits in 8 bytes.
+ bits := crv.Params().BitSize
+
+ // For most common cases we know before hand what the byte length
+ // is going to be. optimize
+ var inBytes int
+ switch bits {
+ case 224, 256, 384: // TODO: use constant?
+ inBytes = bits / 8
+ case 521:
+ inBytes = ec521BufferSize
+ default:
+ inBytes = bits / 8
+ if (bits % 8) != 0 {
+ inBytes++
+ }
+ }
+
+ return inBytes
+}
+
+// AllocECPointBuffer allocates a buffer for the given point in the given
+// curve. This buffer should be released using the ReleaseECPointBuffer
+// function.
+func AllocECPointBuffer(v *big.Int, crv elliptic.Curve) []byte {
+ buf := getCrvFixedBuffer(CalculateKeySize(crv))
+ v.FillBytes(buf)
+ return buf
+}
diff --git a/vendor/github.com/lestrrat-go/dsig/rsa.go b/vendor/github.com/lestrrat-go/dsig/rsa.go
new file mode 100644
index 0000000000..a339fe5b78
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig/rsa.go
@@ -0,0 +1,63 @@
+package dsig
+
+import (
+ "crypto"
+ "crypto/rsa"
+ "fmt"
+ "io"
+)
+
+func rsaGetSignerCryptoSignerKey(key any) (crypto.Signer, bool, error) {
+ if !isValidRSAKey(key) {
+ return nil, false, fmt.Errorf(`invalid key type %T for RSA algorithm`, key)
+ }
+ cs, isCryptoSigner := key.(crypto.Signer)
+ if isCryptoSigner {
+ return cs, true, nil
+ }
+ return nil, false, nil
+}
+
+// rsaPSSOptions returns the PSS options for RSA-PSS signatures with the specified hash.
+// The salt length is set to equal the hash length as per RFC 7518.
+func rsaPSSOptions(h crypto.Hash) rsa.PSSOptions {
+ return rsa.PSSOptions{
+ Hash: h,
+ SaltLength: rsa.PSSSaltLengthEqualsHash,
+ }
+}
+
+// SignRSA generates an RSA signature for the given payload using the specified private key and options.
+// The raw parameter should be the pre-computed signing input (typically header.payload).
+// If pss is true, RSA-PSS is used; otherwise, PKCS#1 v1.5 is used.
+//
+// The rr parameter is an optional io.Reader that can be used to provide randomness for signing.
+// If rr is nil, it defaults to rand.Reader.
+func SignRSA(key *rsa.PrivateKey, payload []byte, h crypto.Hash, pss bool, rr io.Reader) ([]byte, error) {
+ if !isValidRSAKey(key) {
+ return nil, fmt.Errorf(`invalid key type %T for RSA algorithm`, key)
+ }
+ var opts crypto.SignerOpts = h
+ if pss {
+ rsaopts := rsaPSSOptions(h)
+ opts = &rsaopts
+ }
+ return cryptosign(key, payload, h, opts, rr)
+}
+
+// VerifyRSA verifies an RSA signature for the given payload and header.
+// This function constructs the signing input by encoding the header and payload according to JWS specification,
+// then verifies the signature using the specified public key and hash algorithm.
+// If pss is true, RSA-PSS verification is used; otherwise, PKCS#1 v1.5 verification is used.
+func VerifyRSA(key *rsa.PublicKey, payload, signature []byte, h crypto.Hash, pss bool) error {
+ if !isValidRSAKey(key) {
+ return fmt.Errorf(`invalid key type %T for RSA algorithm`, key)
+ }
+ hasher := h.New()
+ hasher.Write(payload)
+ digest := hasher.Sum(nil)
+ if pss {
+ return rsa.VerifyPSS(key, h, digest, signature, &rsa.PSSOptions{Hash: h, SaltLength: rsa.PSSSaltLengthEqualsHash})
+ }
+ return rsa.VerifyPKCS1v15(key, h, digest, signature)
+}
diff --git a/vendor/github.com/lestrrat-go/dsig/sign.go b/vendor/github.com/lestrrat-go/dsig/sign.go
new file mode 100644
index 0000000000..e2a6bde290
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig/sign.go
@@ -0,0 +1,100 @@
+package dsig
+
+import (
+ "crypto"
+ "crypto/rsa"
+ "fmt"
+ "io"
+)
+
+// Sign generates a digital signature using the specified key and algorithm.
+//
+// This function loads the signer registered in the dsig package _ONLY_.
+// It does not support custom signers that the user might have registered.
+//
+// rr is an io.Reader that provides randomness for signing. If rr is nil, it defaults to rand.Reader.
+// Not all algorithms require this parameter, but it is included for consistency.
+// 99% of the time, you can pass nil for rr, and it will work fine.
+func Sign(key any, alg string, payload []byte, rr io.Reader) ([]byte, error) {
+ info, ok := GetAlgorithmInfo(alg)
+ if !ok {
+ return nil, fmt.Errorf(`dsig.Sign: unsupported signature algorithm %q`, alg)
+ }
+
+ switch info.Family {
+ case HMAC:
+ return dispatchHMACSign(key, info, payload)
+ case RSA:
+ return dispatchRSASign(key, info, payload, rr)
+ case ECDSA:
+ return dispatchECDSASign(key, info, payload, rr)
+ case EdDSAFamily:
+ return dispatchEdDSASign(key, info, payload, rr)
+ default:
+ return nil, fmt.Errorf(`dsig.Sign: unsupported signature family %q`, info.Family)
+ }
+}
+
+func dispatchHMACSign(key any, info AlgorithmInfo, payload []byte) ([]byte, error) {
+ meta, ok := info.Meta.(HMACFamilyMeta)
+ if !ok {
+ return nil, fmt.Errorf(`dsig.Sign: invalid HMAC metadata`)
+ }
+
+ var hmackey []byte
+ if err := toHMACKey(&hmackey, key); err != nil {
+ return nil, fmt.Errorf(`dsig.Sign: %w`, err)
+ }
+ return SignHMAC(hmackey, payload, meta.HashFunc)
+}
+
+func dispatchRSASign(key any, info AlgorithmInfo, payload []byte, rr io.Reader) ([]byte, error) {
+ meta, ok := info.Meta.(RSAFamilyMeta)
+ if !ok {
+ return nil, fmt.Errorf(`dsig.Sign: invalid RSA metadata`)
+ }
+
+ cs, isCryptoSigner, err := rsaGetSignerCryptoSignerKey(key)
+ if err != nil {
+ return nil, fmt.Errorf(`dsig.Sign: %w`, err)
+ }
+ if isCryptoSigner {
+ var options crypto.SignerOpts = meta.Hash
+ if meta.PSS {
+ rsaopts := rsaPSSOptions(meta.Hash)
+ options = &rsaopts
+ }
+ return SignCryptoSigner(cs, payload, meta.Hash, options, rr)
+ }
+
+ privkey, ok := key.(*rsa.PrivateKey)
+ if !ok {
+ return nil, fmt.Errorf(`dsig.Sign: invalid key type %T. *rsa.PrivateKey is required`, key)
+ }
+ return SignRSA(privkey, payload, meta.Hash, meta.PSS, rr)
+}
+
+func dispatchEdDSASign(key any, _ AlgorithmInfo, payload []byte, rr io.Reader) ([]byte, error) {
+ signer, err := eddsaGetSigner(key)
+ if err != nil {
+ return nil, fmt.Errorf(`dsig.Sign: %w`, err)
+ }
+
+ return SignCryptoSigner(signer, payload, crypto.Hash(0), crypto.Hash(0), rr)
+}
+
+func dispatchECDSASign(key any, info AlgorithmInfo, payload []byte, rr io.Reader) ([]byte, error) {
+ meta, ok := info.Meta.(ECDSAFamilyMeta)
+ if !ok {
+ return nil, fmt.Errorf(`dsig.Sign: invalid ECDSA metadata`)
+ }
+
+ privkey, cs, isCryptoSigner, err := ecdsaGetSignerKey(key)
+ if err != nil {
+ return nil, fmt.Errorf(`dsig.Sign: %w`, err)
+ }
+ if isCryptoSigner {
+ return SignECDSACryptoSigner(cs, payload, meta.Hash, rr)
+ }
+ return SignECDSA(privkey, payload, meta.Hash, rr)
+}
diff --git a/vendor/github.com/lestrrat-go/dsig/validation.go b/vendor/github.com/lestrrat-go/dsig/validation.go
new file mode 100644
index 0000000000..17682d8538
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig/validation.go
@@ -0,0 +1,66 @@
+package dsig
+
+import (
+ "crypto/ecdsa"
+ "crypto/ed25519"
+ "crypto/rsa"
+)
+
+// isValidRSAKey validates that the provided key type is appropriate for RSA algorithms.
+// It returns false if the key is clearly incompatible (e.g., ECDSA or EdDSA keys).
+func isValidRSAKey(key any) bool {
+ switch key.(type) {
+ case
+ ecdsa.PrivateKey, *ecdsa.PrivateKey,
+ ed25519.PrivateKey:
+ // these are NOT ok for RSA algorithms
+ return false
+ }
+ return true
+}
+
+// isValidECDSAKey validates that the provided key type is appropriate for ECDSA algorithms.
+// It returns false if the key is clearly incompatible (e.g., RSA or EdDSA keys).
+func isValidECDSAKey(key any) bool {
+ switch key.(type) {
+ case
+ ed25519.PrivateKey,
+ rsa.PrivateKey, *rsa.PrivateKey:
+ // these are NOT ok for ECDSA algorithms
+ return false
+ }
+ return true
+}
+
+// isValidEDDSAKey validates that the provided key type is appropriate for EdDSA algorithms.
+// It returns false if the key is clearly incompatible (e.g., RSA or ECDSA keys).
+func isValidEDDSAKey(key any) bool {
+ switch key.(type) {
+ case
+ ecdsa.PrivateKey, *ecdsa.PrivateKey,
+ rsa.PrivateKey, *rsa.PrivateKey:
+ // these are NOT ok for EdDSA algorithms
+ return false
+ }
+ return true
+}
+
+// VerificationError represents an error that occurred during signature verification.
+type VerificationError struct {
+ message string
+}
+
+func (e *VerificationError) Error() string {
+ return e.message
+}
+
+// NewVerificationError creates a new verification error with the given message.
+func NewVerificationError(message string) error {
+ return &VerificationError{message: message}
+}
+
+// IsVerificationError checks if the given error is a verification error.
+func IsVerificationError(err error) bool {
+ _, ok := err.(*VerificationError)
+ return ok
+}
diff --git a/vendor/github.com/lestrrat-go/dsig/verify.go b/vendor/github.com/lestrrat-go/dsig/verify.go
new file mode 100644
index 0000000000..86085b0a37
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/dsig/verify.go
@@ -0,0 +1,134 @@
+package dsig
+
+import (
+ "crypto"
+ "crypto/ecdsa"
+ "crypto/ed25519"
+ "crypto/rsa"
+ "fmt"
+)
+
+// Verify verifies a digital signature using the specified key and algorithm.
+//
+// This function loads the verifier registered in the dsig package _ONLY_.
+// It does not support custom verifiers that the user might have registered.
+func Verify(key any, alg string, payload, signature []byte) error {
+ info, ok := GetAlgorithmInfo(alg)
+ if !ok {
+ return fmt.Errorf(`dsig.Verify: unsupported signature algorithm %q`, alg)
+ }
+
+ switch info.Family {
+ case HMAC:
+ return dispatchHMACVerify(key, info, payload, signature)
+ case RSA:
+ return dispatchRSAVerify(key, info, payload, signature)
+ case ECDSA:
+ return dispatchECDSAVerify(key, info, payload, signature)
+ case EdDSAFamily:
+ return dispatchEdDSAVerify(key, info, payload, signature)
+ default:
+ return fmt.Errorf(`dsig.Verify: unsupported signature family %q`, info.Family)
+ }
+}
+
+func dispatchHMACVerify(key any, info AlgorithmInfo, payload, signature []byte) error {
+ meta, ok := info.Meta.(HMACFamilyMeta)
+ if !ok {
+ return fmt.Errorf(`dsig.Verify: invalid HMAC metadata`)
+ }
+
+ var hmackey []byte
+ if err := toHMACKey(&hmackey, key); err != nil {
+ return fmt.Errorf(`dsig.Verify: %w`, err)
+ }
+ return VerifyHMAC(hmackey, payload, signature, meta.HashFunc)
+}
+
+func dispatchRSAVerify(key any, info AlgorithmInfo, payload, signature []byte) error {
+ meta, ok := info.Meta.(RSAFamilyMeta)
+ if !ok {
+ return fmt.Errorf(`dsig.Verify: invalid RSA metadata`)
+ }
+
+ var pubkey *rsa.PublicKey
+
+ if cs, ok := key.(crypto.Signer); ok {
+ cpub := cs.Public()
+ switch cpub := cpub.(type) {
+ case rsa.PublicKey:
+ pubkey = &cpub
+ case *rsa.PublicKey:
+ pubkey = cpub
+ default:
+ return fmt.Errorf(`dsig.Verify: failed to retrieve rsa.PublicKey out of crypto.Signer %T`, key)
+ }
+ } else {
+ var ok bool
+ pubkey, ok = key.(*rsa.PublicKey)
+ if !ok {
+ return fmt.Errorf(`dsig.Verify: failed to retrieve *rsa.PublicKey out of %T`, key)
+ }
+ }
+
+ return VerifyRSA(pubkey, payload, signature, meta.Hash, meta.PSS)
+}
+
+func dispatchECDSAVerify(key any, info AlgorithmInfo, payload, signature []byte) error {
+ meta, ok := info.Meta.(ECDSAFamilyMeta)
+ if !ok {
+ return fmt.Errorf(`dsig.Verify: invalid ECDSA metadata`)
+ }
+
+ pubkey, cs, isCryptoSigner, err := ecdsaGetVerifierKey(key)
+ if err != nil {
+ return fmt.Errorf(`dsig.Verify: %w`, err)
+ }
+ if isCryptoSigner {
+ return VerifyECDSACryptoSigner(cs, payload, signature, meta.Hash)
+ }
+ return VerifyECDSA(pubkey, payload, signature, meta.Hash)
+}
+
+func dispatchEdDSAVerify(key any, _ AlgorithmInfo, payload, signature []byte) error {
+ var pubkey ed25519.PublicKey
+ signer, ok := key.(crypto.Signer)
+ if ok {
+ v := signer.Public()
+ pubkey, ok = v.(ed25519.PublicKey)
+ if !ok {
+ return fmt.Errorf(`dsig.Verify: expected crypto.Signer.Public() to return ed25519.PublicKey, but got %T`, v)
+ }
+ } else {
+ var ok bool
+ pubkey, ok = key.(ed25519.PublicKey)
+ if !ok {
+ return fmt.Errorf(`dsig.Verify: failed to retrieve ed25519.PublicKey out of %T`, key)
+ }
+ }
+
+ return VerifyEdDSA(pubkey, payload, signature)
+}
+
+func ecdsaGetVerifierKey(key any) (*ecdsa.PublicKey, crypto.Signer, bool, error) {
+ cs, isCryptoSigner := key.(crypto.Signer)
+ if isCryptoSigner {
+ switch key.(type) {
+ case ecdsa.PublicKey, *ecdsa.PublicKey:
+ // if it's ecdsa.PublicKey, it's more efficient to
+ // go through the non-crypto.Signer route. Set isCryptoSigner to false
+ isCryptoSigner = false
+ }
+ }
+
+ if isCryptoSigner {
+ return nil, cs, true, nil
+ }
+
+ pubkey, ok := key.(*ecdsa.PublicKey)
+ if !ok {
+ return nil, nil, false, fmt.Errorf(`invalid key type %T. *ecdsa.PublicKey is required`, key)
+ }
+
+ return pubkey, nil, false, nil
+}
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/.gitignore b/vendor/github.com/lestrrat-go/httprc/v3/.gitignore
new file mode 100644
index 0000000000..66fd13c903
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/.gitignore
@@ -0,0 +1,15 @@
+# Binaries for programs and plugins
+*.exe
+*.exe~
+*.dll
+*.so
+*.dylib
+
+# Test binary, built with `go test -c`
+*.test
+
+# Output of the go coverage tool, specifically when used with LiteIDE
+*.out
+
+# Dependency directories (remove the comment below to include it)
+# vendor/
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/.golangci.yml b/vendor/github.com/lestrrat-go/httprc/v3/.golangci.yml
new file mode 100644
index 0000000000..b3af8cfe12
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/.golangci.yml
@@ -0,0 +1,95 @@
+version: "2"
+linters:
+ default: all
+ disable:
+ - cyclop
+ - depguard
+ - dupl
+ - errorlint
+ - exhaustive
+ - forbidigo
+ - funcorder
+ - funlen
+ - gochecknoglobals
+ - gochecknoinits
+ - gocognit
+ - gocritic
+ - gocyclo
+ - godot
+ - godox
+ - gosec
+ - gosmopolitan
+ - govet
+ - inamedparam
+ - ireturn
+ - lll
+ - maintidx
+ - makezero
+ - mnd
+ - nakedret
+ - nestif
+ - nlreturn
+ - noinlineerr
+ - nonamedreturns
+ - paralleltest
+ - tagliatelle
+ - testpackage
+ - thelper
+ - varnamelen
+ - wrapcheck
+ - wsl
+ - wsl_v5
+ settings:
+ govet:
+ disable:
+ - shadow
+ - fieldalignment
+ enable-all: true
+ exclusions:
+ generated: lax
+ presets:
+ - comments
+ - common-false-positives
+ - legacy
+ - std-error-handling
+ rules:
+ - linters:
+ - staticcheck
+ path: /*.go
+ text: 'ST1003: should not use underscores in package names'
+ - linters:
+ - revive
+ path: /*.go
+ text: don't use an underscore in package name
+ - linters:
+ - contextcheck
+ - exhaustruct
+ path: /*.go
+ - linters:
+ - errcheck
+ path: /main.go
+ - linters:
+ - errcheck
+ - errchkjson
+ - forcetypeassert
+ path: /*_test.go
+ - linters:
+ - forbidigo
+ path: /*_example_test.go
+ paths:
+ - third_party$
+ - builtin$
+ - examples$
+issues:
+ max-issues-per-linter: 0
+ max-same-issues: 0
+formatters:
+ enable:
+ - gofmt
+ - goimports
+ exclusions:
+ generated: lax
+ paths:
+ - third_party$
+ - builtin$
+ - examples$
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/Changes b/vendor/github.com/lestrrat-go/httprc/v3/Changes
new file mode 100644
index 0000000000..6a5eb8064a
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/Changes
@@ -0,0 +1,34 @@
+Changes
+=======
+
+v3.0.2 05 Dev 2025
+* Code changes mainly due to upgraded linter.
+* github.com/lestrrat-go/option upgraded to v2
+
+v3.0.1 18 Aug 2025
+* Refresh() no longer requires the resource to be ready.
+
+v3.0.0 5 Jun 2025
+[Breaking Changes]
+ * The entire API has been re-imagined for Go versions that allow typed parameters
+
+v2.0.0 19 Feb 2024
+[Breaking Changes]
+ * `Fetcher` type is no longer available. You probably want to provide
+ a customg HTTP client instead via httprc.WithHTTPClient()).
+ *
+
+v1.0.4 19 Jul 2022
+ * Fix sloppy API breakage
+
+v1.0.3 19 Jul 2022
+ * Fix queue insertion in the middle of the queue (#7)
+
+v1.0.2 13 Jun 2022
+ * Properly release a lock when the fetch fails (#5)
+
+v1.0.1 29 Mar 2022
+ * Bump dependency for github.com/lestrrat-go/httpcc to v1.0.1
+
+v1.0.0 29 Mar 2022
+ * Initial release, refactored out of github.com/lestrrat-go/jwx
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/LICENSE b/vendor/github.com/lestrrat-go/httprc/v3/LICENSE
new file mode 100644
index 0000000000..3e196892ca
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2022 lestrrat
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/README.md b/vendor/github.com/lestrrat-go/httprc/v3/README.md
new file mode 100644
index 0000000000..68239669a2
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/README.md
@@ -0,0 +1,172 @@
+# github.com/lestrrat-go/httprc/v3  [](https://pkg.go.dev/github.com/lestrrat-go/httprc/v3)
+
+`httprc` is a HTTP "Refresh" Cache. Its aim is to cache a remote resource that
+can be fetched via HTTP, but keep the cached content up-to-date based on periodic
+refreshing.
+
+# Client
+
+A `httprc.Client` object is comprised of 3 parts: The user-facing controller API,
+the main controller loop, and set of workers that perform the actual fetching.
+
+The user-facing controller API is the object returned when you call `(httprc.Client).Start`.
+
+```go
+ctrl, _ := client.Start(ctx)
+```
+
+# Controller API
+
+The controller API gives you access to the controller backend that runs asynchronously.
+All methods take a `context.Context` object because they potentially block. You should
+be careful to use `context.WithTimeout` to properly set a timeout if you cannot tolerate
+a blocking operation.
+
+# Main Controller Loop
+
+The main controller loop is run asynchronously to the controller API. It is single threaded,
+and it has two reponsibilities.
+
+The first is to receive commands from the controller API,
+and appropriately modify the state of the goroutine, i.e. modify the list of resources
+it is watching, performing forced refreshes, etc.
+
+The other is to periodically wake up and go through the list of resources and re-fetch
+ones that are past their TTL (in reality, each resource carry a "next-check" time, not
+a TTL). The main controller loop itself does nothing more: it just kicks these checks periodically.
+
+The interval between fetches is changed dynamically based on either the metadata carried
+with the HTTP responses, such as `Cache-Control` and `Expires` headers, or a constant
+interval set by the user for a given resource. Between these values, the main controller loop
+will pick the shortest interval (but no less than 1 second) and checks if resources
+need updating based on that value.
+
+For example, if a resource A has an expiry of 10 minutes and if resource has an expiry of 5
+minutes, the main controller loop will attempt to wake up roughly every 5 minutes to check
+on the resources.
+
+When the controller loop detects that a resource needs to be checked for freshness,
+it will send the resource to the worker pool to be synced.
+
+# Interval calculation
+
+After the resource is synced, the next fetch is scheduled. The interval to the next
+fetch is calculated either by using constant intervals, or by heuristics using values
+from the `http.Response` object.
+
+If the constant interval is specified, no extra calculation is performed. If you specify
+a constant interval of 15 minutes, the resource will be checked every 15 minutes. This is
+predictable and reliable, but not necessarily efficient.
+
+If you do not specify a constant interval, the HTTP response is analyzed for
+values in `Cache-Control` and `Expires` headers. These values will be compared against
+a maximum and minimum interval values, which default to 30 days and 15 minutes, respectively.
+If the values obtained from the headers fall within that range, the value from the header is
+used. If the value is larger than the maximum, the maximum is used. If the value is lower
+than the minimum, the minimum is used.
+
+# SYNOPSIS
+
+
+```go
+package httprc_test
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "net/http/httptest"
+ "time"
+
+ "github.com/lestrrat-go/httprc/v3"
+)
+
+func ExampleClient() {
+ ctx, cancel := context.WithCancel(context.Background())
+ defer cancel()
+
+ type HelloWorld struct {
+ Hello string `json:"hello"`
+ }
+
+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
+ json.NewEncoder(w).Encode(map[string]string{"hello": "world"})
+ }))
+
+ options := []httprc.NewClientOption{
+ // By default the client will allow all URLs (which is what the option
+ // below is explicitly specifying). If you want to restrict what URLs
+ // are allowed, you can specify another whitelist.
+ //
+ // httprc.WithWhitelist(httprc.NewInsecureWhitelist()),
+ }
+ // If you would like to handle errors from asynchronous workers, you can specify a error sink.
+ // This is disabled in this example because the trace logs are dynamic
+ // and thus would interfere with the runnable example test.
+ // options = append(options, httprc.WithErrorSink(errsink.NewSlog(slog.New(slog.NewJSONHandler(os.Stdout, nil)))))
+
+ // If you would like to see the trace logs, you can specify a trace sink.
+ // This is disabled in this example because the trace logs are dynamic
+ // and thus would interfere with the runnable example test.
+ // options = append(options, httprc.WithTraceSink(tracesink.NewSlog(slog.New(slog.NewJSONHandler(os.Stdout, nil)))))
+
+ // Create a new client
+ cl := httprc.NewClient(options...)
+
+ // Start the client, and obtain a Controller object
+ ctrl, err := cl.Start(ctx)
+ if err != nil {
+ fmt.Println(err.Error())
+ return
+ }
+ // The following is required if you want to make sure that there are no
+ // dangling goroutines hanging around when you exit. For example, if you
+ // are running tests to check for goroutine leaks, you should call this
+ // function before the end of your test.
+ defer ctrl.Shutdown(time.Second)
+
+ // Create a new resource that is synchronized every so often
+ //
+ // By default the client will attempt to fetch the resource once
+ // as soon as it can, and then if no other metadata is provided,
+ // it will fetch the resource every 15 minutes.
+ //
+ // If the resource responds with a Cache-Control/Expires header,
+ // the client will attempt to respect that, and will try to fetch
+ // the resource again based on the values obatained from the headers.
+ r, err := httprc.NewResource[HelloWorld](srv.URL, httprc.JSONTransformer[HelloWorld]())
+ if err != nil {
+ fmt.Println(err.Error())
+ return
+ }
+
+ // Add the resource to the controller, so that it starts fetching.
+ // By default, a call to `Add()` will block until the first fetch
+ // succeeds, via an implicit call to `r.Ready()`
+ // You can change this behavior if you specify the `WithWaitReady(false)`
+ // option.
+ ctrl.Add(ctx, r)
+
+ // if you specified `httprc.WithWaitReady(false)` option, the fetch will happen
+ // "soon", but you're not guaranteed that it will happen before the next
+ // call to `Lookup()`. If you want to make sure that the resource is ready,
+ // you can call `Ready()` like so:
+ /*
+ {
+ tctx, tcancel := context.WithTimeout(ctx, time.Second)
+ defer tcancel()
+ if err := r.Ready(tctx); err != nil {
+ fmt.Println(err.Error())
+ return
+ }
+ }
+ */
+ m := r.Resource()
+ fmt.Println(m.Hello)
+ // OUTPUT:
+ // world
+}
+```
+source: [client_example_test.go](https://github.com/lestrrat-go/httprc/blob/refs/heads/v3/client_example_test.go)
+
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/backend.go b/vendor/github.com/lestrrat-go/httprc/v3/backend.go
new file mode 100644
index 0000000000..31f9fc07d3
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/backend.go
@@ -0,0 +1,235 @@
+package httprc
+
+import (
+ "context"
+ "fmt"
+ "sync"
+ "time"
+)
+
+func (c *ctrlBackend) adjustInterval(ctx context.Context, req adjustIntervalRequest) {
+ interval := roundupToSeconds(time.Until(req.resource.Next()))
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: got adjust request (current tick interval=%s, next for %q=%s)", c.tickInterval, req.resource.URL(), interval))
+
+ if interval < time.Second {
+ interval = time.Second
+ }
+
+ if c.tickInterval < interval {
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: no adjusting required (time to next check %s > current tick interval %s)", interval, c.tickInterval))
+ } else {
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: adjusting tick interval to %s", interval))
+ c.tickInterval = interval
+ c.check.Reset(interval)
+ }
+}
+
+func (c *ctrlBackend) addResource(ctx context.Context, req addRequest) {
+ r := req.resource
+ if _, ok := c.items[r.URL()]; ok {
+ // Already exists
+ sendReply(ctx, req.reply, struct{}{}, errResourceAlreadyExists)
+ return
+ }
+ c.items[r.URL()] = r
+
+ if r.MaxInterval() == 0 {
+ r.SetMaxInterval(c.defaultMaxInterval)
+ }
+
+ if r.MinInterval() == 0 {
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: set minimum interval to %s", c.defaultMinInterval))
+ r.SetMinInterval(c.defaultMinInterval)
+ }
+
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: added resource %q", r.URL()))
+ sendReply(ctx, req.reply, struct{}{}, nil)
+ c.SetTickInterval(time.Nanosecond)
+}
+
+func (c *ctrlBackend) rmResource(ctx context.Context, req rmRequest) {
+ u := req.u
+ if _, ok := c.items[u]; !ok {
+ sendReply(ctx, req.reply, struct{}{}, errResourceNotFound)
+ return
+ }
+
+ delete(c.items, u)
+
+ minInterval := oneDay
+ for _, item := range c.items {
+ if d := item.MinInterval(); d < minInterval {
+ minInterval = d
+ }
+ }
+
+ close(req.reply)
+ c.check.Reset(minInterval)
+}
+
+func (c *ctrlBackend) refreshResource(ctx context.Context, req refreshRequest) {
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: [refresh] START %q", req.u))
+ defer c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: [refresh] END %q", req.u))
+ u := req.u
+
+ r, ok := c.items[u]
+ if !ok {
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: [refresh] %s is not registered", req.u))
+ sendReply(ctx, req.reply, struct{}{}, errResourceNotFound)
+ return
+ }
+
+ // Note: We don't wait for r.Ready() here because refresh should work
+ // regardless of whether the resource has been fetched before. This allows
+ // refresh to work with resources registered using WithWaitReady(false).
+
+ r.SetNext(time.Unix(0, 0))
+ sendWorkerSynchronous(ctx, c.syncoutgoing, synchronousRequest{
+ resource: r,
+ reply: req.reply,
+ })
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: [refresh] sync request for %s sent to worker pool", req.u))
+}
+
+func (c *ctrlBackend) lookupResource(ctx context.Context, req lookupRequest) {
+ u := req.u
+ r, ok := c.items[u]
+ if !ok {
+ sendReply(ctx, req.reply, nil, errResourceNotFound)
+ return
+ }
+ sendReply(ctx, req.reply, r, nil)
+}
+
+func (c *ctrlBackend) handleRequest(ctx context.Context, req any) {
+ switch req := req.(type) {
+ case adjustIntervalRequest:
+ c.adjustInterval(ctx, req)
+ case addRequest:
+ c.addResource(ctx, req)
+ case rmRequest:
+ c.rmResource(ctx, req)
+ case refreshRequest:
+ c.refreshResource(ctx, req)
+ case lookupRequest:
+ c.lookupResource(ctx, req)
+ default:
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: unknown request type %T", req))
+ }
+}
+
+func sendWorker(ctx context.Context, ch chan Resource, r Resource) {
+ r.SetBusy(true)
+ select {
+ case <-ctx.Done():
+ case ch <- r:
+ }
+}
+
+func sendWorkerSynchronous(ctx context.Context, ch chan synchronousRequest, r synchronousRequest) {
+ r.resource.SetBusy(true)
+ select {
+ case <-ctx.Done():
+ case ch <- r:
+ }
+}
+
+func sendReply[T any](ctx context.Context, ch chan backendResponse[T], v T, err error) {
+ defer close(ch)
+ select {
+ case <-ctx.Done():
+ case ch <- backendResponse[T]{payload: v, err: err}:
+ }
+}
+
+type ctrlBackend struct {
+ items map[string]Resource
+ outgoing chan Resource
+ syncoutgoing chan synchronousRequest
+ incoming chan any // incoming requests to the controller
+ traceSink TraceSink
+ tickInterval time.Duration
+ check *time.Ticker
+ defaultMaxInterval time.Duration
+ defaultMinInterval time.Duration
+}
+
+func (c *ctrlBackend) loop(ctx context.Context, readywg, donewg *sync.WaitGroup) {
+ c.traceSink.Put(ctx, "httprc controller: starting main controller loop")
+ readywg.Done()
+ defer c.traceSink.Put(ctx, "httprc controller: stopping main controller loop")
+ defer donewg.Done()
+ for {
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: waiting for request or tick (tick interval=%s)", c.tickInterval))
+ select {
+ case req := <-c.incoming:
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: got request %T", req))
+ c.handleRequest(ctx, req)
+ case t := <-c.check.C:
+ c.periodicCheck(ctx, t)
+ case <-ctx.Done():
+ return
+ }
+ }
+}
+
+func (c *ctrlBackend) periodicCheck(ctx context.Context, t time.Time) {
+ c.traceSink.Put(ctx, "httprc controller: START periodic check")
+ defer c.traceSink.Put(ctx, "httprc controller: END periodic check")
+ var minNext time.Time
+ var dispatched int
+ minInterval := -1 * time.Second
+ for _, item := range c.items {
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: checking resource %q", item.URL()))
+
+ next := item.Next()
+ if minNext.IsZero() || next.Before(minNext) {
+ minNext = next
+ }
+
+ if interval := item.MinInterval(); minInterval < 0 || interval < minInterval {
+ minInterval = interval
+ }
+
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: resource %q isBusy=%t, next(%s).After(%s)=%t", item.URL(), item.IsBusy(), next, t, next.After(t)))
+ if item.IsBusy() || next.After(t) {
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: resource %q is busy or not ready yet, skipping", item.URL()))
+ continue
+ }
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: resource %q is ready, dispatching to worker pool", item.URL()))
+
+ dispatched++
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: dispatching resource %q to worker pool", item.URL()))
+ sendWorker(ctx, c.outgoing, item)
+ }
+
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: dispatched %d resources", dispatched))
+
+ // Next check is always at the earliest next check + 1 second.
+ // The extra second makes sure that we are _past_ the actual next check time
+ // so we can send the resource to the worker pool
+ if interval := time.Until(minNext); interval > 0 {
+ c.SetTickInterval(roundupToSeconds(interval) + time.Second)
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: resetting check intervanl to %s", c.tickInterval))
+ } else {
+ // if we got here, either we have no resources, or all resources are busy.
+ // In this state, it's possible that the interval is less than 1 second,
+ // because we previously set it to a small value for an immediate refresh.
+ // in this case, we want to reset it to a sane value
+ if c.tickInterval < time.Second {
+ c.SetTickInterval(minInterval)
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: resetting check intervanl to %s after forced refresh", c.tickInterval))
+ }
+ }
+
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: next check in %s", c.tickInterval))
+}
+
+func (c *ctrlBackend) SetTickInterval(d time.Duration) {
+ // TODO synchronize
+ if d <= 0 {
+ d = time.Second // ensure positive interval
+ }
+ c.tickInterval = d
+ c.check.Reset(d)
+}
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/client.go b/vendor/github.com/lestrrat-go/httprc/v3/client.go
new file mode 100644
index 0000000000..05dfbb43f3
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/client.go
@@ -0,0 +1,185 @@
+package httprc
+
+import (
+ "context"
+ "net/http"
+ "sync"
+ "time"
+
+ "github.com/lestrrat-go/httprc/v3/errsink"
+ "github.com/lestrrat-go/httprc/v3/proxysink"
+ "github.com/lestrrat-go/httprc/v3/tracesink"
+)
+
+// setupSink creates and starts a proxy for the given sink if it's not a Nop sink
+// Returns the sink to use and a cancel function that should be chained with the original cancel
+func setupSink[T any, S proxysink.Backend[T], NopType any](ctx context.Context, sink S, wg *sync.WaitGroup) (S, context.CancelFunc) {
+ if _, ok := any(sink).(NopType); ok {
+ return sink, func() {}
+ }
+
+ proxy := proxysink.New[T](sink)
+ wg.Add(1)
+ go func(ctx context.Context, wg *sync.WaitGroup, proxy *proxysink.Proxy[T]) {
+ defer wg.Done()
+ proxy.Run(ctx)
+ }(ctx, wg, proxy)
+
+ // proxy can be converted to one of the sink subtypes
+ s, ok := any(proxy).(S)
+ if !ok {
+ panic("type assertion failed: proxy cannot be converted to type S")
+ }
+ return s, proxy.Close
+}
+
+// Client is the main entry point for the httprc package.
+type Client struct {
+ mu sync.Mutex
+ httpcl HTTPClient
+ numWorkers int
+ running bool
+ errSink ErrorSink
+ traceSink TraceSink
+ wl Whitelist
+ defaultMaxInterval time.Duration
+ defaultMinInterval time.Duration
+}
+
+// NewClient creates a new `httprc.Client` object.
+//
+// By default ALL urls are allowed. This may not be suitable for you if
+// are using this in a production environment. You are encouraged to specify
+// a whitelist using the `WithWhitelist` option.
+//
+// NOTE: In future versions, this function signature should be changed to
+// return an error to properly handle option parsing failures.
+func NewClient(options ...NewClientOption) *Client {
+ //nolint:staticcheck
+ var errSink ErrorSink = errsink.NewNop()
+ //nolint:staticcheck
+ var traceSink TraceSink = tracesink.NewNop()
+ var wl Whitelist = InsecureWhitelist{}
+ var httpcl HTTPClient = http.DefaultClient
+
+ defaultMinInterval := DefaultMinInterval
+ defaultMaxInterval := DefaultMaxInterval
+
+ numWorkers := DefaultWorkers
+ for _, option := range options {
+ switch option.Ident() {
+ case identHTTPClient{}:
+ _ = option.Value(&httpcl)
+ case identWorkers{}:
+ _ = option.Value(&numWorkers)
+ case identErrorSink{}:
+ _ = option.Value(&errSink)
+ case identTraceSink{}:
+ _ = option.Value(&traceSink)
+ case identWhitelist{}:
+ _ = option.Value(&wl)
+ }
+ }
+
+ if numWorkers <= 0 {
+ numWorkers = 1
+ }
+ return &Client{
+ httpcl: httpcl,
+ numWorkers: numWorkers,
+ errSink: errSink,
+ traceSink: traceSink,
+ wl: wl,
+
+ defaultMinInterval: defaultMinInterval,
+ defaultMaxInterval: defaultMaxInterval,
+ }
+}
+
+// Start sets the client into motion. It will start a number of worker goroutines,
+// and return a Controller object that you can use to control the execution of
+// the client.
+//
+// If you attempt to call Start more than once, it will return an error.
+func (c *Client) Start(octx context.Context) (Controller, error) {
+ c.mu.Lock()
+ if c.running {
+ c.mu.Unlock()
+ return nil, errAlreadyRunning
+ }
+ c.running = true
+ c.mu.Unlock()
+
+ // DON'T CANCEL THIS IN THIS METHOD! It's the responsibility of the
+ // controller to cancel this context.
+ ctx, cancel := context.WithCancel(octx)
+
+ var donewg sync.WaitGroup
+
+ // start proxy goroutines that will accept sink requests
+ // and forward them to the appropriate sink
+ errSink, errCancel := setupSink[error, ErrorSink, errsink.Nop](ctx, c.errSink, &donewg)
+ traceSink, traceCancel := setupSink[string, TraceSink, tracesink.Nop](ctx, c.traceSink, &donewg)
+
+ // Chain the cancel functions
+ ocancel := cancel
+ cancel = func() {
+ ocancel()
+ errCancel()
+ traceCancel()
+ }
+
+ chbuf := c.numWorkers + 1
+ incoming := make(chan any, chbuf)
+ outgoing := make(chan Resource, chbuf)
+ syncoutgoing := make(chan synchronousRequest, chbuf)
+
+ var readywg sync.WaitGroup
+ readywg.Add(c.numWorkers)
+ donewg.Add(c.numWorkers)
+ for range c.numWorkers {
+ wrk := worker{
+ incoming: incoming,
+ next: outgoing,
+ nextsync: syncoutgoing,
+ errSink: errSink,
+ traceSink: traceSink,
+ httpcl: c.httpcl,
+ }
+ go wrk.Run(ctx, &readywg, &donewg)
+ }
+
+ tickInterval := oneDay
+ ctrl := &controller{
+ cancel: cancel,
+ incoming: incoming,
+ shutdown: make(chan struct{}),
+ traceSink: traceSink,
+ wl: c.wl,
+ }
+
+ backend := &ctrlBackend{
+ items: make(map[string]Resource),
+ outgoing: outgoing,
+ syncoutgoing: syncoutgoing,
+ incoming: incoming,
+ traceSink: traceSink,
+ tickInterval: tickInterval,
+ check: time.NewTicker(tickInterval),
+
+ defaultMinInterval: c.defaultMinInterval,
+ defaultMaxInterval: c.defaultMaxInterval,
+ }
+ donewg.Add(1)
+ readywg.Add(1)
+ go backend.loop(ctx, &readywg, &donewg)
+
+ go func(wg *sync.WaitGroup, ch chan struct{}) {
+ wg.Wait()
+ close(ch)
+ }(&donewg, ctrl.shutdown)
+
+ readywg.Wait()
+
+ return ctrl, nil
+}
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/controller.go b/vendor/github.com/lestrrat-go/httprc/v3/controller.go
new file mode 100644
index 0000000000..1ad9d7b6c6
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/controller.go
@@ -0,0 +1,187 @@
+package httprc
+
+import (
+ "context"
+ "fmt"
+ "time"
+)
+
+type Controller interface {
+ // Add adds a new `http.Resource` to the controller. If the resource already exists,
+ // it will return an error.
+ Add(context.Context, Resource, ...AddOption) error
+
+ // Lookup a `httprc.Resource` by its URL. If the resource does not exist, it
+ // will return an error.
+ Lookup(context.Context, string) (Resource, error)
+
+ // Remove a `httprc.Resource` from the controller by its URL. If the resource does
+ // not exist, it will return an error.
+ Remove(context.Context, string) error
+
+ // Refresh forces a resource to be refreshed immediately. If the resource does
+ // not exist, or if the refresh fails, it will return an error.
+ Refresh(context.Context, string) error
+
+ ShutdownContext(context.Context) error
+ Shutdown(time.Duration) error
+}
+
+type controller struct {
+ cancel context.CancelFunc
+ incoming chan any // incoming requests to the controller
+ shutdown chan struct{}
+ traceSink TraceSink
+ wl Whitelist
+}
+
+// Shutdown is a convenience function that calls ShutdownContext with a
+// context that has a timeout of `timeout`.
+func (c *controller) Shutdown(timeout time.Duration) error {
+ ctx, cancel := context.WithTimeout(context.Background(), timeout)
+ defer cancel()
+ return c.ShutdownContext(ctx)
+}
+
+// ShutdownContext stops the client and all associated goroutines, and waits for them
+// to finish. If the context is canceled, the function will return immediately:
+// there fore you should not use the context you used to start the client (because
+// presumably it's already canceled).
+//
+// Waiting for the client shutdown will also ensure that all sinks are properly
+// flushed.
+func (c *controller) ShutdownContext(ctx context.Context) error {
+ c.cancel()
+
+ select {
+ case <-ctx.Done():
+ return ctx.Err()
+ case <-c.shutdown:
+ return nil
+ }
+}
+
+type ctrlRequest[T any] struct {
+ reply chan T
+ resource Resource
+ u string
+}
+type addRequest ctrlRequest[backendResponse[struct{}]]
+type rmRequest ctrlRequest[backendResponse[struct{}]]
+type refreshRequest ctrlRequest[backendResponse[struct{}]]
+type lookupRequest ctrlRequest[backendResponse[Resource]]
+type synchronousRequest ctrlRequest[backendResponse[struct{}]]
+type adjustIntervalRequest struct {
+ resource Resource
+}
+
+type backendResponse[T any] struct {
+ payload T
+ err error
+}
+
+func sendBackend[TReq any, TB any](ctx context.Context, backendCh chan any, v TReq, replyCh chan backendResponse[TB]) (TB, error) {
+ select {
+ case <-ctx.Done():
+ case backendCh <- v:
+ }
+
+ select {
+ case <-ctx.Done():
+ var zero TB
+ return zero, ctx.Err()
+ case res := <-replyCh:
+ return res.payload, res.err
+ }
+}
+
+// Lookup returns a resource by its URL. If the resource does not exist, it
+// will return an error.
+//
+// Unfortunately, due to the way typed parameters are handled in Go, we can only
+// return a Resource object (and not a ResourceBase[T] object). This means that
+// you will either need to use the `Resource.Get()` method or use a type
+// assertion to obtain a `ResourceBase[T]` to get to the actual object you are
+// looking for
+func (c *controller) Lookup(ctx context.Context, u string) (Resource, error) {
+ reply := make(chan backendResponse[Resource], 1)
+ req := lookupRequest{
+ reply: reply,
+ u: u,
+ }
+ return sendBackend[lookupRequest, Resource](ctx, c.incoming, req, reply)
+}
+
+// Add adds a new resource to the controller. If the resource already
+// exists, it will return an error.
+//
+// By default this function will automatically wait for the resource to be
+// fetched once (by calling `r.Ready()`). Note that the `r.Ready()` call will NOT
+// timeout unless you configure your context object with `context.WithTimeout`.
+// To disable waiting, you can specify the `WithWaitReady(false)` option.
+func (c *controller) Add(ctx context.Context, r Resource, options ...AddOption) error {
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: START Add(%q)", r.URL()))
+ defer c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: END Add(%q)", r.URL()))
+ waitReady := true
+ for _, option := range options {
+ switch option.Ident() {
+ case identWaitReady{}:
+ if err := option.Value(&waitReady); err != nil {
+ return fmt.Errorf(`httprc.Controller.Add: failed to parse WaitReady option: %w`, err)
+ }
+ }
+ }
+
+ if !c.wl.IsAllowed(r.URL()) {
+ return fmt.Errorf(`httprc.Controller.AddResource: cannot add %q: %w`, r.URL(), errBlockedByWhitelist)
+ }
+
+ reply := make(chan backendResponse[struct{}], 1)
+ req := addRequest{
+ reply: reply,
+ resource: r,
+ }
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: sending add request for %q to backend", r.URL()))
+ if _, err := sendBackend[addRequest, struct{}](ctx, c.incoming, req, reply); err != nil {
+ return err
+ }
+
+ if waitReady {
+ c.traceSink.Put(ctx, fmt.Sprintf("httprc controller: waiting for resource %q to be ready", r.URL()))
+ if err := r.Ready(ctx); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+// Remove removes a resource from the controller. If the resource does
+// not exist, it will return an error.
+func (c *controller) Remove(ctx context.Context, u string) error {
+ reply := make(chan backendResponse[struct{}], 1)
+ req := rmRequest{
+ reply: reply,
+ u: u,
+ }
+ if _, err := sendBackend[rmRequest, struct{}](ctx, c.incoming, req, reply); err != nil {
+ return err
+ }
+ return nil
+}
+
+// Refresh forces a resource to be refreshed immediately. If the resource does
+// not exist, or if the refresh fails, it will return an error.
+//
+// This function is synchronous, and will block until the resource has been refreshed.
+func (c *controller) Refresh(ctx context.Context, u string) error {
+ reply := make(chan backendResponse[struct{}], 1)
+ req := refreshRequest{
+ reply: reply,
+ u: u,
+ }
+
+ if _, err := sendBackend[refreshRequest, struct{}](ctx, c.incoming, req, reply); err != nil {
+ return err
+ }
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/errors.go b/vendor/github.com/lestrrat-go/httprc/v3/errors.go
new file mode 100644
index 0000000000..1152ba947f
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/errors.go
@@ -0,0 +1,57 @@
+package httprc
+
+import "errors"
+
+var errResourceAlreadyExists = errors.New(`resource already exists`)
+
+func ErrResourceAlreadyExists() error {
+ return errResourceAlreadyExists
+}
+
+var errAlreadyRunning = errors.New(`client is already running`)
+
+func ErrAlreadyRunning() error {
+ return errAlreadyRunning
+}
+
+var errResourceNotFound = errors.New(`resource not found`)
+
+func ErrResourceNotFound() error {
+ return errResourceNotFound
+}
+
+var errTransformerRequired = errors.New(`transformer is required`)
+
+func ErrTransformerRequired() error {
+ return errTransformerRequired
+}
+
+var errURLCannotBeEmpty = errors.New(`URL cannot be empty`)
+
+func ErrURLCannotBeEmpty() error {
+ return errURLCannotBeEmpty
+}
+
+var errUnexpectedStatusCode = errors.New(`unexpected status code`)
+
+func ErrUnexpectedStatusCode() error {
+ return errUnexpectedStatusCode
+}
+
+var errTransformerFailed = errors.New(`failed to transform response body`)
+
+func ErrTransformerFailed() error {
+ return errTransformerFailed
+}
+
+var errRecoveredFromPanic = errors.New(`recovered from panic`)
+
+func ErrRecoveredFromPanic() error {
+ return errRecoveredFromPanic
+}
+
+var errBlockedByWhitelist = errors.New(`blocked by whitelist`)
+
+func ErrBlockedByWhitelist() error {
+ return errBlockedByWhitelist
+}
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/errsink/errsink.go b/vendor/github.com/lestrrat-go/httprc/v3/errsink/errsink.go
new file mode 100644
index 0000000000..03d128ffcd
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/errsink/errsink.go
@@ -0,0 +1,59 @@
+package errsink
+
+import (
+ "context"
+ "log/slog"
+)
+
+type Interface interface {
+ Put(context.Context, error)
+}
+
+// Nop is an ErrorSink that does nothing. It does not require
+// any initialization, so the zero value can be used.
+type Nop struct{}
+
+// NewNop returns a new NopErrorSink object. The constructor
+// is provided for consistency.
+func NewNop() Interface {
+ return Nop{}
+}
+
+// Put for NopErrorSink does nothing.
+func (Nop) Put(context.Context, error) {}
+
+type SlogLogger interface {
+ Log(context.Context, slog.Level, string, ...any)
+}
+
+type slogSink struct {
+ logger SlogLogger
+}
+
+// NewSlog returns a new ErrorSink that logs errors using the provided slog.Logger
+func NewSlog(l SlogLogger) Interface {
+ return &slogSink{
+ logger: l,
+ }
+}
+
+func (s *slogSink) Put(ctx context.Context, v error) {
+ s.logger.Log(ctx, slog.LevelError, v.Error())
+}
+
+// FuncSink is an ErrorSink that calls a function with the error.
+type FuncSink struct {
+ fn func(context.Context, error)
+}
+
+// NewFunc returns a new FuncSink that calls the provided function with errors.
+func NewFunc(fn func(context.Context, error)) Interface {
+ return &FuncSink{fn: fn}
+}
+
+// Put calls the function with the error.
+func (f *FuncSink) Put(ctx context.Context, err error) {
+ if f.fn != nil {
+ f.fn(ctx, err)
+ }
+}
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/httprc.go b/vendor/github.com/lestrrat-go/httprc/v3/httprc.go
new file mode 100644
index 0000000000..fc324b771f
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/httprc.go
@@ -0,0 +1,90 @@
+package httprc
+
+import (
+ "context"
+ "net/http"
+ "time"
+
+ "github.com/lestrrat-go/httprc/v3/errsink"
+ "github.com/lestrrat-go/httprc/v3/tracesink"
+)
+
+// Buffer size constants
+const (
+ // ReadBufferSize is the default buffer size for reading HTTP responses (10MB)
+ ReadBufferSize = 1024 * 1024 * 10
+ // MaxBufferSize is the maximum allowed buffer size (1GB)
+ MaxBufferSize = 1024 * 1024 * 1000
+)
+
+// Client worker constants
+const (
+ // DefaultWorkers is the default number of worker goroutines
+ DefaultWorkers = 5
+)
+
+// Interval constants
+const (
+ // DefaultMaxInterval is the default maximum interval between fetches (30 days)
+ DefaultMaxInterval = 24 * time.Hour * 30
+ // DefaultMinInterval is the default minimum interval between fetches (15 minutes)
+ DefaultMinInterval = 15 * time.Minute
+ // oneDay is used internally for time calculations
+ oneDay = 24 * time.Hour
+)
+
+// utility to round up intervals to the nearest second
+func roundupToSeconds(d time.Duration) time.Duration {
+ if diff := d % time.Second; diff > 0 {
+ return d + time.Second - diff
+ }
+ return d
+}
+
+// ErrorSink is an interface that abstracts a sink for errors.
+type ErrorSink = errsink.Interface
+
+type TraceSink = tracesink.Interface
+
+// HTTPClient is an interface that abstracts a "net/http".Client, so that
+// users can provide their own implementation of the HTTP client, if need be.
+type HTTPClient interface {
+ Do(*http.Request) (*http.Response, error)
+}
+
+// Transformer is used to convert the body of an HTTP response into an appropriate
+// object of type T.
+type Transformer[T any] interface {
+ Transform(context.Context, *http.Response) (T, error)
+}
+
+// TransformFunc is a function type that implements the Transformer interface.
+type TransformFunc[T any] func(context.Context, *http.Response) (T, error)
+
+func (f TransformFunc[T]) Transform(ctx context.Context, res *http.Response) (T, error) {
+ return f(ctx, res)
+}
+
+// Resource is a single resource that can be retrieved via HTTP, and (possibly) transformed
+// into an arbitrary object type.
+//
+// Realistically, there is no need for third-parties to implement this interface. This exists
+// to provide a way to aggregate `httprc.ResourceBase` objects with different specialized types
+// into a single collection.
+//
+// See ResourceBase for details
+type Resource interface { //nolint:interfacebloat
+ Get(any) error
+ Next() time.Time
+ SetNext(time.Time)
+ URL() string
+ Sync(context.Context) error
+ ConstantInterval() time.Duration
+ MaxInterval() time.Duration
+ SetMaxInterval(time.Duration)
+ MinInterval() time.Duration
+ SetMinInterval(time.Duration)
+ IsBusy() bool
+ SetBusy(bool)
+ Ready(context.Context) error
+}
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/options.go b/vendor/github.com/lestrrat-go/httprc/v3/options.go
new file mode 100644
index 0000000000..40cf891b15
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/options.go
@@ -0,0 +1,144 @@
+package httprc
+
+import (
+ "time"
+
+ "github.com/lestrrat-go/option/v2"
+)
+
+type NewClientOption interface {
+ option.Interface
+ newClientOption()
+}
+
+type newClientOption struct {
+ option.Interface
+}
+
+func (newClientOption) newClientOption() {}
+
+type identWorkers struct{}
+
+// WithWorkers specifies the number of concurrent workers to use for the client.
+// If n is less than or equal to 0, the client will use a single worker.
+func WithWorkers(n int) NewClientOption {
+ return newClientOption{option.New(identWorkers{}, n)}
+}
+
+type identErrorSink struct{}
+
+// WithErrorSink specifies the error sink to use for the client.
+// If not specified, the client will use a NopErrorSink.
+func WithErrorSink(sink ErrorSink) NewClientOption {
+ return newClientOption{option.New(identErrorSink{}, sink)}
+}
+
+type identTraceSink struct{}
+
+// WithTraceSink specifies the trace sink to use for the client.
+// If not specified, the client will use a NopTraceSink.
+func WithTraceSink(sink TraceSink) NewClientOption {
+ return newClientOption{option.New(identTraceSink{}, sink)}
+}
+
+type identWhitelist struct{}
+
+// WithWhitelist specifies the whitelist to use for the client.
+// If not specified, the client will use a BlockAllWhitelist.
+func WithWhitelist(wl Whitelist) NewClientOption {
+ return newClientOption{option.New(identWhitelist{}, wl)}
+}
+
+type NewResourceOption interface {
+ option.Interface
+ newResourceOption()
+}
+
+type newResourceOption struct {
+ option.Interface
+}
+
+func (newResourceOption) newResourceOption() {}
+
+type NewClientResourceOption interface {
+ option.Interface
+ newResourceOption()
+ newClientOption()
+}
+
+type newClientResourceOption struct {
+ option.Interface
+}
+
+func (newClientResourceOption) newResourceOption() {}
+func (newClientResourceOption) newClientOption() {}
+
+type identHTTPClient struct{}
+
+// WithHTTPClient specifies the HTTP client to use for the client.
+// If not specified, the client will use http.DefaultClient.
+//
+// This option can be passed to NewClient or NewResource.
+func WithHTTPClient(cl HTTPClient) NewClientResourceOption {
+ return newClientResourceOption{option.New(identHTTPClient{}, cl)}
+}
+
+type identMinimumInterval struct{}
+
+// WithMinInterval specifies the minimum interval between fetches.
+//
+// This option affects the dynamic calculation of the interval between fetches.
+// If the value calculated from the http.Response is less than the this value,
+// the client will use this value instead.
+func WithMinInterval(d time.Duration) NewResourceOption {
+ return newResourceOption{option.New(identMinimumInterval{}, d)}
+}
+
+type identMaximumInterval struct{}
+
+// WithMaxInterval specifies the maximum interval between fetches.
+//
+// This option affects the dynamic calculation of the interval between fetches.
+// If the value calculated from the http.Response is greater than the this value,
+// the client will use this value instead.
+func WithMaxInterval(d time.Duration) NewResourceOption {
+ return newResourceOption{option.New(identMaximumInterval{}, d)}
+}
+
+type identConstantInterval struct{}
+
+// WithConstantInterval specifies the interval between fetches. When you
+// specify this option, the client will fetch the resource at the specified
+// intervals, regardless of the response's Cache-Control or Expires headers.
+//
+// By default this option is disabled.
+func WithConstantInterval(d time.Duration) NewResourceOption {
+ return newResourceOption{option.New(identConstantInterval{}, d)}
+}
+
+type AddOption interface {
+ option.Interface
+ newAddOption()
+}
+
+type addOption struct {
+ option.Interface
+}
+
+func (addOption) newAddOption() {}
+
+type identWaitReady struct{}
+
+// WithWaitReady specifies whether the client should wait for the resource to be
+// ready before returning from the Add method.
+//
+// By default, the client will wait for the resource to be ready before returning.
+// If you specify this option with a value of false, the client will not wait for
+// the resource to be fully registered, which is usually not what you want.
+// This option exists to accommodate for cases where you for some reason want to
+// add a resource to the controller, but want to do something else before
+// you wait for it. Make sure to call `r.Ready()` later on to ensure that
+// the resource is ready before you try to access it.
+func WithWaitReady(b bool) AddOption {
+ return addOption{option.New(identWaitReady{}, b)}
+}
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/proxysink/proxysink.go b/vendor/github.com/lestrrat-go/httprc/v3/proxysink/proxysink.go
new file mode 100644
index 0000000000..f290422d6c
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/proxysink/proxysink.go
@@ -0,0 +1,135 @@
+package proxysink
+
+import (
+ "context"
+ "sync"
+)
+
+type Backend[T any] interface {
+ Put(context.Context, T)
+}
+
+// Proxy is used to send values through a channel. This is used to
+// serialize calls to underlying sinks.
+type Proxy[T any] struct {
+ mu *sync.Mutex
+ cancel context.CancelFunc
+ ch chan T
+ cond *sync.Cond
+ pending []T
+ backend Backend[T]
+ closed bool
+}
+
+func New[T any](b Backend[T]) *Proxy[T] {
+ mu := &sync.Mutex{}
+ return &Proxy[T]{
+ ch: make(chan T, 1),
+ mu: mu,
+ cond: sync.NewCond(mu),
+ backend: b,
+ cancel: func() {},
+ }
+}
+
+func (p *Proxy[T]) Run(ctx context.Context) {
+ defer p.cond.Broadcast()
+
+ p.mu.Lock()
+ ctx, cancel := context.WithCancel(ctx)
+ p.cancel = cancel
+ p.mu.Unlock()
+
+ go p.controlloop(ctx)
+ go p.flushloop(ctx)
+
+ <-ctx.Done()
+}
+
+func (p *Proxy[T]) controlloop(ctx context.Context) {
+ defer p.cond.Broadcast()
+ for {
+ select {
+ case <-ctx.Done():
+ return
+ case r := <-p.ch:
+ p.mu.Lock()
+ p.pending = append(p.pending, r)
+ p.mu.Unlock()
+ }
+ p.cond.Broadcast()
+ }
+}
+
+func (p *Proxy[T]) flushloop(ctx context.Context) {
+ const defaultPendingSize = 10
+ pending := make([]T, defaultPendingSize)
+ for {
+ select {
+ case <-ctx.Done():
+ p.mu.Lock()
+ if len(p.pending) <= 0 {
+ p.mu.Unlock()
+ return
+ }
+ default:
+ }
+
+ p.mu.Lock()
+ for len(p.pending) <= 0 {
+ select {
+ case <-ctx.Done():
+ p.mu.Unlock()
+ return
+ default:
+ p.cond.Wait()
+ }
+ }
+
+ // extract all pending values, and clear the shared slice
+ if cap(pending) < len(p.pending) {
+ pending = make([]T, len(p.pending))
+ } else {
+ pending = pending[:len(p.pending)]
+ }
+ copy(pending, p.pending)
+ if cap(p.pending) > defaultPendingSize {
+ p.pending = make([]T, 0, defaultPendingSize)
+ } else {
+ p.pending = p.pending[:0]
+ }
+ p.mu.Unlock()
+
+ for _, v := range pending {
+ // send to sink serially
+ p.backend.Put(ctx, v)
+ }
+ }
+}
+
+func (p *Proxy[T]) Put(ctx context.Context, v T) {
+ p.mu.Lock()
+ if p.closed {
+ p.mu.Unlock()
+ return
+ }
+ p.mu.Unlock()
+
+ select {
+ case <-ctx.Done():
+ return
+ case p.ch <- v:
+ return
+ }
+}
+
+func (p *Proxy[T]) Close() {
+ p.mu.Lock()
+ defer p.mu.Unlock()
+
+ if !p.closed {
+ p.closed = true
+ }
+ p.cancel()
+ p.cond.Broadcast()
+}
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/resource.go b/vendor/github.com/lestrrat-go/httprc/v3/resource.go
new file mode 100644
index 0000000000..0f0d140d27
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/resource.go
@@ -0,0 +1,366 @@
+package httprc
+
+import (
+ "context"
+ "fmt"
+ "io"
+ "net/http"
+ "net/url"
+ "sync"
+ "sync/atomic"
+ "time"
+
+ "github.com/lestrrat-go/blackmagic"
+ "github.com/lestrrat-go/httpcc"
+ "github.com/lestrrat-go/httprc/v3/tracesink"
+)
+
+// ResourceBase is a generic Resource type
+type ResourceBase[T any] struct {
+ u string
+ ready chan struct{} // closed when the resource is ready (i.e. after first successful fetch)
+ once sync.Once
+ httpcl HTTPClient
+ t Transformer[T]
+ r atomic.Value
+ next atomic.Value
+ interval time.Duration
+ minInterval atomic.Int64
+ maxInterval atomic.Int64
+ busy atomic.Bool
+}
+
+// NewResource creates a new Resource object which after fetching the
+// resource from the URL, will transform the response body using the
+// provided Transformer to an object of type T.
+//
+// This function will return an error if the URL is not a valid URL
+// (i.e. it cannot be parsed by url.Parse), or if the transformer is nil.
+func NewResource[T any](s string, transformer Transformer[T], options ...NewResourceOption) (*ResourceBase[T], error) {
+ var httpcl HTTPClient
+ var interval time.Duration
+ minInterval := DefaultMinInterval
+ maxInterval := DefaultMaxInterval
+ for _, option := range options {
+ switch option.Ident() {
+ case identHTTPClient{}:
+ if err := option.Value(&httpcl); err != nil {
+ return nil, fmt.Errorf(`httprc.NewResource: failed to parse HTTPClient option: %w`, err)
+ }
+ case identMinimumInterval{}:
+ if err := option.Value(&minInterval); err != nil {
+ return nil, fmt.Errorf(`httprc.NewResource: failed to parse MinimumInterval option: %w`, err)
+ }
+ case identMaximumInterval{}:
+ if err := option.Value(&maxInterval); err != nil {
+ return nil, fmt.Errorf(`httprc.NewResource: failed to parse MaximumInterval option: %w`, err)
+ }
+ case identConstantInterval{}:
+ if err := option.Value(&interval); err != nil {
+ return nil, fmt.Errorf(`httprc.NewResource: failed to parse ConstantInterval option: %w`, err)
+ }
+ }
+ }
+ if transformer == nil {
+ return nil, fmt.Errorf(`httprc.NewResource: %w`, errTransformerRequired)
+ }
+
+ if s == "" {
+ return nil, fmt.Errorf(`httprc.NewResource: %w`, errURLCannotBeEmpty)
+ }
+
+ if _, err := url.Parse(s); err != nil {
+ return nil, fmt.Errorf(`httprc.NewResource: %w`, err)
+ }
+ r := &ResourceBase[T]{
+ u: s,
+ httpcl: httpcl,
+ t: transformer,
+ interval: interval,
+ ready: make(chan struct{}),
+ }
+ if httpcl != nil {
+ r.httpcl = httpcl
+ }
+ r.minInterval.Store(int64(minInterval))
+ r.maxInterval.Store(int64(maxInterval))
+ r.SetNext(time.Unix(0, 0)) // initially, it should be fetched immediately
+ return r, nil
+}
+
+// URL returns the URL of the resource.
+func (r *ResourceBase[T]) URL() string {
+ return r.u
+}
+
+// Ready returns an empty error when the resource is ready. If the context
+// is canceled before the resource is ready, it will return the error from
+// the context.
+func (r *ResourceBase[T]) Ready(ctx context.Context) error {
+ select {
+ case <-ctx.Done():
+ return ctx.Err()
+ case <-r.ready:
+ return nil
+ }
+}
+
+// Get assigns the value of the resource to the provided pointer.
+// If using the `httprc.ResourceBase[T]` type directly, you can use the `Resource()`
+// method to get the resource directly.
+//
+// This method exists because parametric types cannot be assigned to a single object type
+// that return different return values of the specialized type. i.e. for resources
+// `ResourceBase[A]` and `ResourceBase[B]`, we cannot have a single interface that can
+// be assigned to the same interface type `X` that expects a `Resource()` method that
+// returns `A` or `B` depending on the type of the resource. When accessing the
+// resource through the `httprc.Resource` interface, use this method to obtain the
+// stored value.
+func (r *ResourceBase[T]) Get(dst any) error {
+ return blackmagic.AssignIfCompatible(dst, r.Resource())
+}
+
+// Resource returns the last fetched resource. If the resource has not been
+// fetched yet, this will return the zero value of type T.
+//
+// If you would rather wait until the resource is fetched, you can use the
+// `Ready()` method to wait until the resource is ready (i.e. fetched at least once).
+func (r *ResourceBase[T]) Resource() T {
+ v := r.r.Load()
+ switch v := v.(type) {
+ case T:
+ return v
+ default:
+ var zero T
+ return zero
+ }
+}
+
+func (r *ResourceBase[T]) Next() time.Time {
+ //nolint:forcetypeassert
+ return r.next.Load().(time.Time)
+}
+
+func (r *ResourceBase[T]) SetNext(v time.Time) {
+ r.next.Store(v)
+}
+
+func (r *ResourceBase[T]) ConstantInterval() time.Duration {
+ return r.interval
+}
+
+func (r *ResourceBase[T]) MaxInterval() time.Duration {
+ return time.Duration(r.maxInterval.Load())
+}
+
+func (r *ResourceBase[T]) MinInterval() time.Duration {
+ return time.Duration(r.minInterval.Load())
+}
+
+func (r *ResourceBase[T]) SetMaxInterval(v time.Duration) {
+ r.maxInterval.Store(int64(v))
+}
+
+func (r *ResourceBase[T]) SetMinInterval(v time.Duration) {
+ r.minInterval.Store(int64(v))
+}
+
+func (r *ResourceBase[T]) SetBusy(v bool) {
+ r.busy.Store(v)
+}
+
+func (r *ResourceBase[T]) IsBusy() bool {
+ return r.busy.Load()
+}
+
+// limitedBody is a wrapper around an io.Reader that will only read up to
+// MaxBufferSize bytes. This is provided to prevent the user from accidentally
+// reading a huge response body into memory
+type limitedBody struct {
+ rdr io.Reader
+ close func() error
+}
+
+func (l *limitedBody) Read(p []byte) (n int, err error) {
+ return l.rdr.Read(p)
+}
+
+func (l *limitedBody) Close() error {
+ return l.close()
+}
+
+type traceSinkKey struct{}
+
+func withTraceSink(ctx context.Context, sink TraceSink) context.Context {
+ return context.WithValue(ctx, traceSinkKey{}, sink)
+}
+
+func traceSinkFromContext(ctx context.Context) TraceSink {
+ if v := ctx.Value(traceSinkKey{}); v != nil {
+ //nolint:forcetypeassert
+ return v.(TraceSink)
+ }
+ return tracesink.Nop{}
+}
+
+type httpClientKey struct{}
+
+func withHTTPClient(ctx context.Context, cl HTTPClient) context.Context {
+ return context.WithValue(ctx, httpClientKey{}, cl)
+}
+
+func httpClientFromContext(ctx context.Context) HTTPClient {
+ if v := ctx.Value(httpClientKey{}); v != nil {
+ //nolint:forcetypeassert
+ return v.(HTTPClient)
+ }
+ return http.DefaultClient
+}
+
+func (r *ResourceBase[T]) Sync(ctx context.Context) error {
+ traceSink := traceSinkFromContext(ctx)
+ httpcl := r.httpcl
+ if httpcl == nil {
+ httpcl = httpClientFromContext(ctx)
+ }
+
+ req, err := http.NewRequestWithContext(ctx, http.MethodGet, r.u, nil)
+ if err != nil {
+ return fmt.Errorf(`httprc.Resource.Sync: failed to create request: %w`, err)
+ }
+
+ traceSink.Put(ctx, fmt.Sprintf("httprc.Resource.Sync: fetching %q", r.u))
+ res, err := httpcl.Do(req)
+ if err != nil {
+ return fmt.Errorf(`httprc.Resource.Sync: failed to execute HTTP request: %w`, err)
+ }
+ defer res.Body.Close()
+
+ next := r.calculateNextRefreshTime(ctx, res)
+ traceSink.Put(ctx, fmt.Sprintf("httprc.Resource.Sync: next refresh time for %q is %v", r.u, next))
+ r.SetNext(next)
+
+ if res.StatusCode != http.StatusOK {
+ return fmt.Errorf(`httprc.Resource.Sync: %w (status code=%d, url=%q)`, errUnexpectedStatusCode, res.StatusCode, r.u)
+ }
+
+ // replace the body of the response with a limited reader that
+ // will only read up to MaxBufferSize bytes
+ res.Body = &limitedBody{
+ rdr: &io.LimitedReader{R: res.Body, N: MaxBufferSize},
+ close: res.Body.Close,
+ }
+ traceSink.Put(ctx, fmt.Sprintf("httprc.Resource.Sync: transforming %q", r.u))
+ v, err := r.transform(ctx, res)
+ if err != nil {
+ return fmt.Errorf(`httprc.Resource.Sync: %w: %w`, errTransformerFailed, err)
+ }
+
+ traceSink.Put(ctx, fmt.Sprintf("httprc.Resource.Sync: storing new value for %q", r.u))
+ r.r.Store(v)
+ r.once.Do(func() { close(r.ready) })
+ traceSink.Put(ctx, fmt.Sprintf("httprc.Resource.Sync: stored value for %q", r.u))
+ return nil
+}
+
+func (r *ResourceBase[T]) transform(ctx context.Context, res *http.Response) (ret T, gerr error) {
+ // Protect the call to Transform with a defer/recover block, so that even
+ // if the Transform method panics, we can recover from it and return an error
+ defer func() {
+ if recovered := recover(); recovered != nil {
+ gerr = fmt.Errorf(`httprc.Resource.transform: %w: %v`, errRecoveredFromPanic, recovered)
+ }
+ }()
+ return r.t.Transform(ctx, res)
+}
+
+func (r *ResourceBase[T]) determineNextFetchInterval(ctx context.Context, name string, fromHeader, minValue, maxValue time.Duration) time.Duration {
+ traceSink := traceSinkFromContext(ctx)
+
+ if fromHeader > maxValue {
+ traceSink.Put(ctx, fmt.Sprintf("httprc.Resource.Sync: %s %s > maximum interval, using maximum interval %s", r.URL(), name, maxValue))
+ return maxValue
+ }
+
+ if fromHeader < minValue {
+ traceSink.Put(ctx, fmt.Sprintf("httprc.Resource.Sync: %s %s < minimum interval, using minimum interval %s", r.URL(), name, minValue))
+ return minValue
+ }
+
+ traceSink.Put(ctx, fmt.Sprintf("httprc.Resource.Sync: %s Using %s (%s)", r.URL(), name, fromHeader))
+ return fromHeader
+}
+
+func (r *ResourceBase[T]) calculateNextRefreshTime(ctx context.Context, res *http.Response) time.Time {
+ traceSink := traceSinkFromContext(ctx)
+ now := time.Now()
+
+ // If constant interval is set, use that regardless of what the
+ // response headers say.
+ if interval := r.ConstantInterval(); interval > 0 {
+ traceSink.Put(ctx, fmt.Sprintf("httprc.Resource.Sync: %s Explicit interval set, using value %s", r.URL(), interval))
+ return now.Add(interval)
+ }
+
+ if interval := r.extractCacheControlMaxAge(ctx, res); interval > 0 {
+ return now.Add(interval)
+ }
+
+ if interval := r.extractExpiresInterval(ctx, res); interval > 0 {
+ return now.Add(interval)
+ }
+
+ traceSink.Put(ctx, fmt.Sprintf("httprc.Resource.Sync: %s No cache-control/expires headers found, using minimum interval", r.URL()))
+ return now.Add(r.MinInterval())
+}
+
+func (r *ResourceBase[T]) extractCacheControlMaxAge(ctx context.Context, res *http.Response) time.Duration {
+ traceSink := traceSinkFromContext(ctx)
+
+ v := res.Header.Get(`Cache-Control`)
+ if v == "" {
+ return 0
+ }
+
+ dir, err := httpcc.ParseResponse(v)
+ if err != nil {
+ return 0
+ }
+
+ maxAge, ok := dir.MaxAge()
+ if !ok {
+ return 0
+ }
+
+ traceSink.Put(ctx, fmt.Sprintf("httprc.Resource.Sync: %s Cache-Control=max-age directive set (%d)", r.URL(), maxAge))
+ return r.determineNextFetchInterval(
+ ctx,
+ "max-age",
+ time.Duration(maxAge)*time.Second,
+ r.MinInterval(),
+ r.MaxInterval(),
+ )
+}
+
+func (r *ResourceBase[T]) extractExpiresInterval(ctx context.Context, res *http.Response) time.Duration {
+ traceSink := traceSinkFromContext(ctx)
+
+ v := res.Header.Get(`Expires`)
+ if v == "" {
+ return 0
+ }
+
+ expires, err := http.ParseTime(v)
+ if err != nil {
+ return 0
+ }
+
+ traceSink.Put(ctx, fmt.Sprintf("httprc.Resource.Sync: %s Expires header set (%s)", r.URL(), expires))
+ return r.determineNextFetchInterval(
+ ctx,
+ "expires",
+ time.Until(expires),
+ r.MinInterval(),
+ r.MaxInterval(),
+ )
+}
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/tracesink/tracesink.go b/vendor/github.com/lestrrat-go/httprc/v3/tracesink/tracesink.go
new file mode 100644
index 0000000000..b8400a94ae
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/tracesink/tracesink.go
@@ -0,0 +1,52 @@
+package tracesink
+
+import (
+ "context"
+ "log/slog"
+)
+
+type Interface interface {
+ Put(context.Context, string)
+}
+
+// Nop is an ErrorSink that does nothing. It does not require
+// any initialization, so the zero value can be used.
+type Nop struct{}
+
+// NewNop returns a new NopTraceSink object. The constructor
+// is provided for consistency.
+func NewNop() Interface {
+ return Nop{}
+}
+
+// Put for NopTraceSink does nothing.
+func (Nop) Put(context.Context, string) {}
+
+type slogSink struct {
+ level slog.Level
+ logger SlogLogger
+}
+
+type SlogLogger interface {
+ Log(context.Context, slog.Level, string, ...any)
+}
+
+// NewSlog returns a new ErrorSink that logs errors using the provided slog.Logger
+func NewSlog(l SlogLogger) Interface {
+ return &slogSink{
+ level: slog.LevelInfo,
+ logger: l,
+ }
+}
+
+func (s *slogSink) Put(ctx context.Context, v string) {
+ s.logger.Log(ctx, s.level, v)
+}
+
+// Func is a TraceSink that calls a function with the trace message.
+type Func func(context.Context, string)
+
+// Put calls the function with the trace message.
+func (f Func) Put(ctx context.Context, msg string) {
+ f(ctx, msg)
+}
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/transformer.go b/vendor/github.com/lestrrat-go/httprc/v3/transformer.go
new file mode 100644
index 0000000000..2bd0635a2c
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/transformer.go
@@ -0,0 +1,37 @@
+package httprc
+
+import (
+ "context"
+ "encoding/json"
+ "io"
+ "net/http"
+)
+
+type bytesTransformer struct{}
+
+// BytesTransformer returns a Transformer that reads the entire response body
+// as a byte slice. This is the default Transformer used by httprc.Client
+func BytesTransformer() Transformer[[]byte] {
+ return bytesTransformer{}
+}
+
+func (bytesTransformer) Transform(_ context.Context, res *http.Response) ([]byte, error) {
+ return io.ReadAll(res.Body)
+}
+
+type jsonTransformer[T any] struct{}
+
+// JSONTransformer returns a Transformer that decodes the response body as JSON
+// into the provided type T.
+func JSONTransformer[T any]() Transformer[T] {
+ return jsonTransformer[T]{}
+}
+
+func (jsonTransformer[T]) Transform(_ context.Context, res *http.Response) (T, error) {
+ var v T
+ if err := json.NewDecoder(res.Body).Decode(&v); err != nil {
+ var zero T
+ return zero, err
+ }
+ return v, nil
+}
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/whitelist.go b/vendor/github.com/lestrrat-go/httprc/v3/whitelist.go
new file mode 100644
index 0000000000..74ef2a1be6
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/whitelist.go
@@ -0,0 +1,113 @@
+package httprc
+
+import (
+ "regexp"
+ "sync"
+)
+
+// Whitelist is an interface that allows you to determine if a given URL is allowed
+// or not. Implementations of this interface can be used to restrict the URLs that
+// the client can access.
+//
+// By default all URLs are allowed, but this may not be ideal in production environments
+// for security reasons.
+//
+// This exists because you might use this module to store resources provided by
+// user of your application, in which case you cannot necessarily trust that the
+// URLs are safe.
+//
+// You will HAVE to provide some sort of whitelist.
+type Whitelist interface {
+ IsAllowed(string) bool
+}
+
+// WhitelistFunc is a function type that implements the Whitelist interface.
+type WhitelistFunc func(string) bool
+
+func (f WhitelistFunc) IsAllowed(u string) bool { return f(u) }
+
+// BlockAllWhitelist is a Whitelist implementation that blocks all URLs.
+type BlockAllWhitelist struct{}
+
+// NewBlockAllWhitelist creates a new BlockAllWhitelist instance. It is safe to
+// use the zero value of this type; this constructor is provided for consistency.
+func NewBlockAllWhitelist() BlockAllWhitelist { return BlockAllWhitelist{} }
+
+func (BlockAllWhitelist) IsAllowed(_ string) bool { return false }
+
+// InsecureWhitelist is a Whitelist implementation that allows all URLs. Be careful
+// when using this in your production code: make sure you do not blindly register
+// URLs from untrusted sources.
+type InsecureWhitelist struct{}
+
+// NewInsecureWhitelist creates a new InsecureWhitelist instance. It is safe to
+// use the zero value of this type; this constructor is provided for consistency.
+func NewInsecureWhitelist() InsecureWhitelist { return InsecureWhitelist{} }
+
+func (InsecureWhitelist) IsAllowed(_ string) bool { return true }
+
+// RegexpWhitelist is a jwk.Whitelist object comprised of a list of *regexp.Regexp
+// objects. All entries in the list are tried until one matches. If none of the
+// *regexp.Regexp objects match, then the URL is deemed unallowed.
+type RegexpWhitelist struct {
+ mu sync.RWMutex
+ patterns []*regexp.Regexp
+}
+
+// NewRegexpWhitelist creates a new RegexpWhitelist instance. It is safe to use the
+// zero value of this type; this constructor is provided for consistency.
+func NewRegexpWhitelist() *RegexpWhitelist {
+ return &RegexpWhitelist{}
+}
+
+// Add adds a new regular expression to the list of expressions to match against.
+func (w *RegexpWhitelist) Add(pat *regexp.Regexp) *RegexpWhitelist {
+ w.mu.Lock()
+ defer w.mu.Unlock()
+ w.patterns = append(w.patterns, pat)
+ return w
+}
+
+// IsAllowed returns true if any of the patterns in the whitelist
+// returns true.
+func (w *RegexpWhitelist) IsAllowed(u string) bool {
+ w.mu.RLock()
+ patterns := w.patterns
+ w.mu.RUnlock()
+ for _, pat := range patterns {
+ if pat.MatchString(u) {
+ return true
+ }
+ }
+ return false
+}
+
+// MapWhitelist is a jwk.Whitelist object comprised of a map of strings.
+// If the URL exists in the map, then the URL is allowed to be fetched.
+type MapWhitelist interface {
+ Whitelist
+ Add(string) MapWhitelist
+}
+
+type mapWhitelist struct {
+ mu sync.RWMutex
+ store map[string]struct{}
+}
+
+func NewMapWhitelist() MapWhitelist {
+ return &mapWhitelist{store: make(map[string]struct{})}
+}
+
+func (w *mapWhitelist) Add(pat string) MapWhitelist {
+ w.mu.Lock()
+ defer w.mu.Unlock()
+ w.store[pat] = struct{}{}
+ return w
+}
+
+func (w *mapWhitelist) IsAllowed(u string) bool {
+ w.mu.RLock()
+ _, b := w.store[u]
+ w.mu.RUnlock()
+ return b
+}
diff --git a/vendor/github.com/lestrrat-go/httprc/v3/worker.go b/vendor/github.com/lestrrat-go/httprc/v3/worker.go
new file mode 100644
index 0000000000..d11477dadc
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/httprc/v3/worker.go
@@ -0,0 +1,62 @@
+package httprc
+
+import (
+ "context"
+ "fmt"
+ "sync"
+)
+
+type worker struct {
+ httpcl HTTPClient
+ incoming chan any
+ next <-chan Resource
+ nextsync <-chan synchronousRequest
+ errSink ErrorSink
+ traceSink TraceSink
+}
+
+func (w worker) Run(ctx context.Context, readywg *sync.WaitGroup, donewg *sync.WaitGroup) {
+ w.traceSink.Put(ctx, "httprc worker: START worker loop")
+ defer w.traceSink.Put(ctx, "httprc worker: END worker loop")
+ defer donewg.Done()
+ ctx = withTraceSink(ctx, w.traceSink)
+ ctx = withHTTPClient(ctx, w.httpcl)
+
+ readywg.Done()
+ for {
+ select {
+ case <-ctx.Done():
+ w.traceSink.Put(ctx, "httprc worker: stopping worker loop")
+ return
+ case r := <-w.next:
+ w.traceSink.Put(ctx, fmt.Sprintf("httprc worker: syncing %q (async)", r.URL()))
+ if err := r.Sync(ctx); err != nil {
+ w.errSink.Put(ctx, err)
+ }
+ r.SetBusy(false)
+
+ w.sendAdjustIntervalRequest(ctx, r)
+ case sr := <-w.nextsync:
+ w.traceSink.Put(ctx, fmt.Sprintf("httprc worker: syncing %q (synchronous)", sr.resource.URL()))
+ if err := sr.resource.Sync(ctx); err != nil {
+ w.traceSink.Put(ctx, fmt.Sprintf("httprc worker: FAILED to sync %q (synchronous): %s", sr.resource.URL(), err))
+ sendReply(ctx, sr.reply, struct{}{}, err)
+ sr.resource.SetBusy(false)
+ return
+ }
+ w.traceSink.Put(ctx, fmt.Sprintf("httprc worker: SUCCESS syncing %q (synchronous)", sr.resource.URL()))
+ sr.resource.SetBusy(false)
+ sendReply(ctx, sr.reply, struct{}{}, nil)
+ w.sendAdjustIntervalRequest(ctx, sr.resource)
+ }
+ }
+}
+
+func (w worker) sendAdjustIntervalRequest(ctx context.Context, r Resource) {
+ w.traceSink.Put(ctx, "httprc worker: Sending interval adjustment request for "+r.URL())
+ select {
+ case <-ctx.Done():
+ case w.incoming <- adjustIntervalRequest{resource: r}:
+ }
+ w.traceSink.Put(ctx, "httprc worker: Sent interval adjustment request for "+r.URL())
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/.bazelignore b/vendor/github.com/lestrrat-go/jwx/v3/.bazelignore
new file mode 100644
index 0000000000..50347e8777
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/.bazelignore
@@ -0,0 +1,4 @@
+cmd
+bench
+examples
+tools
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/.bazelrc b/vendor/github.com/lestrrat-go/jwx/v3/.bazelrc
new file mode 100644
index 0000000000..b47648db7b
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/.bazelrc
@@ -0,0 +1 @@
+import %workspace%/.aspect/bazelrc/bazel7.bazelrc
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/.bazelversion b/vendor/github.com/lestrrat-go/jwx/v3/.bazelversion
new file mode 100644
index 0000000000..56b6be4ebb
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/.bazelversion
@@ -0,0 +1 @@
+8.3.1
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/.gitignore b/vendor/github.com/lestrrat-go/jwx/v3/.gitignore
new file mode 100644
index 0000000000..c4c0ebff32
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/.gitignore
@@ -0,0 +1,39 @@
+# Compiled Object files, Static and Dynamic libs (Shared Objects)
+*.o
+*.a
+*.so
+
+# Folders
+_obj
+_test
+
+# Architecture specific extensions/prefixes
+*.[568vq]
+[568vq].out
+
+*.cgo1.go
+*.cgo2.c
+_cgo_defun.c
+_cgo_gotypes.go
+_cgo_export.*
+
+_testmain.go
+
+*.exe
+*.test
+*.prof
+
+# IDE
+.idea
+.vscode
+.DS_Store
+*~
+
+coverage.out
+
+# I redirect my test output to files named "out" way too often
+out
+
+cmd/jwx/jwx
+
+bazel-*
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/.golangci.yml b/vendor/github.com/lestrrat-go/jwx/v3/.golangci.yml
new file mode 100644
index 0000000000..30dc4c519b
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/.golangci.yml
@@ -0,0 +1,128 @@
+version: "2"
+linters:
+ default: all
+ disable:
+ - cyclop
+ - depguard
+ - dupl
+ - err113
+ - errorlint
+ - exhaustive
+ - funcorder
+ - funlen
+ - gochecknoglobals
+ - gochecknoinits
+ - gocognit
+ - gocritic
+ - gocyclo
+ - godot
+ - godox
+ - gosec
+ - gosmopolitan
+ - govet
+ - inamedparam
+ - ireturn
+ - lll
+ - maintidx
+ - makezero
+ - mnd
+ - nakedret
+ - nestif
+ - nlreturn
+ - noinlineerr
+ - nonamedreturns
+ - paralleltest
+ - perfsprint
+ - staticcheck
+ - recvcheck
+ - tagliatelle
+ - testifylint
+ - testpackage
+ - thelper
+ - varnamelen
+ - wrapcheck
+ - wsl
+ - wsl_v5
+ settings:
+ govet:
+ disable:
+ - shadow
+ - fieldalignment
+ enable-all: true
+ exclusions:
+ generated: lax
+ presets:
+ - comments
+ - common-false-positives
+ - legacy
+ - std-error-handling
+ rules:
+ - linters:
+ - staticcheck
+ path: /*.go
+ text: 'ST1003: should not use underscores in package names'
+ - linters:
+ - revive
+ path: /*.go
+ text: don't use an underscore in package name
+ - linters:
+ - staticcheck
+ text: SA1019
+ - linters:
+ - contextcheck
+ - exhaustruct
+ path: /*.go
+ - linters:
+ - errcheck
+ path: /main.go
+ - linters:
+ - errcheck
+ path: internal/codegen/codegen.go
+ - linters:
+ - errcheck
+ - errchkjson
+ - forcetypeassert
+ path: internal/jwxtest/jwxtest.go
+ - linters:
+ - errcheck
+ - errchkjson
+ - forcetypeassert
+ path: /*_test.go
+ - linters:
+ - forbidigo
+ path: /*_example_test.go
+ - linters:
+ - forbidigo
+ path: cmd/jwx/jwx.go
+ - linters:
+ - revive
+ path: /*_test.go
+ text: 'var-naming: '
+ - linters:
+ - revive
+ path: internal/tokens/jwe_tokens.go
+ text: "don't use ALL_CAPS in Go names"
+ - linters:
+ - revive
+ path: jwt/internal/types/
+ text: "var-naming: avoid meaningless package names"
+ - linters:
+ - godoclint
+ path: (^|/)internal/
+ paths:
+ - third_party$
+ - builtin$
+ - examples$
+issues:
+ max-issues-per-linter: 0
+ max-same-issues: 0
+formatters:
+ enable:
+ - gofmt
+ - goimports
+ exclusions:
+ generated: lax
+ paths:
+ - third_party$
+ - builtin$
+ - examples$
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/BUILD b/vendor/github.com/lestrrat-go/jwx/v3/BUILD
new file mode 100644
index 0000000000..2759408882
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/BUILD
@@ -0,0 +1,47 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+load("@gazelle//:def.bzl", "gazelle")
+
+# gazelle:prefix github.com/lestrrat-go/jwx/v3
+# gazelle:go_naming_convention import_alias
+
+gazelle(name = "gazelle")
+
+go_library(
+ name = "jwx",
+ srcs = [
+ "format.go",
+ "formatkind_string_gen.go",
+ "jwx.go",
+ "options.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//internal/json",
+ "//internal/tokens",
+ "@com_github_lestrrat_go_option_v2//:option",
+ ],
+)
+
+go_test(
+ name = "jwx_test",
+ srcs = ["jwx_test.go"],
+ deps = [
+ ":jwx",
+ "//internal/jose",
+ "//internal/json",
+ "//internal/jwxtest",
+ "//jwa",
+ "//jwe",
+ "//jwk",
+ "//jwk/ecdsa",
+ "//jws",
+ "@com_github_stretchr_testify//require",
+ ],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":jwx",
+ visibility = ["//visibility:public"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/Changes b/vendor/github.com/lestrrat-go/jwx/v3/Changes
new file mode 100644
index 0000000000..4df33b756c
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/Changes
@@ -0,0 +1,272 @@
+Changes
+=======
+
+v3 has many incompatibilities with v2. To see the full list of differences between
+v2 and v3, please read the Changes-v3.md file (https://github.com/lestrrat-go/jwx/blob/develop/v3/Changes-v3.md)
+
+v3.0.13 12 Jan 2026
+ * [jwt] The `jwt.WithContext()` option is now properly being passed to `jws.Verify()` from
+ `jwt.Parse()`.
+ * [jwx] github.com/lestrrat-go/httprc/v3 has been upgraded to remove dependency on
+ github.com/lestrrat-go/option (v1)
+ * [jwk] `jwk.Clone()` has been fixed to properly work with private fields.
+
+v3.0.12 20 Oct 2025
+ * [jwe] As part of the next change, now per-recipient headers that are empty
+ are no longer serialized in flattened JSON serialization.
+
+ * [jwe] Introduce `jwe.WithLegacyHeaderMerging(bool)` option to control header
+ merging behavior in during JWE encryption. This only applies to flattened
+ JSON serialization.
+
+ Previously, when using flattened JSON serialization (i.e. you specified
+ JSON serialization via `jwe.WithJSON()` and only supplied one key), per-recipient
+ headers were merged into the protected headers during encryption, and then
+ were left to be included in the final serialization as-is. This caused duplicate
+ headers to be present in both the protected headers and the per-recipient headers.
+
+ Since there may be users who rely on this behavior already, instead of changing the
+ default behavior to fix this duplication, a new option to `jwe.Encrypt()` was added
+ to allow clearing the per-recipient headers after merging to leave the `"headers"`
+ field empty. This in effect makes the flattened JSON serialization more similar to
+ the compact serialization, where there are no per-recipient headers present, and
+ leaves the headers disjoint.
+
+ Note that in compact mode, there are no per-recipient headers and thus the
+ headers need to be merged regardless. In full JSON serialization, we never
+ merge the headers, so it is left up to the user to keep the headers disjoint.
+
+ * [jws] Calling the deprecated `jws.NewSigner()` function for the first time will cause
+ legacy signers to be loaded automatically. Previously, you had to explicitly
+ call `jws.Settings(jws.WithLegacySigners(true))` to enable legacy signers.
+
+ We incorrectly assumed that users would not be using `jws.NewSigner()`, and thus
+ disabled legacy signers by default. However, it turned out that some users
+ were using `jws.NewSigner()` in their code, which lead to breakages in
+ existing code. In hindsight we should have known that any API made public before will
+ be used by _somebody_.
+
+ As a side effect, jws.Settings(jws.WithLegacySigners(...)) is now a no-op.
+
+ However, please do note that jws.Signer (and similar) objects were always intended to be
+ used for _registering_ new signing/verifying algorithms, and not for end users to actually
+ use them directly. If you are using them for other purposes, please consider changing
+ your code, as it is more than likely that we will somehow deprecate/remove/discouraged
+ their use in the future.
+
+v3.0.11 14 Sep 2025
+ * [jwk] Add `(jwk.Cache).Shutdown()` method that delegates to the httprc controller
+ object, to shutdown the cache.
+ * [jwk] Change timing of `res.Body.Close()` call
+ * [jwe] Previously, ecdh.PrivateKey/ecdh.PublicKey were not properly handled
+ when used for encryption, which has been fixed.
+ * [jws/jwsbb] (EXPERIMENTAL/BREAKS COMPATIBILITY) Convert most functions into
+ thin wrappers around functions from github.com/lestrrat-go/dsig package.
+ As a related change, HAMCHashFuncFor/RSAHashFuncFor/ECDSAHashFuncFor/RSAPSSOptions
+ have been removed or unexported.
+ Users of this module should be using jwsbb.Sign() and jwsbb.Verify() instead of
+ algorithm specific jwsbb.SignRSA()/jwsbb.VerifyRSA() and such. If you feel the
+ need to use these functions, you should use github.com/lestrrat-go/dsig directly.
+
+v3.0.10 04 Aug 2025
+ * [jws/jwsbb] Add `jwsbb.ErrHeaderNotFound()` to return the same error type as when
+ a non-existent header is requested. via `HeaderGetXXX()` functions. Previously, this
+ function was called `jwsbb.ErrFieldNotFound()`, but it was a misnomer.
+ * [jws/jwsbb] Fix a bug where error return values from `HeaderGetXXX()` functions
+ could not be matched against `jwsbb.ErrHeaderNotFound()` using `errors.Is()`.
+
+v3.0.9 31 Jul 2025
+ * [jws/jwsbb] `HeaderGetXXX()` functions now return errors when
+ the requested header is not found, or if the value cannot be
+ converted to the requested type.
+
+ * [jwt] `(jwt.Token).Get` methods now return specific types of errors depending
+ on if a) the specified claim was not present, or b) the specified claim could
+ not be assigned to the destination variable.
+
+ You can distinguish these by using `errors.Is` against `jwt.ClaimNotFoundError()`
+ or `jwt.ClaimAssignmentFailedError()`
+
+v3.0.8 27 Jun 2025
+ * [jwe/jwebb] (EXPERIMENTAL) Add low-level functions for JWE operations.
+ * [jws/jwsbb] (EXPERIMENTAL/BREAKS COMPATIBILITY) Add io.Reader parameter
+ so your choice of source of randomness can be passed. Defaults to crypto/rand.Reader.
+ Function signatures around jwsbb.Sign() now accept an addition `rr io.Reader`,
+ which can be nil for 99% of use cases.
+ * [jws/jwsbb] Add HeaderParse([]byte), where it is expected that the header
+ is already in its base64 decoded format.
+ * misc: replace `interface{}` with `any`
+
+v3.0.7 16 Jun 2025
+ * [jws/jwsbb] (EXPERIMENTAL) Add low-level fast access to JWS headers in compact
+ serialization form.
+ * [jws] Fix error reporting when no key matched for a signature.
+ * [jws] Refactor jws signer setup.
+ * Known algorithms are now implemented completely in the jws/jwsbb package.
+ * VerifierFor and SignerFor now always succeed, and will also return a Signer2
+ or Verifier2 that wraps the legacy Signer or Verifier if one is registered.
+
+v3.0.6 13 Jun 2025
+ * This release contains various performance improvements all over the code.
+ No, this time for real. In particular, the most common case for signing
+ a JWT with a key is approx 70% more efficient based on the number of allocations.
+
+ Please read the entry for the (retracted) v3.0.4 for what else I have to
+ say about performance improvements
+
+ * [jwt] Added fast-path for token signing and verification. The fast path
+ is triggered if you only pass `jwt.Sign()` and `jwt.Parse()` one options each
+ (`jwt.WithKey()`), with no suboptions.
+
+ * [jws] Major refactoring around basic operations:
+
+ * How to work with Signer/Verifier have completely changed. Please take
+ a look at examples/jws_custom_signer_verifier_example_test.go for how
+ to do it the new way. The old way still works, but it WILL be removed
+ when v4 arrives.
+ * Related to the above, old code has been moved to `jws/legacy`.
+
+ * A new package `jws/jwsbb` has been added. `bb` stands for building blocks.
+ This package separates out the low-level JWS operations into its own
+ package. So if you are looking for just the signing of a payload with
+ a key, this is it.
+
+ `jws/jwsbb` is currently considered to be EXPERIMENTAL.
+
+v3.0.5 11 Jun 2025
+ * Retract v3.0.4
+ * Code for v3.0.3 is the same as v3.0.3
+
+v3.0.4 09 Jun 2025
+ * This release contains various performance improvements all over the code.
+
+ Because of the direction that this library is taking, we have always been
+ more focused on correctness and usability/flexibility over performance.
+
+ It just so happens that I had a moment of inspiration and decided to see
+ just how good our AI-based coding agents are in this sort of analysis-heavy tasks.
+
+ Long story short, the AI was fairly good at identifying suspicious code with
+ an okay accuracy, but completely failed to make any meaningful changes to the
+ code in a way that both did not break the code _and_ improved performance.
+ I am sure that they will get better in the near future, but for now,
+ I had to do the changes myself. I should clarify to their defence that
+ the AI was very helpful in writing cumbersome benchmark code for me.
+
+ The end result is that we have anywhere from 10 to 30% performance improvements
+ in various parts of the code that we touched, based on number of allocations.
+ We believe that this would be a significant improvement for many users.
+
+ For further improvements, we can see that there would be a clear benefit to
+ writing optimized code path that is designed to serve the most common cases.
+ For example, for the case of signing JWTs with a single key, we could provide
+ a path that skips a lot of extra processing (we kind of did that in this change,
+ but we _could_ go ever harder in this direction). However, it is a trade-off between
+ maintainability and performance, and as I am currently the sole maintainer of
+ this library for the time being, I only plan to pursue such a route where it
+ requires minimal effort on my part.
+
+ If you are interested in helping out in this area, I hereby thank you in advance.
+ However, please be perfectly clear that unlike other types of changes, for performance
+ related changes, the balance between the performance gains and maintainability is
+ top priority. If you have good ideas and code, they will always be welcome, but
+ please be prepared to justify your changes.
+
+ Finally, thank you for using this library!
+
+v3.0.3 06 Jun 2025
+ * Update some dependencies
+ * [jwe] Change some error messages to contain more context information
+
+v3.0.2 03 Jun 2025
+ * [transform] (EXPERIMENTAL) Add utility function `transform.AsMap` to convert a
+ Mappable object to a map[string]interface{}. This is useful for converting
+ objects such as `jws.Header`, `jwk.Key`, `jwt.Token`, etc. to a map that can
+ be used with other libraries that expect a map.
+ * [jwt] (EXPERIMENTAL) Added token filtering functionality through the TokenFilter interface.
+ * [jwt/openid] (EXPERIMENTAL) Added StandardClaimsFilter() for filtering standard OpenID claims.
+ * [jws] (EXPERIMENTAL) Added header filtering functionality through the HeaderFilter interface.
+ * [jwe] (EXPERIMENTAL) Added header filtering functionality through the HeaderFilter interface.
+ * [jwk] (EXPERIMENTAL) Added key filtering functionality through the KeyFilter interface.
+ * [jwk] `jwk.Export` previously did not recognize third-party objects that implemented `jwk.Key`,
+ as it was detecting what to do by checking if the object was one of our own unexported
+ types. This caused some problems for consumers of this library that wanted to extend the
+ features of the keys.
+
+ Now `jwk.Export` checks types against interface types such as `jwk.RSAPrivateKey`, `jwk.ECDSAPrivateKey`, etc.
+ It also uses some reflect blackmagic to detect if the given object implements the `jwk.Key` interface
+ via embedding, so you should be able to embed a `jwk.Key` to another object to act as if it
+ is a legitimate `jwk.Key`, as far as `jwk.Export` is concerned.
+
+v3.0.1 29 Apr 2025
+ * [jwe] Fixed a long standing bug that could lead to degraded encryption or failure to
+ decrypt JWE messages when a very specific combination of inputs were used for
+ JWE operations.
+
+ This problem only manifested itself when the following conditions in content encryption or decryption
+ were met:
+ - Content encryption was specified to use DIRECT mode.
+ - Contentn encryption algorithm is specified as A256CBC_HS512
+ - The key was erronously constructed with a 32-byte content encryption key (CEK)
+
+ In this case, the user would be passing a mis-constructed key of 32-bytes instead
+ of the intended 64-bytes. In all other cases, this construction would cause
+ an error because `crypto/aes.NewCipher` would return an error when a key with length
+ not matching 16, 24, and 32 bytes is used. However, due to use using a the provided
+ 32-bytes as half CEK and half the hash, the `crypto/aes.NewCipher` was passed
+ a 16-byte key, which is fine for AES-128. So internally `crypto/aes.NewCipher` would
+ choose to use AES-128 instead of AES-256, and happily continue. Note that no other
+ key lengths such as 48 and 128 would have worked. It had to be exactly 32.
+
+ This does indeed result in a downgraded encryption, but we believe it is unlikely that this would cause a problem in the real world,
+ as you would have to very specifically choose to use DIRECT mode, choose
+ the specific content encryption algorithm, AND also use the wrong key size of
+ exactly 32 bytes.
+
+ However, in abandunce of caution, we recommend that you upgrade to v3.0.1 or later,
+ or v2.1.6 or later if you are still on v2 series.
+
+ * [jws] Improve performance of jws.SplitCompact and jws.SplitCompactString
+ * [jwe] Improve performance of jwe.Parse
+
+v3.0.0 1 Apr 2025
+ * Release initial v3.0.0 series. Code is identical to v3.0.0-beta2, except
+ for minor documentation changes.
+
+ Please note that v1 will no longer be maintained.
+
+ Going forward v2 will receive security updates but will no longer receive
+ feature updates. Users are encouraged to migrate to v3. There is no hard-set
+ guarantee as to how long v2 will be supported, but if/when v4 comes out,
+ v2 support will be terminated then.
+
+v3.0.0-beta2 30 Mar 2025
+ * [jwk] Fix a bug where `jwk.Set`'s `Keys()` method did not return the proper
+ non-standard fields. (#1322)
+ * [jws][jwt] Implement `WithBase64Encoder()` options to pass base64 encoders
+ to use during signing/verifying signatures. This useful when the token
+ provider generates JWTs that don't follow the specification and uses base64
+ encoding other than raw url encoding (no padding), such as, apparently,
+ AWS ALB. (#1324, #1328)
+
+v3.0.0-beta1 15 Mar 2025
+ * [jwt] Token validation no longer truncates time based fields by default.
+ To restore old behavior, you can either change the global settings by
+ calling `jwt.Settings(jwt.WithTruncation(time.Second))`, or you can
+ change it by each invocation by using `jwt.Validate(..., jwt.WithTruncation(time.Second))`
+
+v3.0.0-alpha3 13 Mar 2025
+ * [jwk] Importing/Exporting from jwk.Key with P256/P386/P521 curves to
+ ecdh.PrivateKey/ecdh.PublicKey should now work. Previously these keys were not properly
+ recognized by the exporter/importer. Note that keys that use X25519 and P256/P384/P521
+ behave differently: X25519 keys can only be exported to/imported from OKP keys,
+ while P256/P384/P521 can be exported to either ecdsa or ecdh keys.
+
+v3.0.0-alpha2 25 Feb 2025
+ * Update to work with go1.24
+ * Update tests to work with latest latchset/jose
+ * Fix build pipeline to work with latest golangci-lint
+ * Require go1.23
+
+v3.0.0-alpha1 01 Nov 2024
+ * Initial release of v3 line.
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/Changes-v2.md b/vendor/github.com/lestrrat-go/jwx/v3/Changes-v2.md
new file mode 100644
index 0000000000..af146ed33a
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/Changes-v2.md
@@ -0,0 +1,390 @@
+# Incompatible Changes from v1 to v2
+
+These are changes that are incompatible with the v1.x.x version.
+
+* [tl;dr](#tldr) - If you don't feel like reading the details -- but you will read the details, right?
+* [Detailed List of Changes](#detailed-list-of-changes) - A comprehensive list of changes from v1 to v2
+
+# tl;dr
+
+## JWT
+
+```go
+// most basic
+jwt.Parse(serialized, jwt.WithKey(alg, key)) // NOTE: verification and validation are ENABLED by default!
+jwt.Sign(token, jwt.WithKey(alg,key))
+
+// with a jwk.Set
+jwt.Parse(serialized, jwt.WithKeySet(set))
+
+// UseDefault/InferAlgorithm with JWKS
+jwt.Parse(serialized, jwt.WithKeySet(set,
+ jws.WithUseDefault(true), jws.WithInferAlgorithm(true))
+
+// Use `jku`
+jwt.Parse(serialized, jwt.WithVerifyAuto(...))
+
+// Any other custom key provisioning (using functions in this
+// example, but can be anything that fulfills jws.KeyProvider)
+jwt.Parse(serialized, jwt.WithKeyProvider(jws.KeyProviderFunc(...)))
+```
+
+## JWK
+
+```go
+// jwk.New() was confusing. Renamed to fit the actual implementation
+key, err := jwk.FromRaw(rawKey)
+
+// Algorithm() now returns jwa.KeyAlgorithm type. `jws.Sign()`
+// and other function that receive JWK algorithm names accept
+// this new type, so you can use the same key and do the following
+// (previously you needed to type assert)
+jws.Sign(payload, jws.WithKey(key.Algorithm(), key))
+
+// If you need the specific type, type assert
+key.Algorithm().(jwa.SignatureAlgorithm)
+
+// jwk.AutoRefresh is no more. Use jwk.Cache
+cache := jwk.NewCache(ctx, options...)
+
+// Certificate chains are no longer jwk.CertificateChain type, but
+// *(github.com/lestrrat-go/jwx/cert).Chain
+cc := key.X509CertChain() // this is *cert.Chain now
+```
+
+## JWS
+
+```go
+// basic
+jws.Sign(payload, jws.WithKey(alg, key))
+jws.Sign(payload, jws.WithKey(alg, key), jws.WithKey(alg, key), jws.WithJSON(true))
+jws.Verify(signed, jws.WithKey(alg, key))
+
+// other ways to pass the key
+jws.Sign(payload, jws.WithKeySet(jwks))
+jws.Sign(payload, jws.WithKeyProvider(kp))
+
+// retrieve the key that succeeded in verifying
+var keyUsed interface{}
+jws.Verify(signed, jws.WithKeySet(jwks), jws.WithKeyUsed(&keyUsed))
+```
+
+## JWE
+
+```go
+// basic
+jwe.Encrypt(payload, jwe.WithKey(alg, key)) // other defaults are inferred
+jwe.Encrypt(payload, jwe.WithKey(alg, key), jwe.WithKey(alg, key), jwe.WithJSON(true))
+jwe.Decrypt(encrypted, jwe.WithKey(alg, key))
+
+// other ways to pass the key
+jwe.Encrypt(payload, jwe.WithKeySet(jwks))
+jwe.Encrypt(payload, jwe.WithKeyProvider(kp))
+
+// retrieve the key that succeeded in decrypting
+var keyUsed interface{}
+jwe.Verify(signed, jwe.WithKeySet(jwks), jwe.WithKeyUsed(&keyUsed))
+```
+
+# Detailed List of Changes
+
+## Module
+
+* Module now requires go 1.16
+
+* Use of github.com/pkg/errors is no more. If you were relying on behavior
+ that depends on the errors being an instance of github.com/pkg/errors
+ then you need to change your code
+
+* File-generation tools have been moved out of internal/ directories.
+ These files pre-dates Go modules, and they were in internal/ in order
+ to avoid being listed in the `go doc` -- however, now that we can
+ make them separate modules this is no longer necessary.
+
+* New package `cert` has been added to handle `x5c` certificate
+ chains, and to work with certificates
+ * cert.Chain to store base64 encoded ASN.1 DER format certificates
+ * cert.EncodeBase64 to encode ASN.1 DER format certificate using base64
+ * cert.Create to create a base64 encoded ASN.1 DER format certificates
+ * cert.Parse to parse base64 encoded ASN.1 DER format certificates
+
+## JWE
+
+* `jwe.Compact()`'s signature has changed to
+ `jwe.Compact(*jwe.Message, ...jwe.CompactOption)`
+
+* `jwe.JSON()` has been removed. You can generate JSON serialization
+ using `jwe.Encrypt(jwe.WitJSON())` or `json.Marshal(jwe.Message)`
+
+* `(jwe.Message).Decrypt()` has been removed. Since formatting of the
+ original serialized message matters (including whitespace), using a parsed
+ object was inherently confusing.
+
+* `jwe.Encrypt()` can now generate JWE messages in either compact or JSON
+ forms. By default, the compact form is used. JSON format can be
+ enabled by using the `jwe.WithJSON` option.
+
+* `jwe.Encrypt()` can now accept multiple keys by passing multiple
+ `jwe.WithKey()` options. This can be used with `jwe.WithJSON` to
+ create JWE messages with multiple recipients.
+
+* `jwe.DecryptEncryptOption()` has been renamed to `jwe.EncryptDecryptOption()`.
+ This is so that it is more uniform with `jws` equivalent of `jws.SignVerifyOption()`
+ where the producer (`Sign`) comes before the consumer (`Verify`) in the naming
+
+* `jwe.WithCompact` and `jwe.WithJSON` options have been added
+ to control the serialization format.
+
+* jwe.Decrypt()'s method signature has been changed to `jwt.Decrypt([]byte, ...jwe.DecryptOption) ([]byte, error)`.
+ These options can be stacked. Therefore, you could configure the
+ verification process to attempt a static key pair, a JWKS, and only
+ try other forms if the first two fails, for example.
+
+ - For static key pair, use `jwe.WithKey()`
+ - For static JWKS, use `jwe.WithKeySet()` (NOTE: InferAlgorithmFromKey like in `jws` package is NOT supported)
+ - For custom, possibly dynamic key provisioning, use `jwe.WithKeyProvider()`
+
+* jwe.Decrypter has been unexported. Users did not need this.
+
+* jwe.WithKeyProvider() has been added to specify arbitrary
+ code to specify which keys to try.
+
+* jwe.KeyProvider interface has been added
+
+* jwe.KeyProviderFunc has been added
+
+* `WithPostParser()` has been removed. You can achieve the same effect
+ by using `jwe.WithKeyProvider()`. Because this was the only consumer for
+ `jwe.DecryptCtx`, this type has been removed as well.
+
+* `x5c` field type has been changed to `*cert.Chain` instead of `[]string`
+
+* Method signature for `jwe.Parse()` has been changed to include options,
+ but options are currently not used
+
+* `jwe.ReadFile` now supports the option `jwe.WithFS` which allows you to
+ read data from arbitrary `fs.FS` objects
+
+* jwe.WithKeyUsed has been added to allow users to retrieve
+ the key used for decryption. This is useful in cases you provided
+ multiple keys and you want to know which one was successful
+
+## JWK
+
+* `jwk.New()` has been renamed to `jwk.FromRaw()`, which hopefully will
+ make it easier for the users what the input should be.
+
+* `jwk.Set` has many interface changes:
+ * Changed methods to match jwk.Key and its semantics:
+ * Field is now Get() (returns values for arbitrary fields other than keys). Fetching a key is done via Key()
+ * Remove() now removes arbitrary fields, not keys. to remove keys, use RemoveKey()
+ * Iterate has been added to iterate through all non-key fields.
+ * Add is now AddKey(Key) string, and returns an error when the same key is added
+ * Get is now Key(int) (Key, bool)
+ * Remove is now RemoveKey(Key) error
+ * Iterate is now Keys(context.Context) KeyIterator
+ * Clear is now Clear() error
+
+* `jwk.CachedSet` has been added. You can create a `jwk.Set` that is backed by
+ `jwk.Cache` so you can do this:
+
+```go
+cache := jkw.NewCache(ctx)
+cachedSet := jwk.NewCachedSet(cache, jwksURI)
+
+// cachedSet is always the refreshed, cached version from jwk.Cache
+jws.Verify(signed, jws.WithKeySet(cachedSet))
+```
+
+* `jwk.NewRSAPRivateKey()`, `jwk.NewECDSAPrivateKey()`, etc have been removed.
+ There is no longer any way to create concrete types of `jwk.Key`
+
+* `jwk.Key` type no longer supports direct unmarshaling via `json.Unmarshal()`,
+ because you can no longer instantiate concrete `jwk.Key` types. You will need to
+ use `jwk.ParseKey()`. See the documentation for ways to parse JWKs.
+
+* `(jwk.Key).Algorithm()` is now of `jwk.KeyAlgorithm` type. This field used
+ to be `string` and therefore could not be passed directly to `jwt.Sign()`
+ `jws.Sign()`, `jwe.Encrypt()`, et al. This is no longer the case, and
+ now you can pass it directly. See
+ https://github.com/lestrrat-go/jwx/blob/v2/docs/99-faq.md#why-is-jwkkeyalgorithm-and-jwakeyalgorithm-so-confusing
+ for more details
+
+* `jwk.Fetcher` and `jwk.FetchFunc` has been added.
+ They represent something that can fetch a `jwk.Set`
+
+* `jwk.CertificateChain` has been removed, use `*cert.Chain`
+* `x5c` field type has been changed to `*cert.Chain` instead of `[]*x509.Certificate`
+
+* `jwk.ReadFile` now supports the option `jwk.WithFS` which allows you to
+ read data from arbitrary `fs.FS` objects
+
+* Added `jwk.PostFetcher`, `jwk.PostFetchFunc`, and `jwk.WithPostFetch` to
+ allow users to get at the `jwk.Set` that was fetched in `jwk.Cache`.
+ This will make it possible for users to supply extra information and edit
+ `jwk.Set` after it has been fetched and parsed, but before it is cached.
+ You could, for example, modify the `alg` field so that it's easier to
+ work with when you use it in `jws.Verify` later.
+
+* Reworked `jwk.AutoRefresh` in terms of `github.com/lestrrat-go/httprc`
+ and renamed it `jwk.Cache`.
+
+ Major difference between `jwk.AutoRefresh` and `jwk.Cache` is that while
+ former used one `time.Timer` per resource, the latter uses a static timer
+ (based on `jwk.WithRefreshWindow()` value, default 15 minutes) that periodically
+ refreshes all resources that were due to be refreshed within that time frame.
+
+ This method may cause your updates to happen slightly later, but uses significantly
+ less resources and is less prone to clogging.
+
+* Reimplemented `jwk.Fetch` in terms of `github.com/lestrrat-go/httprc`.
+
+* Previously `jwk.Fetch` and `jwk.AutoRefresh` respected backoff options,
+ but this has been removed. This is to avoid unwanted clogging of the fetch workers
+ which is the default processing mode in `github.com/lestrrat-go/httprc`.
+
+ If you are using backoffs, you need to control your inputs more carefully so as
+ not to clog your fetch queue, and therefore you should be writing custom code that
+ suits your needs
+
+## JWS
+
+* `jws.Sign()` can now generate JWS messages in either compact or JSON
+ forms. By default, the compact form is used. JSON format can be
+ enabled by using the `jws.WithJSON` option.
+
+* `jws.Sign()` can now accept multiple keys by passing multiple
+ `jws.WithKey()` options. This can be used with `jws.WithJSON` to
+ create JWS messages with multiple signatures.
+
+* `jws.WithCompact` and `jws.WithJSON` options have been added
+ to control the serialization format.
+
+* jws.Verify()'s method signature has been changed to `jwt.Verify([]byte, ...jws.VerifyOption) ([]byte, error)`.
+ These options can be stacked. Therefore, you could configure the
+ verification process to attempt a static key pair, a JWKS, and only
+ try other forms if the first two fails, for example.
+
+ - For static key pair, use `jws.WithKey()`
+ - For static JWKS, use `jws.WithKeySet()`
+ - For enabling verification using `jku`, use `jws.WithVerifyAuto()`
+ - For custom, possibly dynamic key provisioning, use `jws.WithKeyProvider()`
+
+* jws.WithVerify() has been removed.
+
+* jws.WithKey() has been added to specify an algorithm + key to
+ verify the payload with.
+
+* jws.WithKeySet() has been added to specify a JWKS to be used for
+ verification. By default `kid` AND `alg` must match between the signature
+ and the key.
+
+ The option can take further suboptions:
+
+```go
+jws.Parse(serialized,
+ jws.WithKeySet(set,
+ // by default `kid` is required. set false to disable.
+ jws.WithRequireKid(false),
+ // optionally skip matching kid if there's exactly one key in set
+ jws.WithUseDefault(true),
+ // infer algorithm name from key type
+ jws.WithInferAlgorithm(true),
+ ),
+)
+```
+
+* `jws.VerifuAuto` has been removed in favor of using
+ `jws.WithVerifyAuto` option with `jws.Verify()`
+
+* `jws.WithVerifyAuto` has been added to enable verification
+ using `jku`.
+
+ The first argument must be a jwk.Fetcher object, but can be
+ set to `nil` to use the default implementation which is `jwk.Fetch`
+
+ The rest of the arguments are treated as options passed to the
+ `(jwk.Fetcher).Fetch()` function.
+
+* Remove `jws.WithPayloadSigner()`. This should be completely replaceable
+ using `jws.WithKey()`
+
+* jws.WithKeyProvider() has been added to specify arbitrary
+ code to specify which keys to try.
+
+* jws.KeyProvider interface has been added
+
+* jws.KeyProviderFunc has been added
+
+* jws.WithKeyUsed has been added to allow users to retrieve
+ the key used for verification. This is useful in cases you provided
+ multiple keys and you want to know which one was successful
+
+* `x5c` field type has been changed to `*cert.Chain` instead of `[]string`
+
+* `jws.ReadFile` now supports the option `jws.WithFS` which allows you to
+ read data from arbitrary `fs.FS` objects
+
+## JWT
+
+* `jwt.Parse` now verifies the signature and validates the token
+ by default. You must disable it explicitly using `jwt.WithValidate(false)`
+ and/or `jwt.WithVerify(false)` if you only want to parse the JWT message.
+
+ If you don't want either, a convenience function `jwt.ParseInsecure`
+ has been added.
+
+* `jwt.Parse` can only parse raw JWT (JSON) or JWS (JSON or Compact).
+ It no longer accepts JWE messages.
+
+* `jwt.WithDecrypt` has been removed
+
+* `jwt.WithJweHeaders` has been removed
+
+* `jwt.WithVerify()` has been renamed to `jwt.WithKey()`. The option can
+ be used for signing, encryption, and parsing.
+
+* `jwt.Validator` has been changed to return `jwt.ValidationError`.
+ If you provide a custom validator, you should wrap the error with
+ `jwt.NewValidationError()`
+
+* `jwt.UseDefault()` has been removed. You should use `jws.WithUseDefault()`
+ as a suboption in the `jwt.WithKeySet()` option.
+
+```go
+jwt.Parse(serialized, jwt.WithKeySet(set, jws.WithUseDefault(true)))
+```
+
+* `jwt.InferAlgorithmFromKey()` has been removed. You should use
+ `jws.WithInferAlgorithmFromKey()` as a suboption in the `jwt.WithKeySet()` option.
+
+```go
+jwt.Parse(serialized, jwt.WithKeySet(set, jws.WithInferAlgorithmFromKey(true)))
+```
+
+* jwt.WithKeySetProvider has been removed. Use `jwt.WithKeyProvider()`
+ instead. If jwt.WithKeyProvider seems a bit complicated, use a combination of
+ JWS parse, no-verify/validate JWT parse, and an extra JWS verify:
+
+```go
+msg, _ := jws.Parse(signed)
+token, _ := jwt.Parse(msg.Payload(), jwt.WithVerify(false), jwt.WithValidate(false))
+// Get information out of token, for example, `iss`
+switch token.Issuer() {
+case ...:
+ jws.Verify(signed, jwt.WithKey(...))
+}
+```
+
+* `jwt.WithHeaders` and `jwt.WithJwsHeaders` have been removed.
+ You should be able to use the new `jwt.WithKey` option to pass headers
+
+* `jwt.WithSignOption` and `jwt.WithEncryptOption` have been added as
+ escape hatches for options that are declared in `jws` and `jwe` packages
+ but not in `jwt`
+
+* `jwt.ReadFile` now supports the option `jwt.WithFS` which allows you to
+ read data from arbitrary `fs.FS` objects
+
+* `jwt.Sign()` has been changed so that it works more like the new `jws.Sign()`
+
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/Changes-v3.md b/vendor/github.com/lestrrat-go/jwx/v3/Changes-v3.md
new file mode 100644
index 0000000000..c2fa8747b9
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/Changes-v3.md
@@ -0,0 +1,140 @@
+# Incompatible Changes from v2 to v3
+
+These are changes that are incompatible with the v2.x.x version.
+
+# Detailed list of changes
+
+## Module
+
+* This module now requires Go 1.23
+
+* All `xxx.Get()` methods have been changed from `Get(string) (interface{}, error)` to
+ `Get(string, interface{}) error`, where the second argument should be a pointer
+ to the storage destination of the field.
+
+* All convenience accessors (e.g. `(jwt.Token).Subject`) now return `(T, bool)` instead of
+ `T`. If you want an accessor that returns a single value, consider using `Get()`
+
+* Most major errors can now be differentiated using `errors.Is`
+
+## JWA
+
+* All string constants have been renamed to equivalent functions that return a struct.
+ You should rewrite `jwa.RS256` as `jwa.RS256()` and so forth.
+
+* By default, only known algorithm names are accepted. For example, in our JWK tests,
+ there are tests that deal with "ECMR" algorithm, but this will now fail by default.
+ If you want this algorithm to succeed parsing, you need to call `jwa.RegisterXXXX`
+ functions before using them.
+
+* Previously, unmarshaling unquoted strings used to work (e.g. `var s = "RS256"`),
+ but now they must conform to the JSON standard and be quoted (e.g. `var s = strconv.Quote("RS256")`)
+
+## JWT
+
+* All convenience accessors (e.g. `Subject`) now return `(T, bool)` instead of
+ just `T`. If you want a single return value accessor, use `Get(dst) error` instead.
+
+* Validation used to work for `iat`, `nbf`, `exp` fields where these fields were
+ set to the explicit time.Time{} zero value, but now the _presence_ of these fields matter.
+
+* Validation of fields related to time used to be truncated to one second accuracy,
+ but no longer does so. To restore old behavior, you can either change the global settings by
+ calling `jwt.Settings(jwt.WithTruncation(time.Second))`, or you can
+ change it by each invocation by using `jwt.Validate(..., jwt.WithTruncation(time.Second))`
+
+* Error names have been renamed. For example `jwt.ErrInvalidJWT` has been renamed to
+ `jwt.UnknownPayloadTypeError` to better reflect what the error means. For other errors,
+ `func ErrXXXX()` have generally been renamed to `func XXXError()`
+
+* Validation errors are now wrapped. While `Validate()` returns a `ValidateError()` type,
+ it can also be matched against more specific error types such as `TokenExpierdError()`
+ using `errors.Is`
+
+* `jwt.ErrMissingRequiredClaim` has been removed
+
+## JWS
+
+* Iterators have been completely removed.
+* As a side effect of removing iterators, some methods such as `Copy()` lost the
+ `context.Context` argument
+
+* All convenience accessors (e.g. `Algorithm`) now return `(T, bool)` instead of
+ just `T`. If you want a single return value accessor, use `Get(dst) error` instead.
+
+* Errors from `jws.Sign` and `jws.Verify`, as well as `jws.Parse` (and friends)
+ can now be differentiated by using `errors.Is`. All `jws.IsXXXXError` functions
+ have been removed.
+
+## JWE
+
+* Iterators have been completely removed.
+* As a side effect of removing iterators, some methods such as `Copy()` lost the
+ `context.Context` argument
+
+* All convenience accessors (e.g. `Algorithm`) now return `(T, bool)` instead of
+ just `T`. If you want a single return value accessor, use `Get(dst) error` instead.
+
+* Errors from `jwe.Decrypt` and `jwe.Encrypt`, as well as `jwe.Parse` (and friends)
+ can now be differentiated by using `errors.Is`. All `jwe.IsXXXXrror` functions
+ have been removed.
+
+## JWK
+
+* All convenience accessors (e.g. `Algorithm`, `Crv`) now return `(T, bool)` instead
+ of just `T`, except `KeyType`, which _always_ returns a valid value. If you want a
+ single return value accessor, use `Get(dst) error` instead.
+
+* `jwk.KeyUsageType` can now be configured so that it's possible to assign values
+ other than "sig" and "enc" via `jwk.RegisterKeyUsage()`. Furthermore, strict
+ checks can be turned on/off against these registered values
+
+* `jwk.Cache` has been completely re-worked based on github.com/lestrrat-go/httprc/v3.
+ In particular, the default whitelist mode has changed from "block everything" to
+ "allow everything".
+
+* Experimental secp256k1 encoding/decoding for PEM encoded ASN.1 DER Format
+ has been removed. Instead, `jwk.PEMDecoder` and `jwk.PEMEncoder` have been
+ added to support those who want to perform non-standard PEM encoding/decoding
+
+* Iterators have been completely removed.
+
+* `jwk/x25519` has been removed. To use X25519 keys, use `(crypto/ecdh).PrivateKey` and
+ `(crypto/ecdh).PublicKey`. Similarly, internals have been reworked to use `crypto/ecdh`
+
+* Parsing has completely been reworked. It is now possible to add your own `jwk.KeyParser`
+ to generate a custom `jwk.Key` that this library may not natively support. Also see
+ `jwk.RegisterKeyParser()`
+
+* `jwk.KeyProbe` has been added to aid probing the JSON message. This is used to
+ guess the type of key described in the JSON message before deciding which concrete
+ type to instantiate, and aids implementing your own `jwk.KeyParser`. Also see
+ `jwk.RegisterKeyProbe()`
+
+* Conversion between raw keys and `jwk.Key` can be customized using `jwk.KeyImporter` and `jwk.KeyExporter`.
+ Also see `jwk.RegisterKeyImporter()` and `jwk.RegisterKeyExporter()`
+
+* Added `jwk/ecdsa` to keep track of which curves are available for ECDSA keys.
+
+* `(jwk.Key).Raw()` has been deprecated. Use `jwk.Export()` instead to convert `jwk.Key`
+ objects into their "raw" versions (e.g. `*rsa.PrivateKey`, `*ecdsa.PrivateKey`, etc).
+ This is to allow third parties to register custom key types that this library does not
+ natively support: Whereas a method must be bound to an object, and thus does not necessarily
+ have a way to hook into a global settings (i.e. custom exporter/importer) for arbitrary
+ key types, if the entrypoint is a function it's much easier and cleaner to for third-parties
+ to take advantage and hook into the mechanisms.
+
+* `jwk.FromRaw()` has been derepcated. Use `jwk.Import()` instead to convert "raw"
+ keys (e.g. `*rsa.PrivateKEy`, `*Ecdsa.PrivateKey`, etc) int `jwk.Key`s.
+
+* `(jwk.Key).FromRaw()` has been deprecated. The method `(jwk.Key).Import()` still exist for
+ built-in types, but it is no longer part of any public API (`interface{}`).
+
+* `jwk.Fetch` is marked as a simple wrapper around `net/http` and `jwk.Parse`.
+
+* `jwk.SetGlobalFetcher` has been deprecated.
+
+* `jwk.Fetcher` has been clearly marked as something that has limited
+ usage for `jws.WithVerifyAuto`
+
+* `jwk.Key` with P256/P386/P521 curves can be exporrted to `ecdh.PrivateKey`/`ecdh.PublicKey`
\ No newline at end of file
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/LICENSE b/vendor/github.com/lestrrat-go/jwx/v3/LICENSE
new file mode 100644
index 0000000000..205e33a7f1
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 lestrrat
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/MODULE.bazel b/vendor/github.com/lestrrat-go/jwx/v3/MODULE.bazel
new file mode 100644
index 0000000000..c9bdc9b730
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/MODULE.bazel
@@ -0,0 +1,34 @@
+module(
+ name = "com_github_lestrrat_go_jwx_v3",
+ version = "3.0.0",
+ repo_name = "com_github_lestrrat_go_jwx_v2",
+)
+
+bazel_dep(name = "bazel_skylib", version = "1.7.1")
+bazel_dep(name = "rules_go", version = "0.55.1")
+bazel_dep(name = "gazelle", version = "0.44.0")
+bazel_dep(name = "aspect_bazel_lib", version = "2.11.0")
+
+# Go SDK setup from go.mod
+go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
+go_sdk.from_file(go_mod = "//:go.mod")
+
+# Go dependencies from go.mod
+go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
+go_deps.from_file(go_mod = "//:go.mod")
+
+# Use repositories for external Go dependencies
+use_repo(
+ go_deps,
+ "com_github_decred_dcrd_dcrec_secp256k1_v4",
+ "com_github_goccy_go_json",
+ "com_github_lestrrat_go_blackmagic",
+ "com_github_lestrrat_go_dsig",
+ "com_github_lestrrat_go_dsig_secp256k1",
+ "com_github_lestrrat_go_httprc_v3",
+ "com_github_lestrrat_go_option_v2",
+ "com_github_segmentio_asm",
+ "com_github_stretchr_testify",
+ "com_github_valyala_fastjson",
+ "org_golang_x_crypto",
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/MODULE.bazel.lock b/vendor/github.com/lestrrat-go/jwx/v3/MODULE.bazel.lock
new file mode 100644
index 0000000000..2848e8716d
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/MODULE.bazel.lock
@@ -0,0 +1,230 @@
+{
+ "lockFileVersion": 18,
+ "registryFileHashes": {
+ "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497",
+ "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2",
+ "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/MODULE.bazel": "70390338f7a5106231d20620712f7cccb659cd0e9d073d1991c038eb9fc57589",
+ "https://bcr.bazel.build/modules/abseil-cpp/20230125.1/MODULE.bazel": "89047429cb0207707b2dface14ba7f8df85273d484c2572755be4bab7ce9c3a0",
+ "https://bcr.bazel.build/modules/abseil-cpp/20230802.0.bcr.1/MODULE.bazel": "1c8cec495288dccd14fdae6e3f95f772c1c91857047a098fad772034264cc8cb",
+ "https://bcr.bazel.build/modules/abseil-cpp/20230802.0/MODULE.bazel": "d253ae36a8bd9ee3c5955384096ccb6baf16a1b1e93e858370da0a3b94f77c16",
+ "https://bcr.bazel.build/modules/abseil-cpp/20230802.1/MODULE.bazel": "fa92e2eb41a04df73cdabeec37107316f7e5272650f81d6cc096418fe647b915",
+ "https://bcr.bazel.build/modules/abseil-cpp/20240116.1/MODULE.bazel": "37bcdb4440fbb61df6a1c296ae01b327f19e9bb521f9b8e26ec854b6f97309ed",
+ "https://bcr.bazel.build/modules/abseil-cpp/20240116.1/source.json": "9be551b8d4e3ef76875c0d744b5d6a504a27e3ae67bc6b28f46415fd2d2957da",
+ "https://bcr.bazel.build/modules/aspect_bazel_lib/2.11.0/MODULE.bazel": "cb1ba9f9999ed0bc08600c221f532c1ddd8d217686b32ba7d45b0713b5131452",
+ "https://bcr.bazel.build/modules/aspect_bazel_lib/2.11.0/source.json": "92494d5aa43b96665397dd13ee16023097470fa85e276b93674d62a244de47ee",
+ "https://bcr.bazel.build/modules/bazel_features/1.1.0/MODULE.bazel": "cfd42ff3b815a5f39554d97182657f8c4b9719568eb7fded2b9135f084bf760b",
+ "https://bcr.bazel.build/modules/bazel_features/1.1.1/MODULE.bazel": "27b8c79ef57efe08efccbd9dd6ef70d61b4798320b8d3c134fd571f78963dbcd",
+ "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8",
+ "https://bcr.bazel.build/modules/bazel_features/1.15.0/MODULE.bazel": "d38ff6e517149dc509406aca0db3ad1efdd890a85e049585b7234d04238e2a4d",
+ "https://bcr.bazel.build/modules/bazel_features/1.17.0/MODULE.bazel": "039de32d21b816b47bd42c778e0454217e9c9caac4a3cf8e15c7231ee3ddee4d",
+ "https://bcr.bazel.build/modules/bazel_features/1.18.0/MODULE.bazel": "1be0ae2557ab3a72a57aeb31b29be347bcdc5d2b1eb1e70f39e3851a7e97041a",
+ "https://bcr.bazel.build/modules/bazel_features/1.19.0/MODULE.bazel": "59adcdf28230d220f0067b1f435b8537dd033bfff8db21335ef9217919c7fb58",
+ "https://bcr.bazel.build/modules/bazel_features/1.30.0/MODULE.bazel": "a14b62d05969a293b80257e72e597c2da7f717e1e69fa8b339703ed6731bec87",
+ "https://bcr.bazel.build/modules/bazel_features/1.30.0/source.json": "b07e17f067fe4f69f90b03b36ef1e08fe0d1f3cac254c1241a1818773e3423bc",
+ "https://bcr.bazel.build/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7",
+ "https://bcr.bazel.build/modules/bazel_features/1.9.0/MODULE.bazel": "885151d58d90d8d9c811eb75e3288c11f850e1d6b481a8c9f766adee4712358b",
+ "https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.1.1/MODULE.bazel": "1add3e7d93ff2e6998f9e118022c84d163917d912f5afafb3058e3d2f1545b5e",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.2.0/MODULE.bazel": "44fe84260e454ed94ad326352a698422dbe372b21a1ac9f3eab76eb531223686",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.4.1/MODULE.bazel": "a0dcb779424be33100dcae821e9e27e4f2901d9dfd5333efe5ac6a8d7ab75e1d",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.4.2/MODULE.bazel": "3bd40978e7a1fac911d5989e6b09d8f64921865a45822d8b09e815eaa726a651",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.5.0/MODULE.bazel": "32880f5e2945ce6a03d1fbd588e9198c0a959bb42297b2cfaf1685b7bc32e138",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.7.0/MODULE.bazel": "0db596f4563de7938de764cc8deeabec291f55e8ec15299718b93c4423e9796d",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/MODULE.bazel": "3120d80c5861aa616222ec015332e5f8d3171e062e3e804a2a0253e1be26e59b",
+ "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/source.json": "f121b43eeefc7c29efbd51b83d08631e2347297c95aac9764a701f2a6a2bb953",
+ "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84",
+ "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8",
+ "https://bcr.bazel.build/modules/gazelle/0.32.0/MODULE.bazel": "b499f58a5d0d3537f3cf5b76d8ada18242f64ec474d8391247438bf04f58c7b8",
+ "https://bcr.bazel.build/modules/gazelle/0.33.0/MODULE.bazel": "a13a0f279b462b784fb8dd52a4074526c4a2afe70e114c7d09066097a46b3350",
+ "https://bcr.bazel.build/modules/gazelle/0.34.0/MODULE.bazel": "abdd8ce4d70978933209db92e436deb3a8b737859e9354fb5fd11fb5c2004c8a",
+ "https://bcr.bazel.build/modules/gazelle/0.36.0/MODULE.bazel": "e375d5d6e9a6ca59b0cb38b0540bc9a05b6aa926d322f2de268ad267a2ee74c0",
+ "https://bcr.bazel.build/modules/gazelle/0.44.0/MODULE.bazel": "fd3177ca0938da57a1e416cad3f39b9c4334defbc717e89aba9d9ddbbb0341da",
+ "https://bcr.bazel.build/modules/gazelle/0.44.0/source.json": "7fb65ef9c1ce470d099ca27fd478673d9d64c844af28d0d472b0874c7d590cb6",
+ "https://bcr.bazel.build/modules/google_benchmark/1.8.2/MODULE.bazel": "a70cf1bba851000ba93b58ae2f6d76490a9feb74192e57ab8e8ff13c34ec50cb",
+ "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4",
+ "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/MODULE.bazel": "22c31a561553727960057361aa33bf20fb2e98584bc4fec007906e27053f80c6",
+ "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/source.json": "41e9e129f80d8c8bf103a7acc337b76e54fad1214ac0a7084bf24f4cd924b8b4",
+ "https://bcr.bazel.build/modules/googletest/1.14.0/MODULE.bazel": "cfbcbf3e6eac06ef9d85900f64424708cc08687d1b527f0ef65aa7517af8118f",
+ "https://bcr.bazel.build/modules/jsoncpp/1.9.5/MODULE.bazel": "31271aedc59e815656f5736f282bb7509a97c7ecb43e927ac1a37966e0578075",
+ "https://bcr.bazel.build/modules/jsoncpp/1.9.5/source.json": "4108ee5085dd2885a341c7fab149429db457b3169b86eb081fa245eadf69169d",
+ "https://bcr.bazel.build/modules/libpfm/4.11.0/MODULE.bazel": "45061ff025b301940f1e30d2c16bea596c25b176c8b6b3087e92615adbd52902",
+ "https://bcr.bazel.build/modules/package_metadata/0.0.2/MODULE.bazel": "fb8d25550742674d63d7b250063d4580ca530499f045d70748b1b142081ebb92",
+ "https://bcr.bazel.build/modules/package_metadata/0.0.2/source.json": "e53a759a72488d2c0576f57491ef2da0cf4aab05ac0997314012495935531b73",
+ "https://bcr.bazel.build/modules/platforms/0.0.10/MODULE.bazel": "8cb8efaf200bdeb2150d93e162c40f388529a25852b332cec879373771e48ed5",
+ "https://bcr.bazel.build/modules/platforms/0.0.11/MODULE.bazel": "0daefc49732e227caa8bfa834d65dc52e8cc18a2faf80df25e8caea151a9413f",
+ "https://bcr.bazel.build/modules/platforms/0.0.11/source.json": "f7e188b79ebedebfe75e9e1d098b8845226c7992b307e28e1496f23112e8fc29",
+ "https://bcr.bazel.build/modules/platforms/0.0.4/MODULE.bazel": "9b328e31ee156f53f3c416a64f8491f7eb731742655a47c9eec4703a71644aee",
+ "https://bcr.bazel.build/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37",
+ "https://bcr.bazel.build/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615",
+ "https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814",
+ "https://bcr.bazel.build/modules/platforms/0.0.8/MODULE.bazel": "9f142c03e348f6d263719f5074b21ef3adf0b139ee4c5133e2aa35664da9eb2d",
+ "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7",
+ "https://bcr.bazel.build/modules/protobuf/27.0/MODULE.bazel": "7873b60be88844a0a1d8f80b9d5d20cfbd8495a689b8763e76c6372998d3f64c",
+ "https://bcr.bazel.build/modules/protobuf/27.1/MODULE.bazel": "703a7b614728bb06647f965264967a8ef1c39e09e8f167b3ca0bb1fd80449c0d",
+ "https://bcr.bazel.build/modules/protobuf/29.0-rc2.bcr.1/MODULE.bazel": "52f4126f63a2f0bbf36b99c2a87648f08467a4eaf92ba726bc7d6a500bbf770c",
+ "https://bcr.bazel.build/modules/protobuf/29.0-rc2/MODULE.bazel": "6241d35983510143049943fc0d57937937122baf1b287862f9dc8590fc4c37df",
+ "https://bcr.bazel.build/modules/protobuf/29.0/MODULE.bazel": "319dc8bf4c679ff87e71b1ccfb5a6e90a6dbc4693501d471f48662ac46d04e4e",
+ "https://bcr.bazel.build/modules/protobuf/29.0/source.json": "b857f93c796750eef95f0d61ee378f3420d00ee1dd38627b27193aa482f4f981",
+ "https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0",
+ "https://bcr.bazel.build/modules/protobuf/3.19.2/MODULE.bazel": "532ffe5f2186b69fdde039efe6df13ba726ff338c6bc82275ad433013fa10573",
+ "https://bcr.bazel.build/modules/protobuf/3.19.6/MODULE.bazel": "9233edc5e1f2ee276a60de3eaa47ac4132302ef9643238f23128fea53ea12858",
+ "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/MODULE.bazel": "88af1c246226d87e65be78ed49ecd1e6f5e98648558c14ce99176da041dc378e",
+ "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/source.json": "be4789e951dd5301282729fe3d4938995dc4c1a81c2ff150afc9f1b0504c6022",
+ "https://bcr.bazel.build/modules/re2/2023-09-01/MODULE.bazel": "cb3d511531b16cfc78a225a9e2136007a48cf8a677e4264baeab57fe78a80206",
+ "https://bcr.bazel.build/modules/re2/2023-09-01/source.json": "e044ce89c2883cd957a2969a43e79f7752f9656f6b20050b62f90ede21ec6eb4",
+ "https://bcr.bazel.build/modules/rules_android/0.1.1/MODULE.bazel": "48809ab0091b07ad0182defb787c4c5328bd3a278938415c00a7b69b50c4d3a8",
+ "https://bcr.bazel.build/modules/rules_android/0.1.1/source.json": "e6986b41626ee10bdc864937ffb6d6bf275bb5b9c65120e6137d56e6331f089e",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.10/MODULE.bazel": "ec1705118f7eaedd6e118508d3d26deba2a4e76476ada7e0e3965211be012002",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.13/MODULE.bazel": "0e8529ed7b323dad0775ff924d2ae5af7640b23553dfcd4d34344c7e7a867191",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.14/MODULE.bazel": "5e343a3aac88b8d7af3b1b6d2093b55c347b8eefc2e7d1442f7a02dc8fea48ac",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.15/MODULE.bazel": "6704c35f7b4a72502ee81f61bf88706b54f06b3cbe5558ac17e2e14666cd5dcc",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.16/MODULE.bazel": "7661303b8fc1b4d7f532e54e9d6565771fea666fbdf839e0a86affcd02defe87",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.6/MODULE.bazel": "abf360251023dfe3efcef65ab9d56beefa8394d4176dd29529750e1c57eaa33f",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e",
+ "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5",
+ "https://bcr.bazel.build/modules/rules_cc/0.1.1/MODULE.bazel": "2f0222a6f229f0bf44cd711dc13c858dad98c62d52bd51d8fc3a764a83125513",
+ "https://bcr.bazel.build/modules/rules_cc/0.1.1/source.json": "d61627377bd7dd1da4652063e368d9366fc9a73920bfa396798ad92172cf645c",
+ "https://bcr.bazel.build/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6",
+ "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8",
+ "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/source.json": "c8b1e2c717646f1702290959a3302a178fb639d987ab61d548105019f11e527e",
+ "https://bcr.bazel.build/modules/rules_go/0.41.0/MODULE.bazel": "55861d8e8bb0e62cbd2896f60ff303f62ffcb0eddb74ecb0e5c0cbe36fc292c8",
+ "https://bcr.bazel.build/modules/rules_go/0.42.0/MODULE.bazel": "8cfa875b9aa8c6fce2b2e5925e73c1388173ea3c32a0db4d2b4804b453c14270",
+ "https://bcr.bazel.build/modules/rules_go/0.46.0/MODULE.bazel": "3477df8bdcc49e698b9d25f734c4f3a9f5931ff34ee48a2c662be168f5f2d3fd",
+ "https://bcr.bazel.build/modules/rules_go/0.51.0/MODULE.bazel": "b6920f505935bfd69381651c942496d99b16e2a12f3dd5263b90ded16f3b4d0f",
+ "https://bcr.bazel.build/modules/rules_go/0.55.1/MODULE.bazel": "a57a6fc59a74326c0b440d07cca209edf13c7d1a641e48cfbeab56e79f873609",
+ "https://bcr.bazel.build/modules/rules_go/0.55.1/source.json": "827a740c8959c9d20616889e7746cde4dcc6ee80d25146943627ccea0736328f",
+ "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74",
+ "https://bcr.bazel.build/modules/rules_java/5.3.5/MODULE.bazel": "a4ec4f2db570171e3e5eb753276ee4b389bae16b96207e9d3230895c99644b86",
+ "https://bcr.bazel.build/modules/rules_java/6.0.0/MODULE.bazel": "8a43b7df601a7ec1af61d79345c17b31ea1fedc6711fd4abfd013ea612978e39",
+ "https://bcr.bazel.build/modules/rules_java/6.3.0/MODULE.bazel": "a97c7678c19f236a956ad260d59c86e10a463badb7eb2eda787490f4c969b963",
+ "https://bcr.bazel.build/modules/rules_java/6.4.0/MODULE.bazel": "e986a9fe25aeaa84ac17ca093ef13a4637f6107375f64667a15999f77db6c8f6",
+ "https://bcr.bazel.build/modules/rules_java/6.5.2/MODULE.bazel": "1d440d262d0e08453fa0c4d8f699ba81609ed0e9a9a0f02cd10b3e7942e61e31",
+ "https://bcr.bazel.build/modules/rules_java/7.10.0/MODULE.bazel": "530c3beb3067e870561739f1144329a21c851ff771cd752a49e06e3dc9c2e71a",
+ "https://bcr.bazel.build/modules/rules_java/7.12.2/MODULE.bazel": "579c505165ee757a4280ef83cda0150eea193eed3bef50b1004ba88b99da6de6",
+ "https://bcr.bazel.build/modules/rules_java/7.2.0/MODULE.bazel": "06c0334c9be61e6cef2c8c84a7800cef502063269a5af25ceb100b192453d4ab",
+ "https://bcr.bazel.build/modules/rules_java/7.3.2/MODULE.bazel": "50dece891cfdf1741ea230d001aa9c14398062f2b7c066470accace78e412bc2",
+ "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe",
+ "https://bcr.bazel.build/modules/rules_java/8.12.0/MODULE.bazel": "8e6590b961f2defdfc2811c089c75716cb2f06c8a4edeb9a8d85eaa64ee2a761",
+ "https://bcr.bazel.build/modules/rules_java/8.12.0/source.json": "cbd5d55d9d38d4008a7d00bee5b5a5a4b6031fcd4a56515c9accbcd42c7be2ba",
+ "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7",
+ "https://bcr.bazel.build/modules/rules_jvm_external/5.1/MODULE.bazel": "33f6f999e03183f7d088c9be518a63467dfd0be94a11d0055fe2d210f89aa909",
+ "https://bcr.bazel.build/modules/rules_jvm_external/5.2/MODULE.bazel": "d9351ba35217ad0de03816ef3ed63f89d411349353077348a45348b096615036",
+ "https://bcr.bazel.build/modules/rules_jvm_external/5.3/MODULE.bazel": "bf93870767689637164657731849fb887ad086739bd5d360d90007a581d5527d",
+ "https://bcr.bazel.build/modules/rules_jvm_external/6.1/MODULE.bazel": "75b5fec090dbd46cf9b7d8ea08cf84a0472d92ba3585b476f44c326eda8059c4",
+ "https://bcr.bazel.build/modules/rules_jvm_external/6.3/MODULE.bazel": "c998e060b85f71e00de5ec552019347c8bca255062c990ac02d051bb80a38df0",
+ "https://bcr.bazel.build/modules/rules_jvm_external/6.3/source.json": "6f5f5a5a4419ae4e37c35a5bb0a6ae657ed40b7abc5a5189111b47fcebe43197",
+ "https://bcr.bazel.build/modules/rules_kotlin/1.9.0/MODULE.bazel": "ef85697305025e5a61f395d4eaede272a5393cee479ace6686dba707de804d59",
+ "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/MODULE.bazel": "d269a01a18ee74d0335450b10f62c9ed81f2321d7958a2934e44272fe82dcef3",
+ "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/source.json": "2faa4794364282db7c06600b7e5e34867a564ae91bda7cae7c29c64e9466b7d5",
+ "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0",
+ "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d",
+ "https://bcr.bazel.build/modules/rules_license/1.0.0/MODULE.bazel": "a7fda60eefdf3d8c827262ba499957e4df06f659330bbe6cdbdb975b768bb65c",
+ "https://bcr.bazel.build/modules/rules_license/1.0.0/source.json": "a52c89e54cc311196e478f8382df91c15f7a2bfdf4c6cd0e2675cc2ff0b56efb",
+ "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc",
+ "https://bcr.bazel.build/modules/rules_pkg/1.0.1/MODULE.bazel": "5b1df97dbc29623bccdf2b0dcd0f5cb08e2f2c9050aab1092fd39a41e82686ff",
+ "https://bcr.bazel.build/modules/rules_pkg/1.0.1/source.json": "bd82e5d7b9ce2d31e380dd9f50c111d678c3bdaca190cb76b0e1c71b05e1ba8a",
+ "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06",
+ "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7",
+ "https://bcr.bazel.build/modules/rules_proto/6.0.0/MODULE.bazel": "b531d7f09f58dce456cd61b4579ce8c86b38544da75184eadaf0a7cb7966453f",
+ "https://bcr.bazel.build/modules/rules_proto/6.0.2/MODULE.bazel": "ce916b775a62b90b61888052a416ccdda405212b6aaeb39522f7dc53431a5e73",
+ "https://bcr.bazel.build/modules/rules_proto/7.0.2/MODULE.bazel": "bf81793bd6d2ad89a37a40693e56c61b0ee30f7a7fdbaf3eabbf5f39de47dea2",
+ "https://bcr.bazel.build/modules/rules_proto/7.0.2/source.json": "1e5e7260ae32ef4f2b52fd1d0de8d03b606a44c91b694d2f1afb1d3b28a48ce1",
+ "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f",
+ "https://bcr.bazel.build/modules/rules_python/0.23.1/MODULE.bazel": "49ffccf0511cb8414de28321f5fcf2a31312b47c40cc21577144b7447f2bf300",
+ "https://bcr.bazel.build/modules/rules_python/0.25.0/MODULE.bazel": "72f1506841c920a1afec76975b35312410eea3aa7b63267436bfb1dd91d2d382",
+ "https://bcr.bazel.build/modules/rules_python/0.28.0/MODULE.bazel": "cba2573d870babc976664a912539b320cbaa7114cd3e8f053c720171cde331ed",
+ "https://bcr.bazel.build/modules/rules_python/0.31.0/MODULE.bazel": "93a43dc47ee570e6ec9f5779b2e64c1476a6ce921c48cc9a1678a91dd5f8fd58",
+ "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c",
+ "https://bcr.bazel.build/modules/rules_python/0.40.0/MODULE.bazel": "9d1a3cd88ed7d8e39583d9ffe56ae8a244f67783ae89b60caafc9f5cf318ada7",
+ "https://bcr.bazel.build/modules/rules_python/0.40.0/source.json": "939d4bd2e3110f27bfb360292986bb79fd8dcefb874358ccd6cdaa7bda029320",
+ "https://bcr.bazel.build/modules/rules_shell/0.2.0/MODULE.bazel": "fda8a652ab3c7d8fee214de05e7a9916d8b28082234e8d2c0094505c5268ed3c",
+ "https://bcr.bazel.build/modules/rules_shell/0.3.0/MODULE.bazel": "de4402cd12f4cc8fda2354fce179fdb068c0b9ca1ec2d2b17b3e21b24c1a937b",
+ "https://bcr.bazel.build/modules/rules_shell/0.3.0/source.json": "c55ed591aa5009401ddf80ded9762ac32c358d2517ee7820be981e2de9756cf3",
+ "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8",
+ "https://bcr.bazel.build/modules/stardoc/0.5.3/MODULE.bazel": "c7f6948dae6999bf0db32c1858ae345f112cacf98f174c7a8bb707e41b974f1c",
+ "https://bcr.bazel.build/modules/stardoc/0.5.6/MODULE.bazel": "c43dabc564990eeab55e25ed61c07a1aadafe9ece96a4efabb3f8bf9063b71ef",
+ "https://bcr.bazel.build/modules/stardoc/0.6.2/MODULE.bazel": "7060193196395f5dd668eda046ccbeacebfd98efc77fed418dbe2b82ffaa39fd",
+ "https://bcr.bazel.build/modules/stardoc/0.7.0/MODULE.bazel": "05e3d6d30c099b6770e97da986c53bd31844d7f13d41412480ea265ac9e8079c",
+ "https://bcr.bazel.build/modules/stardoc/0.7.1/MODULE.bazel": "3548faea4ee5dda5580f9af150e79d0f6aea934fc60c1cc50f4efdd9420759e7",
+ "https://bcr.bazel.build/modules/stardoc/0.7.1/source.json": "b6500ffcd7b48cd72c29bb67bcac781e12701cc0d6d55d266a652583cfcdab01",
+ "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43",
+ "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0",
+ "https://bcr.bazel.build/modules/zlib/1.2.12/MODULE.bazel": "3b1a8834ada2a883674be8cbd36ede1b6ec481477ada359cd2d3ddc562340b27",
+ "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/MODULE.bazel": "eec517b5bbe5492629466e11dae908d043364302283de25581e3eb944326c4ca",
+ "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/source.json": "22bc55c47af97246cfc093d0acf683a7869377de362b5d1c552c2c2e16b7a806",
+ "https://bcr.bazel.build/modules/zlib/1.3.1/MODULE.bazel": "751c9940dcfe869f5f7274e1295422a34623555916eb98c174c1e945594bf198"
+ },
+ "selectedYankedVersions": {},
+ "moduleExtensions": {
+ "@@rules_kotlin+//src/main/starlark/core/repositories:bzlmod_setup.bzl%rules_kotlin_extensions": {
+ "general": {
+ "bzlTransitiveDigest": "hUTp2w+RUVdL7ma5esCXZJAFnX7vLbVfLd7FwnQI6bU=",
+ "usagesDigest": "QI2z8ZUR+mqtbwsf2fLqYdJAkPOHdOV+tF2yVAUgRzw=",
+ "recordedFileInputs": {},
+ "recordedDirentsInputs": {},
+ "envVariables": {},
+ "generatedRepoSpecs": {
+ "com_github_jetbrains_kotlin_git": {
+ "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_compiler_git_repository",
+ "attributes": {
+ "urls": [
+ "https://github.com/JetBrains/kotlin/releases/download/v1.9.23/kotlin-compiler-1.9.23.zip"
+ ],
+ "sha256": "93137d3aab9afa9b27cb06a824c2324195c6b6f6179d8a8653f440f5bd58be88"
+ }
+ },
+ "com_github_jetbrains_kotlin": {
+ "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_capabilities_repository",
+ "attributes": {
+ "git_repository_name": "com_github_jetbrains_kotlin_git",
+ "compiler_version": "1.9.23"
+ }
+ },
+ "com_github_google_ksp": {
+ "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:ksp.bzl%ksp_compiler_plugin_repository",
+ "attributes": {
+ "urls": [
+ "https://github.com/google/ksp/releases/download/1.9.23-1.0.20/artifacts.zip"
+ ],
+ "sha256": "ee0618755913ef7fd6511288a232e8fad24838b9af6ea73972a76e81053c8c2d",
+ "strip_version": "1.9.23-1.0.20"
+ }
+ },
+ "com_github_pinterest_ktlint": {
+ "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file",
+ "attributes": {
+ "sha256": "01b2e0ef893383a50dbeb13970fe7fa3be36ca3e83259e01649945b09d736985",
+ "urls": [
+ "https://github.com/pinterest/ktlint/releases/download/1.3.0/ktlint"
+ ],
+ "executable": true
+ }
+ },
+ "rules_android": {
+ "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive",
+ "attributes": {
+ "sha256": "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806",
+ "strip_prefix": "rules_android-0.1.1",
+ "urls": [
+ "https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip"
+ ]
+ }
+ }
+ },
+ "recordedRepoMappingEntries": [
+ [
+ "rules_kotlin+",
+ "bazel_tools",
+ "bazel_tools"
+ ]
+ ]
+ }
+ }
+ }
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/Makefile b/vendor/github.com/lestrrat-go/jwx/v3/Makefile
new file mode 100644
index 0000000000..672c007b29
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/Makefile
@@ -0,0 +1,98 @@
+.PHONY: generate realclean cover viewcover test lint check_diffs imports tidy jwx
+generate:
+ @go generate
+ @$(MAKE) generate-jwa generate-jwe generate-jwk generate-jws generate-jwt
+ @./tools/cmd/gofmt.sh
+
+generate-%:
+ @go generate $(shell pwd -P)/$(patsubst generate-%,%,$@)
+
+realclean:
+ rm coverage.out
+
+test-cmd:
+ env TESTOPTS="$(TESTOPTS)" ./tools/test.sh
+
+test:
+ $(MAKE) test-stdlib TESTOPTS=
+
+test-stdlib:
+ $(MAKE) test-cmd TESTOPTS=
+
+test-goccy:
+ $(MAKE) test-cmd TESTOPTS="-tags jwx_goccy"
+
+test-es256k:
+ $(MAKE) test-cmd TESTOPTS="-tags jwx_es256k"
+
+test-secp256k1-pem:
+ $(MAKE) test-cmd TESTOPTS="-tags jwx_es256k,jwx_secp256k1_pem"
+
+test-asmbase64:
+ $(MAKE) test-cmd TESTOPTS="-tags jwx_asmbase64"
+
+test-alltags:
+ $(MAKE) test-cmd TESTOPTS="-tags jwx_asmbase64,jwx_goccy,jwx_es256k,jwx_secp256k1_pem"
+
+cover-cmd:
+ env MODE=cover ./tools/test.sh
+
+cover:
+ $(MAKE) cover-stdlib
+
+cover-stdlib:
+ $(MAKE) cover-cmd TESTOPTS=
+
+cover-goccy:
+ $(MAKE) cover-cmd TESTOPTS="-tags jwx_goccy"
+
+cover-es256k:
+ $(MAKE) cover-cmd TESTOPTS="-tags jwx_es256k"
+
+cover-secp256k1-pem:
+ $(MAKE) cover-cmd TESTOPTS="-tags jwx_es256k,jwx_secp256k1"
+
+cover-asmbase64:
+ $(MAKE) cover-cmd TESTOPTS="-tags jwx_asmbase64"
+
+cover-alltags:
+ $(MAKE) cover-cmd TESTOPTS="-tags jwx_asmbase64,jwx_goccy,jwx_es256k,jwx_secp256k1_pem"
+
+smoke-cmd:
+ env MODE=short ./tools/test.sh
+
+smoke:
+ $(MAKE) smoke-stdlib
+
+smoke-stdlib:
+ $(MAKE) smoke-cmd TESTOPTS=
+
+smoke-goccy:
+ $(MAKE) smoke-cmd TESTOPTS="-tags jwx_goccy"
+
+smoke-es256k:
+ $(MAKE) smoke-cmd TESTOPTS="-tags jwx_es256k"
+
+smoke-secp256k1-pem:
+ $(MAKE) smoke-cmd TESTOPTS="-tags jwx_es256k,jwx_secp256k1_pem"
+
+smoke-alltags:
+ $(MAKE) smoke-cmd TESTOPTS="-tags jwx_goccy,jwx_es256k,jwx_secp256k1_pem"
+
+viewcover:
+ go tool cover -html=coverage.out
+
+lint:
+ golangci-lint run ./...
+
+check_diffs:
+ ./scripts/check-diff.sh
+
+imports:
+ goimports -w ./
+
+tidy:
+ ./scripts/tidy.sh
+
+jwx:
+ @./tools/cmd/install-jwx.sh
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/README.md b/vendor/github.com/lestrrat-go/jwx/v3/README.md
new file mode 100644
index 0000000000..632033f3cb
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/README.md
@@ -0,0 +1,263 @@
+# github.com/lestrrat-go/jwx/v3 [](https://github.com/lestrrat-go/jwx/actions/workflows/ci.yml) [](https://pkg.go.dev/github.com/lestrrat-go/jwx/v3) [](https://codecov.io/github/lestrrat-go/jwx?branch=v3)
+
+Go module implementing various JWx (JWA/JWE/JWK/JWS/JWT, otherwise known as JOSE) technologies.
+
+If you are using this module in your product or your company, please add your product and/or company name in the [Wiki](https://github.com/lestrrat-go/jwx/wiki/Users)! It really helps keeping up our motivation.
+
+# Features
+
+* Complete coverage of JWA/JWE/JWK/JWS/JWT, not just JWT+minimum tool set.
+ * Supports JWS messages with multiple signatures, both compact and JSON serialization
+ * Supports JWS with detached payload
+ * Supports JWS with unencoded payload (RFC7797)
+ * Supports JWE messages with multiple recipients, both compact and JSON serialization
+ * Most operations work with either JWK or raw keys e.g. *rsa.PrivateKey, *ecdsa.PrivateKey, etc).
+* Opinionated, but very uniform API. Everything is symmetric, and follows a standard convention
+ * jws.Parse/Verify/Sign
+ * jwe.Parse/Encrypt/Decrypt
+ * Arguments are organized as explicit required parameters and optional WithXXXX() style options.
+* Extra utilities
+ * `jwk.Cache` to always keep a JWKS up-to-date
+ * [bazel](https://bazel.build)-ready
+
+Some more in-depth discussion on why you might want to use this library over others
+can be found in the [Description section](#description)
+
+If you are using v0 or v1, you are strongly encouraged to migrate to using v3
+(the version that comes with the README you are reading).
+
+# SYNOPSIS
+
+
+```go
+package examples_test
+
+import (
+ "bytes"
+ "fmt"
+ "net/http"
+ "time"
+
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwe"
+ "github.com/lestrrat-go/jwx/v3/jwk"
+ "github.com/lestrrat-go/jwx/v3/jws"
+ "github.com/lestrrat-go/jwx/v3/jwt"
+)
+
+func Example() {
+ // Parse, serialize, slice and dice JWKs!
+ privkey, err := jwk.ParseKey(jsonRSAPrivateKey)
+ if err != nil {
+ fmt.Printf("failed to parse JWK: %s\n", err)
+ return
+ }
+
+ pubkey, err := jwk.PublicKeyOf(privkey)
+ if err != nil {
+ fmt.Printf("failed to get public key: %s\n", err)
+ return
+ }
+
+ // Work with JWTs!
+ {
+ // Build a JWT!
+ tok, err := jwt.NewBuilder().
+ Issuer(`github.com/lestrrat-go/jwx`).
+ IssuedAt(time.Now()).
+ Build()
+ if err != nil {
+ fmt.Printf("failed to build token: %s\n", err)
+ return
+ }
+
+ // Sign a JWT!
+ signed, err := jwt.Sign(tok, jwt.WithKey(jwa.RS256(), privkey))
+ if err != nil {
+ fmt.Printf("failed to sign token: %s\n", err)
+ return
+ }
+
+ // Verify a JWT!
+ {
+ verifiedToken, err := jwt.Parse(signed, jwt.WithKey(jwa.RS256(), pubkey))
+ if err != nil {
+ fmt.Printf("failed to verify JWS: %s\n", err)
+ return
+ }
+ _ = verifiedToken
+ }
+
+ // Work with *http.Request!
+ {
+ req, err := http.NewRequest(http.MethodGet, `https://github.com/lestrrat-go/jwx`, nil)
+ req.Header.Set(`Authorization`, fmt.Sprintf(`Bearer %s`, signed))
+
+ verifiedToken, err := jwt.ParseRequest(req, jwt.WithKey(jwa.RS256(), pubkey))
+ if err != nil {
+ fmt.Printf("failed to verify token from HTTP request: %s\n", err)
+ return
+ }
+ _ = verifiedToken
+ }
+ }
+
+ // Encrypt and Decrypt arbitrary payload with JWE!
+ {
+ encrypted, err := jwe.Encrypt(payloadLoremIpsum, jwe.WithKey(jwa.RSA_OAEP(), jwkRSAPublicKey))
+ if err != nil {
+ fmt.Printf("failed to encrypt payload: %s\n", err)
+ return
+ }
+
+ decrypted, err := jwe.Decrypt(encrypted, jwe.WithKey(jwa.RSA_OAEP(), jwkRSAPrivateKey))
+ if err != nil {
+ fmt.Printf("failed to decrypt payload: %s\n", err)
+ return
+ }
+
+ if !bytes.Equal(decrypted, payloadLoremIpsum) {
+ fmt.Printf("verified payload did not match\n")
+ return
+ }
+ }
+
+ // Sign and Verify arbitrary payload with JWS!
+ {
+ signed, err := jws.Sign(payloadLoremIpsum, jws.WithKey(jwa.RS256(), jwkRSAPrivateKey))
+ if err != nil {
+ fmt.Printf("failed to sign payload: %s\n", err)
+ return
+ }
+
+ verified, err := jws.Verify(signed, jws.WithKey(jwa.RS256(), jwkRSAPublicKey))
+ if err != nil {
+ fmt.Printf("failed to verify payload: %s\n", err)
+ return
+ }
+
+ if !bytes.Equal(verified, payloadLoremIpsum) {
+ fmt.Printf("verified payload did not match\n")
+ return
+ }
+ }
+ // OUTPUT:
+}
+```
+source: [examples/jwx_readme_example_test.go](https://github.com/lestrrat-go/jwx/blob/v3/examples/jwx_readme_example_test.go)
+
+
+# How-to Documentation
+
+* [API documentation](https://pkg.go.dev/github.com/lestrrat-go/jwx/v3)
+* [How-to style documentation](./docs)
+* [Runnable Examples](./examples)
+
+# Description
+
+This Go module implements JWA, JWE, JWK, JWS, and JWT. Please see the following table for the list of
+available packages:
+
+| Package name | Notes |
+|-----------------------------------------------------------|-------------------------------------------------|
+| [jwt](https://github.com/lestrrat-go/jwx/tree/v3/jwt) | [RFC 7519](https://tools.ietf.org/html/rfc7519) |
+| [jwk](https://github.com/lestrrat-go/jwx/tree/v3/jwk) | [RFC 7517](https://tools.ietf.org/html/rfc7517) + [RFC 7638](https://tools.ietf.org/html/rfc7638) |
+| [jwa](https://github.com/lestrrat-go/jwx/tree/v3/jwa) | [RFC 7518](https://tools.ietf.org/html/rfc7518) |
+| [jws](https://github.com/lestrrat-go/jwx/tree/v3/jws) | [RFC 7515](https://tools.ietf.org/html/rfc7515) + [RFC 7797](https://tools.ietf.org/html/rfc7797) |
+| [jwe](https://github.com/lestrrat-go/jwx/tree/v3/jwe) | [RFC 7516](https://tools.ietf.org/html/rfc7516) |
+## History
+
+My goal was to write a server that heavily uses JWK and JWT. At first glance
+the libraries that already exist seemed sufficient, but soon I realized that
+
+1. To completely implement the protocols, I needed the entire JWT, JWK, JWS, JWE (and JWA, by necessity).
+2. Most of the libraries that existed only deal with a subset of the various JWx specifications that were necessary to implement their specific needs
+
+For example, a certain library looks like it had most of JWS, JWE, JWK covered, but then it lacked the ability to include private claims in its JWT responses. Another library had support of all the private claims, but completely lacked in its flexibility to generate various different response formats.
+
+Because I was writing the server side (and the client side for testing), I needed the *entire* JOSE toolset to properly implement my server, **and** they needed to be *flexible* enough to fulfill the entire spec that I was writing.
+
+So here's `github.com/lestrrat-go/jwx/v3`. This library is extensible, customizable, and hopefully well organized to the point that it is easy for you to slice and dice it.
+
+## Why would I use this library?
+
+There are several other major Go modules that handle JWT and related data formats,
+so why should you use this library?
+
+From a purely functional perspective, the only major difference is this:
+Whereas most other projects only deal with what they seem necessary to handle
+JWTs, this module handles the **_entire_** spectrum of JWS, JWE, JWK, and JWT.
+
+That is, if you need to not only parse JWTs, but also to control JWKs, or
+if you need to handle payloads that are NOT JWTs, you should probably consider
+using this module. You should also note that JWT is built _on top_ of those
+other technologies. You simply cannot have a complete JWT package without
+implementing the entirety of JWS/JWE/JWK, which this library does.
+
+Next, from an implementation perspective, this module differs significantly
+from others in that it tries very hard to expose only the APIs, and not the
+internal data. For example, individual JWT claims are not accessible through
+struct field lookups. You need to use one of the getter methods.
+
+This is because this library takes the stance that the end user is fully capable
+and even willing to shoot themselves on the foot when presented with a lax
+API. By making sure that users do not have access to open structs, we can protect
+users from doing silly things like creating _incomplete_ structs, or access the
+structs concurrently without any protection. This structure also allows
+us to put extra smarts in the structs, such as doing the right thing when
+you want to parse / write custom fields (this module does not require the user
+to specify alternate structs to parse objects with custom fields)
+
+In the end I think it comes down to your usage pattern, and priorities.
+Some general guidelines that come to mind are:
+
+* If you want a single library to handle everything JWx, such as using JWE, JWK, JWS, handling [auto-refreshing JWKs](https://github.com/lestrrat-go/jwx/blob/v3/docs/04-jwk.md#auto-refreshing-remote-keys), use this module.
+* If you want to honor all possible custom fields transparently, use this module.
+* If you want a standardized clean API, use this module.
+
+Otherwise, feel free to choose something else.
+
+# Contributions
+
+## Issues
+
+For bug reports and feature requests, please try to follow the issue templates as much as possible.
+For either bug reports or feature requests, failing tests are even better.
+
+## Pull Requests
+
+Please make sure to include tests that exercise the changes you made.
+
+If you are editing auto-generated files (those files with the `_gen.go` suffix, please make sure that you do the following:
+
+1. Edit the generator, not the generated files (e.g. internal/cmd/genreadfile/main.go)
+2. Run `make generate` (or `go generate`) to generate the new code
+3. Commit _both_ the generator _and_ the generated files
+
+## Discussions / Usage
+
+Please try [discussions](https://github.com/lestrrat-go/jwx/tree/v3/discussions) first.
+
+# Related Modules
+
+* [github.com/lestrrat-go/echo-middleware-jwx](https://github.com/lestrrat-go/echo-middleware-jwx) - Sample Echo middleware
+* [github.com/jwx-go/crypto-signer/gcp](https://github.com/jwx-go/crypto-signer/tree/main/gcp) - GCP KMS wrapper that implements [`crypto.Signer`](https://pkg.go.dev/crypto#Signer)
+* [github.com/jwx-go/crypto-signer/aws](https://github.com/jwx-go/crypto-signer/tree/main/aws) - AWS KMS wrapper that implements [`crypto.Signer`](https://pkg.go.dev/crypto#Signer)
+
+# Credits
+
+* Initial work on this library was generously sponsored by HDE Inc (https://www.hde.co.jp)
+* Lots of code, especially JWE was initially taken from go-jose library (https://github.com/square/go-jose)
+* Lots of individual contributors have helped this project over the years. Thank each and everyone of you very much.
+
+# Quid pro quo
+
+If you use this software to build products in a for-profit organization, we ask you to _consider_
+contributing back to FOSS in the following manner:
+
+* For every 100 employees (direct hires) of your organization, please consider contributing minimum of $1 every year to either this project, **or** another FOSS projects that this project uses. For example, for 100 employees, we ask you contribute $100 yearly; for 10,000 employees, we ask you contribute $10,000 yearly.
+* If possible, please make this information public. You do not need to disclose the amount you are contributing, but please make the information that you are contributing to particular FOSS projects public. For this project, please consider writing your name on the [Wiki](https://github.com/lestrrat-go/jwx/wiki/Users)
+
+This is _NOT_ a licensing term: you are still free to use this software according to the license it
+comes with. This clause is only a plea for people to acknowledge the work from FOSS developers whose
+work you rely on each and everyday.
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/SECURITY.md b/vendor/github.com/lestrrat-go/jwx/v3/SECURITY.md
new file mode 100644
index 0000000000..601dced5cd
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/SECURITY.md
@@ -0,0 +1,18 @@
+# Security Policy
+
+## Supported Versions
+
+Most recent two major versions will receive security updates
+
+| Version | Supported |
+| -------- | ------------------ |
+| v3.x.x | :white_check_mark: |
+| v2.x.x | :white_check_mark: |
+| < v2.0.0 | :x: |
+
+## Reporting a Vulnerability
+
+If you think you found a vulnerability, please report it via [GitHub Security Advisory](https://github.com/lestrrat-go/jwx/security/advisories/new).
+Please include explicit steps to reproduce the security issue.
+
+We will do our best to respond in a timely manner, but please also be aware that this project is maintained by a very limited number of people. Please help us with test code and such.
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/WORKSPACE b/vendor/github.com/lestrrat-go/jwx/v3/WORKSPACE
new file mode 100644
index 0000000000..c8578d8b0a
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/WORKSPACE
@@ -0,0 +1,2 @@
+# Empty WORKSPACE file for bzlmod compatibility
+# All dependencies are now managed in MODULE.bazel
\ No newline at end of file
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/cert/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/cert/BUILD.bazel
new file mode 100644
index 0000000000..f308530bcf
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/cert/BUILD.bazel
@@ -0,0 +1,34 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "cert",
+ srcs = [
+ "cert.go",
+ "chain.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/cert",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//internal/base64",
+ "//internal/tokens",
+ ],
+)
+
+go_test(
+ name = "cert_test",
+ srcs = [
+ "cert_test.go",
+ "chain_test.go",
+ ],
+ deps = [
+ ":cert",
+ "//internal/jwxtest",
+ "@com_github_stretchr_testify//require",
+ ],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":cert",
+ visibility = ["//visibility:public"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/cert/cert.go b/vendor/github.com/lestrrat-go/jwx/v3/cert/cert.go
new file mode 100644
index 0000000000..efefbcb417
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/cert/cert.go
@@ -0,0 +1,48 @@
+package cert
+
+import (
+ "crypto/x509"
+ stdlibb64 "encoding/base64"
+ "fmt"
+ "io"
+
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+)
+
+// Create is a wrapper around x509.CreateCertificate, but it additionally
+// encodes it in base64 so that it can be easily added to `x5c` fields
+func Create(rand io.Reader, template, parent *x509.Certificate, pub, priv any) ([]byte, error) {
+ der, err := x509.CreateCertificate(rand, template, parent, pub, priv)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to create x509 certificate: %w`, err)
+ }
+ return EncodeBase64(der)
+}
+
+// EncodeBase64 is a utility function to encode ASN.1 DER certificates
+// using base64 encoding. This operation is normally done by `pem.Encode`
+// but since PEM would include the markers (`-----BEGIN`, and the like)
+// while `x5c` fields do not need this, this function can be used to
+// shave off a few lines
+func EncodeBase64(der []byte) ([]byte, error) {
+ enc := stdlibb64.StdEncoding
+ dst := make([]byte, enc.EncodedLen(len(der)))
+ enc.Encode(dst, der)
+ return dst, nil
+}
+
+// Parse is a utility function to decode a base64 encoded
+// ASN.1 DER format certificate, and to parse the byte sequence.
+// The certificate must be in PKIX format, and it must not contain PEM markers
+func Parse(src []byte) (*x509.Certificate, error) {
+ dst, err := base64.Decode(src)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to base64 decode the certificate: %w`, err)
+ }
+
+ cert, err := x509.ParseCertificate(dst)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to parse x509 certificate: %w`, err)
+ }
+ return cert, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/cert/chain.go b/vendor/github.com/lestrrat-go/jwx/v3/cert/chain.go
new file mode 100644
index 0000000000..112274669a
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/cert/chain.go
@@ -0,0 +1,80 @@
+package cert
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+)
+
+// Chain represents a certificate chain as used in the `x5c` field of
+// various objects within JOSE.
+//
+// It stores the certificates as a list of base64 encoded []byte
+// sequence. By definition these values must PKIX encoded.
+type Chain struct {
+ certificates [][]byte
+}
+
+func (cc Chain) MarshalJSON() ([]byte, error) {
+ var buf bytes.Buffer
+ buf.WriteByte(tokens.OpenSquareBracket)
+ for i, cert := range cc.certificates {
+ if i > 0 {
+ buf.WriteByte(tokens.Comma)
+ }
+ buf.WriteByte('"')
+ buf.Write(cert)
+ buf.WriteByte('"')
+ }
+ buf.WriteByte(tokens.CloseSquareBracket)
+ return buf.Bytes(), nil
+}
+
+func (cc *Chain) UnmarshalJSON(data []byte) error {
+ var tmp []string
+ if err := json.Unmarshal(data, &tmp); err != nil {
+ return fmt.Errorf(`failed to unmarshal certificate chain: %w`, err)
+ }
+
+ certs := make([][]byte, len(tmp))
+ for i, cert := range tmp {
+ certs[i] = []byte(cert)
+ }
+ cc.certificates = certs
+ return nil
+}
+
+// Get returns the n-th ASN.1 DER + base64 encoded certificate
+// stored. `false` will be returned in the second argument if
+// the corresponding index is out of range.
+func (cc *Chain) Get(index int) ([]byte, bool) {
+ if index < 0 || index >= len(cc.certificates) {
+ return nil, false
+ }
+
+ return cc.certificates[index], true
+}
+
+// Len returns the number of certificates stored in this Chain
+func (cc *Chain) Len() int {
+ return len(cc.certificates)
+}
+
+var pemStart = []byte("----- BEGIN CERTIFICATE -----")
+var pemEnd = []byte("----- END CERTIFICATE -----")
+
+func (cc *Chain) AddString(der string) error {
+ return cc.Add([]byte(der))
+}
+
+func (cc *Chain) Add(der []byte) error {
+ // We're going to be nice and remove marker lines if they
+ // give it to us
+ der = bytes.TrimPrefix(der, pemStart)
+ der = bytes.TrimSuffix(der, pemEnd)
+ der = bytes.TrimSpace(der)
+ cc.certificates = append(cc.certificates, der)
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/codecov.yml b/vendor/github.com/lestrrat-go/jwx/v3/codecov.yml
new file mode 100644
index 0000000000..130effd7a6
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/codecov.yml
@@ -0,0 +1,2 @@
+codecov:
+ allow_coverage_offsets: true
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/format.go b/vendor/github.com/lestrrat-go/jwx/v3/format.go
new file mode 100644
index 0000000000..6cb6efe7eb
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/format.go
@@ -0,0 +1,104 @@
+package jwx
+
+import (
+ "bytes"
+ "encoding/json"
+
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+)
+
+type FormatKind int
+
+// These constants describe the result from guessing the format
+// of the incoming buffer.
+const (
+ // InvalidFormat is returned when the format of the incoming buffer
+ // has been deemed conclusively invalid
+ InvalidFormat FormatKind = iota
+ // UnknownFormat is returned when GuessFormat was not able to conclusively
+ // determine the format of the
+ UnknownFormat
+ JWE
+ JWS
+ JWK
+ JWKS
+ JWT
+)
+
+type formatHint struct {
+ Payload json.RawMessage `json:"payload"` // Only in JWS
+ Signatures json.RawMessage `json:"signatures"` // Only in JWS
+ Ciphertext json.RawMessage `json:"ciphertext"` // Only in JWE
+ KeyType json.RawMessage `json:"kty"` // Only in JWK
+ Keys json.RawMessage `json:"keys"` // Only in JWKS
+ Audience json.RawMessage `json:"aud"` // Only in JWT
+}
+
+// GuessFormat is used to guess the format the given payload is in
+// using heuristics. See the type FormatKind for a full list of
+// possible types.
+//
+// This may be useful in determining your next action when you may
+// encounter a payload that could either be a JWE, JWS, or a plain JWT.
+//
+// Because JWTs are almost always JWS signed, you may be thrown off
+// if you pass what you think is a JWT payload to this function.
+// If the function is in the "Compact" format, it means it's a JWS
+// signed message, and its payload is the JWT. Therefore this function
+// will return JWS, not JWT.
+//
+// This function requires an extra parsing of the payload, and therefore
+// may be inefficient if you call it every time before parsing.
+func GuessFormat(payload []byte) FormatKind {
+ // The check against kty, keys, and aud are something this library
+ // made up. for the distinctions between JWE and JWS, we used
+ // https://datatracker.ietf.org/doc/html/rfc7516#section-9.
+ //
+ // The above RFC described several ways to distinguish between
+ // a JWE and JWS JSON, but we're only using one of them
+
+ payload = bytes.TrimSpace(payload)
+ if len(payload) <= 0 {
+ return UnknownFormat
+ }
+
+ if payload[0] != tokens.OpenCurlyBracket {
+ // Compact format. It's probably a JWS or JWE
+ sep := []byte{tokens.Period} // I want to const this :/
+
+ // Note: this counts the number of occurrences of the
+ // separator, but the RFC talks about the number of segments.
+ // number of tokens.Period == segments - 1, so that's why we have 2 and 4 here
+ switch count := bytes.Count(payload, sep); count {
+ case 2:
+ return JWS
+ case 4:
+ return JWE
+ default:
+ return InvalidFormat
+ }
+ }
+
+ // If we got here, we probably have JSON.
+ var h formatHint
+ if err := json.Unmarshal(payload, &h); err != nil {
+ return UnknownFormat
+ }
+
+ if h.Audience != nil {
+ return JWT
+ }
+ if h.KeyType != nil {
+ return JWK
+ }
+ if h.Keys != nil {
+ return JWKS
+ }
+ if h.Ciphertext != nil {
+ return JWE
+ }
+ if h.Signatures != nil && h.Payload != nil {
+ return JWS
+ }
+ return UnknownFormat
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/formatkind_string_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/formatkind_string_gen.go
new file mode 100644
index 0000000000..ab7287214f
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/formatkind_string_gen.go
@@ -0,0 +1,30 @@
+// Code generated by "stringer -type=FormatKind"; DO NOT EDIT.
+
+package jwx
+
+import "strconv"
+
+func _() {
+ // An "invalid array index" compiler error signifies that the constant values have changed.
+ // Re-run the stringer command to generate them again.
+ var x [1]struct{}
+ _ = x[InvalidFormat-0]
+ _ = x[UnknownFormat-1]
+ _ = x[JWE-2]
+ _ = x[JWS-3]
+ _ = x[JWK-4]
+ _ = x[JWKS-5]
+ _ = x[JWT-6]
+}
+
+const _FormatKind_name = "InvalidFormatUnknownFormatJWEJWSJWKJWKSJWT"
+
+var _FormatKind_index = [...]uint8{0, 13, 26, 29, 32, 35, 39, 42}
+
+func (i FormatKind) String() string {
+ idx := int(i) - 0
+ if i < 0 || idx >= len(_FormatKind_index)-1 {
+ return "FormatKind(" + strconv.FormatInt(int64(i), 10) + ")"
+ }
+ return _FormatKind_name[_FormatKind_index[idx]:_FormatKind_index[idx+1]]
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/base64/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/internal/base64/BUILD.bazel
new file mode 100644
index 0000000000..57da5179f3
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/base64/BUILD.bazel
@@ -0,0 +1,21 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "base64",
+ srcs = ["base64.go"],
+ importpath = "github.com/lestrrat-go/jwx/v3/internal/base64",
+ visibility = ["//:__subpackages__"],
+)
+
+go_test(
+ name = "base64_test",
+ srcs = ["base64_test.go"],
+ embed = [":base64"],
+ deps = ["@com_github_stretchr_testify//require"],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":base64",
+ visibility = ["//:__subpackages__"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/base64/asmbase64.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/base64/asmbase64.go
new file mode 100644
index 0000000000..6e83ecc4a5
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/base64/asmbase64.go
@@ -0,0 +1,51 @@
+//go:build jwx_asmbase64
+
+package base64
+
+import (
+ "fmt"
+ "slices"
+
+ asmbase64 "github.com/segmentio/asm/base64"
+)
+
+func init() {
+ SetEncoder(asmEncoder{asmbase64.RawURLEncoding})
+ SetDecoder(asmDecoder{})
+}
+
+type asmEncoder struct {
+ *asmbase64.Encoding
+}
+
+func (e asmEncoder) AppendEncode(dst, src []byte) []byte {
+ n := e.Encoding.EncodedLen(len(src))
+ dst = slices.Grow(dst, n)
+ e.Encoding.Encode(dst[len(dst):][:n], src)
+ return dst[:len(dst)+n]
+}
+
+type asmDecoder struct{}
+
+func (d asmDecoder) Decode(src []byte) ([]byte, error) {
+ var enc *asmbase64.Encoding
+ switch Guess(src) {
+ case Std:
+ enc = asmbase64.StdEncoding
+ case RawStd:
+ enc = asmbase64.RawStdEncoding
+ case URL:
+ enc = asmbase64.URLEncoding
+ case RawURL:
+ enc = asmbase64.RawURLEncoding
+ default:
+ return nil, fmt.Errorf(`invalid encoding`)
+ }
+
+ dst := make([]byte, enc.DecodedLen(len(src)))
+ n, err := enc.Decode(dst, src)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to decode source: %w`, err)
+ }
+ return dst[:n], nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/base64/base64.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/base64/base64.go
new file mode 100644
index 0000000000..5ed8e35006
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/base64/base64.go
@@ -0,0 +1,139 @@
+package base64
+
+import (
+ "bytes"
+ "encoding/base64"
+ "encoding/binary"
+ "fmt"
+ "sync"
+)
+
+type Decoder interface {
+ Decode([]byte) ([]byte, error)
+}
+
+type Encoder interface {
+ Encode([]byte, []byte)
+ EncodedLen(int) int
+ EncodeToString([]byte) string
+ AppendEncode([]byte, []byte) []byte
+}
+
+var muEncoder sync.RWMutex
+var encoder Encoder = base64.RawURLEncoding
+var muDecoder sync.RWMutex
+var decoder Decoder = defaultDecoder{}
+
+func SetEncoder(enc Encoder) {
+ muEncoder.Lock()
+ defer muEncoder.Unlock()
+ encoder = enc
+}
+
+func getEncoder() Encoder {
+ muEncoder.RLock()
+ defer muEncoder.RUnlock()
+ return encoder
+}
+
+func DefaultEncoder() Encoder {
+ return getEncoder()
+}
+
+func SetDecoder(dec Decoder) {
+ muDecoder.Lock()
+ defer muDecoder.Unlock()
+ decoder = dec
+}
+
+func getDecoder() Decoder {
+ muDecoder.RLock()
+ defer muDecoder.RUnlock()
+ return decoder
+}
+
+func Encode(src []byte) []byte {
+ encoder := getEncoder()
+ dst := make([]byte, encoder.EncodedLen(len(src)))
+ encoder.Encode(dst, src)
+ return dst
+}
+
+func EncodeToString(src []byte) string {
+ return getEncoder().EncodeToString(src)
+}
+
+func EncodeUint64ToString(v uint64) string {
+ data := make([]byte, 8)
+ binary.BigEndian.PutUint64(data, v)
+
+ i := 0
+ for ; i < len(data); i++ {
+ if data[i] != 0x0 {
+ break
+ }
+ }
+
+ return EncodeToString(data[i:])
+}
+
+const (
+ InvalidEncoding = iota
+ Std
+ URL
+ RawStd
+ RawURL
+)
+
+func Guess(src []byte) int {
+ var isRaw = !bytes.HasSuffix(src, []byte{'='})
+ var isURL = !bytes.ContainsAny(src, "+/")
+ switch {
+ case isRaw && isURL:
+ return RawURL
+ case isURL:
+ return URL
+ case isRaw:
+ return RawStd
+ default:
+ return Std
+ }
+}
+
+// defaultDecoder is a Decoder that detects the encoding of the source and
+// decodes it accordingly. This shouldn't really be required per the spec, but
+// it exist because we have seen in the wild JWTs that are encoded using
+// various versions of the base64 encoding.
+type defaultDecoder struct{}
+
+func (defaultDecoder) Decode(src []byte) ([]byte, error) {
+ var enc *base64.Encoding
+
+ switch Guess(src) {
+ case RawURL:
+ enc = base64.RawURLEncoding
+ case URL:
+ enc = base64.URLEncoding
+ case RawStd:
+ enc = base64.RawStdEncoding
+ case Std:
+ enc = base64.StdEncoding
+ default:
+ return nil, fmt.Errorf(`invalid encoding`)
+ }
+
+ dst := make([]byte, enc.DecodedLen(len(src)))
+ n, err := enc.Decode(dst, src)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to decode source: %w`, err)
+ }
+ return dst[:n], nil
+}
+
+func Decode(src []byte) ([]byte, error) {
+ return getDecoder().Decode(src)
+}
+
+func DecodeString(src string) ([]byte, error) {
+ return getDecoder().Decode([]byte(src))
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/ecutil/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/internal/ecutil/BUILD.bazel
new file mode 100644
index 0000000000..3ccdcf372a
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/ecutil/BUILD.bazel
@@ -0,0 +1,14 @@
+load("@rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "ecutil",
+ srcs = ["ecutil.go"],
+ importpath = "github.com/lestrrat-go/jwx/v3/internal/ecutil",
+ visibility = ["//:__subpackages__"],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":ecutil",
+ visibility = ["//:__subpackages__"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/ecutil/ecutil.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/ecutil/ecutil.go
new file mode 100644
index 0000000000..cf0bd4ac48
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/ecutil/ecutil.go
@@ -0,0 +1,76 @@
+// Package ecutil defines tools that help with elliptic curve related
+// computation
+package ecutil
+
+import (
+ "crypto/elliptic"
+ "math/big"
+ "sync"
+)
+
+const (
+ // size of buffer that needs to be allocated for EC521 curve
+ ec521BufferSize = 66 // (521 / 8) + 1
+)
+
+var ecpointBufferPool = sync.Pool{
+ New: func() any {
+ // In most cases the curve bit size will be less than this length
+ // so allocate the maximum, and keep reusing
+ buf := make([]byte, 0, ec521BufferSize)
+ return &buf
+ },
+}
+
+func getCrvFixedBuffer(size int) []byte {
+ //nolint:forcetypeassert
+ buf := *(ecpointBufferPool.Get().(*[]byte))
+ if size > ec521BufferSize && cap(buf) < size {
+ buf = append(buf, make([]byte, size-cap(buf))...)
+ }
+ return buf[:size]
+}
+
+// ReleaseECPointBuffer releases the []byte buffer allocated.
+func ReleaseECPointBuffer(buf []byte) {
+ buf = buf[:cap(buf)]
+ buf[0] = 0x0
+ for i := 1; i < len(buf); i *= 2 {
+ copy(buf[i:], buf[:i])
+ }
+ buf = buf[:0]
+ ecpointBufferPool.Put(&buf)
+}
+
+func CalculateKeySize(crv elliptic.Curve) int {
+ // We need to create a buffer that fits the entire curve.
+ // If the curve size is 66, that fits in 9 bytes. If the curve
+ // size is 64, it fits in 8 bytes.
+ bits := crv.Params().BitSize
+
+ // For most common cases we know before hand what the byte length
+ // is going to be. optimize
+ var inBytes int
+ switch bits {
+ case 224, 256, 384: // TODO: use constant?
+ inBytes = bits / 8
+ case 521:
+ inBytes = ec521BufferSize
+ default:
+ inBytes = bits / 8
+ if (bits % 8) != 0 {
+ inBytes++
+ }
+ }
+
+ return inBytes
+}
+
+// AllocECPointBuffer allocates a buffer for the given point in the given
+// curve. This buffer should be released using the ReleaseECPointBuffer
+// function.
+func AllocECPointBuffer(v *big.Int, crv elliptic.Curve) []byte {
+ buf := getCrvFixedBuffer(CalculateKeySize(crv))
+ v.FillBytes(buf)
+ return buf
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/json/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/internal/json/BUILD.bazel
new file mode 100644
index 0000000000..4e2dbe12b7
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/json/BUILD.bazel
@@ -0,0 +1,19 @@
+load("@rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "json",
+ srcs = [
+ "json.go",
+ "registry.go",
+ "stdlib.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/internal/json",
+ visibility = ["//:__subpackages__"],
+ deps = ["//internal/base64"],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":json",
+ visibility = ["//:__subpackages__"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/json/goccy.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/json/goccy.go
new file mode 100644
index 0000000000..9c99c098bc
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/json/goccy.go
@@ -0,0 +1,48 @@
+//go:build jwx_goccy
+
+package json
+
+import (
+ "io"
+
+ "github.com/goccy/go-json"
+)
+
+type Decoder = json.Decoder
+type Delim = json.Delim
+type Encoder = json.Encoder
+type Marshaler = json.Marshaler
+type Number = json.Number
+type RawMessage = json.RawMessage
+type Unmarshaler = json.Unmarshaler
+
+func Engine() string {
+ return "github.com/goccy/go-json"
+}
+
+// NewDecoder respects the values specified in DecoderSettings,
+// and creates a Decoder that has certain features turned on/off
+func NewDecoder(r io.Reader) *json.Decoder {
+ dec := json.NewDecoder(r)
+
+ if UseNumber() {
+ dec.UseNumber()
+ }
+
+ return dec
+}
+
+// NewEncoder is just a proxy for "encoding/json".NewEncoder
+func NewEncoder(w io.Writer) *json.Encoder {
+ return json.NewEncoder(w)
+}
+
+// Marshal is just a proxy for "encoding/json".Marshal
+func Marshal(v any) ([]byte, error) {
+ return json.Marshal(v)
+}
+
+// MarshalIndent is just a proxy for "encoding/json".MarshalIndent
+func MarshalIndent(v any, prefix, indent string) ([]byte, error) {
+ return json.MarshalIndent(v, prefix, indent)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/json/json.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/json/json.go
new file mode 100644
index 0000000000..c1917ef27a
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/json/json.go
@@ -0,0 +1,127 @@
+package json
+
+import (
+ "bytes"
+ "fmt"
+ "os"
+ "sync/atomic"
+
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+)
+
+var useNumber uint32 // TODO: at some point, change to atomic.Bool
+
+func UseNumber() bool {
+ return atomic.LoadUint32(&useNumber) == 1
+}
+
+// Sets the global configuration for json decoding
+func DecoderSettings(inUseNumber bool) {
+ var val uint32
+ if inUseNumber {
+ val = 1
+ }
+ atomic.StoreUint32(&useNumber, val)
+}
+
+// Unmarshal respects the values specified in DecoderSettings,
+// and uses a Decoder that has certain features turned on/off
+func Unmarshal(b []byte, v any) error {
+ dec := NewDecoder(bytes.NewReader(b))
+ return dec.Decode(v)
+}
+
+func AssignNextBytesToken(dst *[]byte, dec *Decoder) error {
+ var val string
+ if err := dec.Decode(&val); err != nil {
+ return fmt.Errorf(`error reading next value: %w`, err)
+ }
+
+ buf, err := base64.DecodeString(val)
+ if err != nil {
+ return fmt.Errorf(`expected base64 encoded []byte (%T)`, val)
+ }
+ *dst = buf
+ return nil
+}
+
+func ReadNextStringToken(dec *Decoder) (string, error) {
+ var val string
+ if err := dec.Decode(&val); err != nil {
+ return "", fmt.Errorf(`error reading next value: %w`, err)
+ }
+ return val, nil
+}
+
+func AssignNextStringToken(dst **string, dec *Decoder) error {
+ val, err := ReadNextStringToken(dec)
+ if err != nil {
+ return err
+ }
+ *dst = &val
+ return nil
+}
+
+// FlattenAudience is a flag to specify if we should flatten the "aud"
+// entry to a string when there's only one entry.
+// In jwx < 1.1.8 we just dumped everything as an array of strings,
+// but apparently AWS Cognito doesn't handle this well.
+//
+// So now we have the ability to dump "aud" as a string if there's
+// only one entry, but we need to retain the old behavior so that
+// we don't accidentally break somebody else's code. (e.g. messing
+// up how signatures are calculated)
+var FlattenAudience uint32
+
+func MarshalAudience(aud []string, flatten bool) ([]byte, error) {
+ var val any
+ if len(aud) == 1 && flatten {
+ val = aud[0]
+ } else {
+ val = aud
+ }
+ return Marshal(val)
+}
+
+func EncodeAudience(enc *Encoder, aud []string, flatten bool) error {
+ var val any
+ if len(aud) == 1 && flatten {
+ val = aud[0]
+ } else {
+ val = aud
+ }
+ return enc.Encode(val)
+}
+
+// DecodeCtx is an interface for objects that needs that extra something
+// when decoding JSON into an object.
+type DecodeCtx interface {
+ Registry() *Registry
+}
+
+// DecodeCtxContainer is used to differentiate objects that can carry extra
+// decoding hints and those who can't.
+type DecodeCtxContainer interface {
+ DecodeCtx() DecodeCtx
+ SetDecodeCtx(DecodeCtx)
+}
+
+// stock decodeCtx. should cover 80% of the cases
+type decodeCtx struct {
+ registry *Registry
+}
+
+func NewDecodeCtx(r *Registry) DecodeCtx {
+ return &decodeCtx{registry: r}
+}
+
+func (dc *decodeCtx) Registry() *Registry {
+ return dc.registry
+}
+
+func Dump(v any) {
+ enc := NewEncoder(os.Stdout)
+ enc.SetIndent("", " ")
+ //nolint:errchkjson
+ _ = enc.Encode(v)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/json/registry.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/json/registry.go
new file mode 100644
index 0000000000..04a6a4c4a5
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/json/registry.go
@@ -0,0 +1,90 @@
+package json
+
+import (
+ "fmt"
+ "reflect"
+ "sync"
+)
+
+// CustomDecoder is the interface we expect from RegisterCustomField in jws, jwe, jwk, and jwt packages.
+type CustomDecoder interface {
+ // Decode takes a JSON encoded byte slice and returns the desired
+ // decoded value,which will be used as the value for that field
+ // registered through RegisterCustomField
+ Decode([]byte) (any, error)
+}
+
+// CustomDecodeFunc is a stateless, function-based implementation of CustomDecoder
+type CustomDecodeFunc func([]byte) (any, error)
+
+func (fn CustomDecodeFunc) Decode(data []byte) (any, error) {
+ return fn(data)
+}
+
+type objectTypeDecoder struct {
+ typ reflect.Type
+ name string
+}
+
+func (dec *objectTypeDecoder) Decode(data []byte) (any, error) {
+ ptr := reflect.New(dec.typ).Interface()
+ if err := Unmarshal(data, ptr); err != nil {
+ return nil, fmt.Errorf(`failed to decode field %s: %w`, dec.name, err)
+ }
+ return reflect.ValueOf(ptr).Elem().Interface(), nil
+}
+
+type Registry struct {
+ mu *sync.RWMutex
+ ctrs map[string]CustomDecoder
+}
+
+func NewRegistry() *Registry {
+ return &Registry{
+ mu: &sync.RWMutex{},
+ ctrs: make(map[string]CustomDecoder),
+ }
+}
+
+func (r *Registry) Register(name string, object any) {
+ if object == nil {
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ delete(r.ctrs, name)
+ return
+ }
+
+ r.mu.Lock()
+ defer r.mu.Unlock()
+ if ctr, ok := object.(CustomDecoder); ok {
+ r.ctrs[name] = ctr
+ } else {
+ r.ctrs[name] = &objectTypeDecoder{
+ typ: reflect.TypeOf(object),
+ name: name,
+ }
+ }
+}
+
+func (r *Registry) Decode(dec *Decoder, name string) (any, error) {
+ r.mu.RLock()
+ defer r.mu.RUnlock()
+
+ if ctr, ok := r.ctrs[name]; ok {
+ var raw RawMessage
+ if err := dec.Decode(&raw); err != nil {
+ return nil, fmt.Errorf(`failed to decode field %s: %w`, name, err)
+ }
+ v, err := ctr.Decode([]byte(raw))
+ if err != nil {
+ return nil, fmt.Errorf(`failed to decode field %s: %w`, name, err)
+ }
+ return v, nil
+ }
+
+ var decoded any
+ if err := dec.Decode(&decoded); err != nil {
+ return nil, fmt.Errorf(`failed to decode field %s: %w`, name, err)
+ }
+ return decoded, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/json/stdlib.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/json/stdlib.go
new file mode 100644
index 0000000000..9e51fa7fe9
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/json/stdlib.go
@@ -0,0 +1,47 @@
+//go:build !jwx_goccy
+
+//nolint:revive
+package json
+
+import (
+ "encoding/json"
+ "io"
+)
+
+type Decoder = json.Decoder
+type Delim = json.Delim
+type Encoder = json.Encoder
+type Marshaler = json.Marshaler
+type Number = json.Number
+type RawMessage = json.RawMessage
+type Unmarshaler = json.Unmarshaler
+
+func Engine() string {
+ return "encoding/json"
+}
+
+// NewDecoder respects the values specified in DecoderSettings,
+// and creates a Decoder that has certain features turned on/off
+func NewDecoder(r io.Reader) *json.Decoder {
+ dec := json.NewDecoder(r)
+
+ if UseNumber() {
+ dec.UseNumber()
+ }
+
+ return dec
+}
+
+func NewEncoder(w io.Writer) *json.Encoder {
+ return json.NewEncoder(w)
+}
+
+// Marshal is just a proxy for "encoding/json".Marshal
+func Marshal(v any) ([]byte, error) {
+ return json.Marshal(v)
+}
+
+// MarshalIndent is just a proxy for "encoding/json".MarshalIndent
+func MarshalIndent(v any, prefix, indent string) ([]byte, error) {
+ return json.MarshalIndent(v, prefix, indent)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/jwxio/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/internal/jwxio/BUILD.bazel
new file mode 100644
index 0000000000..c70c4d2871
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/jwxio/BUILD.bazel
@@ -0,0 +1,8 @@
+load("@rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "jwxio",
+ srcs = ["jwxio.go"],
+ importpath = "github.com/lestrrat-go/jwx/v3/internal/jwxio",
+ visibility = ["//:__subpackages__"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/jwxio/jwxio.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/jwxio/jwxio.go
new file mode 100644
index 0000000000..8396417a9d
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/jwxio/jwxio.go
@@ -0,0 +1,29 @@
+package jwxio
+
+import (
+ "bytes"
+ "errors"
+ "io"
+ "strings"
+)
+
+var errNonFiniteSource = errors.New(`cannot read from non-finite source`)
+
+func NonFiniteSourceError() error {
+ return errNonFiniteSource
+}
+
+// ReadAllFromFiniteSource reads all data from a io.Reader _if_ it comes from a
+// finite source.
+func ReadAllFromFiniteSource(rdr io.Reader) ([]byte, error) {
+ switch rdr.(type) {
+ case *bytes.Reader, *bytes.Buffer, *strings.Reader:
+ data, err := io.ReadAll(rdr)
+ if err != nil {
+ return nil, err
+ }
+ return data, nil
+ default:
+ return nil, errNonFiniteSource
+ }
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/keyconv/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/internal/keyconv/BUILD.bazel
new file mode 100644
index 0000000000..d46d2f3814
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/keyconv/BUILD.bazel
@@ -0,0 +1,31 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "keyconv",
+ srcs = ["keyconv.go"],
+ importpath = "github.com/lestrrat-go/jwx/v3/internal/keyconv",
+ visibility = ["//:__subpackages__"],
+ deps = [
+ "//jwk",
+ "@com_github_lestrrat_go_blackmagic//:blackmagic",
+ "@org_golang_x_crypto//ed25519",
+ ],
+)
+
+go_test(
+ name = "keyconv_test",
+ srcs = ["keyconv_test.go"],
+ deps = [
+ ":keyconv",
+ "//internal/jwxtest",
+ "//jwa",
+ "//jwk",
+ "@com_github_stretchr_testify//require",
+ ],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":keyconv",
+ visibility = ["//:__subpackages__"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/keyconv/keyconv.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/keyconv/keyconv.go
new file mode 100644
index 0000000000..751fd8f05a
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/keyconv/keyconv.go
@@ -0,0 +1,354 @@
+package keyconv
+
+import (
+ "crypto"
+ "crypto/ecdh"
+ "crypto/ecdsa"
+ "crypto/ed25519"
+ "crypto/elliptic"
+ "crypto/rsa"
+ "fmt"
+ "math/big"
+
+ "github.com/lestrrat-go/blackmagic"
+ "github.com/lestrrat-go/jwx/v3/jwk"
+)
+
+// RSAPrivateKey assigns src to dst.
+// `dst` should be a pointer to a rsa.PrivateKey.
+// `src` may be rsa.PrivateKey, *rsa.PrivateKey, or a jwk.Key
+func RSAPrivateKey(dst, src any) error {
+ if jwkKey, ok := src.(jwk.Key); ok {
+ var raw rsa.PrivateKey
+ if err := jwk.Export(jwkKey, &raw); err != nil {
+ return fmt.Errorf(`failed to produce rsa.PrivateKey from %T: %w`, src, err)
+ }
+ src = &raw
+ }
+
+ var ptr *rsa.PrivateKey
+ switch src := src.(type) {
+ case rsa.PrivateKey:
+ ptr = &src
+ case *rsa.PrivateKey:
+ ptr = src
+ default:
+ return fmt.Errorf(`keyconv: expected rsa.PrivateKey or *rsa.PrivateKey, got %T`, src)
+ }
+
+ return blackmagic.AssignIfCompatible(dst, ptr)
+}
+
+// RSAPublicKey assigns src to dst
+// `dst` should be a pointer to a non-zero rsa.PublicKey.
+// `src` may be rsa.PublicKey, *rsa.PublicKey, or a jwk.Key
+func RSAPublicKey(dst, src any) error {
+ if jwkKey, ok := src.(jwk.Key); ok {
+ pk, err := jwk.PublicRawKeyOf(jwkKey)
+ if err != nil {
+ return fmt.Errorf(`keyconv: failed to produce public key from %T: %w`, src, err)
+ }
+ src = pk
+ }
+
+ var ptr *rsa.PublicKey
+ switch src := src.(type) {
+ case rsa.PrivateKey:
+ ptr = &src.PublicKey
+ case *rsa.PrivateKey:
+ ptr = &src.PublicKey
+ case rsa.PublicKey:
+ ptr = &src
+ case *rsa.PublicKey:
+ ptr = src
+ default:
+ return fmt.Errorf(`keyconv: expected rsa.PublicKey/rsa.PrivateKey or *rsa.PublicKey/*rsa.PrivateKey, got %T`, src)
+ }
+
+ return blackmagic.AssignIfCompatible(dst, ptr)
+}
+
+// ECDSAPrivateKey assigns src to dst, converting its type from a
+// non-pointer to a pointer
+func ECDSAPrivateKey(dst, src any) error {
+ if jwkKey, ok := src.(jwk.Key); ok {
+ var raw ecdsa.PrivateKey
+ if err := jwk.Export(jwkKey, &raw); err != nil {
+ return fmt.Errorf(`keyconv: failed to produce ecdsa.PrivateKey from %T: %w`, src, err)
+ }
+ src = &raw
+ }
+
+ var ptr *ecdsa.PrivateKey
+ switch src := src.(type) {
+ case ecdsa.PrivateKey:
+ ptr = &src
+ case *ecdsa.PrivateKey:
+ ptr = src
+ default:
+ return fmt.Errorf(`keyconv: expected ecdsa.PrivateKey or *ecdsa.PrivateKey, got %T`, src)
+ }
+ return blackmagic.AssignIfCompatible(dst, ptr)
+}
+
+// ECDSAPublicKey assigns src to dst, converting its type from a
+// non-pointer to a pointer
+func ECDSAPublicKey(dst, src any) error {
+ if jwkKey, ok := src.(jwk.Key); ok {
+ pk, err := jwk.PublicRawKeyOf(jwkKey)
+ if err != nil {
+ return fmt.Errorf(`keyconv: failed to produce public key from %T: %w`, src, err)
+ }
+ src = pk
+ }
+
+ var ptr *ecdsa.PublicKey
+ switch src := src.(type) {
+ case ecdsa.PrivateKey:
+ ptr = &src.PublicKey
+ case *ecdsa.PrivateKey:
+ ptr = &src.PublicKey
+ case ecdsa.PublicKey:
+ ptr = &src
+ case *ecdsa.PublicKey:
+ ptr = src
+ default:
+ return fmt.Errorf(`keyconv: expected ecdsa.PublicKey/ecdsa.PrivateKey or *ecdsa.PublicKey/*ecdsa.PrivateKey, got %T`, src)
+ }
+ return blackmagic.AssignIfCompatible(dst, ptr)
+}
+
+func ByteSliceKey(dst, src any) error {
+ if jwkKey, ok := src.(jwk.Key); ok {
+ var raw []byte
+ if err := jwk.Export(jwkKey, &raw); err != nil {
+ return fmt.Errorf(`keyconv: failed to produce []byte from %T: %w`, src, err)
+ }
+ src = raw
+ }
+
+ if _, ok := src.([]byte); !ok {
+ return fmt.Errorf(`keyconv: expected []byte, got %T`, src)
+ }
+ return blackmagic.AssignIfCompatible(dst, src)
+}
+
+func Ed25519PrivateKey(dst, src any) error {
+ if jwkKey, ok := src.(jwk.Key); ok {
+ var raw ed25519.PrivateKey
+ if err := jwk.Export(jwkKey, &raw); err != nil {
+ return fmt.Errorf(`failed to produce ed25519.PrivateKey from %T: %w`, src, err)
+ }
+ src = &raw
+ }
+
+ var ptr *ed25519.PrivateKey
+ switch src := src.(type) {
+ case ed25519.PrivateKey:
+ ptr = &src
+ case *ed25519.PrivateKey:
+ ptr = src
+ default:
+ return fmt.Errorf(`expected ed25519.PrivateKey or *ed25519.PrivateKey, got %T`, src)
+ }
+ return blackmagic.AssignIfCompatible(dst, ptr)
+}
+
+func Ed25519PublicKey(dst, src any) error {
+ if jwkKey, ok := src.(jwk.Key); ok {
+ pk, err := jwk.PublicRawKeyOf(jwkKey)
+ if err != nil {
+ return fmt.Errorf(`keyconv: failed to produce public key from %T: %w`, src, err)
+ }
+ src = pk
+ }
+
+ switch key := src.(type) {
+ case ed25519.PrivateKey:
+ src = key.Public()
+ case *ed25519.PrivateKey:
+ src = key.Public()
+ }
+
+ var ptr *ed25519.PublicKey
+ switch src := src.(type) {
+ case ed25519.PublicKey:
+ ptr = &src
+ case *ed25519.PublicKey:
+ ptr = src
+ case *crypto.PublicKey:
+ tmp, ok := (*src).(ed25519.PublicKey)
+ if !ok {
+ return fmt.Errorf(`failed to retrieve ed25519.PublicKey out of *crypto.PublicKey`)
+ }
+ ptr = &tmp
+ case crypto.PublicKey:
+ tmp, ok := src.(ed25519.PublicKey)
+ if !ok {
+ return fmt.Errorf(`failed to retrieve ed25519.PublicKey out of crypto.PublicKey`)
+ }
+ ptr = &tmp
+ default:
+ return fmt.Errorf(`expected ed25519.PublicKey or *ed25519.PublicKey, got %T`, src)
+ }
+ return blackmagic.AssignIfCompatible(dst, ptr)
+}
+
+type privECDHer interface {
+ ECDH() (*ecdh.PrivateKey, error)
+}
+
+func ECDHPrivateKey(dst, src any) error {
+ var privECDH *ecdh.PrivateKey
+ if jwkKey, ok := src.(jwk.Key); ok {
+ var rawECDH ecdh.PrivateKey
+ if err := jwk.Export(jwkKey, &rawECDH); err == nil {
+ privECDH = &rawECDH
+ } else {
+ // If we cannot export the key as an ecdh.PrivateKey, we try to export it as an ecdsa.PrivateKey
+ var rawECDSA ecdsa.PrivateKey
+ if err := jwk.Export(jwkKey, &rawECDSA); err != nil {
+ return fmt.Errorf(`keyconv: failed to produce ecdh.PrivateKey or ecdsa.PrivateKey from %T: %w`, src, err)
+ }
+ src = &rawECDSA
+ }
+ }
+
+ switch src := src.(type) {
+ case ecdh.PrivateKey:
+ privECDH = &src
+ case *ecdh.PrivateKey:
+ privECDH = src
+ case privECDHer:
+ priv, err := src.ECDH()
+ if err != nil {
+ return fmt.Errorf(`keyconv: failed to convert ecdsa.PrivateKey to ecdh.PrivateKey: %w`, err)
+ }
+ privECDH = priv
+ }
+
+ return blackmagic.AssignIfCompatible(dst, privECDH)
+}
+
+type pubECDHer interface {
+ ECDH() (*ecdh.PublicKey, error)
+}
+
+func ECDHPublicKey(dst, src any) error {
+ var pubECDH *ecdh.PublicKey
+ if jwkKey, ok := src.(jwk.Key); ok {
+ var rawECDH ecdh.PublicKey
+ if err := jwk.Export(jwkKey, &rawECDH); err == nil {
+ pubECDH = &rawECDH
+ } else {
+ // If we cannot export the key as an ecdh.PublicKey, we try to export it as an ecdsa.PublicKey
+ var rawECDSA ecdsa.PublicKey
+ if err := jwk.Export(jwkKey, &rawECDSA); err != nil {
+ return fmt.Errorf(`keyconv: failed to produce ecdh.PublicKey or ecdsa.PublicKey from %T: %w`, src, err)
+ }
+ src = &rawECDSA
+ }
+ }
+
+ switch src := src.(type) {
+ case ecdh.PublicKey:
+ pubECDH = &src
+ case *ecdh.PublicKey:
+ pubECDH = src
+ case pubECDHer:
+ pub, err := src.ECDH()
+ if err != nil {
+ return fmt.Errorf(`keyconv: failed to convert ecdsa.PublicKey to ecdh.PublicKey: %w`, err)
+ }
+ pubECDH = pub
+ }
+
+ return blackmagic.AssignIfCompatible(dst, pubECDH)
+}
+
+// ecdhCurveToElliptic maps ECDH curves to elliptic curves
+func ecdhCurveToElliptic(ecdhCurve ecdh.Curve) (elliptic.Curve, error) {
+ switch ecdhCurve {
+ case ecdh.P256():
+ return elliptic.P256(), nil
+ case ecdh.P384():
+ return elliptic.P384(), nil
+ case ecdh.P521():
+ return elliptic.P521(), nil
+ default:
+ return nil, fmt.Errorf(`keyconv: unsupported ECDH curve: %v`, ecdhCurve)
+ }
+}
+
+// ecdhPublicKeyToECDSA converts an ECDH public key to an ECDSA public key
+func ecdhPublicKeyToECDSA(ecdhPubKey *ecdh.PublicKey) (*ecdsa.PublicKey, error) {
+ curve, err := ecdhCurveToElliptic(ecdhPubKey.Curve())
+ if err != nil {
+ return nil, err
+ }
+
+ pubBytes := ecdhPubKey.Bytes()
+
+ // Parse the uncompressed point format (0x04 prefix + X + Y coordinates)
+ if len(pubBytes) == 0 || pubBytes[0] != 0x04 {
+ return nil, fmt.Errorf(`keyconv: invalid ECDH public key format`)
+ }
+
+ keyLen := (len(pubBytes) - 1) / 2
+ if len(pubBytes) != 1+2*keyLen {
+ return nil, fmt.Errorf(`keyconv: invalid ECDH public key length`)
+ }
+
+ x := new(big.Int).SetBytes(pubBytes[1 : 1+keyLen])
+ y := new(big.Int).SetBytes(pubBytes[1+keyLen:])
+
+ return &ecdsa.PublicKey{
+ Curve: curve,
+ X: x,
+ Y: y,
+ }, nil
+}
+
+func ECDHToECDSA(dst, src any) error {
+ // convert ecdh.PublicKey to ecdsa.PublicKey, ecdh.PrivateKey to ecdsa.PrivateKey
+
+ // First, handle value types by converting to pointers
+ switch s := src.(type) {
+ case ecdh.PrivateKey:
+ src = &s
+ case ecdh.PublicKey:
+ src = &s
+ }
+
+ var privBytes []byte
+ var pubkey *ecdh.PublicKey
+ // Now handle the actual conversion with pointer types
+ switch src := src.(type) {
+ case *ecdh.PrivateKey:
+ pubkey = src.PublicKey()
+ privBytes = src.Bytes()
+ case *ecdh.PublicKey:
+ pubkey = src
+ default:
+ return fmt.Errorf(`keyconv: expected ecdh.PrivateKey, *ecdh.PrivateKey, ecdh.PublicKey, or *ecdh.PublicKey, got %T`, src)
+ }
+
+ // convert the public key
+ ecdsaPubKey, err := ecdhPublicKeyToECDSA(pubkey)
+ if err != nil {
+ return fmt.Errorf(`keyconv.ECDHToECDSA: failed to convert ECDH public key to ECDSA public key: %w`, err)
+ }
+
+ // return if we were being asked to convert *ecdh.PublicKey
+ if privBytes == nil {
+ return blackmagic.AssignIfCompatible(dst, ecdsaPubKey)
+ }
+
+ // Then create the private key with the public key embedded
+ ecdsaPrivKey := &ecdsa.PrivateKey{
+ D: new(big.Int).SetBytes(privBytes),
+ PublicKey: *ecdsaPubKey,
+ }
+
+ return blackmagic.AssignIfCompatible(dst, ecdsaPrivKey)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/BUILD.bazel
new file mode 100644
index 0000000000..cebc269330
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/BUILD.bazel
@@ -0,0 +1,32 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "pool",
+ srcs = [
+ "big_int.go",
+ "byte_slice.go",
+ "bytes_buffer.go",
+ "error_slice.go",
+ "key_to_error_map.go",
+ "pool.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/internal/pool",
+ visibility = ["//:__subpackages__"],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":pool",
+ visibility = ["//:__subpackages__"],
+)
+
+go_test(
+ name = "pool_test",
+ srcs = [
+ "byte_slice_test.go",
+ ],
+ deps = [
+ ":pool",
+ "@com_github_stretchr_testify//require",
+ ],
+)
\ No newline at end of file
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/big_int.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/big_int.go
new file mode 100644
index 0000000000..57c446d4d2
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/big_int.go
@@ -0,0 +1,19 @@
+package pool
+
+import "math/big"
+
+var bigIntPool = New[*big.Int](allocBigInt, freeBigInt)
+
+func allocBigInt() *big.Int {
+ return &big.Int{}
+}
+
+func freeBigInt(b *big.Int) *big.Int {
+ b.SetInt64(0) // Reset the value to zero
+ return b
+}
+
+// BigInt returns a pool of *big.Int instances.
+func BigInt() *Pool[*big.Int] {
+ return bigIntPool
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/byte_slice.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/byte_slice.go
new file mode 100644
index 0000000000..46f1028343
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/byte_slice.go
@@ -0,0 +1,19 @@
+package pool
+
+var byteSlicePool = SlicePool[byte]{
+ pool: New[[]byte](allocByteSlice, freeByteSlice),
+}
+
+func allocByteSlice() []byte {
+ return make([]byte, 0, 64) // Default capacity of 64 bytes
+}
+
+func freeByteSlice(b []byte) []byte {
+ clear(b)
+ b = b[:0] // Reset the slice to zero length
+ return b
+}
+
+func ByteSlice() SlicePool[byte] {
+ return byteSlicePool
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/bytes_buffer.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/bytes_buffer.go
new file mode 100644
index 0000000000..a877f73ff8
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/bytes_buffer.go
@@ -0,0 +1,18 @@
+package pool
+
+import "bytes"
+
+var bytesBufferPool = New[*bytes.Buffer](allocBytesBuffer, freeBytesBuffer)
+
+func allocBytesBuffer() *bytes.Buffer {
+ return &bytes.Buffer{}
+}
+
+func freeBytesBuffer(b *bytes.Buffer) *bytes.Buffer {
+ b.Reset()
+ return b
+}
+
+func BytesBuffer() *Pool[*bytes.Buffer] {
+ return bytesBufferPool
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/error_slice.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/error_slice.go
new file mode 100644
index 0000000000..4f1675c1c0
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/error_slice.go
@@ -0,0 +1,16 @@
+package pool
+
+var errorSlicePool = New[[]error](allocErrorSlice, freeErrorSlice)
+
+func allocErrorSlice() []error {
+ return make([]error, 0, 1)
+}
+
+func freeErrorSlice(s []error) []error {
+ // Reset the slice to its zero value
+ return s[:0]
+}
+
+func ErrorSlice() *Pool[[]error] {
+ return errorSlicePool
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/key_to_error_map.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/key_to_error_map.go
new file mode 100644
index 0000000000..9fae012644
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/key_to_error_map.go
@@ -0,0 +1,19 @@
+package pool
+
+var keyToErrorMapPool = New[map[string]error](allocKeyToErrorMap, freeKeyToErrorMap)
+
+func allocKeyToErrorMap() map[string]error {
+ return make(map[string]error)
+}
+
+func freeKeyToErrorMap(m map[string]error) map[string]error {
+ for k := range m {
+ delete(m, k) // Clear the map
+ }
+ return m
+}
+
+// KeyToErrorMap returns a pool of map[string]error instances.
+func KeyToErrorMap() *Pool[map[string]error] {
+ return keyToErrorMapPool
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/pool.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/pool.go
new file mode 100644
index 0000000000..008b1cdb8b
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/pool/pool.go
@@ -0,0 +1,70 @@
+package pool
+
+import (
+ "sync"
+)
+
+type Pool[T any] struct {
+ pool sync.Pool
+ destructor func(T) T
+}
+
+// New creates a new Pool instance for the type T.
+// The allocator function is used to create new instances of T when the pool is empty.
+// The destructor function is used to clean up instances of T before they are returned to the pool.
+// The destructor should reset the state of T to a clean state, so it can be reused, and
+// return the modified instance of T. This is required for cases when you reset operations
+// can modify the underlying data structure, such as slices or maps.
+func New[T any](allocator func() T, destructor func(T) T) *Pool[T] {
+ return &Pool[T]{
+ pool: sync.Pool{
+ New: func() any {
+ return allocator()
+ },
+ },
+ destructor: destructor,
+ }
+}
+
+// Get retrieves an item of type T from the pool.
+func (p *Pool[T]) Get() T {
+ //nolint:forcetypeassert
+ return p.pool.Get().(T)
+}
+
+// Put returns an item of type T to the pool.
+// The item is first processed by the destructor function to ensure it is in a clean state.
+func (p *Pool[T]) Put(item T) {
+ p.pool.Put(p.destructor(item))
+}
+
+// SlicePool is a specialized pool for slices of type T. It is identical to Pool[T] but
+// provides additional functionality to get slices with a specific capacity.
+type SlicePool[T any] struct {
+ pool *Pool[[]T]
+}
+
+func NewSlicePool[T any](allocator func() []T, destructor func([]T) []T) SlicePool[T] {
+ return SlicePool[T]{
+ pool: New(allocator, destructor),
+ }
+}
+
+func (p SlicePool[T]) Get() []T {
+ return p.pool.Get()
+}
+
+func (p SlicePool[T]) GetCapacity(capacity int) []T {
+ if capacity <= 0 {
+ return p.Get()
+ }
+ s := p.Get()
+ if cap(s) < capacity {
+ s = make([]T, 0, capacity)
+ }
+ return s
+}
+
+func (p SlicePool[T]) Put(s []T) {
+ p.pool.Put(s)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/tokens/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/internal/tokens/BUILD.bazel
new file mode 100644
index 0000000000..6a331efb34
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/tokens/BUILD.bazel
@@ -0,0 +1,17 @@
+load("@rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "tokens",
+ srcs = [
+ "jwe_tokens.go",
+ "tokens.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/internal/tokens",
+ visibility = ["//:__subpackages__"],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":tokens",
+ visibility = ["//:__subpackages__"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/tokens/jwe_tokens.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/tokens/jwe_tokens.go
new file mode 100644
index 0000000000..9001cbbbc7
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/tokens/jwe_tokens.go
@@ -0,0 +1,48 @@
+package tokens
+
+// JWE Key Encryption Algorithms
+const (
+ // RSA algorithms
+ RSA1_5 = "RSA1_5"
+ RSA_OAEP = "RSA-OAEP"
+ RSA_OAEP_256 = "RSA-OAEP-256"
+ RSA_OAEP_384 = "RSA-OAEP-384"
+ RSA_OAEP_512 = "RSA-OAEP-512"
+
+ // AES Key Wrap algorithms
+ A128KW = "A128KW"
+ A192KW = "A192KW"
+ A256KW = "A256KW"
+
+ // AES GCM Key Wrap algorithms
+ A128GCMKW = "A128GCMKW"
+ A192GCMKW = "A192GCMKW"
+ A256GCMKW = "A256GCMKW"
+
+ // ECDH-ES algorithms
+ ECDH_ES = "ECDH-ES"
+ ECDH_ES_A128KW = "ECDH-ES+A128KW"
+ ECDH_ES_A192KW = "ECDH-ES+A192KW"
+ ECDH_ES_A256KW = "ECDH-ES+A256KW"
+
+ // PBES2 algorithms
+ PBES2_HS256_A128KW = "PBES2-HS256+A128KW"
+ PBES2_HS384_A192KW = "PBES2-HS384+A192KW"
+ PBES2_HS512_A256KW = "PBES2-HS512+A256KW"
+
+ // Direct key agreement
+ DIRECT = "dir"
+)
+
+// JWE Content Encryption Algorithms
+const (
+ // AES GCM algorithms
+ A128GCM = "A128GCM"
+ A192GCM = "A192GCM"
+ A256GCM = "A256GCM"
+
+ // AES CBC + HMAC algorithms
+ A128CBC_HS256 = "A128CBC-HS256"
+ A192CBC_HS384 = "A192CBC-HS384"
+ A256CBC_HS512 = "A256CBC-HS512"
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/internal/tokens/tokens.go b/vendor/github.com/lestrrat-go/jwx/v3/internal/tokens/tokens.go
new file mode 100644
index 0000000000..2af3b88de1
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/internal/tokens/tokens.go
@@ -0,0 +1,51 @@
+package tokens
+
+const (
+ CloseCurlyBracket = '}'
+ CloseSquareBracket = ']'
+ Colon = ':'
+ Comma = ','
+ DoubleQuote = '"'
+ OpenCurlyBracket = '{'
+ OpenSquareBracket = '['
+ Period = '.'
+)
+
+// Cryptographic key sizes
+const (
+ KeySize16 = 16
+ KeySize24 = 24
+ KeySize32 = 32
+ KeySize48 = 48 // A192CBC_HS384 key size
+ KeySize64 = 64 // A256CBC_HS512 key size
+)
+
+// Bit/byte conversion factors
+const (
+ BitsPerByte = 8
+ BytesPerBit = 1.0 / 8
+)
+
+// Key wrapping constants
+const (
+ KeywrapChunkLen = 8
+ KeywrapRounds = 6 // RFC 3394 key wrap rounds
+ KeywrapBlockSize = 8 // Key wrap block size in bytes
+)
+
+// AES-GCM constants
+const (
+ GCMIVSize = 12 // GCM IV size in bytes (96 bits)
+ GCMTagSize = 16 // GCM tag size in bytes (128 bits)
+)
+
+// PBES2 constants
+const (
+ PBES2DefaultIterations = 10000 // Default PBKDF2 iteration count
+ PBES2NullByteSeparator = 0 // Null byte separator for PBES2
+)
+
+// RSA key generation constants
+const (
+ RSAKeyGenMultiplier = 2 // RSA key generation size multiplier
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwa/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jwa/BUILD.bazel
new file mode 100644
index 0000000000..cfb7af02a0
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwa/BUILD.bazel
@@ -0,0 +1,45 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "jwa",
+ srcs = [
+ "compression_gen.go",
+ "content_encryption_gen.go",
+ "elliptic_gen.go",
+ "jwa.go",
+ "key_encryption_gen.go",
+ "key_type_gen.go",
+ "options_gen.go",
+ "signature_gen.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/jwa",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//internal/tokens",
+ "@com_github_lestrrat_go_option_v2//:option",
+ ],
+)
+
+go_test(
+ name = "jwa_test",
+ srcs = [
+ "compression_gen_test.go",
+ "content_encryption_gen_test.go",
+ "elliptic_gen_test.go",
+ "jwa_test.go",
+ "key_encryption_gen_test.go",
+ "key_type_gen_test.go",
+ "signature_gen_test.go",
+ ],
+ deps = [
+ ":jwa",
+ "@com_github_stretchr_testify//require",
+ "@com_github_lestrrat_go_option_v2//:option",
+ ],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":jwa",
+ visibility = ["//visibility:public"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwa/README.md b/vendor/github.com/lestrrat-go/jwx/v3/jwa/README.md
new file mode 100644
index 0000000000..270e60c672
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwa/README.md
@@ -0,0 +1,3 @@
+# JWA [](https://pkg.go.dev/github.com/lestrrat-go/jwx/v3/jwa)
+
+Package [github.com/lestrrat-go/jwx/v3/jwa](./jwa) defines the various algorithm described in [RFC7518](https://tools.ietf.org/html/rfc7518)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwa/compression_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwa/compression_gen.go
new file mode 100644
index 0000000000..a7a2451afa
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwa/compression_gen.go
@@ -0,0 +1,153 @@
+// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT.
+
+package jwa
+
+import (
+ "encoding/json"
+ "fmt"
+ "sort"
+ "sync"
+)
+
+var muAllCompressionAlgorithm sync.RWMutex
+var allCompressionAlgorithm = map[string]CompressionAlgorithm{}
+var muListCompressionAlgorithm sync.RWMutex
+var listCompressionAlgorithm []CompressionAlgorithm
+var builtinCompressionAlgorithm = map[string]struct{}{}
+
+func init() {
+ // builtin values for CompressionAlgorithm
+ algorithms := make([]CompressionAlgorithm, 2)
+ algorithms[0] = NewCompressionAlgorithm("DEF")
+ algorithms[1] = NewCompressionAlgorithm("")
+
+ RegisterCompressionAlgorithm(algorithms...)
+}
+
+// Deflate returns an object representing the "DEF" content compression algorithm value. Using this value specifies that the content should be compressed using DEFLATE (RFC 1951).
+func Deflate() CompressionAlgorithm {
+ return lookupBuiltinCompressionAlgorithm("DEF")
+}
+
+// NoCompress returns an object representing an empty compression algorithm value. Using this value specifies that the content should not be compressed.
+func NoCompress() CompressionAlgorithm {
+ return lookupBuiltinCompressionAlgorithm("")
+}
+
+func lookupBuiltinCompressionAlgorithm(name string) CompressionAlgorithm {
+ muAllCompressionAlgorithm.RLock()
+ v, ok := allCompressionAlgorithm[name]
+ muAllCompressionAlgorithm.RUnlock()
+ if !ok {
+ panic(fmt.Sprintf(`jwa: CompressionAlgorithm %q not registered`, name))
+ }
+ return v
+}
+
+// CompressionAlgorithm represents the compression algorithms as described in https://tools.ietf.org/html/rfc7518#section-7.3
+type CompressionAlgorithm struct {
+ name string
+ deprecated bool
+}
+
+func (s CompressionAlgorithm) String() string {
+ return s.name
+}
+
+// IsDeprecated returns true if the CompressionAlgorithm object is deprecated.
+func (s CompressionAlgorithm) IsDeprecated() bool {
+ return s.deprecated
+}
+
+// EmptyCompressionAlgorithm returns an empty CompressionAlgorithm object, used as a zero value.
+func EmptyCompressionAlgorithm() CompressionAlgorithm {
+ return CompressionAlgorithm{}
+}
+
+// NewCompressionAlgorithm creates a new CompressionAlgorithm object with the given name.
+func NewCompressionAlgorithm(name string, options ...NewAlgorithmOption) CompressionAlgorithm {
+ var deprecated bool
+ for _, option := range options {
+ switch option.Ident() {
+ case identDeprecated{}:
+ if err := option.Value(&deprecated); err != nil {
+ panic("jwa.NewCompressionAlgorithm: WithDeprecated option must be a boolean")
+ }
+ }
+ }
+ return CompressionAlgorithm{name: name, deprecated: deprecated}
+}
+
+// LookupCompressionAlgorithm returns the CompressionAlgorithm object for the given name.
+func LookupCompressionAlgorithm(name string) (CompressionAlgorithm, bool) {
+ muAllCompressionAlgorithm.RLock()
+ v, ok := allCompressionAlgorithm[name]
+ muAllCompressionAlgorithm.RUnlock()
+ return v, ok
+}
+
+// RegisterCompressionAlgorithm registers a new CompressionAlgorithm. The signature value must be immutable
+// and safe to be used by multiple goroutines, as it is going to be shared with all other users of this library.
+func RegisterCompressionAlgorithm(algorithms ...CompressionAlgorithm) {
+ muAllCompressionAlgorithm.Lock()
+ for _, alg := range algorithms {
+ allCompressionAlgorithm[alg.String()] = alg
+ }
+ muAllCompressionAlgorithm.Unlock()
+ rebuildCompressionAlgorithm()
+}
+
+// UnregisterCompressionAlgorithm unregisters a CompressionAlgorithm from its known database.
+// Non-existent entries, as well as built-in algorithms will silently be ignored.
+func UnregisterCompressionAlgorithm(algorithms ...CompressionAlgorithm) {
+ muAllCompressionAlgorithm.Lock()
+ for _, alg := range algorithms {
+ if _, ok := builtinCompressionAlgorithm[alg.String()]; ok {
+ continue
+ }
+ delete(allCompressionAlgorithm, alg.String())
+ }
+ muAllCompressionAlgorithm.Unlock()
+ rebuildCompressionAlgorithm()
+}
+
+func rebuildCompressionAlgorithm() {
+ list := make([]CompressionAlgorithm, 0, len(allCompressionAlgorithm))
+ muAllCompressionAlgorithm.RLock()
+ for _, v := range allCompressionAlgorithm {
+ list = append(list, v)
+ }
+ muAllCompressionAlgorithm.RUnlock()
+ sort.Slice(list, func(i, j int) bool {
+ return list[i].String() < list[j].String()
+ })
+ muListCompressionAlgorithm.Lock()
+ listCompressionAlgorithm = list
+ muListCompressionAlgorithm.Unlock()
+}
+
+// CompressionAlgorithms returns a list of all available values for CompressionAlgorithm.
+func CompressionAlgorithms() []CompressionAlgorithm {
+ muListCompressionAlgorithm.RLock()
+ defer muListCompressionAlgorithm.RUnlock()
+ return listCompressionAlgorithm
+}
+
+// MarshalJSON serializes the CompressionAlgorithm object to a JSON string.
+func (s CompressionAlgorithm) MarshalJSON() ([]byte, error) {
+ return json.Marshal(s.String())
+}
+
+// UnmarshalJSON deserializes the JSON string to a CompressionAlgorithm object.
+func (s *CompressionAlgorithm) UnmarshalJSON(data []byte) error {
+ var name string
+ if err := json.Unmarshal(data, &name); err != nil {
+ return fmt.Errorf(`failed to unmarshal CompressionAlgorithm: %w`, err)
+ }
+ v, ok := LookupCompressionAlgorithm(name)
+ if !ok {
+ return fmt.Errorf(`unknown CompressionAlgorithm: %q`, name)
+ }
+ *s = v
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwa/content_encryption_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwa/content_encryption_gen.go
new file mode 100644
index 0000000000..8ccc47e462
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwa/content_encryption_gen.go
@@ -0,0 +1,179 @@
+// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT.
+
+package jwa
+
+import (
+ "encoding/json"
+ "fmt"
+ "sort"
+ "sync"
+
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+)
+
+var muAllContentEncryptionAlgorithm sync.RWMutex
+var allContentEncryptionAlgorithm = map[string]ContentEncryptionAlgorithm{}
+var muListContentEncryptionAlgorithm sync.RWMutex
+var listContentEncryptionAlgorithm []ContentEncryptionAlgorithm
+var builtinContentEncryptionAlgorithm = map[string]struct{}{}
+
+func init() {
+ // builtin values for ContentEncryptionAlgorithm
+ algorithms := make([]ContentEncryptionAlgorithm, 6)
+ algorithms[0] = NewContentEncryptionAlgorithm(tokens.A128CBC_HS256)
+ algorithms[1] = NewContentEncryptionAlgorithm(tokens.A128GCM)
+ algorithms[2] = NewContentEncryptionAlgorithm(tokens.A192CBC_HS384)
+ algorithms[3] = NewContentEncryptionAlgorithm(tokens.A192GCM)
+ algorithms[4] = NewContentEncryptionAlgorithm(tokens.A256CBC_HS512)
+ algorithms[5] = NewContentEncryptionAlgorithm(tokens.A256GCM)
+
+ RegisterContentEncryptionAlgorithm(algorithms...)
+}
+
+// A128CBC_HS256 returns an object representing A128CBC-HS256. Using this value specifies that the content should be encrypted using AES-CBC + HMAC-SHA256 (128).
+func A128CBC_HS256() ContentEncryptionAlgorithm {
+ return lookupBuiltinContentEncryptionAlgorithm(tokens.A128CBC_HS256)
+}
+
+// A128GCM returns an object representing A128GCM. Using this value specifies that the content should be encrypted using AES-GCM (128).
+func A128GCM() ContentEncryptionAlgorithm {
+ return lookupBuiltinContentEncryptionAlgorithm(tokens.A128GCM)
+}
+
+// A192CBC_HS384 returns an object representing A192CBC-HS384. Using this value specifies that the content should be encrypted using AES-CBC + HMAC-SHA384 (192).
+func A192CBC_HS384() ContentEncryptionAlgorithm {
+ return lookupBuiltinContentEncryptionAlgorithm(tokens.A192CBC_HS384)
+}
+
+// A192GCM returns an object representing A192GCM. Using this value specifies that the content should be encrypted using AES-GCM (192).
+func A192GCM() ContentEncryptionAlgorithm {
+ return lookupBuiltinContentEncryptionAlgorithm(tokens.A192GCM)
+}
+
+// A256CBC_HS512 returns an object representing A256CBC-HS512. Using this value specifies that the content should be encrypted using AES-CBC + HMAC-SHA512 (256).
+func A256CBC_HS512() ContentEncryptionAlgorithm {
+ return lookupBuiltinContentEncryptionAlgorithm(tokens.A256CBC_HS512)
+}
+
+// A256GCM returns an object representing A256GCM. Using this value specifies that the content should be encrypted using AES-GCM (256).
+func A256GCM() ContentEncryptionAlgorithm {
+ return lookupBuiltinContentEncryptionAlgorithm(tokens.A256GCM)
+}
+
+func lookupBuiltinContentEncryptionAlgorithm(name string) ContentEncryptionAlgorithm {
+ muAllContentEncryptionAlgorithm.RLock()
+ v, ok := allContentEncryptionAlgorithm[name]
+ muAllContentEncryptionAlgorithm.RUnlock()
+ if !ok {
+ panic(fmt.Sprintf(`jwa: ContentEncryptionAlgorithm %q not registered`, name))
+ }
+ return v
+}
+
+// ContentEncryptionAlgorithm represents the various encryption algorithms as described in https://tools.ietf.org/html/rfc7518#section-5
+type ContentEncryptionAlgorithm struct {
+ name string
+ deprecated bool
+}
+
+func (s ContentEncryptionAlgorithm) String() string {
+ return s.name
+}
+
+// IsDeprecated returns true if the ContentEncryptionAlgorithm object is deprecated.
+func (s ContentEncryptionAlgorithm) IsDeprecated() bool {
+ return s.deprecated
+}
+
+// EmptyContentEncryptionAlgorithm returns an empty ContentEncryptionAlgorithm object, used as a zero value.
+func EmptyContentEncryptionAlgorithm() ContentEncryptionAlgorithm {
+ return ContentEncryptionAlgorithm{}
+}
+
+// NewContentEncryptionAlgorithm creates a new ContentEncryptionAlgorithm object with the given name.
+func NewContentEncryptionAlgorithm(name string, options ...NewAlgorithmOption) ContentEncryptionAlgorithm {
+ var deprecated bool
+ for _, option := range options {
+ switch option.Ident() {
+ case identDeprecated{}:
+ if err := option.Value(&deprecated); err != nil {
+ panic("jwa.NewContentEncryptionAlgorithm: WithDeprecated option must be a boolean")
+ }
+ }
+ }
+ return ContentEncryptionAlgorithm{name: name, deprecated: deprecated}
+}
+
+// LookupContentEncryptionAlgorithm returns the ContentEncryptionAlgorithm object for the given name.
+func LookupContentEncryptionAlgorithm(name string) (ContentEncryptionAlgorithm, bool) {
+ muAllContentEncryptionAlgorithm.RLock()
+ v, ok := allContentEncryptionAlgorithm[name]
+ muAllContentEncryptionAlgorithm.RUnlock()
+ return v, ok
+}
+
+// RegisterContentEncryptionAlgorithm registers a new ContentEncryptionAlgorithm. The signature value must be immutable
+// and safe to be used by multiple goroutines, as it is going to be shared with all other users of this library.
+func RegisterContentEncryptionAlgorithm(algorithms ...ContentEncryptionAlgorithm) {
+ muAllContentEncryptionAlgorithm.Lock()
+ for _, alg := range algorithms {
+ allContentEncryptionAlgorithm[alg.String()] = alg
+ }
+ muAllContentEncryptionAlgorithm.Unlock()
+ rebuildContentEncryptionAlgorithm()
+}
+
+// UnregisterContentEncryptionAlgorithm unregisters a ContentEncryptionAlgorithm from its known database.
+// Non-existent entries, as well as built-in algorithms will silently be ignored.
+func UnregisterContentEncryptionAlgorithm(algorithms ...ContentEncryptionAlgorithm) {
+ muAllContentEncryptionAlgorithm.Lock()
+ for _, alg := range algorithms {
+ if _, ok := builtinContentEncryptionAlgorithm[alg.String()]; ok {
+ continue
+ }
+ delete(allContentEncryptionAlgorithm, alg.String())
+ }
+ muAllContentEncryptionAlgorithm.Unlock()
+ rebuildContentEncryptionAlgorithm()
+}
+
+func rebuildContentEncryptionAlgorithm() {
+ list := make([]ContentEncryptionAlgorithm, 0, len(allContentEncryptionAlgorithm))
+ muAllContentEncryptionAlgorithm.RLock()
+ for _, v := range allContentEncryptionAlgorithm {
+ list = append(list, v)
+ }
+ muAllContentEncryptionAlgorithm.RUnlock()
+ sort.Slice(list, func(i, j int) bool {
+ return list[i].String() < list[j].String()
+ })
+ muListContentEncryptionAlgorithm.Lock()
+ listContentEncryptionAlgorithm = list
+ muListContentEncryptionAlgorithm.Unlock()
+}
+
+// ContentEncryptionAlgorithms returns a list of all available values for ContentEncryptionAlgorithm.
+func ContentEncryptionAlgorithms() []ContentEncryptionAlgorithm {
+ muListContentEncryptionAlgorithm.RLock()
+ defer muListContentEncryptionAlgorithm.RUnlock()
+ return listContentEncryptionAlgorithm
+}
+
+// MarshalJSON serializes the ContentEncryptionAlgorithm object to a JSON string.
+func (s ContentEncryptionAlgorithm) MarshalJSON() ([]byte, error) {
+ return json.Marshal(s.String())
+}
+
+// UnmarshalJSON deserializes the JSON string to a ContentEncryptionAlgorithm object.
+func (s *ContentEncryptionAlgorithm) UnmarshalJSON(data []byte) error {
+ var name string
+ if err := json.Unmarshal(data, &name); err != nil {
+ return fmt.Errorf(`failed to unmarshal ContentEncryptionAlgorithm: %w`, err)
+ }
+ v, ok := LookupContentEncryptionAlgorithm(name)
+ if !ok {
+ return fmt.Errorf(`unknown ContentEncryptionAlgorithm: %q`, name)
+ }
+ *s = v
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwa/elliptic_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwa/elliptic_gen.go
new file mode 100644
index 0000000000..2418efde08
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwa/elliptic_gen.go
@@ -0,0 +1,190 @@
+// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT.
+
+package jwa
+
+import (
+ "encoding/json"
+ "fmt"
+ "sort"
+ "sync"
+)
+
+var muAllEllipticCurveAlgorithm sync.RWMutex
+var allEllipticCurveAlgorithm = map[string]EllipticCurveAlgorithm{}
+var muListEllipticCurveAlgorithm sync.RWMutex
+var listEllipticCurveAlgorithm []EllipticCurveAlgorithm
+var builtinEllipticCurveAlgorithm = map[string]struct{}{}
+
+func init() {
+ // builtin values for EllipticCurveAlgorithm
+ algorithms := make([]EllipticCurveAlgorithm, 7)
+ algorithms[0] = NewEllipticCurveAlgorithm("Ed25519")
+ algorithms[1] = NewEllipticCurveAlgorithm("Ed448")
+ algorithms[2] = NewEllipticCurveAlgorithm("P-256")
+ algorithms[3] = NewEllipticCurveAlgorithm("P-384")
+ algorithms[4] = NewEllipticCurveAlgorithm("P-521")
+ algorithms[5] = NewEllipticCurveAlgorithm("X25519")
+ algorithms[6] = NewEllipticCurveAlgorithm("X448")
+
+ RegisterEllipticCurveAlgorithm(algorithms...)
+}
+
+// Ed25519 returns an object representing Ed25519 algorithm for EdDSA operations.
+func Ed25519() EllipticCurveAlgorithm {
+ return lookupBuiltinEllipticCurveAlgorithm("Ed25519")
+}
+
+// Ed448 returns an object representing Ed448 algorithm for EdDSA operations.
+func Ed448() EllipticCurveAlgorithm {
+ return lookupBuiltinEllipticCurveAlgorithm("Ed448")
+}
+
+var invalidEllipticCurve = NewEllipticCurveAlgorithm("P-invalid")
+
+// InvalidEllipticCurve returns an object representing an invalid elliptic curve.
+func InvalidEllipticCurve() EllipticCurveAlgorithm {
+ return invalidEllipticCurve
+}
+
+// P256 returns an object representing P-256 algorithm for ECDSA operations.
+func P256() EllipticCurveAlgorithm {
+ return lookupBuiltinEllipticCurveAlgorithm("P-256")
+}
+
+// P384 returns an object representing P-384 algorithm for ECDSA operations.
+func P384() EllipticCurveAlgorithm {
+ return lookupBuiltinEllipticCurveAlgorithm("P-384")
+}
+
+// P521 returns an object representing P-521 algorithm for ECDSA operations.
+func P521() EllipticCurveAlgorithm {
+ return lookupBuiltinEllipticCurveAlgorithm("P-521")
+}
+
+// X25519 returns an object representing X25519 algorithm for ECDH operations.
+func X25519() EllipticCurveAlgorithm {
+ return lookupBuiltinEllipticCurveAlgorithm("X25519")
+}
+
+// X448 returns an object representing X448 algorithm for ECDH operations.
+func X448() EllipticCurveAlgorithm {
+ return lookupBuiltinEllipticCurveAlgorithm("X448")
+}
+
+func lookupBuiltinEllipticCurveAlgorithm(name string) EllipticCurveAlgorithm {
+ muAllEllipticCurveAlgorithm.RLock()
+ v, ok := allEllipticCurveAlgorithm[name]
+ muAllEllipticCurveAlgorithm.RUnlock()
+ if !ok {
+ panic(fmt.Sprintf(`jwa: EllipticCurveAlgorithm %q not registered`, name))
+ }
+ return v
+}
+
+// EllipticCurveAlgorithm represents the algorithms used for EC keys
+type EllipticCurveAlgorithm struct {
+ name string
+ deprecated bool
+}
+
+func (s EllipticCurveAlgorithm) String() string {
+ return s.name
+}
+
+// IsDeprecated returns true if the EllipticCurveAlgorithm object is deprecated.
+func (s EllipticCurveAlgorithm) IsDeprecated() bool {
+ return s.deprecated
+}
+
+// EmptyEllipticCurveAlgorithm returns an empty EllipticCurveAlgorithm object, used as a zero value.
+func EmptyEllipticCurveAlgorithm() EllipticCurveAlgorithm {
+ return EllipticCurveAlgorithm{}
+}
+
+// NewEllipticCurveAlgorithm creates a new EllipticCurveAlgorithm object with the given name.
+func NewEllipticCurveAlgorithm(name string, options ...NewAlgorithmOption) EllipticCurveAlgorithm {
+ var deprecated bool
+ for _, option := range options {
+ switch option.Ident() {
+ case identDeprecated{}:
+ if err := option.Value(&deprecated); err != nil {
+ panic("jwa.NewEllipticCurveAlgorithm: WithDeprecated option must be a boolean")
+ }
+ }
+ }
+ return EllipticCurveAlgorithm{name: name, deprecated: deprecated}
+}
+
+// LookupEllipticCurveAlgorithm returns the EllipticCurveAlgorithm object for the given name.
+func LookupEllipticCurveAlgorithm(name string) (EllipticCurveAlgorithm, bool) {
+ muAllEllipticCurveAlgorithm.RLock()
+ v, ok := allEllipticCurveAlgorithm[name]
+ muAllEllipticCurveAlgorithm.RUnlock()
+ return v, ok
+}
+
+// RegisterEllipticCurveAlgorithm registers a new EllipticCurveAlgorithm. The signature value must be immutable
+// and safe to be used by multiple goroutines, as it is going to be shared with all other users of this library.
+func RegisterEllipticCurveAlgorithm(algorithms ...EllipticCurveAlgorithm) {
+ muAllEllipticCurveAlgorithm.Lock()
+ for _, alg := range algorithms {
+ allEllipticCurveAlgorithm[alg.String()] = alg
+ }
+ muAllEllipticCurveAlgorithm.Unlock()
+ rebuildEllipticCurveAlgorithm()
+}
+
+// UnregisterEllipticCurveAlgorithm unregisters a EllipticCurveAlgorithm from its known database.
+// Non-existent entries, as well as built-in algorithms will silently be ignored.
+func UnregisterEllipticCurveAlgorithm(algorithms ...EllipticCurveAlgorithm) {
+ muAllEllipticCurveAlgorithm.Lock()
+ for _, alg := range algorithms {
+ if _, ok := builtinEllipticCurveAlgorithm[alg.String()]; ok {
+ continue
+ }
+ delete(allEllipticCurveAlgorithm, alg.String())
+ }
+ muAllEllipticCurveAlgorithm.Unlock()
+ rebuildEllipticCurveAlgorithm()
+}
+
+func rebuildEllipticCurveAlgorithm() {
+ list := make([]EllipticCurveAlgorithm, 0, len(allEllipticCurveAlgorithm))
+ muAllEllipticCurveAlgorithm.RLock()
+ for _, v := range allEllipticCurveAlgorithm {
+ list = append(list, v)
+ }
+ muAllEllipticCurveAlgorithm.RUnlock()
+ sort.Slice(list, func(i, j int) bool {
+ return list[i].String() < list[j].String()
+ })
+ muListEllipticCurveAlgorithm.Lock()
+ listEllipticCurveAlgorithm = list
+ muListEllipticCurveAlgorithm.Unlock()
+}
+
+// EllipticCurveAlgorithms returns a list of all available values for EllipticCurveAlgorithm.
+func EllipticCurveAlgorithms() []EllipticCurveAlgorithm {
+ muListEllipticCurveAlgorithm.RLock()
+ defer muListEllipticCurveAlgorithm.RUnlock()
+ return listEllipticCurveAlgorithm
+}
+
+// MarshalJSON serializes the EllipticCurveAlgorithm object to a JSON string.
+func (s EllipticCurveAlgorithm) MarshalJSON() ([]byte, error) {
+ return json.Marshal(s.String())
+}
+
+// UnmarshalJSON deserializes the JSON string to a EllipticCurveAlgorithm object.
+func (s *EllipticCurveAlgorithm) UnmarshalJSON(data []byte) error {
+ var name string
+ if err := json.Unmarshal(data, &name); err != nil {
+ return fmt.Errorf(`failed to unmarshal EllipticCurveAlgorithm: %w`, err)
+ }
+ v, ok := LookupEllipticCurveAlgorithm(name)
+ if !ok {
+ return fmt.Errorf(`unknown EllipticCurveAlgorithm: %q`, name)
+ }
+ *s = v
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwa/jwa.go b/vendor/github.com/lestrrat-go/jwx/v3/jwa/jwa.go
new file mode 100644
index 0000000000..29ac1dfe76
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwa/jwa.go
@@ -0,0 +1,68 @@
+//go:generate ../tools/cmd/genjwa.sh
+
+// Package jwa defines the various algorithm described in https://tools.ietf.org/html/rfc7518
+package jwa
+
+import (
+ "errors"
+ "fmt"
+)
+
+// KeyAlgorithm is a workaround for jwk.Key being able to contain different
+// types of algorithms in its `alg` field.
+//
+// Previously the storage for the `alg` field was represented as a string,
+// but this caused some users to wonder why the field was not typed appropriately
+// like other fields.
+//
+// Ideally we would like to keep track of Signature Algorithms and
+// Key Encryption Algorithms separately, and force the APIs to
+// type-check at compile time, but this allows users to pass a value from a
+// jwk.Key directly
+type KeyAlgorithm interface {
+ String() string
+ IsDeprecated() bool
+}
+
+var errInvalidKeyAlgorithm = errors.New(`invalid key algorithm`)
+
+func ErrInvalidKeyAlgorithm() error {
+ return errInvalidKeyAlgorithm
+}
+
+// KeyAlgorithmFrom takes either a string, `jwa.SignatureAlgorithm`,
+// `jwa.KeyEncryptionAlgorithm`, or `jwa.ContentEncryptionAlgorithm`.
+// and returns a `jwa.KeyAlgorithm`.
+//
+// If the value cannot be handled, it returns an `jwa.InvalidKeyAlgorithm`
+// object instead of returning an error. This design choice was made to allow
+// users to directly pass the return value to functions such as `jws.Sign()`
+func KeyAlgorithmFrom(v any) (KeyAlgorithm, error) {
+ switch v := v.(type) {
+ case SignatureAlgorithm:
+ return v, nil
+ case KeyEncryptionAlgorithm:
+ return v, nil
+ case ContentEncryptionAlgorithm:
+ return v, nil
+ case string:
+ salg, ok := LookupSignatureAlgorithm(v)
+ if ok {
+ return salg, nil
+ }
+
+ kalg, ok := LookupKeyEncryptionAlgorithm(v)
+ if ok {
+ return kalg, nil
+ }
+
+ calg, ok := LookupContentEncryptionAlgorithm(v)
+ if ok {
+ return calg, nil
+ }
+
+ return nil, fmt.Errorf(`invalid key value: %q: %w`, v, errInvalidKeyAlgorithm)
+ default:
+ return nil, fmt.Errorf(`invalid key type: %T: %w`, v, errInvalidKeyAlgorithm)
+ }
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwa/key_encryption_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwa/key_encryption_gen.go
new file mode 100644
index 0000000000..716c43cd04
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwa/key_encryption_gen.go
@@ -0,0 +1,268 @@
+// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT.
+
+package jwa
+
+import (
+ "encoding/json"
+ "fmt"
+ "sort"
+ "sync"
+
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+)
+
+var muAllKeyEncryptionAlgorithm sync.RWMutex
+var allKeyEncryptionAlgorithm = map[string]KeyEncryptionAlgorithm{}
+var muListKeyEncryptionAlgorithm sync.RWMutex
+var listKeyEncryptionAlgorithm []KeyEncryptionAlgorithm
+var builtinKeyEncryptionAlgorithm = map[string]struct{}{}
+
+func init() {
+ // builtin values for KeyEncryptionAlgorithm
+ algorithms := make([]KeyEncryptionAlgorithm, 19)
+ algorithms[0] = NewKeyEncryptionAlgorithm(tokens.A128GCMKW, WithIsSymmetric(true))
+ algorithms[1] = NewKeyEncryptionAlgorithm(tokens.A128KW, WithIsSymmetric(true))
+ algorithms[2] = NewKeyEncryptionAlgorithm(tokens.A192GCMKW, WithIsSymmetric(true))
+ algorithms[3] = NewKeyEncryptionAlgorithm(tokens.A192KW, WithIsSymmetric(true))
+ algorithms[4] = NewKeyEncryptionAlgorithm(tokens.A256GCMKW, WithIsSymmetric(true))
+ algorithms[5] = NewKeyEncryptionAlgorithm(tokens.A256KW, WithIsSymmetric(true))
+ algorithms[6] = NewKeyEncryptionAlgorithm(tokens.DIRECT, WithIsSymmetric(true))
+ algorithms[7] = NewKeyEncryptionAlgorithm(tokens.ECDH_ES)
+ algorithms[8] = NewKeyEncryptionAlgorithm(tokens.ECDH_ES_A128KW)
+ algorithms[9] = NewKeyEncryptionAlgorithm(tokens.ECDH_ES_A192KW)
+ algorithms[10] = NewKeyEncryptionAlgorithm(tokens.ECDH_ES_A256KW)
+ algorithms[11] = NewKeyEncryptionAlgorithm(tokens.PBES2_HS256_A128KW, WithIsSymmetric(true))
+ algorithms[12] = NewKeyEncryptionAlgorithm(tokens.PBES2_HS384_A192KW, WithIsSymmetric(true))
+ algorithms[13] = NewKeyEncryptionAlgorithm(tokens.PBES2_HS512_A256KW, WithIsSymmetric(true))
+ algorithms[14] = NewKeyEncryptionAlgorithm(tokens.RSA1_5, WithDeprecated(true))
+ algorithms[15] = NewKeyEncryptionAlgorithm(tokens.RSA_OAEP)
+ algorithms[16] = NewKeyEncryptionAlgorithm(tokens.RSA_OAEP_256)
+ algorithms[17] = NewKeyEncryptionAlgorithm(tokens.RSA_OAEP_384)
+ algorithms[18] = NewKeyEncryptionAlgorithm(tokens.RSA_OAEP_512)
+
+ RegisterKeyEncryptionAlgorithm(algorithms...)
+}
+
+// A128GCMKW returns an object representing AES-GCM key wrap (128) key encryption algorithm.
+func A128GCMKW() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.A128GCMKW)
+}
+
+// A128KW returns an object representing AES key wrap (128) key encryption algorithm.
+func A128KW() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.A128KW)
+}
+
+// A192GCMKW returns an object representing AES-GCM key wrap (192) key encryption algorithm.
+func A192GCMKW() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.A192GCMKW)
+}
+
+// A192KW returns an object representing AES key wrap (192) key encryption algorithm.
+func A192KW() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.A192KW)
+}
+
+// A256GCMKW returns an object representing AES-GCM key wrap (256) key encryption algorithm.
+func A256GCMKW() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.A256GCMKW)
+}
+
+// A256KW returns an object representing AES key wrap (256) key encryption algorithm.
+func A256KW() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.A256KW)
+}
+
+// DIRECT returns an object representing Direct key encryption algorithm.
+func DIRECT() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.DIRECT)
+}
+
+// ECDH_ES returns an object representing ECDH-ES key encryption algorithm.
+func ECDH_ES() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.ECDH_ES)
+}
+
+// ECDH_ES_A128KW returns an object representing ECDH-ES + AES key wrap (128) key encryption algorithm.
+func ECDH_ES_A128KW() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.ECDH_ES_A128KW)
+}
+
+// ECDH_ES_A192KW returns an object representing ECDH-ES + AES key wrap (192) key encryption algorithm.
+func ECDH_ES_A192KW() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.ECDH_ES_A192KW)
+}
+
+// ECDH_ES_A256KW returns an object representing ECDH-ES + AES key wrap (256) key encryption algorithm.
+func ECDH_ES_A256KW() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.ECDH_ES_A256KW)
+}
+
+// PBES2_HS256_A128KW returns an object representing PBES2 + HMAC-SHA256 + AES key wrap (128) key encryption algorithm.
+func PBES2_HS256_A128KW() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.PBES2_HS256_A128KW)
+}
+
+// PBES2_HS384_A192KW returns an object representing PBES2 + HMAC-SHA384 + AES key wrap (192) key encryption algorithm.
+func PBES2_HS384_A192KW() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.PBES2_HS384_A192KW)
+}
+
+// PBES2_HS512_A256KW returns an object representing PBES2 + HMAC-SHA512 + AES key wrap (256) key encryption algorithm.
+func PBES2_HS512_A256KW() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.PBES2_HS512_A256KW)
+}
+
+// RSA1_5 returns an object representing RSA-PKCS1v1.5 key encryption algorithm.
+func RSA1_5() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.RSA1_5)
+}
+
+// RSA_OAEP returns an object representing RSA-OAEP-SHA1 key encryption algorithm.
+func RSA_OAEP() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.RSA_OAEP)
+}
+
+// RSA_OAEP_256 returns an object representing RSA-OAEP-SHA256 key encryption algorithm.
+func RSA_OAEP_256() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.RSA_OAEP_256)
+}
+
+// RSA_OAEP_384 returns an object representing RSA-OAEP-SHA384 key encryption algorithm.
+func RSA_OAEP_384() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.RSA_OAEP_384)
+}
+
+// RSA_OAEP_512 returns an object representing RSA-OAEP-SHA512 key encryption algorithm.
+func RSA_OAEP_512() KeyEncryptionAlgorithm {
+ return lookupBuiltinKeyEncryptionAlgorithm(tokens.RSA_OAEP_512)
+}
+
+func lookupBuiltinKeyEncryptionAlgorithm(name string) KeyEncryptionAlgorithm {
+ muAllKeyEncryptionAlgorithm.RLock()
+ v, ok := allKeyEncryptionAlgorithm[name]
+ muAllKeyEncryptionAlgorithm.RUnlock()
+ if !ok {
+ panic(fmt.Sprintf(`jwa: KeyEncryptionAlgorithm %q not registered`, name))
+ }
+ return v
+}
+
+// KeyEncryptionAlgorithm represents the various encryption algorithms as described in https://tools.ietf.org/html/rfc7518#section-4.1
+type KeyEncryptionAlgorithm struct {
+ name string
+ deprecated bool
+ isSymmetric bool
+}
+
+func (s KeyEncryptionAlgorithm) String() string {
+ return s.name
+}
+
+// IsDeprecated returns true if the KeyEncryptionAlgorithm object is deprecated.
+func (s KeyEncryptionAlgorithm) IsDeprecated() bool {
+ return s.deprecated
+}
+
+// IsSymmetric returns true if the KeyEncryptionAlgorithm object is symmetric. Symmetric algorithms use the same key for both encryption and decryption.
+func (s KeyEncryptionAlgorithm) IsSymmetric() bool {
+ return s.isSymmetric
+}
+
+// EmptyKeyEncryptionAlgorithm returns an empty KeyEncryptionAlgorithm object, used as a zero value.
+func EmptyKeyEncryptionAlgorithm() KeyEncryptionAlgorithm {
+ return KeyEncryptionAlgorithm{}
+}
+
+// NewKeyEncryptionAlgorithm creates a new KeyEncryptionAlgorithm object with the given name.
+func NewKeyEncryptionAlgorithm(name string, options ...NewKeyEncryptionAlgorithmOption) KeyEncryptionAlgorithm {
+ var deprecated bool
+ var isSymmetric bool
+ for _, option := range options {
+ switch option.Ident() {
+ case identIsSymmetric{}:
+ if err := option.Value(&isSymmetric); err != nil {
+ panic("jwa.NewKeyEncryptionAlgorithm: WithIsSymmetric option must be a boolean")
+ }
+ case identDeprecated{}:
+ if err := option.Value(&deprecated); err != nil {
+ panic("jwa.NewKeyEncryptionAlgorithm: WithDeprecated option must be a boolean")
+ }
+ }
+ }
+ return KeyEncryptionAlgorithm{name: name, deprecated: deprecated, isSymmetric: isSymmetric}
+}
+
+// LookupKeyEncryptionAlgorithm returns the KeyEncryptionAlgorithm object for the given name.
+func LookupKeyEncryptionAlgorithm(name string) (KeyEncryptionAlgorithm, bool) {
+ muAllKeyEncryptionAlgorithm.RLock()
+ v, ok := allKeyEncryptionAlgorithm[name]
+ muAllKeyEncryptionAlgorithm.RUnlock()
+ return v, ok
+}
+
+// RegisterKeyEncryptionAlgorithm registers a new KeyEncryptionAlgorithm. The signature value must be immutable
+// and safe to be used by multiple goroutines, as it is going to be shared with all other users of this library.
+func RegisterKeyEncryptionAlgorithm(algorithms ...KeyEncryptionAlgorithm) {
+ muAllKeyEncryptionAlgorithm.Lock()
+ for _, alg := range algorithms {
+ allKeyEncryptionAlgorithm[alg.String()] = alg
+ }
+ muAllKeyEncryptionAlgorithm.Unlock()
+ rebuildKeyEncryptionAlgorithm()
+}
+
+// UnregisterKeyEncryptionAlgorithm unregisters a KeyEncryptionAlgorithm from its known database.
+// Non-existent entries, as well as built-in algorithms will silently be ignored.
+func UnregisterKeyEncryptionAlgorithm(algorithms ...KeyEncryptionAlgorithm) {
+ muAllKeyEncryptionAlgorithm.Lock()
+ for _, alg := range algorithms {
+ if _, ok := builtinKeyEncryptionAlgorithm[alg.String()]; ok {
+ continue
+ }
+ delete(allKeyEncryptionAlgorithm, alg.String())
+ }
+ muAllKeyEncryptionAlgorithm.Unlock()
+ rebuildKeyEncryptionAlgorithm()
+}
+
+func rebuildKeyEncryptionAlgorithm() {
+ list := make([]KeyEncryptionAlgorithm, 0, len(allKeyEncryptionAlgorithm))
+ muAllKeyEncryptionAlgorithm.RLock()
+ for _, v := range allKeyEncryptionAlgorithm {
+ list = append(list, v)
+ }
+ muAllKeyEncryptionAlgorithm.RUnlock()
+ sort.Slice(list, func(i, j int) bool {
+ return list[i].String() < list[j].String()
+ })
+ muListKeyEncryptionAlgorithm.Lock()
+ listKeyEncryptionAlgorithm = list
+ muListKeyEncryptionAlgorithm.Unlock()
+}
+
+// KeyEncryptionAlgorithms returns a list of all available values for KeyEncryptionAlgorithm.
+func KeyEncryptionAlgorithms() []KeyEncryptionAlgorithm {
+ muListKeyEncryptionAlgorithm.RLock()
+ defer muListKeyEncryptionAlgorithm.RUnlock()
+ return listKeyEncryptionAlgorithm
+}
+
+// MarshalJSON serializes the KeyEncryptionAlgorithm object to a JSON string.
+func (s KeyEncryptionAlgorithm) MarshalJSON() ([]byte, error) {
+ return json.Marshal(s.String())
+}
+
+// UnmarshalJSON deserializes the JSON string to a KeyEncryptionAlgorithm object.
+func (s *KeyEncryptionAlgorithm) UnmarshalJSON(data []byte) error {
+ var name string
+ if err := json.Unmarshal(data, &name); err != nil {
+ return fmt.Errorf(`failed to unmarshal KeyEncryptionAlgorithm: %w`, err)
+ }
+ v, ok := LookupKeyEncryptionAlgorithm(name)
+ if !ok {
+ return fmt.Errorf(`unknown KeyEncryptionAlgorithm: %q`, name)
+ }
+ *s = v
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwa/key_type_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwa/key_type_gen.go
new file mode 100644
index 0000000000..8bc5ebb5f0
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwa/key_type_gen.go
@@ -0,0 +1,172 @@
+// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT.
+
+package jwa
+
+import (
+ "encoding/json"
+ "fmt"
+ "sort"
+ "sync"
+)
+
+var muAllKeyType sync.RWMutex
+var allKeyType = map[string]KeyType{}
+var muListKeyType sync.RWMutex
+var listKeyType []KeyType
+var builtinKeyType = map[string]struct{}{}
+
+func init() {
+ // builtin values for KeyType
+ algorithms := make([]KeyType, 4)
+ algorithms[0] = NewKeyType("EC")
+ algorithms[1] = NewKeyType("OKP")
+ algorithms[2] = NewKeyType("oct")
+ algorithms[3] = NewKeyType("RSA")
+
+ RegisterKeyType(algorithms...)
+}
+
+// EC returns an object representing EC. Elliptic Curve
+func EC() KeyType {
+ return lookupBuiltinKeyType("EC")
+}
+
+var invalidKeyType = NewKeyType("")
+
+// InvalidKeyType returns an object representing invalid key type. Invalid KeyType
+func InvalidKeyType() KeyType {
+ return invalidKeyType
+}
+
+// OKP returns an object representing OKP. Octet string key pairs
+func OKP() KeyType {
+ return lookupBuiltinKeyType("OKP")
+}
+
+// OctetSeq returns an object representing oct. Octet sequence (used to represent symmetric keys)
+func OctetSeq() KeyType {
+ return lookupBuiltinKeyType("oct")
+}
+
+// RSA returns an object representing RSA. RSA
+func RSA() KeyType {
+ return lookupBuiltinKeyType("RSA")
+}
+
+func lookupBuiltinKeyType(name string) KeyType {
+ muAllKeyType.RLock()
+ v, ok := allKeyType[name]
+ muAllKeyType.RUnlock()
+ if !ok {
+ panic(fmt.Sprintf(`jwa: KeyType %q not registered`, name))
+ }
+ return v
+}
+
+// KeyType represents the key type ("kty") that are supported
+type KeyType struct {
+ name string
+ deprecated bool
+}
+
+func (s KeyType) String() string {
+ return s.name
+}
+
+// IsDeprecated returns true if the KeyType object is deprecated.
+func (s KeyType) IsDeprecated() bool {
+ return s.deprecated
+}
+
+// EmptyKeyType returns an empty KeyType object, used as a zero value.
+func EmptyKeyType() KeyType {
+ return KeyType{}
+}
+
+// NewKeyType creates a new KeyType object with the given name.
+func NewKeyType(name string, options ...NewAlgorithmOption) KeyType {
+ var deprecated bool
+ for _, option := range options {
+ switch option.Ident() {
+ case identDeprecated{}:
+ if err := option.Value(&deprecated); err != nil {
+ panic("jwa.NewKeyType: WithDeprecated option must be a boolean")
+ }
+ }
+ }
+ return KeyType{name: name, deprecated: deprecated}
+}
+
+// LookupKeyType returns the KeyType object for the given name.
+func LookupKeyType(name string) (KeyType, bool) {
+ muAllKeyType.RLock()
+ v, ok := allKeyType[name]
+ muAllKeyType.RUnlock()
+ return v, ok
+}
+
+// RegisterKeyType registers a new KeyType. The signature value must be immutable
+// and safe to be used by multiple goroutines, as it is going to be shared with all other users of this library.
+func RegisterKeyType(algorithms ...KeyType) {
+ muAllKeyType.Lock()
+ for _, alg := range algorithms {
+ allKeyType[alg.String()] = alg
+ }
+ muAllKeyType.Unlock()
+ rebuildKeyType()
+}
+
+// UnregisterKeyType unregisters a KeyType from its known database.
+// Non-existent entries, as well as built-in algorithms will silently be ignored.
+func UnregisterKeyType(algorithms ...KeyType) {
+ muAllKeyType.Lock()
+ for _, alg := range algorithms {
+ if _, ok := builtinKeyType[alg.String()]; ok {
+ continue
+ }
+ delete(allKeyType, alg.String())
+ }
+ muAllKeyType.Unlock()
+ rebuildKeyType()
+}
+
+func rebuildKeyType() {
+ list := make([]KeyType, 0, len(allKeyType))
+ muAllKeyType.RLock()
+ for _, v := range allKeyType {
+ list = append(list, v)
+ }
+ muAllKeyType.RUnlock()
+ sort.Slice(list, func(i, j int) bool {
+ return list[i].String() < list[j].String()
+ })
+ muListKeyType.Lock()
+ listKeyType = list
+ muListKeyType.Unlock()
+}
+
+// KeyTypes returns a list of all available values for KeyType.
+func KeyTypes() []KeyType {
+ muListKeyType.RLock()
+ defer muListKeyType.RUnlock()
+ return listKeyType
+}
+
+// MarshalJSON serializes the KeyType object to a JSON string.
+func (s KeyType) MarshalJSON() ([]byte, error) {
+ return json.Marshal(s.String())
+}
+
+// UnmarshalJSON deserializes the JSON string to a KeyType object.
+func (s *KeyType) UnmarshalJSON(data []byte) error {
+ var name string
+ if err := json.Unmarshal(data, &name); err != nil {
+ return fmt.Errorf(`failed to unmarshal KeyType: %w`, err)
+ }
+ v, ok := LookupKeyType(name)
+ if !ok {
+ return fmt.Errorf(`unknown KeyType: %q`, name)
+ }
+ *s = v
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwa/options.yaml b/vendor/github.com/lestrrat-go/jwx/v3/jwa/options.yaml
new file mode 100644
index 0000000000..dd498c680e
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwa/options.yaml
@@ -0,0 +1,41 @@
+package_name: jwa
+output: jwa/options_gen.go
+interfaces:
+ - name: NewAlgorithmOption
+ methods:
+ - newSignatureAlgorithmOption
+ - newKeyEncryptionAlgorithmOption
+ - newSignatureKeyEncryptionAlgorithmOption
+ comment: |
+ NewAlgorithmOption represents an option that can be passed to any of the constructor functions
+ - name: NewSignatureAlgorithmOption
+ methods:
+ - newSignatureAlgorithmOption
+ comment: |
+ NewSignatureAlgorithmOption represents an option that can be passed to the NewSignatureAlgorithm
+ - name: NewKeyEncryptionAlgorithmOption
+ methods:
+ - newKeyEncryptionAlgorithmOption
+ comment: |
+ NewKeyEncryptionAlgorithmOption represents an option that can be passed to the NewKeyEncryptionAlgorithm
+ - name: NewSignatureKeyEncryptionAlgorithmOption
+ comment: |
+ NewSignatureKeyEncryptionAlgorithmOption represents an option that can be passed to both
+ NewSignatureAlgorithm and NewKeyEncryptionAlgorithm
+ methods:
+ - newSignatureAlgorithmOption
+ - newKeyEncryptionAlgorithmOption
+options:
+ - ident: IsSymmetric
+ interface: NewSignatureKeyEncryptionAlgorithmOption
+ argument_type: bool
+ comment: |
+ IsSymmetric specifies that the algorithm is symmetric
+ - ident: Deprecated
+ interface: NewAlgorithmOption
+ argument_type: bool
+ comment: |
+ WithDeprecated specifies that the algorithm is deprecated. In order to
+ un-deprecate an algorithm, you will have to create a new algorithm
+ with the same values but with the Deprecated option set to false, and
+ then call RegisterXXXXAlgorithm with the new algorithm.
\ No newline at end of file
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwa/options_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwa/options_gen.go
new file mode 100644
index 0000000000..9394ac587a
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwa/options_gen.go
@@ -0,0 +1,91 @@
+// Code generated by tools/cmd/genoptions/main.go. DO NOT EDIT.
+
+package jwa
+
+import (
+ "github.com/lestrrat-go/option/v2"
+)
+
+type Option = option.Interface
+
+// NewAlgorithmOption represents an option that can be passed to any of the constructor functions
+type NewAlgorithmOption interface {
+ Option
+ newSignatureAlgorithmOption()
+ newKeyEncryptionAlgorithmOption()
+ newSignatureKeyEncryptionAlgorithmOption()
+}
+
+type newAlgorithmOption struct {
+ Option
+}
+
+func (*newAlgorithmOption) newSignatureAlgorithmOption() {}
+
+func (*newAlgorithmOption) newKeyEncryptionAlgorithmOption() {}
+
+func (*newAlgorithmOption) newSignatureKeyEncryptionAlgorithmOption() {}
+
+// NewKeyEncryptionAlgorithmOption represents an option that can be passed to the NewKeyEncryptionAlgorithm
+type NewKeyEncryptionAlgorithmOption interface {
+ Option
+ newKeyEncryptionAlgorithmOption()
+}
+
+type newKeyEncryptionAlgorithmOption struct {
+ Option
+}
+
+func (*newKeyEncryptionAlgorithmOption) newKeyEncryptionAlgorithmOption() {}
+
+// NewSignatureAlgorithmOption represents an option that can be passed to the NewSignatureAlgorithm
+type NewSignatureAlgorithmOption interface {
+ Option
+ newSignatureAlgorithmOption()
+}
+
+type newSignatureAlgorithmOption struct {
+ Option
+}
+
+func (*newSignatureAlgorithmOption) newSignatureAlgorithmOption() {}
+
+// NewSignatureKeyEncryptionAlgorithmOption represents an option that can be passed to both
+// NewSignatureAlgorithm and NewKeyEncryptionAlgorithm
+type NewSignatureKeyEncryptionAlgorithmOption interface {
+ Option
+ newSignatureAlgorithmOption()
+ newKeyEncryptionAlgorithmOption()
+}
+
+type newSignatureKeyEncryptionAlgorithmOption struct {
+ Option
+}
+
+func (*newSignatureKeyEncryptionAlgorithmOption) newSignatureAlgorithmOption() {}
+
+func (*newSignatureKeyEncryptionAlgorithmOption) newKeyEncryptionAlgorithmOption() {}
+
+type identDeprecated struct{}
+type identIsSymmetric struct{}
+
+func (identDeprecated) String() string {
+ return "WithDeprecated"
+}
+
+func (identIsSymmetric) String() string {
+ return "WithIsSymmetric"
+}
+
+// WithDeprecated specifies that the algorithm is deprecated. In order to
+// un-deprecate an algorithm, you will have to create a new algorithm
+// with the same values but with the Deprecated option set to false, and
+// then call RegisterXXXXAlgorithm with the new algorithm.
+func WithDeprecated(v bool) NewAlgorithmOption {
+ return &newAlgorithmOption{option.New(identDeprecated{}, v)}
+}
+
+// IsSymmetric specifies that the algorithm is symmetric
+func WithIsSymmetric(v bool) NewSignatureKeyEncryptionAlgorithmOption {
+ return &newSignatureKeyEncryptionAlgorithmOption{option.New(identIsSymmetric{}, v)}
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwa/secp2561k.go b/vendor/github.com/lestrrat-go/jwx/v3/jwa/secp2561k.go
new file mode 100644
index 0000000000..9ce6ad4d05
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwa/secp2561k.go
@@ -0,0 +1,14 @@
+//go:build jwx_es256k
+
+package jwa
+
+var secp256k1Algorithm = NewEllipticCurveAlgorithm("secp256k1")
+
+// This constant is only available if compiled with jwx_es256k build tag
+func Secp256k1() EllipticCurveAlgorithm {
+ return secp256k1Algorithm
+}
+
+func init() {
+ RegisterEllipticCurveAlgorithm(secp256k1Algorithm)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwa/signature_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwa/signature_gen.go
new file mode 100644
index 0000000000..653d7d56af
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwa/signature_gen.go
@@ -0,0 +1,242 @@
+// Code generated by tools/cmd/genjwa/main.go. DO NOT EDIT.
+
+package jwa
+
+import (
+ "encoding/json"
+ "fmt"
+ "sort"
+ "sync"
+)
+
+var muAllSignatureAlgorithm sync.RWMutex
+var allSignatureAlgorithm = map[string]SignatureAlgorithm{}
+var muListSignatureAlgorithm sync.RWMutex
+var listSignatureAlgorithm []SignatureAlgorithm
+var builtinSignatureAlgorithm = map[string]struct{}{}
+
+func init() {
+ // builtin values for SignatureAlgorithm
+ algorithms := make([]SignatureAlgorithm, 15)
+ algorithms[0] = NewSignatureAlgorithm("ES256")
+ algorithms[1] = NewSignatureAlgorithm("ES256K")
+ algorithms[2] = NewSignatureAlgorithm("ES384")
+ algorithms[3] = NewSignatureAlgorithm("ES512")
+ algorithms[4] = NewSignatureAlgorithm("EdDSA")
+ algorithms[5] = NewSignatureAlgorithm("HS256", WithIsSymmetric(true))
+ algorithms[6] = NewSignatureAlgorithm("HS384", WithIsSymmetric(true))
+ algorithms[7] = NewSignatureAlgorithm("HS512", WithIsSymmetric(true))
+ algorithms[8] = NewSignatureAlgorithm("none")
+ algorithms[9] = NewSignatureAlgorithm("PS256")
+ algorithms[10] = NewSignatureAlgorithm("PS384")
+ algorithms[11] = NewSignatureAlgorithm("PS512")
+ algorithms[12] = NewSignatureAlgorithm("RS256")
+ algorithms[13] = NewSignatureAlgorithm("RS384")
+ algorithms[14] = NewSignatureAlgorithm("RS512")
+
+ RegisterSignatureAlgorithm(algorithms...)
+}
+
+// ES256 returns an object representing ECDSA signature algorithm using P-256 curve and SHA-256.
+func ES256() SignatureAlgorithm {
+ return lookupBuiltinSignatureAlgorithm("ES256")
+}
+
+// ES256K returns an object representing ECDSA signature algorithm using secp256k1 curve and SHA-256.
+func ES256K() SignatureAlgorithm {
+ return lookupBuiltinSignatureAlgorithm("ES256K")
+}
+
+// ES384 returns an object representing ECDSA signature algorithm using P-384 curve and SHA-384.
+func ES384() SignatureAlgorithm {
+ return lookupBuiltinSignatureAlgorithm("ES384")
+}
+
+// ES512 returns an object representing ECDSA signature algorithm using P-521 curve and SHA-512.
+func ES512() SignatureAlgorithm {
+ return lookupBuiltinSignatureAlgorithm("ES512")
+}
+
+// EdDSA returns an object representing EdDSA signature algorithms.
+func EdDSA() SignatureAlgorithm {
+ return lookupBuiltinSignatureAlgorithm("EdDSA")
+}
+
+// HS256 returns an object representing HMAC signature algorithm using SHA-256.
+func HS256() SignatureAlgorithm {
+ return lookupBuiltinSignatureAlgorithm("HS256")
+}
+
+// HS384 returns an object representing HMAC signature algorithm using SHA-384.
+func HS384() SignatureAlgorithm {
+ return lookupBuiltinSignatureAlgorithm("HS384")
+}
+
+// HS512 returns an object representing HMAC signature algorithm using SHA-512.
+func HS512() SignatureAlgorithm {
+ return lookupBuiltinSignatureAlgorithm("HS512")
+}
+
+// NoSignature returns an object representing the lack of a signature algorithm. Using this value specifies that the content should not be signed, which you should avoid doing.
+func NoSignature() SignatureAlgorithm {
+ return lookupBuiltinSignatureAlgorithm("none")
+}
+
+// PS256 returns an object representing RSASSA-PSS signature algorithm using SHA-256 and MGF1-SHA256.
+func PS256() SignatureAlgorithm {
+ return lookupBuiltinSignatureAlgorithm("PS256")
+}
+
+// PS384 returns an object representing RSASSA-PSS signature algorithm using SHA-384 and MGF1-SHA384.
+func PS384() SignatureAlgorithm {
+ return lookupBuiltinSignatureAlgorithm("PS384")
+}
+
+// PS512 returns an object representing RSASSA-PSS signature algorithm using SHA-512 and MGF1-SHA512.
+func PS512() SignatureAlgorithm {
+ return lookupBuiltinSignatureAlgorithm("PS512")
+}
+
+// RS256 returns an object representing RSASSA-PKCS-v1.5 signature algorithm using SHA-256.
+func RS256() SignatureAlgorithm {
+ return lookupBuiltinSignatureAlgorithm("RS256")
+}
+
+// RS384 returns an object representing RSASSA-PKCS-v1.5 signature algorithm using SHA-384.
+func RS384() SignatureAlgorithm {
+ return lookupBuiltinSignatureAlgorithm("RS384")
+}
+
+// RS512 returns an object representing RSASSA-PKCS-v1.5 signature algorithm using SHA-512.
+func RS512() SignatureAlgorithm {
+ return lookupBuiltinSignatureAlgorithm("RS512")
+}
+
+func lookupBuiltinSignatureAlgorithm(name string) SignatureAlgorithm {
+ muAllSignatureAlgorithm.RLock()
+ v, ok := allSignatureAlgorithm[name]
+ muAllSignatureAlgorithm.RUnlock()
+ if !ok {
+ panic(fmt.Sprintf(`jwa: SignatureAlgorithm %q not registered`, name))
+ }
+ return v
+}
+
+// SignatureAlgorithm represents the various signature algorithms as described in https://tools.ietf.org/html/rfc7518#section-3.1
+type SignatureAlgorithm struct {
+ name string
+ deprecated bool
+ isSymmetric bool
+}
+
+func (s SignatureAlgorithm) String() string {
+ return s.name
+}
+
+// IsDeprecated returns true if the SignatureAlgorithm object is deprecated.
+func (s SignatureAlgorithm) IsDeprecated() bool {
+ return s.deprecated
+}
+
+// IsSymmetric returns true if the SignatureAlgorithm object is symmetric. Symmetric algorithms use the same key for both encryption and decryption.
+func (s SignatureAlgorithm) IsSymmetric() bool {
+ return s.isSymmetric
+}
+
+// EmptySignatureAlgorithm returns an empty SignatureAlgorithm object, used as a zero value.
+func EmptySignatureAlgorithm() SignatureAlgorithm {
+ return SignatureAlgorithm{}
+}
+
+// NewSignatureAlgorithm creates a new SignatureAlgorithm object with the given name.
+func NewSignatureAlgorithm(name string, options ...NewSignatureAlgorithmOption) SignatureAlgorithm {
+ var deprecated bool
+ var isSymmetric bool
+ for _, option := range options {
+ switch option.Ident() {
+ case identIsSymmetric{}:
+ if err := option.Value(&isSymmetric); err != nil {
+ panic("jwa.NewSignatureAlgorithm: WithIsSymmetric option must be a boolean")
+ }
+ case identDeprecated{}:
+ if err := option.Value(&deprecated); err != nil {
+ panic("jwa.NewSignatureAlgorithm: WithDeprecated option must be a boolean")
+ }
+ }
+ }
+ return SignatureAlgorithm{name: name, deprecated: deprecated, isSymmetric: isSymmetric}
+}
+
+// LookupSignatureAlgorithm returns the SignatureAlgorithm object for the given name.
+func LookupSignatureAlgorithm(name string) (SignatureAlgorithm, bool) {
+ muAllSignatureAlgorithm.RLock()
+ v, ok := allSignatureAlgorithm[name]
+ muAllSignatureAlgorithm.RUnlock()
+ return v, ok
+}
+
+// RegisterSignatureAlgorithm registers a new SignatureAlgorithm. The signature value must be immutable
+// and safe to be used by multiple goroutines, as it is going to be shared with all other users of this library.
+func RegisterSignatureAlgorithm(algorithms ...SignatureAlgorithm) {
+ muAllSignatureAlgorithm.Lock()
+ for _, alg := range algorithms {
+ allSignatureAlgorithm[alg.String()] = alg
+ }
+ muAllSignatureAlgorithm.Unlock()
+ rebuildSignatureAlgorithm()
+}
+
+// UnregisterSignatureAlgorithm unregisters a SignatureAlgorithm from its known database.
+// Non-existent entries, as well as built-in algorithms will silently be ignored.
+func UnregisterSignatureAlgorithm(algorithms ...SignatureAlgorithm) {
+ muAllSignatureAlgorithm.Lock()
+ for _, alg := range algorithms {
+ if _, ok := builtinSignatureAlgorithm[alg.String()]; ok {
+ continue
+ }
+ delete(allSignatureAlgorithm, alg.String())
+ }
+ muAllSignatureAlgorithm.Unlock()
+ rebuildSignatureAlgorithm()
+}
+
+func rebuildSignatureAlgorithm() {
+ list := make([]SignatureAlgorithm, 0, len(allSignatureAlgorithm))
+ muAllSignatureAlgorithm.RLock()
+ for _, v := range allSignatureAlgorithm {
+ list = append(list, v)
+ }
+ muAllSignatureAlgorithm.RUnlock()
+ sort.Slice(list, func(i, j int) bool {
+ return list[i].String() < list[j].String()
+ })
+ muListSignatureAlgorithm.Lock()
+ listSignatureAlgorithm = list
+ muListSignatureAlgorithm.Unlock()
+}
+
+// SignatureAlgorithms returns a list of all available values for SignatureAlgorithm.
+func SignatureAlgorithms() []SignatureAlgorithm {
+ muListSignatureAlgorithm.RLock()
+ defer muListSignatureAlgorithm.RUnlock()
+ return listSignatureAlgorithm
+}
+
+// MarshalJSON serializes the SignatureAlgorithm object to a JSON string.
+func (s SignatureAlgorithm) MarshalJSON() ([]byte, error) {
+ return json.Marshal(s.String())
+}
+
+// UnmarshalJSON deserializes the JSON string to a SignatureAlgorithm object.
+func (s *SignatureAlgorithm) UnmarshalJSON(data []byte) error {
+ var name string
+ if err := json.Unmarshal(data, &name); err != nil {
+ return fmt.Errorf(`failed to unmarshal SignatureAlgorithm: %w`, err)
+ }
+ v, ok := LookupSignatureAlgorithm(name)
+ if !ok {
+ return fmt.Errorf(`unknown SignatureAlgorithm: %q`, name)
+ }
+ *s = v
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jwe/BUILD.bazel
new file mode 100644
index 0000000000..0719efd2dc
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/BUILD.bazel
@@ -0,0 +1,70 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "jwe",
+ srcs = [
+ "compress.go",
+ "decrypt.go",
+ "encrypt.go",
+ "errors.go",
+ "filter.go",
+ "headers.go",
+ "headers_gen.go",
+ "interface.go",
+ "io.go",
+ "jwe.go",
+ "key_provider.go",
+ "message.go",
+ "options.go",
+ "options_gen.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/jwe",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//cert",
+ "//internal/base64",
+ "//transform",
+ "//internal/json",
+ "//internal/tokens",
+ "//internal/keyconv",
+ "//internal/pool",
+ "//jwa",
+ "//jwe/internal/aescbc",
+ "//jwe/internal/cipher",
+ "//jwe/internal/content_crypt",
+ "//jwe/internal/keygen",
+ "//jwe/jwebb",
+ "//jwk",
+ "@com_github_lestrrat_go_blackmagic//:blackmagic",
+ "@com_github_lestrrat_go_option_v2//:option",
+ "@org_golang_x_crypto//pbkdf2",
+ ],
+)
+
+go_test(
+ name = "jwe_test",
+ srcs = [
+ "filter_test.go",
+ "gh402_test.go",
+ "headers_test.go",
+ "jwe_test.go",
+ "message_test.go",
+ "options_gen_test.go",
+ "speed_test.go",
+ ],
+ embed = [":jwe"],
+ deps = [
+ "//cert",
+ "//internal/json",
+ "//internal/jwxtest",
+ "//jwa",
+ "//jwk",
+ "@com_github_stretchr_testify//require",
+ ],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":jwe",
+ visibility = ["//visibility:public"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/README.md b/vendor/github.com/lestrrat-go/jwx/v3/jwe/README.md
new file mode 100644
index 0000000000..c85d05bbbe
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/README.md
@@ -0,0 +1,94 @@
+# JWE [](https://pkg.go.dev/github.com/lestrrat-go/jwx/v3/jwe)
+
+Package jwe implements JWE as described in [RFC7516](https://tools.ietf.org/html/rfc7516)
+
+* Encrypt and Decrypt arbitrary data
+* Content compression and decompression
+* Add arbitrary fields in the JWE header object
+
+How-to style documentation can be found in the [docs directory](../docs).
+
+Examples are located in the examples directory ([jwe_example_test.go](../examples/jwe_example_test.go))
+
+Supported key encryption algorithm:
+
+| Algorithm | Supported? | Constant in [jwa](../jwa) |
+|:-----------------------------------------|:-----------|:-------------------------|
+| RSA-PKCS1v1.5 | YES | jwa.RSA1_5 |
+| RSA-OAEP-SHA1 | YES | jwa.RSA_OAEP |
+| RSA-OAEP-SHA256 | YES | jwa.RSA_OAEP_256 |
+| AES key wrap (128) | YES | jwa.A128KW |
+| AES key wrap (192) | YES | jwa.A192KW |
+| AES key wrap (256) | YES | jwa.A256KW |
+| Direct encryption | YES (1) | jwa.DIRECT |
+| ECDH-ES | YES (1) | jwa.ECDH_ES |
+| ECDH-ES + AES key wrap (128) | YES | jwa.ECDH_ES_A128KW |
+| ECDH-ES + AES key wrap (192) | YES | jwa.ECDH_ES_A192KW |
+| ECDH-ES + AES key wrap (256) | YES | jwa.ECDH_ES_A256KW |
+| AES-GCM key wrap (128) | YES | jwa.A128GCMKW |
+| AES-GCM key wrap (192) | YES | jwa.A192GCMKW |
+| AES-GCM key wrap (256) | YES | jwa.A256GCMKW |
+| PBES2 + HMAC-SHA256 + AES key wrap (128) | YES | jwa.PBES2_HS256_A128KW |
+| PBES2 + HMAC-SHA384 + AES key wrap (192) | YES | jwa.PBES2_HS384_A192KW |
+| PBES2 + HMAC-SHA512 + AES key wrap (256) | YES | jwa.PBES2_HS512_A256KW |
+
+* Note 1: Single-recipient only
+
+Supported content encryption algorithm:
+
+| Algorithm | Supported? | Constant in [jwa](../jwa) |
+|:----------------------------|:-----------|:--------------------------|
+| AES-CBC + HMAC-SHA256 (128) | YES | jwa.A128CBC_HS256 |
+| AES-CBC + HMAC-SHA384 (192) | YES | jwa.A192CBC_HS384 |
+| AES-CBC + HMAC-SHA512 (256) | YES | jwa.A256CBC_HS512 |
+| AES-GCM (128) | YES | jwa.A128GCM |
+| AES-GCM (192) | YES | jwa.A192GCM |
+| AES-GCM (256) | YES | jwa.A256GCM |
+
+# SYNOPSIS
+
+## Encrypt data
+
+```go
+func ExampleEncrypt() {
+ privkey, err := rsa.GenerateKey(rand.Reader, 2048)
+ if err != nil {
+ log.Printf("failed to generate private key: %s", err)
+ return
+ }
+
+ payload := []byte("Lorem Ipsum")
+
+ encrypted, err := jwe.Encrypt(payload, jwe.WithKey(jwa.RSA1_5, &privkey.PublicKey), jwe.WithContentEncryption(jwa.A128CBC_HS256))
+ if err != nil {
+ log.Printf("failed to encrypt payload: %s", err)
+ return
+ }
+ _ = encrypted
+ // OUTPUT:
+}
+```
+
+## Decrypt data
+
+```go
+func ExampleDecrypt() {
+ privkey, encrypted, err := exampleGenPayload()
+ if err != nil {
+ log.Printf("failed to generate encrypted payload: %s", err)
+ return
+ }
+
+ decrypted, err := jwe.Decrypt(encrypted, jwe.WithKey(jwa.RSA1_5, privkey))
+ if err != nil {
+ log.Printf("failed to decrypt: %s", err)
+ return
+ }
+
+ if string(decrypted) != "Lorem Ipsum" {
+ log.Printf("WHAT?!")
+ return
+ }
+ // OUTPUT:
+}
+```
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/compress.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/compress.go
new file mode 100644
index 0000000000..a1ed158fb0
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/compress.go
@@ -0,0 +1,62 @@
+package jwe
+
+import (
+ "bytes"
+ "compress/flate"
+ "fmt"
+ "io"
+
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+)
+
+func uncompress(src []byte, maxBufferSize int64) ([]byte, error) {
+ var dst bytes.Buffer
+ r := flate.NewReader(bytes.NewReader(src))
+ defer r.Close()
+ var buf [16384]byte
+ var sofar int64
+ for {
+ n, readErr := r.Read(buf[:])
+ sofar += int64(n)
+ if sofar > maxBufferSize {
+ return nil, fmt.Errorf(`compressed payload exceeds maximum allowed size`)
+ }
+ if readErr != nil {
+ // if we have a read error, and it's not EOF, then we need to stop
+ if readErr != io.EOF {
+ return nil, fmt.Errorf(`failed to read inflated data: %w`, readErr)
+ }
+ }
+
+ if _, err := dst.Write(buf[:n]); err != nil {
+ return nil, fmt.Errorf(`failed to write inflated data: %w`, err)
+ }
+
+ if readErr != nil {
+ // if it got here, then readErr == io.EOF, we're done
+ return dst.Bytes(), nil
+ }
+ }
+}
+
+func compress(plaintext []byte) ([]byte, error) {
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+
+ w, _ := flate.NewWriter(buf, 1)
+ in := plaintext
+ for len(in) > 0 {
+ n, err := w.Write(in)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to write to compression writer: %w`, err)
+ }
+ in = in[n:]
+ }
+ if err := w.Close(); err != nil {
+ return nil, fmt.Errorf(`failed to close compression writer: %w`, err)
+ }
+
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ return ret, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/decrypt.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/decrypt.go
new file mode 100644
index 0000000000..9429d84b1b
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/decrypt.go
@@ -0,0 +1,227 @@
+package jwe
+
+import (
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/content_crypt"
+ "github.com/lestrrat-go/jwx/v3/jwe/jwebb"
+)
+
+// decrypter is responsible for taking various components to decrypt a message.
+// its operation is not concurrency safe. You must provide locking yourself
+//
+//nolint:govet
+type decrypter struct {
+ aad []byte
+ apu []byte
+ apv []byte
+ cek *[]byte
+ computedAad []byte
+ iv []byte
+ keyiv []byte
+ keysalt []byte
+ keytag []byte
+ tag []byte
+ privkey any
+ pubkey any
+ ctalg jwa.ContentEncryptionAlgorithm
+ keyalg jwa.KeyEncryptionAlgorithm
+ cipher content_crypt.Cipher
+ keycount int
+}
+
+// newDecrypter Creates a new Decrypter instance. You must supply the
+// rest of parameters via their respective setter methods before
+// calling Decrypt().
+//
+// privkey must be a private key in its "raw" format (i.e. something like
+// *rsa.PrivateKey, instead of jwk.Key)
+//
+// You should consider this object immutable once you assign values to it.
+func newDecrypter(keyalg jwa.KeyEncryptionAlgorithm, ctalg jwa.ContentEncryptionAlgorithm, privkey any) *decrypter {
+ return &decrypter{
+ ctalg: ctalg,
+ keyalg: keyalg,
+ privkey: privkey,
+ }
+}
+
+func (d *decrypter) AgreementPartyUInfo(apu []byte) *decrypter {
+ d.apu = apu
+ return d
+}
+
+func (d *decrypter) AgreementPartyVInfo(apv []byte) *decrypter {
+ d.apv = apv
+ return d
+}
+
+func (d *decrypter) AuthenticatedData(aad []byte) *decrypter {
+ d.aad = aad
+ return d
+}
+
+func (d *decrypter) ComputedAuthenticatedData(aad []byte) *decrypter {
+ d.computedAad = aad
+ return d
+}
+
+func (d *decrypter) ContentEncryptionAlgorithm(ctalg jwa.ContentEncryptionAlgorithm) *decrypter {
+ d.ctalg = ctalg
+ return d
+}
+
+func (d *decrypter) InitializationVector(iv []byte) *decrypter {
+ d.iv = iv
+ return d
+}
+
+func (d *decrypter) KeyCount(keycount int) *decrypter {
+ d.keycount = keycount
+ return d
+}
+
+func (d *decrypter) KeyInitializationVector(keyiv []byte) *decrypter {
+ d.keyiv = keyiv
+ return d
+}
+
+func (d *decrypter) KeySalt(keysalt []byte) *decrypter {
+ d.keysalt = keysalt
+ return d
+}
+
+func (d *decrypter) KeyTag(keytag []byte) *decrypter {
+ d.keytag = keytag
+ return d
+}
+
+// PublicKey sets the public key to be used in decoding EC based encryptions.
+// The key must be in its "raw" format (i.e. *ecdsa.PublicKey, instead of jwk.Key)
+func (d *decrypter) PublicKey(pubkey any) *decrypter {
+ d.pubkey = pubkey
+ return d
+}
+
+func (d *decrypter) Tag(tag []byte) *decrypter {
+ d.tag = tag
+ return d
+}
+
+func (d *decrypter) CEK(ptr *[]byte) *decrypter {
+ d.cek = ptr
+ return d
+}
+
+func (d *decrypter) ContentCipher() (content_crypt.Cipher, error) {
+ if d.cipher == nil {
+ cipher, err := jwebb.CreateContentCipher(d.ctalg.String())
+ if err != nil {
+ return nil, err
+ }
+ d.cipher = cipher
+ }
+
+ return d.cipher, nil
+}
+
+func (d *decrypter) Decrypt(recipient Recipient, ciphertext []byte, msg *Message) (plaintext []byte, err error) {
+ cek, keyerr := d.DecryptKey(recipient, msg)
+ if keyerr != nil {
+ err = fmt.Errorf(`failed to decrypt key: %w`, keyerr)
+ return
+ }
+
+ cipher, ciphererr := d.ContentCipher()
+ if ciphererr != nil {
+ err = fmt.Errorf(`failed to fetch content crypt cipher: %w`, ciphererr)
+ return
+ }
+
+ computedAad := d.computedAad
+ if d.aad != nil {
+ computedAad = append(append(computedAad, tokens.Period), d.aad...)
+ }
+
+ plaintext, err = cipher.Decrypt(cek, d.iv, ciphertext, d.tag, computedAad)
+ if err != nil {
+ err = fmt.Errorf(`failed to decrypt payload: %w`, err)
+ return
+ }
+
+ if d.cek != nil {
+ *d.cek = cek
+ }
+ return plaintext, nil
+}
+
+func (d *decrypter) DecryptKey(recipient Recipient, msg *Message) (cek []byte, err error) {
+ recipientKey := recipient.EncryptedKey()
+ if kd, ok := d.privkey.(KeyDecrypter); ok {
+ return kd.DecryptKey(d.keyalg, recipientKey, recipient, msg)
+ }
+
+ if jwebb.IsDirect(d.keyalg.String()) {
+ cek, ok := d.privkey.([]byte)
+ if !ok {
+ return nil, fmt.Errorf("decrypt key: []byte is required as the key for %s (got %T)", d.keyalg, d.privkey)
+ }
+ return jwebb.KeyDecryptDirect(recipientKey, recipientKey, d.keyalg.String(), cek)
+ }
+
+ if jwebb.IsPBES2(d.keyalg.String()) {
+ password, ok := d.privkey.([]byte)
+ if !ok {
+ return nil, fmt.Errorf("decrypt key: []byte is required as the password for %s (got %T)", d.keyalg, d.privkey)
+ }
+ salt := []byte(d.keyalg.String())
+ salt = append(salt, byte(0))
+ salt = append(salt, d.keysalt...)
+ return jwebb.KeyDecryptPBES2(recipientKey, recipientKey, d.keyalg.String(), password, salt, d.keycount)
+ }
+
+ if jwebb.IsAESGCMKW(d.keyalg.String()) {
+ sharedkey, ok := d.privkey.([]byte)
+ if !ok {
+ return nil, fmt.Errorf("decrypt key: []byte is required as the key for %s (got %T)", d.keyalg, d.privkey)
+ }
+ return jwebb.KeyDecryptAESGCMKW(recipientKey, recipientKey, d.keyalg.String(), sharedkey, d.keyiv, d.keytag)
+ }
+
+ if jwebb.IsECDHES(d.keyalg.String()) {
+ alg, keysize, keywrap, err := jwebb.KeyEncryptionECDHESKeySize(d.keyalg.String(), d.ctalg.String())
+ if err != nil {
+ return nil, fmt.Errorf(`failed to determine ECDH-ES key size: %w`, err)
+ }
+
+ if !keywrap {
+ return jwebb.KeyDecryptECDHES(recipientKey, cek, alg, d.apu, d.apv, d.privkey, d.pubkey, keysize)
+ }
+ return jwebb.KeyDecryptECDHESKeyWrap(recipientKey, recipientKey, d.keyalg.String(), d.apu, d.apv, d.privkey, d.pubkey, keysize)
+ }
+
+ if jwebb.IsRSA15(d.keyalg.String()) {
+ cipher, err := d.ContentCipher()
+ if err != nil {
+ return nil, fmt.Errorf(`failed to fetch content crypt cipher: %w`, err)
+ }
+ keysize := cipher.KeySize() / 2
+ return jwebb.KeyDecryptRSA15(recipientKey, recipientKey, d.privkey, keysize)
+ }
+
+ if jwebb.IsRSAOAEP(d.keyalg.String()) {
+ return jwebb.KeyDecryptRSAOAEP(recipientKey, recipientKey, d.keyalg.String(), d.privkey)
+ }
+
+ if jwebb.IsAESKW(d.keyalg.String()) {
+ sharedkey, ok := d.privkey.([]byte)
+ if !ok {
+ return nil, fmt.Errorf("[]byte is required as the key to decrypt %s", d.keyalg.String())
+ }
+ return jwebb.KeyDecryptAESKW(recipientKey, recipientKey, d.keyalg.String(), sharedkey)
+ }
+
+ return nil, fmt.Errorf(`unsupported algorithm for key decryption (%s)`, d.keyalg)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/encrypt.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/encrypt.go
new file mode 100644
index 0000000000..e75f342a3d
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/encrypt.go
@@ -0,0 +1,193 @@
+package jwe
+
+import (
+ "crypto/ecdh"
+ "crypto/ecdsa"
+ "crypto/rsa"
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/internal/keyconv"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/content_crypt"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/keygen"
+ "github.com/lestrrat-go/jwx/v3/jwe/jwebb"
+)
+
+// encrypter is responsible for taking various components to encrypt a key.
+// its operation is not concurrency safe. You must provide locking yourself
+//
+//nolint:govet
+type encrypter struct {
+ apu []byte
+ apv []byte
+ ctalg jwa.ContentEncryptionAlgorithm
+ keyalg jwa.KeyEncryptionAlgorithm
+ pubkey any
+ rawKey any
+ cipher content_crypt.Cipher
+}
+
+// newEncrypter creates a new Encrypter instance with all required parameters.
+// The content cipher is built internally during construction.
+//
+// pubkey must be a public key in its "raw" format (i.e. something like
+// *rsa.PublicKey, instead of jwk.Key)
+//
+// You should consider this object immutable once created.
+func newEncrypter(keyalg jwa.KeyEncryptionAlgorithm, ctalg jwa.ContentEncryptionAlgorithm, pubkey any, rawKey any, apu, apv []byte) (*encrypter, error) {
+ cipher, err := jwebb.CreateContentCipher(ctalg.String())
+ if err != nil {
+ return nil, fmt.Errorf(`failed to create content cipher: %w`, err)
+ }
+
+ return &encrypter{
+ apu: apu,
+ apv: apv,
+ ctalg: ctalg,
+ keyalg: keyalg,
+ pubkey: pubkey,
+ rawKey: rawKey,
+ cipher: cipher,
+ }, nil
+}
+
+func (e *encrypter) EncryptKey(cek []byte) (keygen.ByteSource, error) {
+ if ke, ok := e.pubkey.(KeyEncrypter); ok {
+ encrypted, err := ke.EncryptKey(cek)
+ if err != nil {
+ return nil, err
+ }
+ return keygen.ByteKey(encrypted), nil
+ }
+
+ if jwebb.IsDirect(e.keyalg.String()) {
+ sharedkey, ok := e.rawKey.([]byte)
+ if !ok {
+ return nil, fmt.Errorf("encrypt key: []byte is required as the key for %s (got %T)", e.keyalg, e.rawKey)
+ }
+ return jwebb.KeyEncryptDirect(cek, e.keyalg.String(), sharedkey)
+ }
+
+ if jwebb.IsPBES2(e.keyalg.String()) {
+ password, ok := e.rawKey.([]byte)
+ if !ok {
+ return nil, fmt.Errorf("encrypt key: []byte is required as the password for %s (got %T)", e.keyalg, e.rawKey)
+ }
+ return jwebb.KeyEncryptPBES2(cek, e.keyalg.String(), password)
+ }
+
+ if jwebb.IsAESGCMKW(e.keyalg.String()) {
+ sharedkey, ok := e.rawKey.([]byte)
+ if !ok {
+ return nil, fmt.Errorf("encrypt key: []byte is required as the key for %s (got %T)", e.keyalg, e.rawKey)
+ }
+ return jwebb.KeyEncryptAESGCMKW(cek, e.keyalg.String(), sharedkey)
+ }
+
+ if jwebb.IsECDHES(e.keyalg.String()) {
+ _, keysize, keywrap, err := jwebb.KeyEncryptionECDHESKeySize(e.keyalg.String(), e.ctalg.String())
+ if err != nil {
+ return nil, fmt.Errorf(`failed to determine ECDH-ES key size: %w`, err)
+ }
+
+ // Use rawKey for ECDH-ES operations - it should contain the actual key material
+ keyToUse := e.rawKey
+ if keyToUse == nil {
+ keyToUse = e.pubkey
+ }
+
+ switch key := keyToUse.(type) {
+ case *ecdsa.PublicKey:
+ // no op
+ case ecdsa.PublicKey:
+ keyToUse = &key
+ case *ecdsa.PrivateKey:
+ keyToUse = &key.PublicKey
+ case ecdsa.PrivateKey:
+ keyToUse = &key.PublicKey
+ case *ecdh.PublicKey:
+ // no op
+ case ecdh.PublicKey:
+ keyToUse = &key
+ case ecdh.PrivateKey:
+ keyToUse = key.PublicKey()
+ case *ecdh.PrivateKey:
+ keyToUse = key.PublicKey()
+ }
+
+ // Determine key type and call appropriate function
+ switch key := keyToUse.(type) {
+ case *ecdh.PublicKey:
+ if key.Curve() == ecdh.X25519() {
+ if !keywrap {
+ return jwebb.KeyEncryptECDHESX25519(cek, e.keyalg.String(), e.apu, e.apv, key, keysize, e.ctalg.String())
+ }
+ return jwebb.KeyEncryptECDHESKeyWrapX25519(cek, e.keyalg.String(), e.apu, e.apv, key, keysize, e.ctalg.String())
+ }
+
+ var ecdsaKey *ecdsa.PublicKey
+ if err := keyconv.ECDHToECDSA(&ecdsaKey, key); err != nil {
+ return nil, fmt.Errorf(`encrypt: failed to convert ECDH public key to ECDSA: %w`, err)
+ }
+ keyToUse = ecdsaKey
+ }
+
+ switch key := keyToUse.(type) {
+ case *ecdsa.PublicKey:
+ if !keywrap {
+ return jwebb.KeyEncryptECDHESECDSA(cek, e.keyalg.String(), e.apu, e.apv, key, keysize, e.ctalg.String())
+ }
+ return jwebb.KeyEncryptECDHESKeyWrapECDSA(cek, e.keyalg.String(), e.apu, e.apv, key, keysize, e.ctalg.String())
+ default:
+ return nil, fmt.Errorf(`encrypt: unsupported key type for ECDH-ES: %T`, keyToUse)
+ }
+ }
+
+ if jwebb.IsRSA15(e.keyalg.String()) {
+ keyToUse := e.rawKey
+ if keyToUse == nil {
+ keyToUse = e.pubkey
+ }
+
+ // Handle rsa.PublicKey by value - convert to pointer
+ if pk, ok := keyToUse.(rsa.PublicKey); ok {
+ keyToUse = &pk
+ }
+
+ var pubkey *rsa.PublicKey
+ if err := keyconv.RSAPublicKey(&pubkey, keyToUse); err != nil {
+ return nil, fmt.Errorf(`encrypt: failed to convert to RSA public key: %w`, err)
+ }
+
+ return jwebb.KeyEncryptRSA15(cek, e.keyalg.String(), pubkey)
+ }
+
+ if jwebb.IsRSAOAEP(e.keyalg.String()) {
+ keyToUse := e.rawKey
+ if keyToUse == nil {
+ keyToUse = e.pubkey
+ }
+
+ // Handle rsa.PublicKey by value - convert to pointer
+ if pk, ok := keyToUse.(rsa.PublicKey); ok {
+ keyToUse = &pk
+ }
+
+ var pubkey *rsa.PublicKey
+ if err := keyconv.RSAPublicKey(&pubkey, keyToUse); err != nil {
+ return nil, fmt.Errorf(`encrypt: failed to convert to RSA public key: %w`, err)
+ }
+
+ return jwebb.KeyEncryptRSAOAEP(cek, e.keyalg.String(), pubkey)
+ }
+
+ if jwebb.IsAESKW(e.keyalg.String()) {
+ sharedkey, ok := e.rawKey.([]byte)
+ if !ok {
+ return nil, fmt.Errorf("[]byte is required as the key to encrypt %s", e.keyalg.String())
+ }
+ return jwebb.KeyEncryptAESKW(cek, e.keyalg.String(), sharedkey)
+ }
+
+ return nil, fmt.Errorf(`unsupported algorithm for key encryption (%s)`, e.keyalg)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/errors.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/errors.go
new file mode 100644
index 0000000000..89d276fc44
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/errors.go
@@ -0,0 +1,90 @@
+package jwe
+
+import "errors"
+
+type encryptError struct {
+ error
+}
+
+func (e encryptError) Unwrap() error {
+ return e.error
+}
+
+func (encryptError) Is(err error) bool {
+ _, ok := err.(encryptError)
+ return ok
+}
+
+var errDefaultEncryptError = encryptError{errors.New(`encrypt error`)}
+
+// EncryptError returns an error that can be passed to `errors.Is` to check if the error is an error returned by `jwe.Encrypt`.
+func EncryptError() error {
+ return errDefaultEncryptError
+}
+
+type decryptError struct {
+ error
+}
+
+func (e decryptError) Unwrap() error {
+ return e.error
+}
+
+func (decryptError) Is(err error) bool {
+ _, ok := err.(decryptError)
+ return ok
+}
+
+var errDefaultDecryptError = decryptError{errors.New(`decrypt error`)}
+
+// DecryptError returns an error that can be passed to `errors.Is` to check if the error is an error returned by `jwe.Decrypt`.
+func DecryptError() error {
+ return errDefaultDecryptError
+}
+
+type recipientError struct {
+ error
+}
+
+func (e recipientError) Unwrap() error {
+ return e.error
+}
+
+func (recipientError) Is(err error) bool {
+ _, ok := err.(recipientError)
+ return ok
+}
+
+var errDefaultRecipientError = recipientError{errors.New(`recipient error`)}
+
+// RecipientError returns an error that can be passed to `errors.Is` to check if the error is
+// an error that occurred while attempting to decrypt a JWE message for a particular recipient.
+//
+// For example, if the JWE message failed to parse during `jwe.Decrypt`, it will be a
+// `jwe.DecryptError`, but NOT `jwe.RecipientError`. However, if the JWE message could not
+// be decrypted for any of the recipients, then it will be a `jwe.RecipientError`
+// (actually, it will be _multiple_ `jwe.RecipientError` errors, one for each recipient)
+func RecipientError() error {
+ return errDefaultRecipientError
+}
+
+type parseError struct {
+ error
+}
+
+func (e parseError) Unwrap() error {
+ return e.error
+}
+
+func (parseError) Is(err error) bool {
+ _, ok := err.(parseError)
+ return ok
+}
+
+var errDefaultParseError = parseError{errors.New(`parse error`)}
+
+// ParseError returns an error that can be passed to `errors.Is` to check if the error
+// is an error returned by `jwe.Parse` and related functions.
+func ParseError() error {
+ return errDefaultParseError
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/filter.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/filter.go
new file mode 100644
index 0000000000..14941604bf
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/filter.go
@@ -0,0 +1,36 @@
+package jwe
+
+import (
+ "github.com/lestrrat-go/jwx/v3/transform"
+)
+
+// HeaderFilter is an interface that allows users to filter JWE header fields.
+// It provides two methods: Filter and Reject; Filter returns a new header with only
+// the fields that match the filter criteria, while Reject returns a new header with
+// only the fields that DO NOT match the filter.
+//
+// EXPERIMENTAL: This API is experimental and its interface and behavior is
+// subject to change in future releases. This API is not subject to semver
+// compatibility guarantees.
+type HeaderFilter interface {
+ Filter(header Headers) (Headers, error)
+ Reject(header Headers) (Headers, error)
+}
+
+// StandardHeadersFilter returns a HeaderFilter that filters out standard JWE header fields.
+//
+// You can use this filter to create headers that either only have standard fields
+// or only custom fields.
+//
+// If you need to configure the filter more precisely, consider
+// using the HeaderNameFilter directly.
+func StandardHeadersFilter() HeaderFilter {
+ return stdHeadersFilter
+}
+
+var stdHeadersFilter = NewHeaderNameFilter(stdHeaderNames...)
+
+// NewHeaderNameFilter creates a new HeaderNameFilter with the specified field names.
+func NewHeaderNameFilter(names ...string) HeaderFilter {
+ return transform.NewNameBasedFilter[Headers](names...)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/headers.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/headers.go
new file mode 100644
index 0000000000..6e13afde76
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/headers.go
@@ -0,0 +1,95 @@
+package jwe
+
+import (
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+)
+
+type isZeroer interface {
+ isZero() bool
+}
+
+func (h *stdHeaders) isZero() bool {
+ return h.agreementPartyUInfo == nil &&
+ h.agreementPartyVInfo == nil &&
+ h.algorithm == nil &&
+ h.compression == nil &&
+ h.contentEncryption == nil &&
+ h.contentType == nil &&
+ h.critical == nil &&
+ h.ephemeralPublicKey == nil &&
+ h.jwk == nil &&
+ h.jwkSetURL == nil &&
+ h.keyID == nil &&
+ h.typ == nil &&
+ h.x509CertChain == nil &&
+ h.x509CertThumbprint == nil &&
+ h.x509CertThumbprintS256 == nil &&
+ h.x509URL == nil &&
+ len(h.privateParams) == 0
+}
+
+func (h *stdHeaders) Clone() (Headers, error) {
+ dst := NewHeaders()
+ if err := h.Copy(dst); err != nil {
+ return nil, fmt.Errorf(`failed to copy header contents to new object: %w`, err)
+ }
+ return dst, nil
+}
+
+func (h *stdHeaders) Copy(dst Headers) error {
+ for _, key := range h.Keys() {
+ var v any
+ if err := h.Get(key, &v); err != nil {
+ return fmt.Errorf(`jwe.Headers: Copy: failed to get header %q: %w`, key, err)
+ }
+
+ if err := dst.Set(key, v); err != nil {
+ return fmt.Errorf(`jwe.Headers: Copy: failed to set header %q: %w`, key, err)
+ }
+ }
+ return nil
+}
+
+func (h *stdHeaders) Merge(h2 Headers) (Headers, error) {
+ h3 := NewHeaders()
+
+ if h != nil {
+ if err := h.Copy(h3); err != nil {
+ return nil, fmt.Errorf(`failed to copy headers from receiver: %w`, err)
+ }
+ }
+
+ if h2 != nil {
+ if err := h2.Copy(h3); err != nil {
+ return nil, fmt.Errorf(`failed to copy headers from argument: %w`, err)
+ }
+ }
+
+ return h3, nil
+}
+
+func (h *stdHeaders) Encode() ([]byte, error) {
+ buf, err := json.Marshal(h)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to marshal headers to JSON prior to encoding: %w`, err)
+ }
+
+ return base64.Encode(buf), nil
+}
+
+func (h *stdHeaders) Decode(buf []byte) error {
+ // base64 json string -> json object representation of header
+ decoded, err := base64.Decode(buf)
+ if err != nil {
+ return fmt.Errorf(`failed to unmarshal base64 encoded buffer: %w`, err)
+ }
+
+ if err := json.Unmarshal(decoded, h); err != nil {
+ return fmt.Errorf(`failed to unmarshal buffer: %w`, err)
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/headers_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/headers_gen.go
new file mode 100644
index 0000000000..7773a5d812
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/headers_gen.go
@@ -0,0 +1,899 @@
+// Code generated by tools/cmd/genjwe/main.go. DO NOT EDIT.
+
+package jwe
+
+import (
+ "bytes"
+ "fmt"
+ "sort"
+ "sync"
+
+ "github.com/lestrrat-go/blackmagic"
+ "github.com/lestrrat-go/jwx/v3/cert"
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwk"
+)
+
+const (
+ AgreementPartyUInfoKey = "apu"
+ AgreementPartyVInfoKey = "apv"
+ AlgorithmKey = "alg"
+ CompressionKey = "zip"
+ ContentEncryptionKey = "enc"
+ ContentTypeKey = "cty"
+ CriticalKey = "crit"
+ EphemeralPublicKeyKey = "epk"
+ JWKKey = "jwk"
+ JWKSetURLKey = "jku"
+ KeyIDKey = "kid"
+ TypeKey = "typ"
+ X509CertChainKey = "x5c"
+ X509CertThumbprintKey = "x5t"
+ X509CertThumbprintS256Key = "x5t#S256"
+ X509URLKey = "x5u"
+)
+
+// Headers describe a standard JWE Header set. It is part of the JWE message
+// and is used to represent both Protected and Unprotected headers,
+// which in turn can be found in each Recipient object.
+// If you are not sure how this works, it is strongly recommended that
+// you read RFC7516, especially the section
+// that describes the full JSON serialization format of JWE messages.
+//
+// In most cases, you likely want to use the protected headers, as this is the part of the encrypted content
+type Headers interface {
+ AgreementPartyUInfo() ([]byte, bool)
+ AgreementPartyVInfo() ([]byte, bool)
+ Algorithm() (jwa.KeyEncryptionAlgorithm, bool)
+ Compression() (jwa.CompressionAlgorithm, bool)
+ ContentEncryption() (jwa.ContentEncryptionAlgorithm, bool)
+ ContentType() (string, bool)
+ Critical() ([]string, bool)
+ EphemeralPublicKey() (jwk.Key, bool)
+ JWK() (jwk.Key, bool)
+ JWKSetURL() (string, bool)
+ KeyID() (string, bool)
+ Type() (string, bool)
+ X509CertChain() (*cert.Chain, bool)
+ X509CertThumbprint() (string, bool)
+ X509CertThumbprintS256() (string, bool)
+ X509URL() (string, bool)
+
+ // Get is used to extract the value of any field, including non-standard fields, out of the header.
+ //
+ // The first argument is the name of the field. The second argument is a pointer
+ // to a variable that will receive the value of the field. The method returns
+ // an error if the field does not exist, or if the value cannot be assigned to
+ // the destination variable. Note that a field is considered to "exist" even if
+ // the value is empty-ish (e.g. 0, false, ""), as long as it is explicitly set.
+ Get(string, any) error
+ Set(string, any) error
+ Remove(string) error
+ // Has returns true if the specified header has a value, even if
+ // the value is empty-ish (e.g. 0, false, "") as long as it has been
+ // explicitly set.
+ Has(string) bool
+ Encode() ([]byte, error)
+ Decode([]byte) error
+ Clone() (Headers, error)
+ Copy(Headers) error
+ Merge(Headers) (Headers, error)
+
+ // Keys returns a list of the keys contained in this header.
+ Keys() []string
+}
+
+// stdHeaderNames is a list of all standard header names defined in the JWE specification.
+var stdHeaderNames = []string{AgreementPartyUInfoKey, AgreementPartyVInfoKey, AlgorithmKey, CompressionKey, ContentEncryptionKey, ContentTypeKey, CriticalKey, EphemeralPublicKeyKey, JWKKey, JWKSetURLKey, KeyIDKey, TypeKey, X509CertChainKey, X509CertThumbprintKey, X509CertThumbprintS256Key, X509URLKey}
+
+type stdHeaders struct {
+ agreementPartyUInfo []byte
+ agreementPartyVInfo []byte
+ algorithm *jwa.KeyEncryptionAlgorithm
+ compression *jwa.CompressionAlgorithm
+ contentEncryption *jwa.ContentEncryptionAlgorithm
+ contentType *string
+ critical []string
+ ephemeralPublicKey jwk.Key
+ jwk jwk.Key
+ jwkSetURL *string
+ keyID *string
+ typ *string
+ x509CertChain *cert.Chain
+ x509CertThumbprint *string
+ x509CertThumbprintS256 *string
+ x509URL *string
+ privateParams map[string]any
+ mu *sync.RWMutex
+}
+
+func NewHeaders() Headers {
+ return &stdHeaders{
+ mu: &sync.RWMutex{},
+ privateParams: map[string]any{},
+ }
+}
+
+func (h *stdHeaders) AgreementPartyUInfo() ([]byte, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ return h.agreementPartyUInfo, h.agreementPartyUInfo != nil
+}
+
+func (h *stdHeaders) AgreementPartyVInfo() ([]byte, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ return h.agreementPartyVInfo, h.agreementPartyVInfo != nil
+}
+
+func (h *stdHeaders) Algorithm() (jwa.KeyEncryptionAlgorithm, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.algorithm == nil {
+ return jwa.EmptyKeyEncryptionAlgorithm(), false
+ }
+ return *(h.algorithm), true
+}
+
+func (h *stdHeaders) Compression() (jwa.CompressionAlgorithm, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.compression == nil {
+ return jwa.NoCompress(), false
+ }
+ return *(h.compression), true
+}
+
+func (h *stdHeaders) ContentEncryption() (jwa.ContentEncryptionAlgorithm, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.contentEncryption == nil {
+ return jwa.EmptyContentEncryptionAlgorithm(), false
+ }
+ return *(h.contentEncryption), true
+}
+
+func (h *stdHeaders) ContentType() (string, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.contentType == nil {
+ return "", false
+ }
+ return *(h.contentType), true
+}
+
+func (h *stdHeaders) Critical() ([]string, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ return h.critical, h.critical != nil
+}
+
+func (h *stdHeaders) EphemeralPublicKey() (jwk.Key, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ return h.ephemeralPublicKey, h.ephemeralPublicKey != nil
+}
+
+func (h *stdHeaders) JWK() (jwk.Key, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ return h.jwk, h.jwk != nil
+}
+
+func (h *stdHeaders) JWKSetURL() (string, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.jwkSetURL == nil {
+ return "", false
+ }
+ return *(h.jwkSetURL), true
+}
+
+func (h *stdHeaders) KeyID() (string, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.keyID == nil {
+ return "", false
+ }
+ return *(h.keyID), true
+}
+
+func (h *stdHeaders) Type() (string, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.typ == nil {
+ return "", false
+ }
+ return *(h.typ), true
+}
+
+func (h *stdHeaders) X509CertChain() (*cert.Chain, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ return h.x509CertChain, h.x509CertChain != nil
+}
+
+func (h *stdHeaders) X509CertThumbprint() (string, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.x509CertThumbprint == nil {
+ return "", false
+ }
+ return *(h.x509CertThumbprint), true
+}
+
+func (h *stdHeaders) X509CertThumbprintS256() (string, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.x509CertThumbprintS256 == nil {
+ return "", false
+ }
+ return *(h.x509CertThumbprintS256), true
+}
+
+func (h *stdHeaders) X509URL() (string, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.x509URL == nil {
+ return "", false
+ }
+ return *(h.x509URL), true
+}
+
+func (h *stdHeaders) PrivateParams() map[string]any {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ return h.privateParams
+}
+
+func (h *stdHeaders) Has(name string) bool {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case AgreementPartyUInfoKey:
+ return h.agreementPartyUInfo != nil
+ case AgreementPartyVInfoKey:
+ return h.agreementPartyVInfo != nil
+ case AlgorithmKey:
+ return h.algorithm != nil
+ case CompressionKey:
+ return h.compression != nil
+ case ContentEncryptionKey:
+ return h.contentEncryption != nil
+ case ContentTypeKey:
+ return h.contentType != nil
+ case CriticalKey:
+ return h.critical != nil
+ case EphemeralPublicKeyKey:
+ return h.ephemeralPublicKey != nil
+ case JWKKey:
+ return h.jwk != nil
+ case JWKSetURLKey:
+ return h.jwkSetURL != nil
+ case KeyIDKey:
+ return h.keyID != nil
+ case TypeKey:
+ return h.typ != nil
+ case X509CertChainKey:
+ return h.x509CertChain != nil
+ case X509CertThumbprintKey:
+ return h.x509CertThumbprint != nil
+ case X509CertThumbprintS256Key:
+ return h.x509CertThumbprintS256 != nil
+ case X509URLKey:
+ return h.x509URL != nil
+ default:
+ _, ok := h.privateParams[name]
+ return ok
+ }
+}
+
+func (h *stdHeaders) Get(name string, dst any) error {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case AgreementPartyUInfoKey:
+ if h.agreementPartyUInfo == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.agreementPartyUInfo); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ case AgreementPartyVInfoKey:
+ if h.agreementPartyVInfo == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.agreementPartyVInfo); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ case AlgorithmKey:
+ if h.algorithm == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.algorithm)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ case CompressionKey:
+ if h.compression == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.compression)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ case ContentEncryptionKey:
+ if h.contentEncryption == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.contentEncryption)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ case ContentTypeKey:
+ if h.contentType == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.contentType)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ case CriticalKey:
+ if h.critical == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.critical); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ case EphemeralPublicKeyKey:
+ if h.ephemeralPublicKey == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.ephemeralPublicKey); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ case JWKKey:
+ if h.jwk == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.jwk); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ case JWKSetURLKey:
+ if h.jwkSetURL == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.jwkSetURL)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ case KeyIDKey:
+ if h.keyID == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyID)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ case TypeKey:
+ if h.typ == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.typ)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ case X509CertChainKey:
+ if h.x509CertChain == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.x509CertChain); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ case X509CertThumbprintKey:
+ if h.x509CertThumbprint == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprint)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ case X509CertThumbprintS256Key:
+ if h.x509CertThumbprintS256 == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprintS256)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ case X509URLKey:
+ if h.x509URL == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509URL)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ default:
+ v, ok := h.privateParams[name]
+ if !ok {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, v); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ }
+ return nil
+}
+
+func (h *stdHeaders) Set(name string, value any) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ return h.setNoLock(name, value)
+}
+
+func (h *stdHeaders) setNoLock(name string, value any) error {
+ switch name {
+ case AgreementPartyUInfoKey:
+ if v, ok := value.([]byte); ok {
+ h.agreementPartyUInfo = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, AgreementPartyUInfoKey, value)
+ case AgreementPartyVInfoKey:
+ if v, ok := value.([]byte); ok {
+ h.agreementPartyVInfo = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, AgreementPartyVInfoKey, value)
+ case AlgorithmKey:
+ if v, ok := value.(jwa.KeyEncryptionAlgorithm); ok {
+ h.algorithm = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, AlgorithmKey, value)
+ case CompressionKey:
+ if v, ok := value.(jwa.CompressionAlgorithm); ok {
+ h.compression = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, CompressionKey, value)
+ case ContentEncryptionKey:
+ if v, ok := value.(jwa.ContentEncryptionAlgorithm); ok {
+ if v == jwa.EmptyContentEncryptionAlgorithm() {
+ return fmt.Errorf(`"enc" field cannot be an empty string`)
+ }
+ h.contentEncryption = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, ContentEncryptionKey, value)
+ case ContentTypeKey:
+ if v, ok := value.(string); ok {
+ h.contentType = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, ContentTypeKey, value)
+ case CriticalKey:
+ if v, ok := value.([]string); ok {
+ h.critical = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, CriticalKey, value)
+ case EphemeralPublicKeyKey:
+ if v, ok := value.(jwk.Key); ok {
+ h.ephemeralPublicKey = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, EphemeralPublicKeyKey, value)
+ case JWKKey:
+ if v, ok := value.(jwk.Key); ok {
+ h.jwk = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, JWKKey, value)
+ case JWKSetURLKey:
+ if v, ok := value.(string); ok {
+ h.jwkSetURL = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, JWKSetURLKey, value)
+ case KeyIDKey:
+ if v, ok := value.(string); ok {
+ h.keyID = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, KeyIDKey, value)
+ case TypeKey:
+ if v, ok := value.(string); ok {
+ h.typ = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, TypeKey, value)
+ case X509CertChainKey:
+ if v, ok := value.(*cert.Chain); ok {
+ h.x509CertChain = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertChainKey, value)
+ case X509CertThumbprintKey:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprint = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintKey, value)
+ case X509CertThumbprintS256Key:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprintS256 = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintS256Key, value)
+ case X509URLKey:
+ if v, ok := value.(string); ok {
+ h.x509URL = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509URLKey, value)
+ default:
+ if h.privateParams == nil {
+ h.privateParams = map[string]any{}
+ }
+ h.privateParams[name] = value
+ }
+ return nil
+}
+
+func (h *stdHeaders) Remove(key string) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ switch key {
+ case AgreementPartyUInfoKey:
+ h.agreementPartyUInfo = nil
+ case AgreementPartyVInfoKey:
+ h.agreementPartyVInfo = nil
+ case AlgorithmKey:
+ h.algorithm = nil
+ case CompressionKey:
+ h.compression = nil
+ case ContentEncryptionKey:
+ h.contentEncryption = nil
+ case ContentTypeKey:
+ h.contentType = nil
+ case CriticalKey:
+ h.critical = nil
+ case EphemeralPublicKeyKey:
+ h.ephemeralPublicKey = nil
+ case JWKKey:
+ h.jwk = nil
+ case JWKSetURLKey:
+ h.jwkSetURL = nil
+ case KeyIDKey:
+ h.keyID = nil
+ case TypeKey:
+ h.typ = nil
+ case X509CertChainKey:
+ h.x509CertChain = nil
+ case X509CertThumbprintKey:
+ h.x509CertThumbprint = nil
+ case X509CertThumbprintS256Key:
+ h.x509CertThumbprintS256 = nil
+ case X509URLKey:
+ h.x509URL = nil
+ default:
+ delete(h.privateParams, key)
+ }
+ return nil
+}
+
+func (h *stdHeaders) UnmarshalJSON(buf []byte) error {
+ h.agreementPartyUInfo = nil
+ h.agreementPartyVInfo = nil
+ h.algorithm = nil
+ h.compression = nil
+ h.contentEncryption = nil
+ h.contentType = nil
+ h.critical = nil
+ h.ephemeralPublicKey = nil
+ h.jwk = nil
+ h.jwkSetURL = nil
+ h.keyID = nil
+ h.typ = nil
+ h.x509CertChain = nil
+ h.x509CertThumbprint = nil
+ h.x509CertThumbprintS256 = nil
+ h.x509URL = nil
+ dec := json.NewDecoder(bytes.NewReader(buf))
+LOOP:
+ for {
+ tok, err := dec.Token()
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ switch tok := tok.(type) {
+ case json.Delim:
+ // Assuming we're doing everything correctly, we should ONLY
+ // get either tokens.OpenCurlyBracket or tokens.CloseCurlyBracket here.
+ if tok == tokens.CloseCurlyBracket { // End of object
+ break LOOP
+ } else if tok != tokens.OpenCurlyBracket {
+ return fmt.Errorf(`expected '%c' but got '%c'`, tokens.OpenCurlyBracket, tok)
+ }
+ case string: // Objects can only have string keys
+ switch tok {
+ case AgreementPartyUInfoKey:
+ if err := json.AssignNextBytesToken(&h.agreementPartyUInfo, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AgreementPartyUInfoKey, err)
+ }
+ case AgreementPartyVInfoKey:
+ if err := json.AssignNextBytesToken(&h.agreementPartyVInfo, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AgreementPartyVInfoKey, err)
+ }
+ case AlgorithmKey:
+ var decoded jwa.KeyEncryptionAlgorithm
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AlgorithmKey, err)
+ }
+ h.algorithm = &decoded
+ case CompressionKey:
+ var decoded jwa.CompressionAlgorithm
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, CompressionKey, err)
+ }
+ h.compression = &decoded
+ case ContentEncryptionKey:
+ var decoded jwa.ContentEncryptionAlgorithm
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, ContentEncryptionKey, err)
+ }
+ h.contentEncryption = &decoded
+ case ContentTypeKey:
+ if err := json.AssignNextStringToken(&h.contentType, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, ContentTypeKey, err)
+ }
+ case CriticalKey:
+ var decoded []string
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, CriticalKey, err)
+ }
+ h.critical = decoded
+ case EphemeralPublicKeyKey:
+ var buf json.RawMessage
+ if err := dec.Decode(&buf); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s:%w`, EphemeralPublicKeyKey, err)
+ }
+ key, err := jwk.ParseKey(buf)
+ if err != nil {
+ return fmt.Errorf(`failed to parse JWK for key %s: %w`, EphemeralPublicKeyKey, err)
+ }
+ h.ephemeralPublicKey = key
+ case JWKKey:
+ var buf json.RawMessage
+ if err := dec.Decode(&buf); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s:%w`, JWKKey, err)
+ }
+ key, err := jwk.ParseKey(buf)
+ if err != nil {
+ return fmt.Errorf(`failed to parse JWK for key %s: %w`, JWKKey, err)
+ }
+ h.jwk = key
+ case JWKSetURLKey:
+ if err := json.AssignNextStringToken(&h.jwkSetURL, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, JWKSetURLKey, err)
+ }
+ case KeyIDKey:
+ if err := json.AssignNextStringToken(&h.keyID, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyIDKey, err)
+ }
+ case TypeKey:
+ if err := json.AssignNextStringToken(&h.typ, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, TypeKey, err)
+ }
+ case X509CertChainKey:
+ var decoded cert.Chain
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertChainKey, err)
+ }
+ h.x509CertChain = &decoded
+ case X509CertThumbprintKey:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprint, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintKey, err)
+ }
+ case X509CertThumbprintS256Key:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprintS256, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintS256Key, err)
+ }
+ case X509URLKey:
+ if err := json.AssignNextStringToken(&h.x509URL, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509URLKey, err)
+ }
+ default:
+ decoded, err := registry.Decode(dec, tok)
+ if err != nil {
+ return err
+ }
+ h.setNoLock(tok, decoded)
+ }
+ default:
+ return fmt.Errorf(`invalid token %T`, tok)
+ }
+ }
+ return nil
+}
+
+func (h *stdHeaders) Keys() []string {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ keys := make([]string, 0, 16+len(h.privateParams))
+ if h.agreementPartyUInfo != nil {
+ keys = append(keys, AgreementPartyUInfoKey)
+ }
+ if h.agreementPartyVInfo != nil {
+ keys = append(keys, AgreementPartyVInfoKey)
+ }
+ if h.algorithm != nil {
+ keys = append(keys, AlgorithmKey)
+ }
+ if h.compression != nil {
+ keys = append(keys, CompressionKey)
+ }
+ if h.contentEncryption != nil {
+ keys = append(keys, ContentEncryptionKey)
+ }
+ if h.contentType != nil {
+ keys = append(keys, ContentTypeKey)
+ }
+ if h.critical != nil {
+ keys = append(keys, CriticalKey)
+ }
+ if h.ephemeralPublicKey != nil {
+ keys = append(keys, EphemeralPublicKeyKey)
+ }
+ if h.jwk != nil {
+ keys = append(keys, JWKKey)
+ }
+ if h.jwkSetURL != nil {
+ keys = append(keys, JWKSetURLKey)
+ }
+ if h.keyID != nil {
+ keys = append(keys, KeyIDKey)
+ }
+ if h.typ != nil {
+ keys = append(keys, TypeKey)
+ }
+ if h.x509CertChain != nil {
+ keys = append(keys, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ keys = append(keys, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ keys = append(keys, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ keys = append(keys, X509URLKey)
+ }
+ for k := range h.privateParams {
+ keys = append(keys, k)
+ }
+ return keys
+}
+
+func (h stdHeaders) MarshalJSON() ([]byte, error) {
+ data := make(map[string]any)
+ keys := make([]string, 0, 16+len(h.privateParams))
+ h.mu.RLock()
+ if h.agreementPartyUInfo != nil {
+ data[AgreementPartyUInfoKey] = h.agreementPartyUInfo
+ keys = append(keys, AgreementPartyUInfoKey)
+ }
+ if h.agreementPartyVInfo != nil {
+ data[AgreementPartyVInfoKey] = h.agreementPartyVInfo
+ keys = append(keys, AgreementPartyVInfoKey)
+ }
+ if h.algorithm != nil {
+ data[AlgorithmKey] = *(h.algorithm)
+ keys = append(keys, AlgorithmKey)
+ }
+ if h.compression != nil {
+ data[CompressionKey] = *(h.compression)
+ keys = append(keys, CompressionKey)
+ }
+ if h.contentEncryption != nil {
+ data[ContentEncryptionKey] = *(h.contentEncryption)
+ keys = append(keys, ContentEncryptionKey)
+ }
+ if h.contentType != nil {
+ data[ContentTypeKey] = *(h.contentType)
+ keys = append(keys, ContentTypeKey)
+ }
+ if h.critical != nil {
+ data[CriticalKey] = h.critical
+ keys = append(keys, CriticalKey)
+ }
+ if h.ephemeralPublicKey != nil {
+ data[EphemeralPublicKeyKey] = h.ephemeralPublicKey
+ keys = append(keys, EphemeralPublicKeyKey)
+ }
+ if h.jwk != nil {
+ data[JWKKey] = h.jwk
+ keys = append(keys, JWKKey)
+ }
+ if h.jwkSetURL != nil {
+ data[JWKSetURLKey] = *(h.jwkSetURL)
+ keys = append(keys, JWKSetURLKey)
+ }
+ if h.keyID != nil {
+ data[KeyIDKey] = *(h.keyID)
+ keys = append(keys, KeyIDKey)
+ }
+ if h.typ != nil {
+ data[TypeKey] = *(h.typ)
+ keys = append(keys, TypeKey)
+ }
+ if h.x509CertChain != nil {
+ data[X509CertChainKey] = h.x509CertChain
+ keys = append(keys, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ data[X509CertThumbprintKey] = *(h.x509CertThumbprint)
+ keys = append(keys, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ data[X509CertThumbprintS256Key] = *(h.x509CertThumbprintS256)
+ keys = append(keys, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ data[X509URLKey] = *(h.x509URL)
+ keys = append(keys, X509URLKey)
+ }
+ for k, v := range h.privateParams {
+ data[k] = v
+ keys = append(keys, k)
+ }
+ h.mu.RUnlock()
+
+ sort.Strings(keys)
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+ enc := json.NewEncoder(buf)
+ buf.WriteByte(tokens.OpenCurlyBracket)
+ for i, k := range keys {
+ if i > 0 {
+ buf.WriteRune(tokens.Comma)
+ }
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(k)
+ buf.WriteString(`":`)
+ v := data[k]
+ switch v := v.(type) {
+ case []byte:
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(base64.EncodeToString(v))
+ buf.WriteRune(tokens.DoubleQuote)
+ default:
+ if err := enc.Encode(v); err != nil {
+ return nil, fmt.Errorf(`failed to encode value for field %s`, k)
+ }
+ buf.Truncate(buf.Len() - 1)
+ }
+ }
+ buf.WriteByte(tokens.CloseCurlyBracket)
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ return ret, nil
+}
+
+func (h *stdHeaders) clear() {
+ h.mu.Lock()
+ h.agreementPartyUInfo = nil
+ h.agreementPartyVInfo = nil
+ h.algorithm = nil
+ h.compression = nil
+ h.contentEncryption = nil
+ h.contentType = nil
+ h.critical = nil
+ h.ephemeralPublicKey = nil
+ h.jwk = nil
+ h.jwkSetURL = nil
+ h.keyID = nil
+ h.typ = nil
+ h.x509CertChain = nil
+ h.x509CertThumbprint = nil
+ h.x509CertThumbprintS256 = nil
+ h.x509URL = nil
+ h.privateParams = map[string]any{}
+ h.mu.Unlock()
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/interface.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/interface.go
new file mode 100644
index 0000000000..91ad8cb809
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/interface.go
@@ -0,0 +1,207 @@
+package jwe
+
+import (
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/keygen"
+)
+
+// KeyEncrypter is an interface for object that can encrypt a
+// content encryption key.
+//
+// You can use this in place of a regular key (i.e. in jwe.WithKey())
+// to encrypt the content encryption key in a JWE message without
+// having to expose the secret key in memory, for example, when you
+// want to use hardware security modules (HSMs) to encrypt the key.
+//
+// This API is experimental and may change without notice, even
+// in minor releases.
+type KeyEncrypter interface {
+ // Algorithm returns the algorithm used to encrypt the key.
+ Algorithm() jwa.KeyEncryptionAlgorithm
+
+ // EncryptKey encrypts the given content encryption key.
+ EncryptKey([]byte) ([]byte, error)
+}
+
+// KeyIDer is an interface for things that can return a key ID.
+//
+// As of this writing, this is solely used to identify KeyEncrypter
+// objects that also carry a key ID on its own.
+type KeyIDer interface {
+ KeyID() (string, bool)
+}
+
+// KeyDecrypter is an interface for objects that can decrypt a content
+// encryption key.
+//
+// You can use this in place of a regular key (i.e. in jwe.WithKey())
+// to decrypt the encrypted key in a JWE message without having to
+// expose the secret key in memory, for example, when you want to use
+// hardware security modules (HSMs) to decrypt the key.
+//
+// This API is experimental and may change without notice, even
+// in minor releases.
+type KeyDecrypter interface {
+ // Decrypt decrypts the encrypted key of a JWE message.
+ //
+ // Make sure you understand how JWE messages are structured.
+ //
+ // For example, while in most circumstances a JWE message will only have one recipient,
+ // a JWE message may contain multiple recipients, each with their own
+ // encrypted key. This method will be called for each recipient, instead of
+ // just once for a message.
+ //
+ // Also, header values could be found in either protected/unprotected headers
+ // of a JWE message, as well as in protected/unprotected headers for each recipient.
+ // When checking a header value, you can decide to use either one, or both, but you
+ // must be aware that there are multiple places to look for.
+ DecryptKey(alg jwa.KeyEncryptionAlgorithm, encryptedKey []byte, recipient Recipient, message *Message) ([]byte, error)
+}
+
+// Recipient holds the encrypted key and hints to decrypt the key
+type Recipient interface {
+ Headers() Headers
+ EncryptedKey() []byte
+ SetHeaders(Headers) error
+ SetEncryptedKey([]byte) error
+}
+
+type stdRecipient struct {
+ // Comments on each field are taken from https://datatracker.ietf.org/doc/html/rfc7516
+ //
+ // header
+ // The "header" member MUST be present and contain the value JWE Per-
+ // Recipient Unprotected Header when the JWE Per-Recipient
+ // Unprotected Header value is non-empty; otherwise, it MUST be
+ // absent. This value is represented as an unencoded JSON object,
+ // rather than as a string. These Header Parameter values are not
+ // integrity protected.
+ //
+ // At least one of the "header", "protected", and "unprotected" members
+ // MUST be present so that "alg" and "enc" Header Parameter values are
+ // conveyed for each recipient computation.
+ //
+ // JWX note: see Message.unprotectedHeaders
+ headers Headers
+
+ // encrypted_key
+ // The "encrypted_key" member MUST be present and contain the value
+ // BASE64URL(JWE Encrypted Key) when the JWE Encrypted Key value is
+ // non-empty; otherwise, it MUST be absent.
+ encryptedKey []byte
+}
+
+// Message contains the entire encrypted JWE message. You should not
+// expect to use Message for anything other than inspecting the
+// state of an encrypted message. This is because encryption is
+// highly context-sensitive, and once we parse the original payload
+// into an object, we may not always be able to recreate the exact
+// context in which the encryption happened.
+//
+// For example, it is totally valid for if the protected header's
+// integrity was calculated using a non-standard line breaks:
+//
+// {"a dummy":
+// "protected header"}
+//
+// Once parsed, though, we can only serialize the protected header as:
+//
+// {"a dummy":"protected header"}
+//
+// which would obviously result in a contradicting integrity value
+// if we tried to re-calculate it from a parsed message.
+//
+//nolint:govet
+type Message struct {
+ // Comments on each field are taken from https://datatracker.ietf.org/doc/html/rfc7516
+ //
+ // protected
+ // The "protected" member MUST be present and contain the value
+ // BASE64URL(UTF8(JWE Protected Header)) when the JWE Protected
+ // Header value is non-empty; otherwise, it MUST be absent. These
+ // Header Parameter values are integrity protected.
+ protectedHeaders Headers
+
+ // unprotected
+ // The "unprotected" member MUST be present and contain the value JWE
+ // Shared Unprotected Header when the JWE Shared Unprotected Header
+ // value is non-empty; otherwise, it MUST be absent. This value is
+ // represented as an unencoded JSON object, rather than as a string.
+ // These Header Parameter values are not integrity protected.
+ //
+ // JWX note: This field is NOT mutually exclusive with per-recipient
+ // headers within the implementation because... it's too much work.
+ // It is _never_ populated (we don't provide a way to do this) upon encryption.
+ // When decrypting, if present its values are always merged with
+ // per-recipient header.
+ unprotectedHeaders Headers
+
+ // iv
+ // The "iv" member MUST be present and contain the value
+ // BASE64URL(JWE Initialization Vector) when the JWE Initialization
+ // Vector value is non-empty; otherwise, it MUST be absent.
+ initializationVector []byte
+
+ // aad
+ // The "aad" member MUST be present and contain the value
+ // BASE64URL(JWE AAD)) when the JWE AAD value is non-empty;
+ // otherwise, it MUST be absent. A JWE AAD value can be included to
+ // supply a base64url-encoded value to be integrity protected but not
+ // encrypted.
+ authenticatedData []byte
+
+ // ciphertext
+ // The "ciphertext" member MUST be present and contain the value
+ // BASE64URL(JWE Ciphertext).
+ cipherText []byte
+
+ // tag
+ // The "tag" member MUST be present and contain the value
+ // BASE64URL(JWE Authentication Tag) when the JWE Authentication Tag
+ // value is non-empty; otherwise, it MUST be absent.
+ tag []byte
+
+ // recipients
+ // The "recipients" member value MUST be an array of JSON objects.
+ // Each object contains information specific to a single recipient.
+ // This member MUST be present with exactly one array element per
+ // recipient, even if some or all of the array element values are the
+ // empty JSON object "{}" (which can happen when all Header Parameter
+ // values are shared between all recipients and when no encrypted key
+ // is used, such as when doing Direct Encryption).
+ //
+ // Some Header Parameters, including the "alg" parameter, can be shared
+ // among all recipient computations. Header Parameters in the JWE
+ // Protected Header and JWE Shared Unprotected Header values are shared
+ // among all recipients.
+ //
+ // The Header Parameter values used when creating or validating per-
+ // recipient ciphertext and Authentication Tag values are the union of
+ // the three sets of Header Parameter values that may be present: (1)
+ // the JWE Protected Header represented in the "protected" member, (2)
+ // the JWE Shared Unprotected Header represented in the "unprotected"
+ // member, and (3) the JWE Per-Recipient Unprotected Header represented
+ // in the "header" member of the recipient's array element. The union
+ // of these sets of Header Parameters comprises the JOSE Header. The
+ // Header Parameter names in the three locations MUST be disjoint.
+ recipients []Recipient
+
+ // TODO: Additional members can be present in both the JSON objects defined
+ // above; if not understood by implementations encountering them, they
+ // MUST be ignored.
+ // privateParams map[string]any
+
+ // These two fields below are not available for the public consumers of this object.
+ // rawProtectedHeaders stores the original protected header buffer
+ rawProtectedHeaders []byte
+ // storeProtectedHeaders is a hint to be used in UnmarshalJSON().
+ // When this flag is true, UnmarshalJSON() will populate the
+ // rawProtectedHeaders field
+ storeProtectedHeaders bool
+}
+
+// populater is an interface for things that may modify the
+// JWE header. e.g. ByteWithECPrivateKey
+type populater interface {
+ Populate(keygen.Setter) error
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/aescbc/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/aescbc/BUILD.bazel
new file mode 100644
index 0000000000..4ed4c53fa3
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/aescbc/BUILD.bazel
@@ -0,0 +1,22 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "aescbc",
+ srcs = ["aescbc.go"],
+ importpath = "github.com/lestrrat-go/jwx/v3/jwe/internal/aescbc",
+ visibility = ["//:__subpackages__"],
+ deps = ["//internal/pool"],
+)
+
+go_test(
+ name = "aescbc_test",
+ srcs = ["aescbc_test.go"],
+ embed = [":aescbc"],
+ deps = ["@com_github_stretchr_testify//require"]
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":aescbc",
+ visibility = ["//jwe:__subpackages__"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/aescbc/aescbc.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/aescbc/aescbc.go
new file mode 100644
index 0000000000..4f08c4936f
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/aescbc/aescbc.go
@@ -0,0 +1,268 @@
+package aescbc
+
+import (
+ "crypto/cipher"
+ "crypto/hmac"
+ "crypto/sha256"
+ "crypto/sha512"
+ "crypto/subtle"
+ "encoding/binary"
+ "errors"
+ "fmt"
+ "hash"
+ "sync/atomic"
+
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+)
+
+const (
+ NonceSize = 16
+)
+
+const defaultBufSize int64 = 256 * 1024 * 1024
+
+var maxBufSize atomic.Int64
+
+func init() {
+ SetMaxBufferSize(defaultBufSize)
+}
+
+func SetMaxBufferSize(siz int64) {
+ if siz <= 0 {
+ siz = defaultBufSize
+ }
+ maxBufSize.Store(siz)
+}
+
+func pad(buf []byte, n int) []byte {
+ rem := n - len(buf)%n
+ if rem == 0 {
+ return buf
+ }
+
+ bufsiz := len(buf) + rem
+ mbs := maxBufSize.Load()
+ if int64(bufsiz) > mbs {
+ panic(fmt.Errorf("failed to allocate buffer"))
+ }
+ newbuf := make([]byte, bufsiz)
+ copy(newbuf, buf)
+
+ for i := len(buf); i < len(newbuf); i++ {
+ newbuf[i] = byte(rem)
+ }
+ return newbuf
+}
+
+// ref. https://github.com/golang/go/blob/c3db64c0f45e8f2d75c5b59401e0fc925701b6f4/src/crypto/tls/conn.go#L279-L324
+//
+// extractPadding returns, in constant time, the length of the padding to remove
+// from the end of payload. It also returns a byte which is equal to 255 if the
+// padding was valid and 0 otherwise. See RFC 2246, Section 6.2.3.2.
+func extractPadding(payload []byte) (toRemove int, good byte) {
+ if len(payload) < 1 {
+ return 0, 0
+ }
+
+ paddingLen := payload[len(payload)-1]
+ t := uint(len(payload)) - uint(paddingLen)
+ // if len(payload) > paddingLen then the MSB of t is zero
+ good = byte(int32(^t) >> 31)
+
+ // The maximum possible padding length plus the actual length field
+ toCheck := 256
+ // The length of the padded data is public, so we can use an if here
+ toCheck = min(toCheck, len(payload))
+
+ for i := 1; i <= toCheck; i++ {
+ t := uint(paddingLen) - uint(i)
+ // if i <= paddingLen then the MSB of t is zero
+ mask := byte(int32(^t) >> 31)
+ b := payload[len(payload)-i]
+ good &^= mask&paddingLen ^ mask&b
+ }
+
+ // We AND together the bits of good and replicate the result across
+ // all the bits.
+ good &= good << 4
+ good &= good << 2
+ good &= good << 1
+ good = uint8(int8(good) >> 7)
+
+ // Zero the padding length on error. This ensures any unchecked bytes
+ // are included in the MAC. Otherwise, an attacker that could
+ // distinguish MAC failures from padding failures could mount an attack
+ // similar to POODLE in SSL 3.0: given a good ciphertext that uses a
+ // full block's worth of padding, replace the final block with another
+ // block. If the MAC check passed but the padding check failed, the
+ // last byte of that block decrypted to the block size.
+ //
+ // See also macAndPaddingGood logic below.
+ paddingLen &= good
+
+ toRemove = int(paddingLen)
+ return
+}
+
+type Hmac struct {
+ blockCipher cipher.Block
+ hash func() hash.Hash
+ keysize int
+ tagsize int
+ integrityKey []byte
+}
+
+type BlockCipherFunc func([]byte) (cipher.Block, error)
+
+func New(key []byte, f BlockCipherFunc) (hmac *Hmac, err error) {
+ keysize := len(key) / 2
+ ikey := key[:keysize]
+ ekey := key[keysize:]
+
+ bc, ciphererr := f(ekey)
+ if ciphererr != nil {
+ err = fmt.Errorf(`failed to execute block cipher function: %w`, ciphererr)
+ return
+ }
+
+ var hfunc func() hash.Hash
+ switch keysize {
+ case 16:
+ hfunc = sha256.New
+ case 24:
+ hfunc = sha512.New384
+ case 32:
+ hfunc = sha512.New
+ default:
+ return nil, fmt.Errorf("unsupported key size %d", keysize)
+ }
+
+ return &Hmac{
+ blockCipher: bc,
+ hash: hfunc,
+ integrityKey: ikey,
+ keysize: keysize,
+ tagsize: keysize, // NonceSize,
+ // While investigating GH #207, I stumbled upon another problem where
+ // the computed tags don't match on decrypt. After poking through the
+ // code using a bunch of debug statements, I've finally found out that
+ // tagsize = keysize makes the whole thing work.
+ }, nil
+}
+
+// NonceSize fulfills the crypto.AEAD interface
+func (c Hmac) NonceSize() int {
+ return NonceSize
+}
+
+// Overhead fulfills the crypto.AEAD interface
+func (c Hmac) Overhead() int {
+ return c.blockCipher.BlockSize() + c.tagsize
+}
+
+func (c Hmac) ComputeAuthTag(aad, nonce, ciphertext []byte) ([]byte, error) {
+ var buf [8]byte
+ binary.BigEndian.PutUint64(buf[:], uint64(len(aad)*8))
+
+ h := hmac.New(c.hash, c.integrityKey)
+
+ // compute the tag
+ // no need to check errors because Write never returns an error: https://pkg.go.dev/hash#Hash
+ //
+ // > Write (via the embedded io.Writer interface) adds more data to the running hash.
+ // > It never returns an error.
+ h.Write(aad)
+ h.Write(nonce)
+ h.Write(ciphertext)
+ h.Write(buf[:])
+ s := h.Sum(nil)
+ return s[:c.tagsize], nil
+}
+
+func ensureSize(dst []byte, n int) []byte {
+ // if the dst buffer has enough length just copy the relevant parts to it.
+ // Otherwise create a new slice that's big enough, and operate on that
+ // Note: I think go-jose has a bug in that it checks for cap(), but not len().
+ ret := dst
+ if diff := n - len(dst); diff > 0 {
+ // dst is not big enough
+ ret = make([]byte, n)
+ copy(ret, dst)
+ }
+ return ret
+}
+
+// Seal fulfills the crypto.AEAD interface
+func (c Hmac) Seal(dst, nonce, plaintext, data []byte) []byte {
+ ctlen := len(plaintext)
+ bufsiz := ctlen + c.Overhead()
+ mbs := maxBufSize.Load()
+
+ if int64(bufsiz) > mbs {
+ panic(fmt.Errorf("failed to allocate buffer"))
+ }
+ ciphertext := make([]byte, bufsiz)[:ctlen]
+ copy(ciphertext, plaintext)
+ ciphertext = pad(ciphertext, c.blockCipher.BlockSize())
+
+ cbc := cipher.NewCBCEncrypter(c.blockCipher, nonce)
+ cbc.CryptBlocks(ciphertext, ciphertext)
+
+ authtag, err := c.ComputeAuthTag(data, nonce, ciphertext)
+ if err != nil {
+ // Hmac implements cipher.AEAD interface. Seal can't return error.
+ // But currently it never reach here because of Hmac.ComputeAuthTag doesn't return error.
+ panic(fmt.Errorf("failed to seal on hmac: %v", err))
+ }
+
+ retlen := len(dst) + len(ciphertext) + len(authtag)
+
+ ret := ensureSize(dst, retlen)
+ out := ret[len(dst):]
+ n := copy(out, ciphertext)
+ copy(out[n:], authtag)
+
+ return ret
+}
+
+// Open fulfills the crypto.AEAD interface
+func (c Hmac) Open(dst, nonce, ciphertext, data []byte) ([]byte, error) {
+ if len(ciphertext) < c.keysize {
+ return nil, fmt.Errorf(`invalid ciphertext (too short)`)
+ }
+
+ tagOffset := len(ciphertext) - c.tagsize
+ if tagOffset%c.blockCipher.BlockSize() != 0 {
+ return nil, fmt.Errorf(
+ "invalid ciphertext (invalid length: %d %% %d != 0)",
+ tagOffset,
+ c.blockCipher.BlockSize(),
+ )
+ }
+ tag := ciphertext[tagOffset:]
+ ciphertext = ciphertext[:tagOffset]
+
+ expectedTag, err := c.ComputeAuthTag(data, nonce, ciphertext[:tagOffset])
+ if err != nil {
+ return nil, fmt.Errorf(`failed to compute auth tag: %w`, err)
+ }
+
+ cbc := cipher.NewCBCDecrypter(c.blockCipher, nonce)
+ buf := pool.ByteSlice().GetCapacity(tagOffset)
+ defer pool.ByteSlice().Put(buf)
+ buf = buf[:tagOffset]
+
+ cbc.CryptBlocks(buf, ciphertext)
+
+ toRemove, good := extractPadding(buf)
+ cmp := subtle.ConstantTimeCompare(expectedTag, tag) & int(good)
+ if cmp != 1 {
+ return nil, errors.New(`invalid ciphertext`)
+ }
+
+ plaintext := buf[:len(buf)-toRemove]
+ ret := ensureSize(dst, len(plaintext))
+ out := ret[len(dst):]
+ copy(out, plaintext)
+ return ret, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/cipher/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/cipher/BUILD.bazel
new file mode 100644
index 0000000000..cf642c744d
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/cipher/BUILD.bazel
@@ -0,0 +1,34 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "cipher",
+ srcs = [
+ "cipher.go",
+ "interface.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/jwe/internal/cipher",
+ visibility = ["//:__subpackages__"],
+ deps = [
+ "//jwa",
+ "//jwe/internal/aescbc",
+ "//jwe/internal/keygen",
+ "//internal/tokens",
+ ],
+)
+
+go_test(
+ name = "cipher_test",
+ srcs = ["cipher_test.go"],
+ deps = [
+ ":cipher",
+ "//jwa",
+ "//internal/tokens",
+ "@com_github_stretchr_testify//require",
+ ],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":cipher",
+ visibility = ["//jwe:__subpackages__"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/cipher/cipher.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/cipher/cipher.go
new file mode 100644
index 0000000000..9b9a40d00d
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/cipher/cipher.go
@@ -0,0 +1,169 @@
+package cipher
+
+import (
+ "crypto/aes"
+ "crypto/cipher"
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/aescbc"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/keygen"
+)
+
+var gcm = &gcmFetcher{}
+var cbc = &cbcFetcher{}
+
+func (f gcmFetcher) Fetch(key []byte, size int) (cipher.AEAD, error) {
+ if len(key) != size {
+ return nil, fmt.Errorf(`key size (%d) does not match expected key size (%d)`, len(key), size)
+ }
+ aescipher, err := aes.NewCipher(key)
+ if err != nil {
+ return nil, fmt.Errorf(`cipher: failed to create AES cipher for GCM: %w`, err)
+ }
+
+ aead, err := cipher.NewGCM(aescipher)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to create GCM for cipher: %w`, err)
+ }
+ return aead, nil
+}
+
+func (f cbcFetcher) Fetch(key []byte, size int) (cipher.AEAD, error) {
+ if len(key) != size {
+ return nil, fmt.Errorf(`key size (%d) does not match expected key size (%d)`, len(key), size)
+ }
+ aead, err := aescbc.New(key, aes.NewCipher)
+ if err != nil {
+ return nil, fmt.Errorf(`cipher: failed to create AES cipher for CBC: %w`, err)
+ }
+ return aead, nil
+}
+
+func (c AesContentCipher) KeySize() int {
+ return c.keysize
+}
+
+func (c AesContentCipher) TagSize() int {
+ return c.tagsize
+}
+
+func NewAES(alg string) (*AesContentCipher, error) {
+ var keysize int
+ var tagsize int
+ var fetcher Fetcher
+ switch alg {
+ case tokens.A128GCM:
+ keysize = 16
+ tagsize = 16
+ fetcher = gcm
+ case tokens.A192GCM:
+ keysize = 24
+ tagsize = 16
+ fetcher = gcm
+ case tokens.A256GCM:
+ keysize = 32
+ tagsize = 16
+ fetcher = gcm
+ case tokens.A128CBC_HS256:
+ tagsize = 16
+ keysize = tagsize * 2
+ fetcher = cbc
+ case tokens.A192CBC_HS384:
+ tagsize = 24
+ keysize = tagsize * 2
+ fetcher = cbc
+ case tokens.A256CBC_HS512:
+ tagsize = 32
+ keysize = tagsize * 2
+ fetcher = cbc
+ default:
+ return nil, fmt.Errorf("failed to create AES content cipher: invalid algorithm (%s)", alg)
+ }
+
+ return &AesContentCipher{
+ keysize: keysize,
+ tagsize: tagsize,
+ fetch: fetcher,
+ }, nil
+}
+
+func (c AesContentCipher) Encrypt(cek, plaintext, aad []byte) (iv, ciphertxt, tag []byte, err error) {
+ var aead cipher.AEAD
+ aead, err = c.fetch.Fetch(cek, c.keysize)
+ if err != nil {
+ return nil, nil, nil, fmt.Errorf(`failed to fetch AEAD: %w`, err)
+ }
+
+ // Seal may panic (argh!), so protect ourselves from that
+ defer func() {
+ if e := recover(); e != nil {
+ switch e := e.(type) {
+ case error:
+ err = e
+ default:
+ err = fmt.Errorf("%s", e)
+ }
+ err = fmt.Errorf(`failed to encrypt: %w`, err)
+ }
+ }()
+
+ if c.NonceGenerator != nil {
+ iv, err = c.NonceGenerator(aead.NonceSize())
+ if err != nil {
+ return nil, nil, nil, fmt.Errorf(`failed to generate nonce: %w`, err)
+ }
+ } else {
+ bs, err := keygen.Random(aead.NonceSize())
+ if err != nil {
+ return nil, nil, nil, fmt.Errorf(`failed to generate random nonce: %w`, err)
+ }
+ iv = bs.Bytes()
+ }
+
+ combined := aead.Seal(nil, iv, plaintext, aad)
+ tagoffset := len(combined) - c.TagSize()
+
+ if tagoffset < 0 {
+ panic(fmt.Sprintf("tag offset is less than 0 (combined len = %d, tagsize = %d)", len(combined), c.TagSize()))
+ }
+
+ tag = combined[tagoffset:]
+ ciphertxt = make([]byte, tagoffset)
+ copy(ciphertxt, combined[:tagoffset])
+
+ return
+}
+
+func (c AesContentCipher) Decrypt(cek, iv, ciphertxt, tag, aad []byte) (plaintext []byte, err error) {
+ aead, err := c.fetch.Fetch(cek, c.keysize)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to fetch AEAD data: %w`, err)
+ }
+
+ // Open may panic (argh!), so protect ourselves from that
+ defer func() {
+ if e := recover(); e != nil {
+ switch e := e.(type) {
+ case error:
+ err = e
+ default:
+ err = fmt.Errorf(`%s`, e)
+ }
+ err = fmt.Errorf(`failed to decrypt: %w`, err)
+ return
+ }
+ }()
+
+ combined := make([]byte, len(ciphertxt)+len(tag))
+ copy(combined, ciphertxt)
+ copy(combined[len(ciphertxt):], tag)
+
+ buf, aeaderr := aead.Open(nil, iv, combined, aad)
+ if aeaderr != nil {
+ err = fmt.Errorf(`aead.Open failed: %w`, aeaderr)
+ return
+ }
+ plaintext = buf
+ return
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/cipher/interface.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/cipher/interface.go
new file mode 100644
index 0000000000..a03e15b159
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/cipher/interface.go
@@ -0,0 +1,32 @@
+package cipher
+
+import (
+ "crypto/cipher"
+)
+
+const (
+ TagSize = 16
+)
+
+// ContentCipher knows how to encrypt/decrypt the content given a content
+// encryption key and other data
+type ContentCipher interface {
+ KeySize() int
+ Encrypt(cek, aad, plaintext []byte) ([]byte, []byte, []byte, error)
+ Decrypt(cek, iv, aad, ciphertext, tag []byte) ([]byte, error)
+}
+
+type Fetcher interface {
+ Fetch([]byte, int) (cipher.AEAD, error)
+}
+
+type gcmFetcher struct{}
+type cbcFetcher struct{}
+
+// AesContentCipher represents a cipher based on AES
+type AesContentCipher struct {
+ NonceGenerator func(int) ([]byte, error)
+ fetch Fetcher
+ keysize int
+ tagsize int
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/concatkdf/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/concatkdf/BUILD.bazel
new file mode 100644
index 0000000000..59aeb2cd27
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/concatkdf/BUILD.bazel
@@ -0,0 +1,24 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "concatkdf",
+ srcs = ["concatkdf.go"],
+ importpath = "github.com/lestrrat-go/jwx/v3/jwe/internal/concatkdf",
+ visibility = ["//:__subpackages__"],
+)
+
+go_test(
+ name = "concatkdf_test",
+ srcs = ["concatkdf_test.go"],
+ embed = [":concatkdf"],
+ deps = [
+ "//jwa",
+ "@com_github_stretchr_testify//require",
+ ],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":concatkdf",
+ visibility = ["//jwe:__subpackages__"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/concatkdf/concatkdf.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/concatkdf/concatkdf.go
new file mode 100644
index 0000000000..3691830a63
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/concatkdf/concatkdf.go
@@ -0,0 +1,66 @@
+package concatkdf
+
+import (
+ "crypto"
+ "encoding/binary"
+ "fmt"
+)
+
+type KDF struct {
+ buf []byte
+ otherinfo []byte
+ z []byte
+ hash crypto.Hash
+}
+
+func ndata(src []byte) []byte {
+ buf := make([]byte, 4+len(src))
+ binary.BigEndian.PutUint32(buf, uint32(len(src)))
+ copy(buf[4:], src)
+ return buf
+}
+
+func New(hash crypto.Hash, alg, Z, apu, apv, pubinfo, privinfo []byte) *KDF {
+ algbuf := ndata(alg)
+ apubuf := ndata(apu)
+ apvbuf := ndata(apv)
+
+ concat := make([]byte, len(algbuf)+len(apubuf)+len(apvbuf)+len(pubinfo)+len(privinfo))
+ n := copy(concat, algbuf)
+ n += copy(concat[n:], apubuf)
+ n += copy(concat[n:], apvbuf)
+ n += copy(concat[n:], pubinfo)
+ copy(concat[n:], privinfo)
+
+ return &KDF{
+ hash: hash,
+ otherinfo: concat,
+ z: Z,
+ }
+}
+
+func (k *KDF) Read(out []byte) (int, error) {
+ var round uint32 = 1
+ h := k.hash.New()
+
+ for len(out) > len(k.buf) {
+ h.Reset()
+
+ if err := binary.Write(h, binary.BigEndian, round); err != nil {
+ return 0, fmt.Errorf(`failed to write round using kdf: %w`, err)
+ }
+ if _, err := h.Write(k.z); err != nil {
+ return 0, fmt.Errorf(`failed to write z using kdf: %w`, err)
+ }
+ if _, err := h.Write(k.otherinfo); err != nil {
+ return 0, fmt.Errorf(`failed to write other info using kdf: %w`, err)
+ }
+
+ k.buf = append(k.buf, h.Sum(nil)...)
+ round++
+ }
+
+ n := copy(out, k.buf[:len(out)])
+ k.buf = k.buf[len(out):]
+ return n, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/content_crypt/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/content_crypt/BUILD.bazel
new file mode 100644
index 0000000000..bb395200f8
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/content_crypt/BUILD.bazel
@@ -0,0 +1,21 @@
+load("@rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "content_crypt",
+ srcs = [
+ "content_crypt.go",
+ "interface.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/jwe/internal/content_crypt",
+ visibility = ["//:__subpackages__"],
+ deps = [
+ "//jwa",
+ "//jwe/internal/cipher",
+ ],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":content_crypt",
+ visibility = ["//jwe:__subpackages__"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/content_crypt/content_crypt.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/content_crypt/content_crypt.go
new file mode 100644
index 0000000000..0ef45ed953
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/content_crypt/content_crypt.go
@@ -0,0 +1,43 @@
+package content_crypt //nolint:golint
+
+import (
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/cipher"
+)
+
+func (c Generic) Algorithm() jwa.ContentEncryptionAlgorithm {
+ return c.alg
+}
+
+func (c Generic) Encrypt(cek, plaintext, aad []byte) ([]byte, []byte, []byte, error) {
+ iv, encrypted, tag, err := c.cipher.Encrypt(cek, plaintext, aad)
+ if err != nil {
+ return nil, nil, nil, fmt.Errorf(`failed to crypt content: %w`, err)
+ }
+
+ return iv, encrypted, tag, nil
+}
+
+func (c Generic) Decrypt(cek, iv, ciphertext, tag, aad []byte) ([]byte, error) {
+ return c.cipher.Decrypt(cek, iv, ciphertext, tag, aad)
+}
+
+func NewGeneric(alg jwa.ContentEncryptionAlgorithm) (*Generic, error) {
+ c, err := cipher.NewAES(alg.String())
+ if err != nil {
+ return nil, fmt.Errorf(`aes crypt: failed to create content cipher: %w`, err)
+ }
+
+ return &Generic{
+ alg: alg,
+ cipher: c,
+ keysize: c.KeySize(),
+ tagsize: 16,
+ }, nil
+}
+
+func (c Generic) KeySize() int {
+ return c.keysize
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/content_crypt/interface.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/content_crypt/interface.go
new file mode 100644
index 0000000000..84b42fe07d
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/content_crypt/interface.go
@@ -0,0 +1,20 @@
+package content_crypt //nolint:golint
+
+import (
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/cipher"
+)
+
+// Generic encrypts a message by applying all the necessary
+// modifications to the keys and the contents
+type Generic struct {
+ alg jwa.ContentEncryptionAlgorithm
+ keysize int
+ tagsize int
+ cipher cipher.ContentCipher
+}
+
+type Cipher interface {
+ Decrypt([]byte, []byte, []byte, []byte, []byte) ([]byte, error)
+ KeySize() int
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/keygen/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/keygen/BUILD.bazel
new file mode 100644
index 0000000000..bde8eb68f7
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/keygen/BUILD.bazel
@@ -0,0 +1,24 @@
+load("@rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "keygen",
+ srcs = [
+ "interface.go",
+ "keygen.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/jwe/internal/keygen",
+ visibility = ["//:__subpackages__"],
+ deps = [
+ "//internal/ecutil",
+ "//jwa",
+ "//jwe/internal/concatkdf",
+ "//internal/tokens",
+ "//jwk",
+ ],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":keygen",
+ visibility = ["//jwe:__subpackages__"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/keygen/interface.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/keygen/interface.go
new file mode 100644
index 0000000000..7f8fb961a2
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/keygen/interface.go
@@ -0,0 +1,40 @@
+package keygen
+
+// ByteKey is a generated key that only has the key's byte buffer
+// as its instance data. If a key needs to do more, such as providing
+// values to be set in a JWE header, that key type wraps a ByteKey
+type ByteKey []byte
+
+// ByteWithECPublicKey holds the EC private key that generated
+// the key along with the key itself. This is required to set the
+// proper values in the JWE headers
+type ByteWithECPublicKey struct {
+ ByteKey
+
+ PublicKey any
+}
+
+type ByteWithIVAndTag struct {
+ ByteKey
+
+ IV []byte
+ Tag []byte
+}
+
+type ByteWithSaltAndCount struct {
+ ByteKey
+
+ Salt []byte
+ Count int
+}
+
+// ByteSource is an interface for things that return a byte sequence.
+// This is used for KeyGenerator so that the result of computations can
+// carry more than just the generate byte sequence.
+type ByteSource interface {
+ Bytes() []byte
+}
+
+type Setter interface {
+ Set(string, any) error
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/keygen/keygen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/keygen/keygen.go
new file mode 100644
index 0000000000..daa7599d9f
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/internal/keygen/keygen.go
@@ -0,0 +1,139 @@
+package keygen
+
+import (
+ "crypto"
+ "crypto/ecdh"
+ "crypto/ecdsa"
+ "crypto/rand"
+ "encoding/binary"
+ "fmt"
+ "io"
+
+ "github.com/lestrrat-go/jwx/v3/internal/ecutil"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/concatkdf"
+ "github.com/lestrrat-go/jwx/v3/jwk"
+)
+
+// Bytes returns the byte from this ByteKey
+func (k ByteKey) Bytes() []byte {
+ return []byte(k)
+}
+
+func Random(n int) (ByteSource, error) {
+ buf := make([]byte, n)
+ if _, err := io.ReadFull(rand.Reader, buf); err != nil {
+ return nil, fmt.Errorf(`failed to read from rand.Reader: %w`, err)
+ }
+ return ByteKey(buf), nil
+}
+
+// Ecdhes generates a new key using ECDH-ES
+func Ecdhes(alg string, enc string, keysize int, pubkey *ecdsa.PublicKey, apu, apv []byte) (ByteSource, error) {
+ priv, err := ecdsa.GenerateKey(pubkey.Curve, rand.Reader)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to generate key for ECDH-ES: %w`, err)
+ }
+
+ var algorithm string
+ if alg == tokens.ECDH_ES {
+ algorithm = enc
+ } else {
+ algorithm = alg
+ }
+
+ pubinfo := make([]byte, 4)
+ binary.BigEndian.PutUint32(pubinfo, uint32(keysize)*8)
+
+ if !priv.PublicKey.Curve.IsOnCurve(pubkey.X, pubkey.Y) {
+ return nil, fmt.Errorf(`public key used does not contain a point (X,Y) on the curve`)
+ }
+ z, _ := priv.PublicKey.Curve.ScalarMult(pubkey.X, pubkey.Y, priv.D.Bytes())
+ zBytes := ecutil.AllocECPointBuffer(z, priv.PublicKey.Curve)
+ defer ecutil.ReleaseECPointBuffer(zBytes)
+ kdf := concatkdf.New(crypto.SHA256, []byte(algorithm), zBytes, apu, apv, pubinfo, []byte{})
+ kek := make([]byte, keysize)
+ if _, err := kdf.Read(kek); err != nil {
+ return nil, fmt.Errorf(`failed to read kdf: %w`, err)
+ }
+
+ return ByteWithECPublicKey{
+ PublicKey: &priv.PublicKey,
+ ByteKey: ByteKey(kek),
+ }, nil
+}
+
+// X25519 generates a new key using ECDH-ES with X25519
+func X25519(alg string, enc string, keysize int, pubkey *ecdh.PublicKey) (ByteSource, error) {
+ priv, err := ecdh.X25519().GenerateKey(rand.Reader)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to generate key for X25519: %w`, err)
+ }
+
+ var algorithm string
+ if alg == tokens.ECDH_ES {
+ algorithm = enc
+ } else {
+ algorithm = alg
+ }
+
+ pubinfo := make([]byte, 4)
+ binary.BigEndian.PutUint32(pubinfo, uint32(keysize)*8)
+
+ zBytes, err := priv.ECDH(pubkey)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to compute Z: %w`, err)
+ }
+ kdf := concatkdf.New(crypto.SHA256, []byte(algorithm), zBytes, []byte{}, []byte{}, pubinfo, []byte{})
+ kek := make([]byte, keysize)
+ if _, err := kdf.Read(kek); err != nil {
+ return nil, fmt.Errorf(`failed to read kdf: %w`, err)
+ }
+
+ return ByteWithECPublicKey{
+ PublicKey: priv.PublicKey(),
+ ByteKey: ByteKey(kek),
+ }, nil
+}
+
+// HeaderPopulate populates the header with the required EC-DSA public key
+// information ('epk' key)
+func (k ByteWithECPublicKey) Populate(h Setter) error {
+ key, err := jwk.Import(k.PublicKey)
+ if err != nil {
+ return fmt.Errorf(`failed to create JWK: %w`, err)
+ }
+
+ if err := h.Set("epk", key); err != nil {
+ return fmt.Errorf(`failed to write header: %w`, err)
+ }
+ return nil
+}
+
+// HeaderPopulate populates the header with the required AES GCM
+// parameters ('iv' and 'tag')
+func (k ByteWithIVAndTag) Populate(h Setter) error {
+ if err := h.Set("iv", k.IV); err != nil {
+ return fmt.Errorf(`failed to write header: %w`, err)
+ }
+
+ if err := h.Set("tag", k.Tag); err != nil {
+ return fmt.Errorf(`failed to write header: %w`, err)
+ }
+
+ return nil
+}
+
+// HeaderPopulate populates the header with the required PBES2
+// parameters ('p2s' and 'p2c')
+func (k ByteWithSaltAndCount) Populate(h Setter) error {
+ if err := h.Set("p2c", k.Count); err != nil {
+ return fmt.Errorf(`failed to write header: %w`, err)
+ }
+
+ if err := h.Set("p2s", k.Salt); err != nil {
+ return fmt.Errorf(`failed to write header: %w`, err)
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/io.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/io.go
new file mode 100644
index 0000000000..a5d6aca8a3
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/io.go
@@ -0,0 +1,36 @@
+// Code generated by tools/cmd/genreadfile/main.go. DO NOT EDIT.
+
+package jwe
+
+import (
+ "fmt"
+ "io/fs"
+ "os"
+)
+
+type sysFS struct{}
+
+func (sysFS) Open(path string) (fs.File, error) {
+ return os.Open(path)
+}
+
+func ReadFile(path string, options ...ReadFileOption) (*Message, error) {
+
+ var srcFS fs.FS = sysFS{}
+ for _, option := range options {
+ switch option.Ident() {
+ case identFS{}:
+ if err := option.Value(&srcFS); err != nil {
+ return nil, fmt.Errorf("failed to set fs.FS: %w", err)
+ }
+ }
+ }
+
+ f, err := srcFS.Open(path)
+ if err != nil {
+ return nil, err
+ }
+
+ defer f.Close()
+ return ParseReader(f)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwe.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwe.go
new file mode 100644
index 0000000000..5b9c92771a
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwe.go
@@ -0,0 +1,1118 @@
+//go:generate ../tools/cmd/genjwe.sh
+
+// Package jwe implements JWE as described in https://tools.ietf.org/html/rfc7516
+package jwe
+
+// #region imports
+import (
+ "bytes"
+ "context"
+ "crypto/ecdsa"
+ "errors"
+ "fmt"
+ "io"
+ "sync"
+
+ "github.com/lestrrat-go/blackmagic"
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwk"
+
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/aescbc"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/content_crypt"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/keygen"
+)
+
+// #region globals
+
+var muSettings sync.RWMutex
+var maxPBES2Count = 10000
+var maxDecompressBufferSize int64 = 10 * 1024 * 1024 // 10MB
+
+func Settings(options ...GlobalOption) {
+ muSettings.Lock()
+ defer muSettings.Unlock()
+ for _, option := range options {
+ switch option.Ident() {
+ case identMaxPBES2Count{}:
+ if err := option.Value(&maxPBES2Count); err != nil {
+ panic(fmt.Sprintf("jwe.Settings: value for option WithMaxPBES2Count must be an int: %s", err))
+ }
+ case identMaxDecompressBufferSize{}:
+ if err := option.Value(&maxDecompressBufferSize); err != nil {
+ panic(fmt.Sprintf("jwe.Settings: value for option WithMaxDecompressBufferSize must be an int64: %s", err))
+ }
+ case identCBCBufferSize{}:
+ var v int64
+ if err := option.Value(&v); err != nil {
+ panic(fmt.Sprintf("jwe.Settings: value for option WithCBCBufferSize must be an int64: %s", err))
+ }
+ aescbc.SetMaxBufferSize(v)
+ }
+ }
+}
+
+const (
+ fmtInvalid = iota
+ fmtCompact
+ fmtJSON
+ fmtJSONPretty
+ fmtMax
+)
+
+var _ = fmtInvalid
+var _ = fmtMax
+
+var registry = json.NewRegistry()
+
+type recipientBuilder struct {
+ alg jwa.KeyEncryptionAlgorithm
+ key any
+ headers Headers
+}
+
+func (b *recipientBuilder) Build(r Recipient, cek []byte, calg jwa.ContentEncryptionAlgorithm, _ *content_crypt.Generic) ([]byte, error) {
+ // we need the raw key for later use
+ rawKey := b.key
+
+ var keyID string
+ if ke, ok := b.key.(KeyEncrypter); ok {
+ if kider, ok := ke.(KeyIDer); ok {
+ if v, ok := kider.KeyID(); ok {
+ keyID = v
+ }
+ }
+ } else if jwkKey, ok := b.key.(jwk.Key); ok {
+ // Meanwhile, grab the kid as well
+ if v, ok := jwkKey.KeyID(); ok {
+ keyID = v
+ }
+
+ var raw any
+ if err := jwk.Export(jwkKey, &raw); err != nil {
+ return nil, fmt.Errorf(`jwe.Encrypt: recipientBuilder: failed to retrieve raw key out of %T: %w`, b.key, err)
+ }
+
+ rawKey = raw
+ }
+
+ // Extract ECDH-ES specific parameters if needed.
+ var apu, apv []byte
+
+ hdr := b.headers
+ if hdr == nil {
+ hdr = NewHeaders()
+ }
+
+ if val, ok := hdr.AgreementPartyUInfo(); ok {
+ apu = val
+ }
+
+ if val, ok := hdr.AgreementPartyVInfo(); ok {
+ apv = val
+ }
+
+ // Create the encrypter using the new jwebb pattern
+ enc, err := newEncrypter(b.alg, calg, b.key, rawKey, apu, apv)
+ if err != nil {
+ return nil, fmt.Errorf(`jwe.Encrypt: recipientBuilder: failed to create encrypter: %w`, err)
+ }
+
+ _ = r.SetHeaders(hdr)
+
+ // Populate headers with stuff that we automatically set
+ if err := hdr.Set(AlgorithmKey, b.alg); err != nil {
+ return nil, fmt.Errorf(`failed to set header: %w`, err)
+ }
+
+ if keyID != "" {
+ if err := hdr.Set(KeyIDKey, keyID); err != nil {
+ return nil, fmt.Errorf(`failed to set header: %w`, err)
+ }
+ }
+
+ // Handle the encrypted key
+ var rawCEK []byte
+ enckey, err := enc.EncryptKey(cek)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encrypt key: %w`, err)
+ }
+ if b.alg == jwa.ECDH_ES() || b.alg == jwa.DIRECT() {
+ rawCEK = enckey.Bytes()
+ } else {
+ if err := r.SetEncryptedKey(enckey.Bytes()); err != nil {
+ return nil, fmt.Errorf(`failed to set encrypted key: %w`, err)
+ }
+ }
+
+ // finally, anything specific should go here
+ if hp, ok := enckey.(populater); ok {
+ if err := hp.Populate(hdr); err != nil {
+ return nil, fmt.Errorf(`failed to populate: %w`, err)
+ }
+ }
+
+ return rawCEK, nil
+}
+
+// Encrypt generates a JWE message for the given payload and returns
+// it in serialized form, which can be in either compact or
+// JSON format. Default is compact. When JSON format is specified and
+// there is only one recipient, the resulting serialization is
+// automatically converted to flattened JSON serialization format.
+//
+// You must pass at least one key to `jwe.Encrypt()` by using `jwe.WithKey()`
+// option.
+//
+// jwe.Encrypt(payload, jwe.WithKey(alg, key))
+// jwe.Encrypt(payload, jws.WithJSON(), jws.WithKey(alg1, key1), jws.WithKey(alg2, key2))
+//
+// Note that in the second example the `jws.WithJSON()` option is
+// specified as well. This is because the compact serialization
+// format does not support multiple recipients, and users must
+// specifically ask for the JSON serialization format.
+//
+// Read the documentation for `jwe.WithKey()` to learn more about the
+// possible values that can be used for `alg` and `key`.
+//
+// Look for options that return `jwe.EncryptOption` or `jws.EncryptDecryptOption`
+// for a complete list of options that can be passed to this function.
+//
+// As of v3.0.12, users can specify `jwe.WithLegacyHeaderMerging()` to
+// disable header merging behavior that was the default prior to v3.0.12.
+// Read the documentation for `jwe.WithLegacyHeaderMerging()` for more information.
+func Encrypt(payload []byte, options ...EncryptOption) ([]byte, error) {
+ ec := encryptContextPool.Get()
+ defer encryptContextPool.Put(ec)
+ if err := ec.ProcessOptions(options); err != nil {
+ return nil, encryptError{fmt.Errorf(`jwe.Encrypt: failed to process options: %w`, err)}
+ }
+ ret, err := ec.EncryptMessage(payload, nil)
+ if err != nil {
+ return nil, encryptError{fmt.Errorf(`jwe.Encrypt: %w`, err)}
+ }
+ return ret, nil
+}
+
+// EncryptStatic is exactly like Encrypt, except it accepts a static
+// content encryption key (CEK). It is separated out from the main
+// Encrypt function such that the latter does not accidentally use a static
+// CEK.
+//
+// DO NOT attempt to use this function unless you completely understand the
+// security implications to using static CEKs. You have been warned.
+//
+// This function is currently considered EXPERIMENTAL, and is subject to
+// future changes across minor/micro versions.
+func EncryptStatic(payload, cek []byte, options ...EncryptOption) ([]byte, error) {
+ if len(cek) <= 0 {
+ return nil, encryptError{fmt.Errorf(`jwe.EncryptStatic: empty CEK`)}
+ }
+ ec := encryptContextPool.Get()
+ defer encryptContextPool.Put(ec)
+ if err := ec.ProcessOptions(options); err != nil {
+ return nil, encryptError{fmt.Errorf(`jwe.EncryptStatic: failed to process options: %w`, err)}
+ }
+ ret, err := ec.EncryptMessage(payload, cek)
+ if err != nil {
+ return nil, encryptError{fmt.Errorf(`jwe.EncryptStatic: %w`, err)}
+ }
+ return ret, nil
+}
+
+// decryptContext holds the state during JWE decryption, similar to JWS verifyContext
+type decryptContext struct {
+ keyProviders []KeyProvider
+ keyUsed any
+ cek *[]byte
+ dst *Message
+ maxDecompressBufferSize int64
+ //nolint:containedctx
+ ctx context.Context
+}
+
+var decryptContextPool = pool.New(allocDecryptContext, freeDecryptContext)
+
+func allocDecryptContext() *decryptContext {
+ return &decryptContext{
+ ctx: context.Background(),
+ }
+}
+
+func freeDecryptContext(dc *decryptContext) *decryptContext {
+ dc.keyProviders = dc.keyProviders[:0]
+ dc.keyUsed = nil
+ dc.cek = nil
+ dc.dst = nil
+ dc.maxDecompressBufferSize = 0
+ dc.ctx = context.Background()
+ return dc
+}
+
+func (dc *decryptContext) ProcessOptions(options []DecryptOption) error {
+ // Set default max decompress buffer size
+ muSettings.RLock()
+ dc.maxDecompressBufferSize = maxDecompressBufferSize
+ muSettings.RUnlock()
+
+ for _, option := range options {
+ switch option.Ident() {
+ case identMessage{}:
+ if err := option.Value(&dc.dst); err != nil {
+ return fmt.Errorf("jwe.decrypt: WithMessage must be a *jwe.Message: %w", err)
+ }
+ case identKeyProvider{}:
+ var kp KeyProvider
+ if err := option.Value(&kp); err != nil {
+ return fmt.Errorf("jwe.decrypt: WithKeyProvider must be a KeyProvider: %w", err)
+ }
+ dc.keyProviders = append(dc.keyProviders, kp)
+ case identKeyUsed{}:
+ if err := option.Value(&dc.keyUsed); err != nil {
+ return fmt.Errorf("jwe.decrypt: WithKeyUsed must be an any: %w", err)
+ }
+ case identKey{}:
+ var pair *withKey
+ if err := option.Value(&pair); err != nil {
+ return fmt.Errorf("jwe.decrypt: WithKey must be a *withKey: %w", err)
+ }
+ alg, ok := pair.alg.(jwa.KeyEncryptionAlgorithm)
+ if !ok {
+ return fmt.Errorf("jwe.decrypt: WithKey() option must be specified using jwa.KeyEncryptionAlgorithm (got %T)", pair.alg)
+ }
+ dc.keyProviders = append(dc.keyProviders, &staticKeyProvider{alg: alg, key: pair.key})
+ case identCEK{}:
+ if err := option.Value(&dc.cek); err != nil {
+ return fmt.Errorf("jwe.decrypt: WithCEK must be a *[]byte: %w", err)
+ }
+ case identMaxDecompressBufferSize{}:
+ if err := option.Value(&dc.maxDecompressBufferSize); err != nil {
+ return fmt.Errorf("jwe.decrypt: WithMaxDecompressBufferSize must be int64: %w", err)
+ }
+ case identContext{}:
+ if err := option.Value(&dc.ctx); err != nil {
+ return fmt.Errorf("jwe.decrypt: WithContext must be a context.Context: %w", err)
+ }
+ }
+ }
+
+ if len(dc.keyProviders) < 1 {
+ return fmt.Errorf(`jwe.Decrypt: no key providers have been provided (see jwe.WithKey(), jwe.WithKeySet(), and jwe.WithKeyProvider()`)
+ }
+
+ return nil
+}
+
+func (dc *decryptContext) DecryptMessage(buf []byte) ([]byte, error) {
+ msg, err := parseJSONOrCompact(buf, true)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to parse buffer for Decrypt: %w`, err)
+ }
+
+ // Process things that are common to the message
+ h, err := msg.protectedHeaders.Clone()
+ if err != nil {
+ return nil, fmt.Errorf(`failed to copy protected headers: %w`, err)
+ }
+ h, err = h.Merge(msg.unprotectedHeaders)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to merge headers for message decryption: %w`, err)
+ }
+
+ var aad []byte
+ if aadContainer := msg.authenticatedData; aadContainer != nil {
+ aad = base64.Encode(aadContainer)
+ }
+
+ var computedAad []byte
+ if len(msg.rawProtectedHeaders) > 0 {
+ computedAad = msg.rawProtectedHeaders
+ } else {
+ // this is probably not required once msg.Decrypt is deprecated
+ var err error
+ computedAad, err = msg.protectedHeaders.Encode()
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encode protected headers: %w`, err)
+ }
+ }
+
+ // for each recipient, attempt to match the key providers
+ // if we have no recipients, pretend like we only have one
+ recipients := msg.recipients
+ if len(recipients) == 0 {
+ r := NewRecipient()
+ if err := r.SetHeaders(msg.protectedHeaders); err != nil {
+ return nil, fmt.Errorf(`failed to set headers to recipient: %w`, err)
+ }
+ recipients = append(recipients, r)
+ }
+
+ errs := make([]error, 0, len(recipients))
+ for _, recipient := range recipients {
+ decrypted, err := dc.tryRecipient(msg, recipient, h, aad, computedAad)
+ if err != nil {
+ errs = append(errs, recipientError{err})
+ continue
+ }
+ if dc.dst != nil {
+ *dc.dst = *msg
+ dc.dst.rawProtectedHeaders = nil
+ dc.dst.storeProtectedHeaders = false
+ }
+ return decrypted, nil
+ }
+ return nil, fmt.Errorf(`failed to decrypt any of the recipients: %w`, errors.Join(errs...))
+}
+
+func (dc *decryptContext) tryRecipient(msg *Message, recipient Recipient, protectedHeaders Headers, aad, computedAad []byte) ([]byte, error) {
+ var tried int
+ var lastError error
+ for i, kp := range dc.keyProviders {
+ var sink algKeySink
+ if err := kp.FetchKeys(dc.ctx, &sink, recipient, msg); err != nil {
+ return nil, fmt.Errorf(`key provider %d failed: %w`, i, err)
+ }
+
+ for _, pair := range sink.list {
+ tried++
+ // alg is converted here because pair.alg is of type jwa.KeyAlgorithm.
+ // this may seem ugly, but we're trying to avoid declaring separate
+ // structs for `alg jwa.KeyEncryptionAlgorithm` and `alg jwa.SignatureAlgorithm`
+ //nolint:forcetypeassert
+ alg := pair.alg.(jwa.KeyEncryptionAlgorithm)
+ key := pair.key
+
+ decrypted, err := dc.decryptContent(msg, alg, key, recipient, protectedHeaders, aad, computedAad)
+ if err != nil {
+ lastError = err
+ continue
+ }
+
+ if dc.keyUsed != nil {
+ if err := blackmagic.AssignIfCompatible(dc.keyUsed, key); err != nil {
+ return nil, fmt.Errorf(`failed to assign used key (%T) to %T: %w`, key, dc.keyUsed, err)
+ }
+ }
+ return decrypted, nil
+ }
+ }
+ return nil, fmt.Errorf(`jwe.Decrypt: tried %d keys, but failed to match any of the keys with recipient (last error = %s)`, tried, lastError)
+}
+
+func (dc *decryptContext) decryptContent(msg *Message, alg jwa.KeyEncryptionAlgorithm, key any, recipient Recipient, protectedHeaders Headers, aad, computedAad []byte) ([]byte, error) {
+ if jwkKey, ok := key.(jwk.Key); ok {
+ var raw any
+ if err := jwk.Export(jwkKey, &raw); err != nil {
+ return nil, fmt.Errorf(`failed to retrieve raw key from %T: %w`, key, err)
+ }
+ key = raw
+ }
+
+ ce, ok := msg.protectedHeaders.ContentEncryption()
+ if !ok {
+ return nil, fmt.Errorf(`jwe.Decrypt: failed to retrieve content encryption algorithm from protected headers`)
+ }
+ dec := newDecrypter(alg, ce, key).
+ AuthenticatedData(aad).
+ ComputedAuthenticatedData(computedAad).
+ InitializationVector(msg.initializationVector).
+ Tag(msg.tag).
+ CEK(dc.cek)
+
+ // The "alg" header can be in either protected/unprotected headers.
+ // prefer per-recipient headers (as it might be the case that the algorithm differs
+ // by each recipient), then look at protected headers.
+ var algMatched bool
+ for _, hdr := range []Headers{recipient.Headers(), protectedHeaders} {
+ v, ok := hdr.Algorithm()
+ if !ok {
+ continue
+ }
+
+ if v == alg {
+ algMatched = true
+ break
+ }
+ // if we found something but didn't match, it's a failure
+ return nil, fmt.Errorf(`jwe.Decrypt: key (%q) and recipient (%q) algorithms do not match`, alg, v)
+ }
+ if !algMatched {
+ return nil, fmt.Errorf(`jwe.Decrypt: failed to find "alg" header in either protected or per-recipient headers`)
+ }
+
+ h2, err := protectedHeaders.Clone()
+ if err != nil {
+ return nil, fmt.Errorf(`jwe.Decrypt: failed to copy headers (1): %w`, err)
+ }
+
+ h2, err = h2.Merge(recipient.Headers())
+ if err != nil {
+ return nil, fmt.Errorf(`failed to copy headers (2): %w`, err)
+ }
+
+ switch alg {
+ case jwa.ECDH_ES(), jwa.ECDH_ES_A128KW(), jwa.ECDH_ES_A192KW(), jwa.ECDH_ES_A256KW():
+ var epk any
+ if err := h2.Get(EphemeralPublicKeyKey, &epk); err != nil {
+ return nil, fmt.Errorf(`failed to get 'epk' field: %w`, err)
+ }
+ switch epk := epk.(type) {
+ case jwk.ECDSAPublicKey:
+ var pubkey ecdsa.PublicKey
+ if err := jwk.Export(epk, &pubkey); err != nil {
+ return nil, fmt.Errorf(`failed to get public key: %w`, err)
+ }
+ dec.PublicKey(&pubkey)
+ case jwk.OKPPublicKey:
+ var pubkey any
+ if err := jwk.Export(epk, &pubkey); err != nil {
+ return nil, fmt.Errorf(`failed to get public key: %w`, err)
+ }
+ dec.PublicKey(pubkey)
+ default:
+ return nil, fmt.Errorf("unexpected 'epk' type %T for alg %s", epk, alg)
+ }
+
+ if apu, ok := h2.AgreementPartyUInfo(); ok && len(apu) > 0 {
+ dec.AgreementPartyUInfo(apu)
+ }
+ if apv, ok := h2.AgreementPartyVInfo(); ok && len(apv) > 0 {
+ dec.AgreementPartyVInfo(apv)
+ }
+ case jwa.A128GCMKW(), jwa.A192GCMKW(), jwa.A256GCMKW():
+ var ivB64 string
+ if err := h2.Get(InitializationVectorKey, &ivB64); err == nil {
+ iv, err := base64.DecodeString(ivB64)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to b64-decode 'iv': %w`, err)
+ }
+ dec.KeyInitializationVector(iv)
+ }
+ var tagB64 string
+ if err := h2.Get(TagKey, &tagB64); err == nil {
+ tag, err := base64.DecodeString(tagB64)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to b64-decode 'tag': %w`, err)
+ }
+ dec.KeyTag(tag)
+ }
+ case jwa.PBES2_HS256_A128KW(), jwa.PBES2_HS384_A192KW(), jwa.PBES2_HS512_A256KW():
+ var saltB64 string
+ if err := h2.Get(SaltKey, &saltB64); err != nil {
+ return nil, fmt.Errorf(`failed to get %q field`, SaltKey)
+ }
+
+ // check if WithUseNumber is effective, because it will change the
+ // type of the underlying value (#1140)
+ var countFlt float64
+ if json.UseNumber() {
+ var count json.Number
+ if err := h2.Get(CountKey, &count); err != nil {
+ return nil, fmt.Errorf(`failed to get %q field`, CountKey)
+ }
+ v, err := count.Float64()
+ if err != nil {
+ return nil, fmt.Errorf("failed to convert 'p2c' to float64: %w", err)
+ }
+ countFlt = v
+ } else {
+ var count float64
+ if err := h2.Get(CountKey, &count); err != nil {
+ return nil, fmt.Errorf(`failed to get %q field`, CountKey)
+ }
+ countFlt = count
+ }
+
+ muSettings.RLock()
+ maxCount := maxPBES2Count
+ muSettings.RUnlock()
+ if countFlt > float64(maxCount) {
+ return nil, fmt.Errorf("invalid 'p2c' value")
+ }
+ salt, err := base64.DecodeString(saltB64)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to b64-decode 'salt': %w`, err)
+ }
+ dec.KeySalt(salt)
+ dec.KeyCount(int(countFlt))
+ }
+
+ plaintext, err := dec.Decrypt(recipient, msg.cipherText, msg)
+ if err != nil {
+ return nil, fmt.Errorf(`jwe.Decrypt: decryption failed: %w`, err)
+ }
+
+ if v, ok := h2.Compression(); ok && v == jwa.Deflate() {
+ buf, err := uncompress(plaintext, dc.maxDecompressBufferSize)
+ if err != nil {
+ return nil, fmt.Errorf(`jwe.Derypt: failed to uncompress payload: %w`, err)
+ }
+ plaintext = buf
+ }
+
+ if plaintext == nil {
+ return nil, fmt.Errorf(`failed to find matching recipient`)
+ }
+
+ return plaintext, nil
+}
+
+// encryptContext holds the state during JWE encryption, similar to JWS signContext
+type encryptContext struct {
+ calg jwa.ContentEncryptionAlgorithm
+ compression jwa.CompressionAlgorithm
+ format int
+ builders []*recipientBuilder
+ protected Headers
+ legacyHeaderMerging bool
+}
+
+var encryptContextPool = pool.New(allocEncryptContext, freeEncryptContext)
+
+func allocEncryptContext() *encryptContext {
+ return &encryptContext{
+ calg: jwa.A256GCM(),
+ compression: jwa.NoCompress(),
+ format: fmtCompact,
+ }
+}
+
+func freeEncryptContext(ec *encryptContext) *encryptContext {
+ ec.calg = jwa.A256GCM()
+ ec.compression = jwa.NoCompress()
+ ec.format = fmtCompact
+ ec.builders = ec.builders[:0]
+ ec.protected = nil
+ return ec
+}
+
+func (ec *encryptContext) ProcessOptions(options []EncryptOption) error {
+ ec.legacyHeaderMerging = true
+ var mergeProtected bool
+ var useRawCEK bool
+ for _, option := range options {
+ switch option.Ident() {
+ case identKey{}:
+ var wk *withKey
+ if err := option.Value(&wk); err != nil {
+ return fmt.Errorf("jwe.encrypt: WithKey must be a *withKey: %w", err)
+ }
+ v, ok := wk.alg.(jwa.KeyEncryptionAlgorithm)
+ if !ok {
+ return fmt.Errorf("jwe.encrypt: WithKey() option must be specified using jwa.KeyEncryptionAlgorithm (got %T)", wk.alg)
+ }
+ if v == jwa.DIRECT() || v == jwa.ECDH_ES() {
+ useRawCEK = true
+ }
+ ec.builders = append(ec.builders, &recipientBuilder{
+ alg: v,
+ key: wk.key,
+ headers: wk.headers,
+ })
+ case identContentEncryptionAlgorithm{}:
+ var c jwa.ContentEncryptionAlgorithm
+ if err := option.Value(&c); err != nil {
+ return err
+ }
+ ec.calg = c
+ case identCompress{}:
+ var comp jwa.CompressionAlgorithm
+ if err := option.Value(&comp); err != nil {
+ return err
+ }
+ ec.compression = comp
+ case identMergeProtectedHeaders{}:
+ var mp bool
+ if err := option.Value(&mp); err != nil {
+ return err
+ }
+ mergeProtected = mp
+ case identProtectedHeaders{}:
+ var hdrs Headers
+ if err := option.Value(&hdrs); err != nil {
+ return err
+ }
+ if !mergeProtected || ec.protected == nil {
+ ec.protected = hdrs
+ } else {
+ merged, err := ec.protected.Merge(hdrs)
+ if err != nil {
+ return fmt.Errorf(`failed to merge headers: %w`, err)
+ }
+ ec.protected = merged
+ }
+ case identSerialization{}:
+ var fmtOpt int
+ if err := option.Value(&fmtOpt); err != nil {
+ return err
+ }
+ ec.format = fmtOpt
+ case identLegacyHeaderMerging{}:
+ var v bool
+ if err := option.Value(&v); err != nil {
+ return err
+ }
+ ec.legacyHeaderMerging = v
+ }
+ }
+
+ // We need to have at least one builder
+ switch l := len(ec.builders); {
+ case l == 0:
+ return fmt.Errorf(`missing key encryption builders: use jwe.WithKey() to specify one`)
+ case l > 1:
+ if ec.format == fmtCompact {
+ return fmt.Errorf(`cannot use compact serialization when multiple recipients exist (check the number of WithKey() argument, or use WithJSON())`)
+ }
+ }
+
+ if useRawCEK {
+ if len(ec.builders) != 1 {
+ return fmt.Errorf(`multiple recipients for ECDH-ES/DIRECT mode supported`)
+ }
+ }
+
+ return nil
+}
+
+var msgPool = pool.New(allocMessage, freeMessage)
+
+func allocMessage() *Message {
+ return &Message{
+ recipients: make([]Recipient, 0, 1),
+ }
+}
+
+func freeMessage(msg *Message) *Message {
+ msg.cipherText = nil
+ msg.initializationVector = nil
+ if hdr := msg.protectedHeaders; hdr != nil {
+ headerPool.Put(hdr)
+ }
+ msg.protectedHeaders = nil
+ msg.unprotectedHeaders = nil
+ msg.recipients = nil // reuse should be done elsewhere
+ msg.authenticatedData = nil
+ msg.tag = nil
+ msg.rawProtectedHeaders = nil
+ msg.storeProtectedHeaders = false
+ return msg
+}
+
+var headerPool = pool.New(NewHeaders, freeHeaders)
+
+func freeHeaders(h Headers) Headers {
+ if c, ok := h.(interface{ clear() }); ok {
+ c.clear()
+ }
+ return h
+}
+
+var recipientPool = pool.New(NewRecipient, freeRecipient)
+
+func freeRecipient(r Recipient) Recipient {
+ if h := r.Headers(); h != nil {
+ if c, ok := h.(interface{ clear() }); ok {
+ c.clear()
+ }
+ }
+
+ if sr, ok := r.(*stdRecipient); ok {
+ sr.encryptedKey = nil
+ }
+ return r
+}
+
+var recipientSlicePool = pool.NewSlicePool(allocRecipientSlice, freeRecipientSlice)
+
+func allocRecipientSlice() []Recipient {
+ return make([]Recipient, 0, 1)
+}
+
+func freeRecipientSlice(rs []Recipient) []Recipient {
+ for _, r := range rs {
+ recipientPool.Put(r)
+ }
+ return rs[:0]
+}
+
+func (ec *encryptContext) EncryptMessage(payload []byte, cek []byte) ([]byte, error) {
+ // Get protected headers from pool and copy contents from context
+ protected := headerPool.Get()
+ if userSupplied := ec.protected; userSupplied != nil {
+ ec.protected = nil // Clear from context
+ if err := userSupplied.Copy(protected); err != nil {
+ return nil, fmt.Errorf(`failed to copy protected headers: %w`, err)
+ }
+ }
+
+ // There is exactly one content encrypter.
+ contentcrypt, err := content_crypt.NewGeneric(ec.calg)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to create AES encrypter: %w`, err)
+ }
+
+ // Generate CEK if not provided
+ if len(cek) <= 0 {
+ bk, err := keygen.Random(contentcrypt.KeySize())
+ if err != nil {
+ return nil, fmt.Errorf(`failed to generate key: %w`, err)
+ }
+ cek = bk.Bytes()
+ }
+
+ var useRawCEK bool
+ for _, builder := range ec.builders {
+ if builder.alg == jwa.DIRECT() || builder.alg == jwa.ECDH_ES() {
+ useRawCEK = true
+ break
+ }
+ }
+
+ lbuilders := len(ec.builders)
+ recipients := recipientSlicePool.GetCapacity(lbuilders)
+ defer recipientSlicePool.Put(recipients)
+
+ for i, builder := range ec.builders {
+ r := recipientPool.Get()
+ defer recipientPool.Put(r)
+
+ // some builders require hint from the contentcrypt object
+ rawCEK, err := builder.Build(r, cek, ec.calg, contentcrypt)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to create recipient #%d: %w`, i, err)
+ }
+ recipients = append(recipients, r)
+
+ // Kinda feels weird, but if useRawCEK == true, we asserted earlier
+ // that len(builders) == 1, so this is OK
+ if useRawCEK {
+ cek = rawCEK
+ }
+ }
+
+ if err := protected.Set(ContentEncryptionKey, ec.calg); err != nil {
+ return nil, fmt.Errorf(`failed to set "enc" in protected header: %w`, err)
+ }
+
+ if ec.compression != jwa.NoCompress() {
+ payload, err = compress(payload)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to compress payload before encryption: %w`, err)
+ }
+ if err := protected.Set(CompressionKey, ec.compression); err != nil {
+ return nil, fmt.Errorf(`failed to set "zip" in protected header: %w`, err)
+ }
+ }
+
+ // fmtCompact does not have per-recipient headers, nor a "header" field.
+ // In this mode, we're going to have to merge everything to the protected
+ // header.
+ if ec.format == fmtCompact {
+ // We have already established that the number of builders is 1 in
+ // ec.ProcessOptions(). But we're going to be pedantic
+ if lbuilders != 1 {
+ return nil, fmt.Errorf(`internal error: expected exactly one recipient builder (got %d)`, lbuilders)
+ }
+
+ // when we're using compact format, we can safely merge per-recipient
+ // headers into the protected header, if any
+ h, err := protected.Merge(recipients[0].Headers())
+ if err != nil {
+ return nil, fmt.Errorf(`failed to merge protected headers for compact serialization: %w`, err)
+ }
+ protected = h
+ // per-recipient headers, if any, will be ignored in compact format
+ } else {
+ // If it got here, it's JSON (could be pretty mode, too).
+ if lbuilders == 1 {
+ // If it got here, then we're doing flattened JSON serialization.
+ // In this mode, we should merge per-recipient headers into the protected header,
+ // but we also need to make sure that the "header" field is reset so that
+ // it does not contain the same fields as the protected header.
+ //
+ // However, old behavior was to merge per-recipient headers into the
+ // protected header when there was only one recipient, AND leave the
+ // original "header" field as is, so we need to support that for backwards compatibility.
+ //
+ // The legacy merging only takes effect when there is exactly one recipient.
+ //
+ // This behavior can be disabled by passing jwe.WithLegacyHeaderMerging(false)
+ // If the user has explicitly asked for merging, do it
+ h, err := protected.Merge(recipients[0].Headers())
+ if err != nil {
+ return nil, fmt.Errorf(`failed to merge protected headers for flattenend JSON format: %w`, err)
+ }
+ protected = h
+
+ if !ec.legacyHeaderMerging {
+ // Clear per-recipient headers, since they have been merged.
+ // But we only do it when legacy merging is disabled.
+ // Note: we should probably introduce a Reset() method in v4
+ if err := recipients[0].SetHeaders(NewHeaders()); err != nil {
+ return nil, fmt.Errorf(`failed to clear per-recipient headers after merging: %w`, err)
+ }
+ }
+ }
+ }
+
+ aad, err := protected.Encode()
+ if err != nil {
+ return nil, fmt.Errorf(`failed to base64 encode protected headers: %w`, err)
+ }
+
+ iv, ciphertext, tag, err := contentcrypt.Encrypt(cek, payload, aad)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encrypt payload: %w`, err)
+ }
+
+ msg := msgPool.Get()
+ defer msgPool.Put(msg)
+
+ if err := msg.Set(CipherTextKey, ciphertext); err != nil {
+ return nil, fmt.Errorf(`failed to set %s: %w`, CipherTextKey, err)
+ }
+ if err := msg.Set(InitializationVectorKey, iv); err != nil {
+ return nil, fmt.Errorf(`failed to set %s: %w`, InitializationVectorKey, err)
+ }
+ if err := msg.Set(ProtectedHeadersKey, protected); err != nil {
+ return nil, fmt.Errorf(`failed to set %s: %w`, ProtectedHeadersKey, err)
+ }
+ if err := msg.Set(RecipientsKey, recipients); err != nil {
+ return nil, fmt.Errorf(`failed to set %s: %w`, RecipientsKey, err)
+ }
+ if err := msg.Set(TagKey, tag); err != nil {
+ return nil, fmt.Errorf(`failed to set %s: %w`, TagKey, err)
+ }
+
+ switch ec.format {
+ case fmtCompact:
+ return Compact(msg)
+ case fmtJSON:
+ return json.Marshal(msg)
+ case fmtJSONPretty:
+ return json.MarshalIndent(msg, "", " ")
+ default:
+ return nil, fmt.Errorf(`invalid serialization`)
+ }
+}
+
+// Decrypt takes encrypted payload, and information required to decrypt the
+// payload (e.g. the key encryption algorithm and the corresponding
+// key to decrypt the JWE message) in its optional arguments. See
+// the examples and list of options that return a DecryptOption for possible
+// values. Upon successful decryptiond returns the decrypted payload.
+//
+// The JWE message can be either compact or full JSON format.
+//
+// When using `jwe.WithKeyEncryptionAlgorithm()`, you can pass a `jwa.KeyAlgorithm`
+// for convenience: this is mainly to allow you to directly pass the result of `(jwk.Key).Algorithm()`.
+// However, do note that while `(jwk.Key).Algorithm()` could very well contain key encryption
+// algorithms, it could also contain other types of values, such as _signature algorithms_.
+// In order for `jwe.Decrypt` to work properly, the `alg` parameter must be of type
+// `jwa.KeyEncryptionAlgorithm` or otherwise it will cause an error.
+//
+// When using `jwe.WithKey()`, the value must be a private key.
+// It can be either in its raw format (e.g. *rsa.PrivateKey) or a jwk.Key
+//
+// When the encrypted message is also compressed, the decompressed payload must be
+// smaller than the size specified by the `jwe.WithMaxDecompressBufferSize` setting,
+// which defaults to 10MB. If the decompressed payload is larger than this size,
+// an error is returned.
+//
+// You can opt to change the MaxDecompressBufferSize setting globally, or on a
+// per-call basis by passing the `jwe.WithMaxDecompressBufferSize` option to
+// either `jwe.Settings()` or `jwe.Decrypt()`:
+//
+// jwe.Settings(jwe.WithMaxDecompressBufferSize(10*1024*1024)) // changes value globally
+// jwe.Decrypt(..., jwe.WithMaxDecompressBufferSize(250*1024)) // changes just for this call
+func Decrypt(buf []byte, options ...DecryptOption) ([]byte, error) {
+ dc := decryptContextPool.Get()
+ defer decryptContextPool.Put(dc)
+
+ if err := dc.ProcessOptions(options); err != nil {
+ return nil, decryptError{fmt.Errorf(`jwe.Decrypt: failed to process options: %w`, err)}
+ }
+
+ ret, err := dc.DecryptMessage(buf)
+ if err != nil {
+ return nil, decryptError{fmt.Errorf(`jwe.Decrypt: %w`, err)}
+ }
+ return ret, nil
+}
+
+// Parse parses the JWE message into a Message object. The JWE message
+// can be either compact or full JSON format.
+//
+// Parse() currently does not take any options, but the API accepts it
+// in anticipation of future addition.
+func Parse(buf []byte, _ ...ParseOption) (*Message, error) {
+ return parseJSONOrCompact(buf, false)
+}
+
+// errors are wrapped within this function, because we call it directly
+// from Decrypt as well.
+func parseJSONOrCompact(buf []byte, storeProtectedHeaders bool) (*Message, error) {
+ buf = bytes.TrimSpace(buf)
+ if len(buf) == 0 {
+ return nil, parseError{fmt.Errorf(`jwe.Parse: empty buffer`)}
+ }
+
+ var msg *Message
+ var err error
+ if buf[0] == tokens.OpenCurlyBracket {
+ msg, err = parseJSON(buf, storeProtectedHeaders)
+ } else {
+ msg, err = parseCompact(buf, storeProtectedHeaders)
+ }
+
+ if err != nil {
+ return nil, parseError{fmt.Errorf(`jwe.Parse: %w`, err)}
+ }
+ return msg, nil
+}
+
+// ParseString is the same as Parse, but takes a string.
+func ParseString(s string) (*Message, error) {
+ msg, err := Parse([]byte(s))
+ if err != nil {
+ return nil, parseError{fmt.Errorf(`jwe.ParseString: %w`, err)}
+ }
+ return msg, nil
+}
+
+// ParseReader is the same as Parse, but takes an io.Reader.
+func ParseReader(src io.Reader) (*Message, error) {
+ buf, err := io.ReadAll(src)
+ if err != nil {
+ return nil, parseError{fmt.Errorf(`jwe.ParseReader: failed to read from io.Reader: %w`, err)}
+ }
+ msg, err := Parse(buf)
+ if err != nil {
+ return nil, parseError{fmt.Errorf(`jwe.ParseReader: %w`, err)}
+ }
+ return msg, nil
+}
+
+func parseJSON(buf []byte, storeProtectedHeaders bool) (*Message, error) {
+ m := NewMessage()
+ m.storeProtectedHeaders = storeProtectedHeaders
+ if err := json.Unmarshal(buf, &m); err != nil {
+ return nil, fmt.Errorf(`failed to parse JSON: %w`, err)
+ }
+ return m, nil
+}
+
+func parseCompact(buf []byte, storeProtectedHeaders bool) (*Message, error) {
+ var parts [5][]byte
+ var ok bool
+
+ for i := range 4 {
+ parts[i], buf, ok = bytes.Cut(buf, []byte{tokens.Period})
+ if !ok {
+ return nil, fmt.Errorf(`compact JWE format must have five parts (%d)`, i+1)
+ }
+ }
+ // Validate that the last part does not contain more dots
+ if bytes.ContainsRune(buf, tokens.Period) {
+ return nil, errors.New(`compact JWE format must have five parts, not more`)
+ }
+ parts[4] = buf
+
+ hdrbuf, err := base64.Decode(parts[0])
+ if err != nil {
+ return nil, fmt.Errorf(`failed to parse first part of compact form: %w`, err)
+ }
+
+ protected := NewHeaders()
+ if err := json.Unmarshal(hdrbuf, protected); err != nil {
+ return nil, fmt.Errorf(`failed to parse header JSON: %w`, err)
+ }
+
+ ivbuf, err := base64.Decode(parts[2])
+ if err != nil {
+ return nil, fmt.Errorf(`failed to base64 decode iv: %w`, err)
+ }
+
+ ctbuf, err := base64.Decode(parts[3])
+ if err != nil {
+ return nil, fmt.Errorf(`failed to base64 decode content: %w`, err)
+ }
+
+ tagbuf, err := base64.Decode(parts[4])
+ if err != nil {
+ return nil, fmt.Errorf(`failed to base64 decode tag: %w`, err)
+ }
+
+ m := NewMessage()
+ if err := m.Set(CipherTextKey, ctbuf); err != nil {
+ return nil, fmt.Errorf(`failed to set %s: %w`, CipherTextKey, err)
+ }
+ if err := m.Set(InitializationVectorKey, ivbuf); err != nil {
+ return nil, fmt.Errorf(`failed to set %s: %w`, InitializationVectorKey, err)
+ }
+ if err := m.Set(ProtectedHeadersKey, protected); err != nil {
+ return nil, fmt.Errorf(`failed to set %s: %w`, ProtectedHeadersKey, err)
+ }
+
+ if err := m.makeDummyRecipient(string(parts[1]), protected); err != nil {
+ return nil, fmt.Errorf(`failed to setup recipient: %w`, err)
+ }
+
+ if err := m.Set(TagKey, tagbuf); err != nil {
+ return nil, fmt.Errorf(`failed to set %s: %w`, TagKey, err)
+ }
+
+ if storeProtectedHeaders {
+ // This is later used for decryption.
+ m.rawProtectedHeaders = parts[0]
+ }
+
+ return m, nil
+}
+
+type CustomDecoder = json.CustomDecoder
+type CustomDecodeFunc = json.CustomDecodeFunc
+
+// RegisterCustomField allows users to specify that a private field
+// be decoded as an instance of the specified type. This option has
+// a global effect.
+//
+// For example, suppose you have a custom field `x-birthday`, which
+// you want to represent as a string formatted in RFC3339 in JSON,
+// but want it back as `time.Time`.
+//
+// In such case you would register a custom field as follows
+//
+// jws.RegisterCustomField(`x-birthday`, time.Time{})
+//
+// Then you can use a `time.Time` variable to extract the value
+// of `x-birthday` field, instead of having to use `any`
+// and later convert it to `time.Time`
+//
+// var bday time.Time
+// _ = hdr.Get(`x-birthday`, &bday)
+//
+// If you need a more fine-tuned control over the decoding process,
+// you can register a `CustomDecoder`. For example, below shows
+// how to register a decoder that can parse RFC1123 format string:
+//
+// jwe.RegisterCustomField(`x-birthday`, jwe.CustomDecodeFunc(func(data []byte) (any, error) {
+// return time.Parse(time.RFC1123, string(data))
+// }))
+//
+// Please note that use of custom fields can be problematic if you
+// are using a library that does not implement MarshalJSON/UnmarshalJSON
+// and you try to roundtrip from an object to JSON, and then back to an object.
+// For example, in the above example, you can _parse_ time values formatted
+// in the format specified in RFC822, but when you convert an object into
+// JSON, it will be formatted in RFC3339, because that's what `time.Time`
+// likes to do. To avoid this, it's always better to use a custom type
+// that wraps your desired type (in this case `time.Time`) and implement
+// MarshalJSON and UnmashalJSON.
+func RegisterCustomField(name string, object any) {
+ registry.Register(name, object)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/BUILD.bazel
new file mode 100644
index 0000000000..c410a05cdf
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/BUILD.bazel
@@ -0,0 +1,43 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "jwebb",
+ srcs = [
+ "content_cipher.go",
+ "key_decrypt_asymmetric.go",
+ "key_decrypt_symmetric.go",
+ "key_encrypt_asymmetric.go",
+ "key_encrypt_symmetric.go",
+ "key_encryption.go",
+ "keywrap.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/jwe/jwebb",
+ visibility = ["//jwe:__subpackages__"],
+ deps = [
+ "//internal/keyconv",
+ "//internal/pool",
+ "//jwe/internal/cipher",
+ "//jwe/internal/concatkdf",
+ "//jwe/internal/content_crypt",
+ "//jwe/internal/keygen",
+ "//internal/tokens",
+ "@org_golang_x_crypto//pbkdf2",
+ ],
+)
+
+go_test(
+ name = "jwebb_test",
+ srcs = [
+ "decrypt_test.go",
+ "jwebb_test.go",
+ "keywrap_test.go",
+ ],
+ embed = [":jwebb"],
+ deps = [
+ "//internal/jwxtest",
+ "//jwa",
+ "//jwe/internal/keygen",
+ "//internal/tokens",
+ "@com_github_stretchr_testify//require",
+ ],
+)
\ No newline at end of file
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/content_cipher.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/content_cipher.go
new file mode 100644
index 0000000000..9078789d8d
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/content_cipher.go
@@ -0,0 +1,34 @@
+package jwebb
+
+import (
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/cipher"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/content_crypt"
+)
+
+// ContentEncryptionIsSupported checks if the content encryption algorithm is supported
+func ContentEncryptionIsSupported(alg string) bool {
+ switch alg {
+ case tokens.A128GCM, tokens.A192GCM, tokens.A256GCM,
+ tokens.A128CBC_HS256, tokens.A192CBC_HS384, tokens.A256CBC_HS512:
+ return true
+ default:
+ return false
+ }
+}
+
+// CreateContentCipher creates a content encryption cipher for the given algorithm string
+func CreateContentCipher(alg string) (content_crypt.Cipher, error) {
+ if !ContentEncryptionIsSupported(alg) {
+ return nil, fmt.Errorf(`invalid content cipher algorithm (%s)`, alg)
+ }
+
+ cipher, err := cipher.NewAES(alg)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to build content cipher for %s: %w`, alg, err)
+ }
+
+ return cipher, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/jwebb.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/jwebb.go
new file mode 100644
index 0000000000..3768acef8b
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/jwebb.go
@@ -0,0 +1,15 @@
+// Package jwebb provides the building blocks (hence the name "bb") for JWE operations.
+// It should be thought of as a low-level API, almost akin to internal packages
+// that should not be used directly by users of the jwx package. However, these exist
+// to provide a more efficient way to perform JWE operations without the overhead of
+// the higher-level jwe package to power-users who know what they are doing.
+//
+// This package is currently considered EXPERIMENTAL, and the API may change
+// without notice. It is not recommended to use this package unless you are
+// fully aware of the implications of using it.
+//
+// All bb packages in jwx follow the same design principles:
+// 1. Does minimal checking of input parameters (for performance); callers need to ensure that the parameters are valid.
+// 2. All exported functions are stringly typed (i.e. they do not take any parameters unless they absolutely have to).
+// 3. Does not rely on other public jwx packages (they are standalone, except for internal packages).
+package jwebb
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/key_decrypt_asymmetric.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/key_decrypt_asymmetric.go
new file mode 100644
index 0000000000..ac07993176
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/key_decrypt_asymmetric.go
@@ -0,0 +1,177 @@
+package jwebb
+
+import (
+ "crypto"
+ "crypto/aes"
+ "crypto/ecdh"
+ "crypto/rand"
+ "crypto/rsa"
+ "crypto/sha1"
+ "crypto/sha256"
+ "crypto/sha512"
+ "encoding/binary"
+ "fmt"
+ "hash"
+
+ "github.com/lestrrat-go/jwx/v3/internal/keyconv"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/concatkdf"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/keygen"
+)
+
+func contentEncryptionKeySize(ctalg string) (uint32, error) {
+ switch ctalg {
+ case tokens.A128GCM:
+ return tokens.KeySize16, nil
+ case tokens.A192GCM:
+ return tokens.KeySize24, nil
+ case tokens.A256GCM:
+ return tokens.KeySize32, nil
+ case tokens.A128CBC_HS256:
+ return tokens.KeySize32, nil
+ case tokens.A192CBC_HS384:
+ return tokens.KeySize48, nil
+ case tokens.A256CBC_HS512:
+ return tokens.KeySize64, nil
+ default:
+ return 0, fmt.Errorf(`unsupported content encryption algorithm %s`, ctalg)
+ }
+}
+
+func KeyEncryptionECDHESKeySize(alg, ctalg string) (string, uint32, bool, error) {
+ switch alg {
+ case tokens.ECDH_ES:
+ keysize, err := contentEncryptionKeySize(ctalg)
+ if err != nil {
+ return "", 0, false, err
+ }
+ return ctalg, keysize, false, nil
+ case tokens.ECDH_ES_A128KW:
+ return alg, tokens.KeySize16, true, nil
+ case tokens.ECDH_ES_A192KW:
+ return alg, tokens.KeySize24, true, nil
+ case tokens.ECDH_ES_A256KW:
+ return alg, tokens.KeySize32, true, nil
+ default:
+ return "", 0, false, fmt.Errorf(`unsupported key encryption algorithm %s`, alg)
+ }
+}
+
+func DeriveECDHES(alg string, apu, apv []byte, privkeyif, pubkeyif any, keysize uint32) ([]byte, error) {
+ pubinfo := make([]byte, 4)
+ binary.BigEndian.PutUint32(pubinfo, keysize*tokens.BitsPerByte)
+
+ var privkey *ecdh.PrivateKey
+ var pubkey *ecdh.PublicKey
+ if err := keyconv.ECDHPrivateKey(&privkey, privkeyif); err != nil {
+ return nil, fmt.Errorf(`jwebb.DeriveECDHES: %w`, err)
+ }
+ if err := keyconv.ECDHPublicKey(&pubkey, pubkeyif); err != nil {
+ return nil, fmt.Errorf(`jwebb.DeriveECDHES: %w`, err)
+ }
+
+ zBytes, err := privkey.ECDH(pubkey)
+ if err != nil {
+ return nil, fmt.Errorf(`jwebb.DeriveECDHES: unable to determine Z: %w`, err)
+ }
+ kdf := concatkdf.New(crypto.SHA256, []byte(alg), zBytes, apu, apv, pubinfo, []byte{})
+ key := make([]byte, keysize)
+ if _, err := kdf.Read(key); err != nil {
+ return nil, fmt.Errorf(`jwebb.DeriveECDHES: failed to read kdf: %w`, err)
+ }
+
+ return key, nil
+}
+
+func KeyDecryptECDHESKeyWrap(_, enckey []byte, alg string, apu, apv []byte, privkey, pubkey any, keysize uint32) ([]byte, error) {
+ key, err := DeriveECDHES(alg, apu, apv, privkey, pubkey, keysize)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to derive ECDHES encryption key: %w`, err)
+ }
+
+ block, err := aes.NewCipher(key)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to create cipher for ECDH-ES key wrap: %w`, err)
+ }
+
+ return Unwrap(block, enckey)
+}
+
+func KeyDecryptECDHES(_, _ []byte, alg string, apu, apv []byte, privkey, pubkey any, keysize uint32) ([]byte, error) {
+ key, err := DeriveECDHES(alg, apu, apv, privkey, pubkey, keysize)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to derive ECDHES encryption key: %w`, err)
+ }
+ return key, nil
+}
+
+// RSA key decryption functions
+
+func KeyDecryptRSA15(_, enckey []byte, privkeyif any, keysize int) ([]byte, error) {
+ var privkey *rsa.PrivateKey
+ if err := keyconv.RSAPrivateKey(&privkey, privkeyif); err != nil {
+ return nil, fmt.Errorf(`jwebb.KeyDecryptRSA15: %w`, err)
+ }
+
+ // Perform some input validation.
+ expectedlen := privkey.PublicKey.N.BitLen() / tokens.BitsPerByte
+ if expectedlen != len(enckey) {
+ // Input size is incorrect, the encrypted payload should always match
+ // the size of the public modulus (e.g. using a 2048 bit key will
+ // produce 256 bytes of output). Reject this since it's invalid input.
+ return nil, fmt.Errorf(
+ "input size for key decrypt is incorrect (expected %d, got %d)",
+ expectedlen,
+ len(enckey),
+ )
+ }
+
+ // Generate a random CEK of the required size
+ bk, err := keygen.Random(keysize * tokens.RSAKeyGenMultiplier)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to generate key`)
+ }
+ cek := bk.Bytes()
+
+ // Use a defer/recover pattern to handle potential panics from DecryptPKCS1v15SessionKey
+ defer func() {
+ // DecryptPKCS1v15SessionKey sometimes panics on an invalid payload
+ // because of an index out of bounds error, which we want to ignore.
+ // This has been fixed in Go 1.3.1 (released 2014/08/13), the recover()
+ // only exists for preventing crashes with unpatched versions.
+ // See: https://groups.google.com/forum/#!topic/golang-dev/7ihX6Y6kx9k
+ // See: https://code.google.com/p/go/source/detail?r=58ee390ff31602edb66af41ed10901ec95904d33
+ _ = recover()
+ }()
+
+ // When decrypting an RSA-PKCS1v1.5 payload, we must take precautions to
+ // prevent chosen-ciphertext attacks as described in RFC 3218, "Preventing
+ // the Million Message Attack on Cryptographic Message Syntax". We are
+ // therefore deliberately ignoring errors here.
+ _ = rsa.DecryptPKCS1v15SessionKey(rand.Reader, privkey, enckey, cek)
+
+ return cek, nil
+}
+
+func KeyDecryptRSAOAEP(_, enckey []byte, alg string, privkeyif any) ([]byte, error) {
+ var privkey *rsa.PrivateKey
+ if err := keyconv.RSAPrivateKey(&privkey, privkeyif); err != nil {
+ return nil, fmt.Errorf(`jwebb.KeyDecryptRSAOAEP: %w`, err)
+ }
+
+ var hash hash.Hash
+ switch alg {
+ case tokens.RSA_OAEP:
+ hash = sha1.New()
+ case tokens.RSA_OAEP_256:
+ hash = sha256.New()
+ case tokens.RSA_OAEP_384:
+ hash = sha512.New384()
+ case tokens.RSA_OAEP_512:
+ hash = sha512.New()
+ default:
+ return nil, fmt.Errorf(`failed to generate key encrypter for RSA-OAEP: RSA_OAEP/RSA_OAEP_256/RSA_OAEP_384/RSA_OAEP_512 required`)
+ }
+
+ return rsa.DecryptOAEP(hash, rand.Reader, privkey, enckey, []byte{})
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/key_decrypt_symmetric.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/key_decrypt_symmetric.go
new file mode 100644
index 0000000000..c09e30a34e
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/key_decrypt_symmetric.go
@@ -0,0 +1,91 @@
+package jwebb
+
+import (
+ "crypto/aes"
+ cryptocipher "crypto/cipher"
+ "crypto/sha256"
+ "crypto/sha512"
+ "fmt"
+ "hash"
+
+ "golang.org/x/crypto/pbkdf2"
+
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+)
+
+// AES key wrap decryption functions
+
+// Use constants from tokens package
+// No need to redefine them here
+
+func KeyDecryptAESKW(_, enckey []byte, _ string, sharedkey []byte) ([]byte, error) {
+ block, err := aes.NewCipher(sharedkey)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to create cipher from shared key: %w`, err)
+ }
+
+ cek, err := Unwrap(block, enckey)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to unwrap data: %w`, err)
+ }
+ return cek, nil
+}
+
+func KeyDecryptDirect(_, _ []byte, _ string, cek []byte) ([]byte, error) {
+ return cek, nil
+}
+
+func KeyDecryptPBES2(_, enckey []byte, alg string, password []byte, salt []byte, count int) ([]byte, error) {
+ var hashFunc func() hash.Hash
+ var keylen int
+
+ switch alg {
+ case tokens.PBES2_HS256_A128KW:
+ hashFunc = sha256.New
+ keylen = tokens.KeySize16
+ case tokens.PBES2_HS384_A192KW:
+ hashFunc = sha512.New384
+ keylen = tokens.KeySize24
+ case tokens.PBES2_HS512_A256KW:
+ hashFunc = sha512.New
+ keylen = tokens.KeySize32
+ default:
+ return nil, fmt.Errorf(`unsupported PBES2 algorithm: %s`, alg)
+ }
+
+ // Derive key using PBKDF2
+ derivedKey := pbkdf2.Key(password, salt, count, keylen, hashFunc)
+
+ // Use the derived key for AES key wrap
+ return KeyDecryptAESKW(nil, enckey, alg, derivedKey)
+}
+
+func KeyDecryptAESGCMKW(recipientKey, _ []byte, _ string, sharedkey []byte, iv []byte, tag []byte) ([]byte, error) {
+ if len(iv) != tokens.GCMIVSize {
+ return nil, fmt.Errorf("GCM requires 96-bit iv, got %d", len(iv)*tokens.BitsPerByte)
+ }
+ if len(tag) != tokens.GCMTagSize {
+ return nil, fmt.Errorf("GCM requires 128-bit tag, got %d", len(tag)*tokens.BitsPerByte)
+ }
+
+ block, err := aes.NewCipher(sharedkey)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to create new AES cipher: %w`, err)
+ }
+
+ aesgcm, err := cryptocipher.NewGCM(block)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to create new GCM wrap: %w`, err)
+ }
+
+ // Combine recipient key and tag for GCM decryption
+ ciphertext := recipientKey[:]
+ ciphertext = append(ciphertext, tag...)
+
+ jek, err := aesgcm.Open(nil, iv, ciphertext, nil)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to decode key: %w`, err)
+ }
+
+ return jek, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/key_encrypt_asymmetric.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/key_encrypt_asymmetric.go
new file mode 100644
index 0000000000..6f008173c8
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/key_encrypt_asymmetric.go
@@ -0,0 +1,147 @@
+package jwebb
+
+import (
+ "crypto/aes"
+ "crypto/ecdh"
+ "crypto/ecdsa"
+ "crypto/rand"
+ "crypto/rsa"
+ "crypto/sha1"
+ "crypto/sha256"
+ "crypto/sha512"
+ "fmt"
+ "hash"
+
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/keygen"
+)
+
+// KeyEncryptRSA15 encrypts the CEK using RSA PKCS#1 v1.5
+func KeyEncryptRSA15(cek []byte, _ string, pubkey *rsa.PublicKey) (keygen.ByteSource, error) {
+ encrypted, err := rsa.EncryptPKCS1v15(rand.Reader, pubkey, cek)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encrypt using PKCS1v15: %w`, err)
+ }
+ return keygen.ByteKey(encrypted), nil
+}
+
+// KeyEncryptRSAOAEP encrypts the CEK using RSA OAEP
+func KeyEncryptRSAOAEP(cek []byte, alg string, pubkey *rsa.PublicKey) (keygen.ByteSource, error) {
+ var hash hash.Hash
+ switch alg {
+ case tokens.RSA_OAEP:
+ hash = sha1.New()
+ case tokens.RSA_OAEP_256:
+ hash = sha256.New()
+ case tokens.RSA_OAEP_384:
+ hash = sha512.New384()
+ case tokens.RSA_OAEP_512:
+ hash = sha512.New()
+ default:
+ return nil, fmt.Errorf(`failed to generate key encrypter for RSA-OAEP: RSA_OAEP/RSA_OAEP_256/RSA_OAEP_384/RSA_OAEP_512 required`)
+ }
+
+ encrypted, err := rsa.EncryptOAEP(hash, rand.Reader, pubkey, cek, []byte{})
+ if err != nil {
+ return nil, fmt.Errorf(`failed to OAEP encrypt: %w`, err)
+ }
+ return keygen.ByteKey(encrypted), nil
+}
+
+// generateECDHESKeyECDSA generates the key material for ECDSA keys using ECDH-ES
+func generateECDHESKeyECDSA(alg string, calg string, keysize uint32, pubkey *ecdsa.PublicKey, apu, apv []byte) (keygen.ByteWithECPublicKey, error) {
+ // Generate the key directly
+ kg, err := keygen.Ecdhes(alg, calg, int(keysize), pubkey, apu, apv)
+ if err != nil {
+ return keygen.ByteWithECPublicKey{}, fmt.Errorf(`failed to generate ECDSA key: %w`, err)
+ }
+
+ bwpk, ok := kg.(keygen.ByteWithECPublicKey)
+ if !ok {
+ return keygen.ByteWithECPublicKey{}, fmt.Errorf(`key generator generated invalid key (expected ByteWithECPublicKey)`)
+ }
+
+ return bwpk, nil
+}
+
+// generateECDHESKeyX25519 generates the key material for X25519 keys using ECDH-ES
+func generateECDHESKeyX25519(alg string, calg string, keysize uint32, pubkey *ecdh.PublicKey) (keygen.ByteWithECPublicKey, error) {
+ // Generate the key directly
+ kg, err := keygen.X25519(alg, calg, int(keysize), pubkey)
+ if err != nil {
+ return keygen.ByteWithECPublicKey{}, fmt.Errorf(`failed to generate X25519 key: %w`, err)
+ }
+
+ bwpk, ok := kg.(keygen.ByteWithECPublicKey)
+ if !ok {
+ return keygen.ByteWithECPublicKey{}, fmt.Errorf(`key generator generated invalid key (expected ByteWithECPublicKey)`)
+ }
+
+ return bwpk, nil
+}
+
+// KeyEncryptECDHESKeyWrapECDSA encrypts the CEK using ECDH-ES with key wrapping for ECDSA keys
+func KeyEncryptECDHESKeyWrapECDSA(cek []byte, alg string, apu, apv []byte, pubkey *ecdsa.PublicKey, keysize uint32, calg string) (keygen.ByteSource, error) {
+ bwpk, err := generateECDHESKeyECDSA(alg, calg, keysize, pubkey, apu, apv)
+ if err != nil {
+ return nil, err
+ }
+
+ // For key wrapping algorithms, wrap the CEK with the generated key
+ block, err := aes.NewCipher(bwpk.Bytes())
+ if err != nil {
+ return nil, fmt.Errorf(`failed to generate cipher from generated key: %w`, err)
+ }
+
+ jek, err := Wrap(block, cek)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to wrap data: %w`, err)
+ }
+
+ bwpk.ByteKey = keygen.ByteKey(jek)
+ return bwpk, nil
+}
+
+// KeyEncryptECDHESKeyWrapX25519 encrypts the CEK using ECDH-ES with key wrapping for X25519 keys
+func KeyEncryptECDHESKeyWrapX25519(cek []byte, alg string, _ []byte, _ []byte, pubkey *ecdh.PublicKey, keysize uint32, calg string) (keygen.ByteSource, error) {
+ bwpk, err := generateECDHESKeyX25519(alg, calg, keysize, pubkey)
+ if err != nil {
+ return nil, err
+ }
+
+ // For key wrapping algorithms, wrap the CEK with the generated key
+ block, err := aes.NewCipher(bwpk.Bytes())
+ if err != nil {
+ return nil, fmt.Errorf(`failed to generate cipher from generated key: %w`, err)
+ }
+
+ jek, err := Wrap(block, cek)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to wrap data: %w`, err)
+ }
+
+ bwpk.ByteKey = keygen.ByteKey(jek)
+ return bwpk, nil
+}
+
+// KeyEncryptECDHESECDSA encrypts using ECDH-ES direct (no key wrapping) for ECDSA keys
+func KeyEncryptECDHESECDSA(_ []byte, alg string, apu, apv []byte, pubkey *ecdsa.PublicKey, keysize uint32, calg string) (keygen.ByteSource, error) {
+ bwpk, err := generateECDHESKeyECDSA(alg, calg, keysize, pubkey, apu, apv)
+ if err != nil {
+ return nil, err
+ }
+
+ // For direct ECDH-ES, return the generated key directly
+ return bwpk, nil
+}
+
+// KeyEncryptECDHESX25519 encrypts using ECDH-ES direct (no key wrapping) for X25519 keys
+func KeyEncryptECDHESX25519(_ []byte, alg string, _, _ []byte, pubkey *ecdh.PublicKey, keysize uint32, calg string) (keygen.ByteSource, error) {
+ bwpk, err := generateECDHESKeyX25519(alg, calg, keysize, pubkey)
+ if err != nil {
+ return nil, err
+ }
+
+ // For direct ECDH-ES, return the generated key directly
+ return bwpk, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/key_encrypt_symmetric.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/key_encrypt_symmetric.go
new file mode 100644
index 0000000000..d489aaba28
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/key_encrypt_symmetric.go
@@ -0,0 +1,115 @@
+package jwebb
+
+import (
+ "crypto/aes"
+ cryptocipher "crypto/cipher"
+ "crypto/rand"
+ "crypto/sha256"
+ "crypto/sha512"
+ "fmt"
+ "hash"
+ "io"
+
+ "golang.org/x/crypto/pbkdf2"
+
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwe/internal/keygen"
+)
+
+// KeyEncryptAESKW encrypts the CEK using AES key wrap
+func KeyEncryptAESKW(cek []byte, _ string, sharedkey []byte) (keygen.ByteSource, error) {
+ block, err := aes.NewCipher(sharedkey)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to create cipher from shared key: %w`, err)
+ }
+
+ encrypted, err := Wrap(block, cek)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to wrap data: %w`, err)
+ }
+ return keygen.ByteKey(encrypted), nil
+}
+
+// KeyEncryptDirect returns the CEK directly for DIRECT algorithm
+func KeyEncryptDirect(_ []byte, _ string, sharedkey []byte) (keygen.ByteSource, error) {
+ return keygen.ByteKey(sharedkey), nil
+}
+
+// KeyEncryptPBES2 encrypts the CEK using PBES2 password-based encryption
+func KeyEncryptPBES2(cek []byte, alg string, password []byte) (keygen.ByteSource, error) {
+ var hashFunc func() hash.Hash
+ var keylen int
+
+ switch alg {
+ case tokens.PBES2_HS256_A128KW:
+ hashFunc = sha256.New
+ keylen = tokens.KeySize16
+ case tokens.PBES2_HS384_A192KW:
+ hashFunc = sha512.New384
+ keylen = tokens.KeySize24
+ case tokens.PBES2_HS512_A256KW:
+ hashFunc = sha512.New
+ keylen = tokens.KeySize32
+ default:
+ return nil, fmt.Errorf(`unsupported PBES2 algorithm: %s`, alg)
+ }
+
+ count := tokens.PBES2DefaultIterations
+ salt := make([]byte, keylen)
+ _, err := io.ReadFull(rand.Reader, salt)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to get random salt: %w`, err)
+ }
+
+ fullsalt := []byte(alg)
+ fullsalt = append(fullsalt, byte(tokens.PBES2NullByteSeparator))
+ fullsalt = append(fullsalt, salt...)
+
+ // Derive key using PBKDF2
+ derivedKey := pbkdf2.Key(password, fullsalt, count, keylen, hashFunc)
+
+ // Use the derived key for AES key wrap
+ block, err := aes.NewCipher(derivedKey)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to create cipher from derived key: %w`, err)
+ }
+ encrypted, err := Wrap(block, cek)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to wrap data: %w`, err)
+ }
+
+ return keygen.ByteWithSaltAndCount{
+ ByteKey: encrypted,
+ Salt: salt,
+ Count: count,
+ }, nil
+}
+
+// KeyEncryptAESGCMKW encrypts the CEK using AES GCM key wrap
+func KeyEncryptAESGCMKW(cek []byte, _ string, sharedkey []byte) (keygen.ByteSource, error) {
+ block, err := aes.NewCipher(sharedkey)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to create new AES cipher: %w`, err)
+ }
+
+ aesgcm, err := cryptocipher.NewGCM(block)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to create new GCM wrap: %w`, err)
+ }
+
+ iv := make([]byte, aesgcm.NonceSize())
+ _, err = io.ReadFull(rand.Reader, iv)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to get random iv: %w`, err)
+ }
+
+ encrypted := aesgcm.Seal(nil, iv, cek, nil)
+ tag := encrypted[len(encrypted)-aesgcm.Overhead():]
+ ciphertext := encrypted[:len(encrypted)-aesgcm.Overhead()]
+
+ return keygen.ByteWithIVAndTag{
+ ByteKey: ciphertext,
+ IV: iv,
+ Tag: tag,
+ }, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/key_encryption.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/key_encryption.go
new file mode 100644
index 0000000000..ce39352fc5
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/key_encryption.go
@@ -0,0 +1,70 @@
+package jwebb
+
+import (
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+)
+
+// IsECDHES checks if the algorithm is an ECDH-ES based algorithm
+func IsECDHES(alg string) bool {
+ switch alg {
+ case tokens.ECDH_ES, tokens.ECDH_ES_A128KW, tokens.ECDH_ES_A192KW, tokens.ECDH_ES_A256KW:
+ return true
+ default:
+ return false
+ }
+}
+
+// IsRSA15 checks if the algorithm is RSA1_5
+func IsRSA15(alg string) bool {
+ return alg == tokens.RSA1_5
+}
+
+// IsRSAOAEP checks if the algorithm is an RSA-OAEP based algorithm
+func IsRSAOAEP(alg string) bool {
+ switch alg {
+ case tokens.RSA_OAEP, tokens.RSA_OAEP_256, tokens.RSA_OAEP_384, tokens.RSA_OAEP_512:
+ return true
+ default:
+ return false
+ }
+}
+
+// IsAESKW checks if the algorithm is an AES key wrap algorithm
+func IsAESKW(alg string) bool {
+ switch alg {
+ case tokens.A128KW, tokens.A192KW, tokens.A256KW:
+ return true
+ default:
+ return false
+ }
+}
+
+// IsAESGCMKW checks if the algorithm is an AES-GCM key wrap algorithm
+func IsAESGCMKW(alg string) bool {
+ switch alg {
+ case tokens.A128GCMKW, tokens.A192GCMKW, tokens.A256GCMKW:
+ return true
+ default:
+ return false
+ }
+}
+
+// IsPBES2 checks if the algorithm is a PBES2 based algorithm
+func IsPBES2(alg string) bool {
+ switch alg {
+ case tokens.PBES2_HS256_A128KW, tokens.PBES2_HS384_A192KW, tokens.PBES2_HS512_A256KW:
+ return true
+ default:
+ return false
+ }
+}
+
+// IsDirect checks if the algorithm is direct encryption
+func IsDirect(alg string) bool {
+ return alg == tokens.DIRECT
+}
+
+// IsSymmetric checks if the algorithm is a symmetric key encryption algorithm
+func IsSymmetric(alg string) bool {
+ return IsAESKW(alg) || IsAESGCMKW(alg) || IsPBES2(alg) || IsDirect(alg)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/keywrap.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/keywrap.go
new file mode 100644
index 0000000000..0792d6cb8e
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/jwebb/keywrap.go
@@ -0,0 +1,110 @@
+package jwebb
+
+import (
+ "crypto/cipher"
+ "crypto/subtle"
+ "encoding/binary"
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+)
+
+var keywrapDefaultIV = []byte{0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6}
+
+func Wrap(kek cipher.Block, cek []byte) ([]byte, error) {
+ if len(cek)%tokens.KeywrapBlockSize != 0 {
+ return nil, fmt.Errorf(`keywrap input must be %d byte blocks`, tokens.KeywrapBlockSize)
+ }
+
+ n := len(cek) / tokens.KeywrapChunkLen
+ r := make([][]byte, n)
+
+ for i := range n {
+ r[i] = make([]byte, tokens.KeywrapChunkLen)
+ copy(r[i], cek[i*tokens.KeywrapChunkLen:])
+ }
+
+ buffer := pool.ByteSlice().GetCapacity(tokens.KeywrapChunkLen * 2)
+ defer pool.ByteSlice().Put(buffer)
+ // the byte slice has the capacity, but len is 0
+ buffer = buffer[:tokens.KeywrapChunkLen*2]
+
+ tBytes := pool.ByteSlice().GetCapacity(tokens.KeywrapChunkLen)
+ defer pool.ByteSlice().Put(tBytes)
+ // the byte slice has the capacity, but len is 0
+ tBytes = tBytes[:tokens.KeywrapChunkLen]
+
+ copy(buffer, keywrapDefaultIV)
+
+ for t := range tokens.KeywrapRounds * n {
+ copy(buffer[tokens.KeywrapChunkLen:], r[t%n])
+
+ kek.Encrypt(buffer, buffer)
+
+ binary.BigEndian.PutUint64(tBytes, uint64(t+1))
+
+ for i := range tokens.KeywrapChunkLen {
+ buffer[i] = buffer[i] ^ tBytes[i]
+ }
+ copy(r[t%n], buffer[tokens.KeywrapChunkLen:])
+ }
+
+ out := make([]byte, (n+1)*tokens.KeywrapChunkLen)
+ copy(out, buffer[:tokens.KeywrapChunkLen])
+ for i := range r {
+ copy(out[(i+1)*tokens.KeywrapBlockSize:], r[i])
+ }
+
+ return out, nil
+}
+
+func Unwrap(block cipher.Block, ciphertxt []byte) ([]byte, error) {
+ if len(ciphertxt)%tokens.KeywrapChunkLen != 0 {
+ return nil, fmt.Errorf(`keyunwrap input must be %d byte blocks`, tokens.KeywrapChunkLen)
+ }
+
+ n := (len(ciphertxt) / tokens.KeywrapChunkLen) - 1
+ r := make([][]byte, n)
+
+ for i := range r {
+ r[i] = make([]byte, tokens.KeywrapChunkLen)
+ copy(r[i], ciphertxt[(i+1)*tokens.KeywrapChunkLen:])
+ }
+
+ buffer := pool.ByteSlice().GetCapacity(tokens.KeywrapChunkLen * 2)
+ defer pool.ByteSlice().Put(buffer)
+ // the byte slice has the capacity, but len is 0
+ buffer = buffer[:tokens.KeywrapChunkLen*2]
+
+ tBytes := pool.ByteSlice().GetCapacity(tokens.KeywrapChunkLen)
+ defer pool.ByteSlice().Put(tBytes)
+ // the byte slice has the capacity, but len is 0
+ tBytes = tBytes[:tokens.KeywrapChunkLen]
+
+ copy(buffer[:tokens.KeywrapChunkLen], ciphertxt[:tokens.KeywrapChunkLen])
+
+ for t := tokens.KeywrapRounds*n - 1; t >= 0; t-- {
+ binary.BigEndian.PutUint64(tBytes, uint64(t+1))
+
+ for i := range tokens.KeywrapChunkLen {
+ buffer[i] = buffer[i] ^ tBytes[i]
+ }
+ copy(buffer[tokens.KeywrapChunkLen:], r[t%n])
+
+ block.Decrypt(buffer, buffer)
+
+ copy(r[t%n], buffer[tokens.KeywrapChunkLen:])
+ }
+
+ if subtle.ConstantTimeCompare(buffer[:tokens.KeywrapChunkLen], keywrapDefaultIV) == 0 {
+ return nil, fmt.Errorf(`key unwrap: failed to unwrap key`)
+ }
+
+ out := make([]byte, n*tokens.KeywrapChunkLen)
+ for i := range r {
+ copy(out[i*tokens.KeywrapChunkLen:], r[i])
+ }
+
+ return out, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/key_provider.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/key_provider.go
new file mode 100644
index 0000000000..05adc04517
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/key_provider.go
@@ -0,0 +1,163 @@
+package jwe
+
+import (
+ "context"
+ "fmt"
+ "sync"
+
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwk"
+)
+
+// KeyProvider is responsible for providing key(s) to encrypt or decrypt a payload.
+// Multiple `jwe.KeyProvider`s can be passed to `jwe.Encrypt()` or `jwe.Decrypt()`
+//
+// `jwe.Encrypt()` can only accept static key providers via `jwe.WithKey()`,
+// while `jwe.Decrypt()` can accept `jwe.WithKey()`, `jwe.WithKeySet()`,
+// and `jwe.WithKeyProvider()`.
+//
+// Understanding how this works is crucial to learn how this package works.
+// Here we will use `jwe.Decrypt()` as an example to show how the `KeyProvider`
+// works.
+//
+// `jwe.Encrypt()` is straightforward: the content encryption key is encrypted
+// using the provided keys, and JWS recipient objects are created for each.
+//
+// `jwe.Decrypt()` is a bit more involved, because there are cases you
+// will want to compute/deduce/guess the keys that you would like to
+// use for decryption.
+//
+// The first thing that `jwe.Decrypt()` needs to do is to collect the
+// KeyProviders from the option list that the user provided (presented in pseudocode):
+//
+// keyProviders := filterKeyProviders(options)
+//
+// Then, remember that a JWE message may contain multiple recipients in the
+// message. For each recipient, we call on the KeyProviders to give us
+// the key(s) to use on this CEK:
+//
+// for r in msg.Recipients {
+// for kp in keyProviders {
+// kp.FetchKeys(ctx, sink, r, msg)
+// ...
+// }
+// }
+//
+// The `sink` argument passed to the KeyProvider is a temporary storage
+// for the keys (either a jwk.Key or a "raw" key). The `KeyProvider`
+// is responsible for sending keys into the `sink`.
+//
+// When called, the `KeyProvider` created by `jwe.WithKey()` sends the same key,
+// `jwe.WithKeySet()` sends keys that matches a particular `kid` and `alg`,
+// and finally `jwe.WithKeyProvider()` allows you to execute arbitrary
+// logic to provide keys. If you are providing a custom `KeyProvider`,
+// you should execute the necessary checks or retrieval of keys, and
+// then send the key(s) to the sink:
+//
+// sink.Key(alg, key)
+//
+// These keys are then retrieved and tried for each recipient, until
+// a match is found:
+//
+// keys := sink.Keys()
+// for key in keys {
+// if decryptJWEKey(recipient.EncryptedKey(), key) {
+// return OK
+// }
+// }
+type KeyProvider interface {
+ FetchKeys(context.Context, KeySink, Recipient, *Message) error
+}
+
+// KeySink is a data storage where `jwe.KeyProvider` objects should
+// send their keys to.
+type KeySink interface {
+ Key(jwa.KeyEncryptionAlgorithm, any)
+}
+
+type algKeyPair struct {
+ alg jwa.KeyAlgorithm
+ key any
+}
+
+type algKeySink struct {
+ mu sync.Mutex
+ list []algKeyPair
+}
+
+func (s *algKeySink) Key(alg jwa.KeyEncryptionAlgorithm, key any) {
+ s.mu.Lock()
+ s.list = append(s.list, algKeyPair{alg, key})
+ s.mu.Unlock()
+}
+
+type staticKeyProvider struct {
+ alg jwa.KeyEncryptionAlgorithm
+ key any
+}
+
+func (kp *staticKeyProvider) FetchKeys(_ context.Context, sink KeySink, _ Recipient, _ *Message) error {
+ sink.Key(kp.alg, kp.key)
+ return nil
+}
+
+type keySetProvider struct {
+ set jwk.Set
+ requireKid bool
+}
+
+func (kp *keySetProvider) selectKey(sink KeySink, key jwk.Key, _ Recipient, _ *Message) error {
+ if usage, ok := key.KeyUsage(); ok {
+ if usage != "" && usage != jwk.ForEncryption.String() {
+ return nil
+ }
+ }
+
+ if v, ok := key.Algorithm(); ok {
+ kalg, ok := jwa.LookupKeyEncryptionAlgorithm(v.String())
+ if !ok {
+ return fmt.Errorf(`invalid key encryption algorithm %s`, v)
+ }
+
+ sink.Key(kalg, key)
+ return nil
+ }
+
+ return nil
+}
+
+func (kp *keySetProvider) FetchKeys(_ context.Context, sink KeySink, r Recipient, msg *Message) error {
+ if kp.requireKid {
+ var key jwk.Key
+
+ wantedKid, ok := r.Headers().KeyID()
+ if !ok || wantedKid == "" {
+ return fmt.Errorf(`failed to find matching key: no key ID ("kid") specified in token but multiple keys available in key set`)
+ }
+ // Otherwise we better be able to look up the key, baby.
+ v, ok := kp.set.LookupKeyID(wantedKid)
+ if !ok {
+ return fmt.Errorf(`failed to find key with key ID %q in key set`, wantedKid)
+ }
+ key = v
+
+ return kp.selectKey(sink, key, r, msg)
+ }
+
+ for i := range kp.set.Len() {
+ key, _ := kp.set.Key(i)
+ if err := kp.selectKey(sink, key, r, msg); err != nil {
+ continue
+ }
+ }
+ return nil
+}
+
+// KeyProviderFunc is a type of KeyProvider that is implemented by
+// a single function. You can use this to create ad-hoc `KeyProvider`
+// instances.
+type KeyProviderFunc func(context.Context, KeySink, Recipient, *Message) error
+
+func (kp KeyProviderFunc) FetchKeys(ctx context.Context, sink KeySink, r Recipient, msg *Message) error {
+ return kp(ctx, sink, r, msg)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/message.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/message.go
new file mode 100644
index 0000000000..7aad833f26
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/message.go
@@ -0,0 +1,560 @@
+package jwe
+
+import (
+ "fmt"
+ "sort"
+ "strings"
+
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+)
+
+// NewRecipient creates a Recipient object
+func NewRecipient() Recipient {
+ return &stdRecipient{
+ headers: NewHeaders(),
+ }
+}
+
+func (r *stdRecipient) SetHeaders(h Headers) error {
+ r.headers = h
+ return nil
+}
+
+func (r *stdRecipient) SetEncryptedKey(v []byte) error {
+ r.encryptedKey = v
+ return nil
+}
+
+func (r *stdRecipient) Headers() Headers {
+ return r.headers
+}
+
+func (r *stdRecipient) EncryptedKey() []byte {
+ return r.encryptedKey
+}
+
+type recipientMarshalProxy struct {
+ Headers Headers `json:"header"`
+ EncryptedKey string `json:"encrypted_key"`
+}
+
+func (r *stdRecipient) UnmarshalJSON(buf []byte) error {
+ var proxy recipientMarshalProxy
+ proxy.Headers = NewHeaders()
+ if err := json.Unmarshal(buf, &proxy); err != nil {
+ return fmt.Errorf(`failed to unmarshal json into recipient: %w`, err)
+ }
+
+ r.headers = proxy.Headers
+ decoded, err := base64.DecodeString(proxy.EncryptedKey)
+ if err != nil {
+ return fmt.Errorf(`failed to decode "encrypted_key": %w`, err)
+ }
+ r.encryptedKey = decoded
+ return nil
+}
+
+func (r *stdRecipient) MarshalJSON() ([]byte, error) {
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+
+ buf.WriteString(`{"header":`)
+ hdrbuf, err := json.Marshal(r.headers)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to marshal recipient header: %w`, err)
+ }
+ buf.Write(hdrbuf)
+ buf.WriteString(`,"encrypted_key":"`)
+ buf.WriteString(base64.EncodeToString(r.encryptedKey))
+ buf.WriteString(`"}`)
+
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ return ret, nil
+}
+
+// NewMessage creates a new message
+func NewMessage() *Message {
+ return &Message{}
+}
+
+func (m *Message) AuthenticatedData() []byte {
+ return m.authenticatedData
+}
+
+func (m *Message) CipherText() []byte {
+ return m.cipherText
+}
+
+func (m *Message) InitializationVector() []byte {
+ return m.initializationVector
+}
+
+func (m *Message) Tag() []byte {
+ return m.tag
+}
+
+func (m *Message) ProtectedHeaders() Headers {
+ return m.protectedHeaders
+}
+
+func (m *Message) Recipients() []Recipient {
+ return m.recipients
+}
+
+func (m *Message) UnprotectedHeaders() Headers {
+ return m.unprotectedHeaders
+}
+
+const (
+ AuthenticatedDataKey = "aad"
+ CipherTextKey = "ciphertext"
+ CountKey = "p2c"
+ InitializationVectorKey = "iv"
+ ProtectedHeadersKey = "protected"
+ RecipientsKey = "recipients"
+ SaltKey = "p2s"
+ TagKey = "tag"
+ UnprotectedHeadersKey = "unprotected"
+ HeadersKey = "header"
+ EncryptedKeyKey = "encrypted_key"
+)
+
+func (m *Message) Set(k string, v any) error {
+ switch k {
+ case AuthenticatedDataKey:
+ buf, ok := v.([]byte)
+ if !ok {
+ return fmt.Errorf(`invalid value %T for %s key`, v, AuthenticatedDataKey)
+ }
+ m.authenticatedData = buf
+ case CipherTextKey:
+ buf, ok := v.([]byte)
+ if !ok {
+ return fmt.Errorf(`invalid value %T for %s key`, v, CipherTextKey)
+ }
+ m.cipherText = buf
+ case InitializationVectorKey:
+ buf, ok := v.([]byte)
+ if !ok {
+ return fmt.Errorf(`invalid value %T for %s key`, v, InitializationVectorKey)
+ }
+ m.initializationVector = buf
+ case ProtectedHeadersKey:
+ cv, ok := v.(Headers)
+ if !ok {
+ return fmt.Errorf(`invalid value %T for %s key`, v, ProtectedHeadersKey)
+ }
+ m.protectedHeaders = cv
+ case RecipientsKey:
+ cv, ok := v.([]Recipient)
+ if !ok {
+ return fmt.Errorf(`invalid value %T for %s key`, v, RecipientsKey)
+ }
+ m.recipients = cv
+ case TagKey:
+ buf, ok := v.([]byte)
+ if !ok {
+ return fmt.Errorf(`invalid value %T for %s key`, v, TagKey)
+ }
+ m.tag = buf
+ case UnprotectedHeadersKey:
+ cv, ok := v.(Headers)
+ if !ok {
+ return fmt.Errorf(`invalid value %T for %s key`, v, UnprotectedHeadersKey)
+ }
+ m.unprotectedHeaders = cv
+ default:
+ if m.unprotectedHeaders == nil {
+ m.unprotectedHeaders = NewHeaders()
+ }
+ return m.unprotectedHeaders.Set(k, v)
+ }
+ return nil
+}
+
+type messageMarshalProxy struct {
+ AuthenticatedData string `json:"aad,omitempty"`
+ CipherText string `json:"ciphertext"`
+ InitializationVector string `json:"iv,omitempty"`
+ ProtectedHeaders json.RawMessage `json:"protected"`
+ Recipients []json.RawMessage `json:"recipients,omitempty"`
+ Tag string `json:"tag,omitempty"`
+ UnprotectedHeaders Headers `json:"unprotected,omitempty"`
+
+ // For flattened structure. Headers is NOT a Headers type,
+ // so that we can detect its presence by checking proxy.Headers != nil
+ Headers json.RawMessage `json:"header,omitempty"`
+ EncryptedKey string `json:"encrypted_key,omitempty"`
+}
+
+type jsonKV struct {
+ Key string
+ Value string
+}
+
+func (m *Message) MarshalJSON() ([]byte, error) {
+ // This is slightly convoluted, but we need to encode the
+ // protected headers, so we do it by hand
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+ enc := json.NewEncoder(buf)
+
+ var fields []jsonKV
+
+ if cipherText := m.CipherText(); len(cipherText) > 0 {
+ buf.Reset()
+ if err := enc.Encode(base64.EncodeToString(cipherText)); err != nil {
+ return nil, fmt.Errorf(`failed to encode %s field: %w`, CipherTextKey, err)
+ }
+ fields = append(fields, jsonKV{
+ Key: CipherTextKey,
+ Value: strings.TrimSpace(buf.String()),
+ })
+ }
+
+ if iv := m.InitializationVector(); len(iv) > 0 {
+ buf.Reset()
+ if err := enc.Encode(base64.EncodeToString(iv)); err != nil {
+ return nil, fmt.Errorf(`failed to encode %s field: %w`, InitializationVectorKey, err)
+ }
+ fields = append(fields, jsonKV{
+ Key: InitializationVectorKey,
+ Value: strings.TrimSpace(buf.String()),
+ })
+ }
+
+ var encodedProtectedHeaders []byte
+ if h := m.ProtectedHeaders(); h != nil {
+ v, err := h.Encode()
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encode protected headers: %w`, err)
+ }
+
+ encodedProtectedHeaders = v
+ if len(encodedProtectedHeaders) <= 2 { // '{}'
+ encodedProtectedHeaders = nil
+ } else {
+ fields = append(fields, jsonKV{
+ Key: ProtectedHeadersKey,
+ Value: fmt.Sprintf("%q", encodedProtectedHeaders),
+ })
+ }
+ }
+
+ if aad := m.AuthenticatedData(); len(aad) > 0 {
+ aad = base64.Encode(aad)
+ if encodedProtectedHeaders != nil {
+ tmp := append(encodedProtectedHeaders, tokens.Period)
+ aad = append(tmp, aad...)
+ }
+
+ buf.Reset()
+ if err := enc.Encode(aad); err != nil {
+ return nil, fmt.Errorf(`failed to encode %s field: %w`, AuthenticatedDataKey, err)
+ }
+ fields = append(fields, jsonKV{
+ Key: AuthenticatedDataKey,
+ Value: strings.TrimSpace(buf.String()),
+ })
+ }
+
+ if recipients := m.Recipients(); len(recipients) > 0 {
+ if len(recipients) == 1 { // Use flattened format
+ if hdrs := recipients[0].Headers(); hdrs != nil {
+ var skipHeaders bool
+ if zeroer, ok := hdrs.(isZeroer); ok {
+ if zeroer.isZero() {
+ skipHeaders = true
+ }
+ }
+
+ if !skipHeaders {
+ buf.Reset()
+ if err := enc.Encode(hdrs); err != nil {
+ return nil, fmt.Errorf(`failed to encode %s field: %w`, HeadersKey, err)
+ }
+ fields = append(fields, jsonKV{
+ Key: HeadersKey,
+ Value: strings.TrimSpace(buf.String()),
+ })
+ }
+ }
+
+ if ek := recipients[0].EncryptedKey(); len(ek) > 0 {
+ buf.Reset()
+ if err := enc.Encode(base64.EncodeToString(ek)); err != nil {
+ return nil, fmt.Errorf(`failed to encode %s field: %w`, EncryptedKeyKey, err)
+ }
+ fields = append(fields, jsonKV{
+ Key: EncryptedKeyKey,
+ Value: strings.TrimSpace(buf.String()),
+ })
+ }
+ } else {
+ buf.Reset()
+ if err := enc.Encode(recipients); err != nil {
+ return nil, fmt.Errorf(`failed to encode %s field: %w`, RecipientsKey, err)
+ }
+ fields = append(fields, jsonKV{
+ Key: RecipientsKey,
+ Value: strings.TrimSpace(buf.String()),
+ })
+ }
+ }
+
+ if tag := m.Tag(); len(tag) > 0 {
+ buf.Reset()
+ if err := enc.Encode(base64.EncodeToString(tag)); err != nil {
+ return nil, fmt.Errorf(`failed to encode %s field: %w`, TagKey, err)
+ }
+ fields = append(fields, jsonKV{
+ Key: TagKey,
+ Value: strings.TrimSpace(buf.String()),
+ })
+ }
+
+ if h := m.UnprotectedHeaders(); h != nil {
+ unprotected, err := json.Marshal(h)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encode unprotected headers: %w`, err)
+ }
+
+ if len(unprotected) > 2 {
+ fields = append(fields, jsonKV{
+ Key: UnprotectedHeadersKey,
+ Value: fmt.Sprintf("%q", unprotected),
+ })
+ }
+ }
+
+ sort.Slice(fields, func(i, j int) bool {
+ return fields[i].Key < fields[j].Key
+ })
+ buf.Reset()
+ fmt.Fprintf(buf, `{`)
+ for i, kv := range fields {
+ if i > 0 {
+ fmt.Fprintf(buf, `,`)
+ }
+ fmt.Fprintf(buf, `%q:%s`, kv.Key, kv.Value)
+ }
+ fmt.Fprintf(buf, `}`)
+
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ return ret, nil
+}
+
+func (m *Message) UnmarshalJSON(buf []byte) error {
+ var proxy messageMarshalProxy
+ proxy.UnprotectedHeaders = NewHeaders()
+
+ if err := json.Unmarshal(buf, &proxy); err != nil {
+ return fmt.Errorf(`failed to unmashal JSON into message: %w`, err)
+ }
+
+ // Get the string value
+ var protectedHeadersStr string
+ if err := json.Unmarshal(proxy.ProtectedHeaders, &protectedHeadersStr); err != nil {
+ return fmt.Errorf(`failed to decode protected headers (1): %w`, err)
+ }
+
+ // It's now in _quoted_ base64 string. Decode it
+ protectedHeadersRaw, err := base64.DecodeString(protectedHeadersStr)
+ if err != nil {
+ return fmt.Errorf(`failed to base64 decoded protected headers buffer: %w`, err)
+ }
+
+ h := NewHeaders()
+ if err := json.Unmarshal(protectedHeadersRaw, h); err != nil {
+ return fmt.Errorf(`failed to decode protected headers (2): %w`, err)
+ }
+
+ // if this were a flattened message, we would see a "header" and "ciphertext"
+ // field. TODO: do both of these conditions need to meet, or just one?
+ if proxy.Headers != nil || len(proxy.EncryptedKey) > 0 {
+ recipient := NewRecipient()
+
+ // `"heders"` could be empty. If that's the case, just skip the
+ // following unmarshaling step
+ if proxy.Headers != nil {
+ hdrs := NewHeaders()
+ if err := json.Unmarshal(proxy.Headers, hdrs); err != nil {
+ return fmt.Errorf(`failed to decode headers field: %w`, err)
+ }
+
+ if err := recipient.SetHeaders(hdrs); err != nil {
+ return fmt.Errorf(`failed to set new headers: %w`, err)
+ }
+ }
+
+ if v := proxy.EncryptedKey; len(v) > 0 {
+ buf, err := base64.DecodeString(v)
+ if err != nil {
+ return fmt.Errorf(`failed to decode encrypted key: %w`, err)
+ }
+ if err := recipient.SetEncryptedKey(buf); err != nil {
+ return fmt.Errorf(`failed to set encrypted key: %w`, err)
+ }
+ }
+
+ m.recipients = append(m.recipients, recipient)
+ } else {
+ for i, recipientbuf := range proxy.Recipients {
+ recipient := NewRecipient()
+ if err := json.Unmarshal(recipientbuf, recipient); err != nil {
+ return fmt.Errorf(`failed to decode recipient at index %d: %w`, i, err)
+ }
+
+ m.recipients = append(m.recipients, recipient)
+ }
+ }
+
+ if src := proxy.AuthenticatedData; len(src) > 0 {
+ v, err := base64.DecodeString(src)
+ if err != nil {
+ return fmt.Errorf(`failed to decode "aad": %w`, err)
+ }
+ m.authenticatedData = v
+ }
+
+ if src := proxy.CipherText; len(src) > 0 {
+ v, err := base64.DecodeString(src)
+ if err != nil {
+ return fmt.Errorf(`failed to decode "ciphertext": %w`, err)
+ }
+ m.cipherText = v
+ }
+
+ if src := proxy.InitializationVector; len(src) > 0 {
+ v, err := base64.DecodeString(src)
+ if err != nil {
+ return fmt.Errorf(`failed to decode "iv": %w`, err)
+ }
+ m.initializationVector = v
+ }
+
+ if src := proxy.Tag; len(src) > 0 {
+ v, err := base64.DecodeString(src)
+ if err != nil {
+ return fmt.Errorf(`failed to decode "tag": %w`, err)
+ }
+ m.tag = v
+ }
+
+ m.protectedHeaders = h
+ if m.storeProtectedHeaders {
+ // this is later used for decryption
+ m.rawProtectedHeaders = base64.Encode(protectedHeadersRaw)
+ }
+
+ if iz, ok := proxy.UnprotectedHeaders.(isZeroer); ok {
+ if !iz.isZero() {
+ m.unprotectedHeaders = proxy.UnprotectedHeaders
+ }
+ }
+
+ if len(m.recipients) == 0 {
+ if err := m.makeDummyRecipient(proxy.EncryptedKey, m.protectedHeaders); err != nil {
+ return fmt.Errorf(`failed to setup recipient: %w`, err)
+ }
+ }
+
+ return nil
+}
+
+func (m *Message) makeDummyRecipient(enckeybuf string, protected Headers) error {
+ // Recipients in this case should not contain the content encryption key,
+ // so move that out
+ hdrs, err := protected.Clone()
+ if err != nil {
+ return fmt.Errorf(`failed to clone headers: %w`, err)
+ }
+
+ if err := hdrs.Remove(ContentEncryptionKey); err != nil {
+ return fmt.Errorf(`failed to remove %#v from public header: %w`, ContentEncryptionKey, err)
+ }
+
+ enckey, err := base64.DecodeString(enckeybuf)
+ if err != nil {
+ return fmt.Errorf(`failed to decode encrypted key: %w`, err)
+ }
+
+ if err := m.Set(RecipientsKey, []Recipient{
+ &stdRecipient{
+ headers: hdrs,
+ encryptedKey: enckey,
+ },
+ }); err != nil {
+ return fmt.Errorf(`failed to set %s: %w`, RecipientsKey, err)
+ }
+ return nil
+}
+
+// Compact generates a JWE message in compact serialization format from a
+// `*jwe.Message` object. The object contain exactly one recipient, or
+// an error is returned.
+//
+// This function currently does not take any options, but the function
+// signature contains `options` for possible future expansion of the API
+func Compact(m *Message, _ ...CompactOption) ([]byte, error) {
+ if len(m.recipients) != 1 {
+ return nil, fmt.Errorf(`wrong number of recipients for compact serialization`)
+ }
+
+ recipient := m.recipients[0]
+
+ // The protected header must be a merge between the message-wide
+ // protected header AND the recipient header
+
+ // There's something wrong if m.protectedHeaders is nil, but
+ // it could happen
+ if m.protectedHeaders == nil {
+ return nil, fmt.Errorf(`invalid protected header`)
+ }
+
+ hcopy, err := m.protectedHeaders.Clone()
+ if err != nil {
+ return nil, fmt.Errorf(`failed to copy protected header: %w`, err)
+ }
+ hcopy, err = hcopy.Merge(m.unprotectedHeaders)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to merge unprotected header: %w`, err)
+ }
+ hcopy, err = hcopy.Merge(recipient.Headers())
+ if err != nil {
+ return nil, fmt.Errorf(`failed to merge recipient header: %w`, err)
+ }
+
+ protected, err := hcopy.Encode()
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encode header: %w`, err)
+ }
+
+ encryptedKey := base64.Encode(recipient.EncryptedKey())
+ iv := base64.Encode(m.initializationVector)
+ cipher := base64.Encode(m.cipherText)
+ tag := base64.Encode(m.tag)
+
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+
+ buf.Grow(len(protected) + len(encryptedKey) + len(iv) + len(cipher) + len(tag) + 4)
+ buf.Write(protected)
+ buf.WriteByte(tokens.Period)
+ buf.Write(encryptedKey)
+ buf.WriteByte(tokens.Period)
+ buf.Write(iv)
+ buf.WriteByte(tokens.Period)
+ buf.Write(cipher)
+ buf.WriteByte(tokens.Period)
+ buf.Write(tag)
+
+ result := make([]byte, buf.Len())
+ copy(result, buf.Bytes())
+ return result, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/options.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/options.go
new file mode 100644
index 0000000000..0437ea8733
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/options.go
@@ -0,0 +1,109 @@
+package jwe
+
+import (
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwk"
+ "github.com/lestrrat-go/option/v2"
+)
+
+// WithProtectedHeaders is used to specify contents of the protected header.
+// Some fields such as "enc" and "zip" will be overwritten when encryption is
+// performed.
+//
+// There is no equivalent for unprotected headers in this implementation
+func WithProtectedHeaders(h Headers) EncryptOption {
+ cloned, _ := h.Clone()
+ return &encryptOption{option.New(identProtectedHeaders{}, cloned)}
+}
+
+type withKey struct {
+ alg jwa.KeyAlgorithm
+ key any
+ headers Headers
+}
+
+type WithKeySuboption interface {
+ Option
+ withKeySuboption()
+}
+
+type withKeySuboption struct {
+ Option
+}
+
+func (*withKeySuboption) withKeySuboption() {}
+
+// WithPerRecipientHeaders is used to pass header values for each recipient.
+// Note that these headers are by definition _unprotected_.
+func WithPerRecipientHeaders(hdr Headers) WithKeySuboption {
+ return &withKeySuboption{option.New(identPerRecipientHeaders{}, hdr)}
+}
+
+// WithKey is used to pass a static algorithm/key pair to either `jwe.Encrypt()` or `jwe.Decrypt()`.
+// either a raw key or `jwk.Key` may be passed as `key`.
+//
+// The `alg` parameter is the identifier for the key encryption algorithm that should be used.
+// It is of type `jwa.KeyAlgorithm` but in reality you can only pass `jwa.KeyEncryptionAlgorithm`
+// types. It is this way so that the value in `(jwk.Key).Algorithm()` can be directly
+// passed to the option. If you specify other algorithm types such as `jwa.SignatureAlgorithm`,
+// then you will get an error when `jwe.Encrypt()` or `jwe.Decrypt()` is executed.
+//
+// Unlike `jwe.WithKeySet()`, the `kid` field does not need to match for the key
+// to be tried.
+func WithKey(alg jwa.KeyAlgorithm, key any, options ...WithKeySuboption) EncryptDecryptOption {
+ var hdr Headers
+ for _, option := range options {
+ switch option.Ident() {
+ case identPerRecipientHeaders{}:
+ if err := option.Value(&hdr); err != nil {
+ panic(`jwe.WithKey() requires Headers value for WithPerRecipientHeaders option`)
+ }
+ }
+ }
+
+ return &encryptDecryptOption{option.New(identKey{}, &withKey{
+ alg: alg,
+ key: key,
+ headers: hdr,
+ })}
+}
+
+func WithKeySet(set jwk.Set, options ...WithKeySetSuboption) DecryptOption {
+ requireKid := true
+ for _, option := range options {
+ switch option.Ident() {
+ case identRequireKid{}:
+ if err := option.Value(&requireKid); err != nil {
+ panic(`jwe.WithKeySet() requires bool value for WithRequireKid option`)
+ }
+ }
+ }
+
+ return WithKeyProvider(&keySetProvider{
+ set: set,
+ requireKid: requireKid,
+ })
+}
+
+// WithJSON specifies that the result of `jwe.Encrypt()` is serialized in
+// JSON format.
+//
+// If you pass multiple keys to `jwe.Encrypt()`, it will fail unless
+// you also pass this option.
+func WithJSON(options ...WithJSONSuboption) EncryptOption {
+ var pretty bool
+ for _, option := range options {
+ switch option.Ident() {
+ case identPretty{}:
+ if err := option.Value(&pretty); err != nil {
+ panic(`jwe.WithJSON() requires bool value for WithPretty option`)
+ }
+ }
+ }
+
+ format := fmtJSON
+ if pretty {
+ format = fmtJSONPretty
+ }
+ return &encryptOption{option.New(identSerialization{}, format)}
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/options.yaml b/vendor/github.com/lestrrat-go/jwx/v3/jwe/options.yaml
new file mode 100644
index 0000000000..359d80944d
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/options.yaml
@@ -0,0 +1,210 @@
+package_name: jwe
+output: jwe/options_gen.go
+interfaces:
+ - name: GlobalOption
+ comment: |
+ GlobalOption describes options that changes global settings for this package
+ - name: GlobalDecryptOption
+ comment: |
+ GlobalDecryptOption describes options that changes global settings and for each call of the `jwe.Decrypt` function
+ methods:
+ - globalOption
+ - decryptOption
+ - name: CompactOption
+ comment: |
+ CompactOption describes options that can be passed to `jwe.Compact`
+ - name: DecryptOption
+ comment: |
+ DecryptOption describes options that can be passed to `jwe.Decrypt`
+ - name: EncryptOption
+ comment: |
+ EncryptOption describes options that can be passed to `jwe.Encrypt`
+ - name: EncryptDecryptOption
+ methods:
+ - encryptOption
+ - decryptOption
+ comment: |
+ EncryptDecryptOption describes options that can be passed to either `jwe.Encrypt` or `jwe.Decrypt`
+ - name: WithJSONSuboption
+ concrete_type: withJSONSuboption
+ comment: |
+ JSONSuboption describes suboptions that can be passed to `jwe.WithJSON()` option
+ - name: WithKeySetSuboption
+ comment: |
+ WithKeySetSuboption is a suboption passed to the WithKeySet() option
+ - name: ParseOption
+ methods:
+ - readFileOption
+ comment: |
+ ReadFileOption is a type of `Option` that can be passed to `jwe.Parse`
+ - name: ReadFileOption
+ comment: |
+ ReadFileOption is a type of `Option` that can be passed to `jwe.ReadFile`
+options:
+ - ident: Key
+ skip_option: true
+ - ident: Pretty
+ skip_option: true
+ - ident: ProtectedHeaders
+ skip_option: true
+ - ident: PerRecipientHeaders
+ skip_option: true
+ - ident: KeyProvider
+ interface: DecryptOption
+ argument_type: KeyProvider
+ - ident: Context
+ interface: DecryptOption
+ argument_type: context.Context
+ comment: |
+ WithContext specifies the context.Context object to use when decrypting a JWE message.
+ If not provided, context.Background() will be used.
+ - ident: Serialization
+ option_name: WithCompact
+ interface: EncryptOption
+ constant_value: fmtCompact
+ comment: |
+ WithCompact specifies that the result of `jwe.Encrypt()` is serialized in
+ compact format.
+
+ By default `jwe.Encrypt()` will opt to use compact format, so you usually
+ do not need to specify this option other than to be explicit about it
+ - ident: Compress
+ interface: EncryptOption
+ argument_type: jwa.CompressionAlgorithm
+ comment: |
+ WithCompress specifies the compression algorithm to use when encrypting
+ a payload using `jwe.Encrypt` (Yes, we know it can only be "" or "DEF",
+ but the way the specification is written it could allow for more options,
+ and therefore this option takes an argument)
+ - ident: ContentEncryptionAlgorithm
+ interface: EncryptOption
+ option_name: WithContentEncryption
+ argument_type: jwa.ContentEncryptionAlgorithm
+ comment: |
+ WithContentEncryptionAlgorithm specifies the algorithm to encrypt the
+ JWE message content with. If not provided, `jwa.A256GCM` is used.
+ - ident: Message
+ interface: DecryptOption
+ argument_type: '*Message'
+ comment: |
+ WithMessage provides a message object to be populated by `jwe.Decrypt`
+ Using this option allows you to decrypt AND obtain the `jwe.Message`
+ in one go.
+ - ident: RequireKid
+ interface: WithKeySetSuboption
+ argument_type: bool
+ comment: |
+ WithRequiredKid specifies whether the keys in the jwk.Set should
+ only be matched if the target JWE message's Key ID and the Key ID
+ in the given key matches.
+ - ident: Pretty
+ interface: WithJSONSuboption
+ argument_type: bool
+ comment: |
+ WithPretty specifies whether the JSON output should be formatted and
+ indented
+ - ident: MergeProtectedHeaders
+ interface: EncryptOption
+ argument_type: bool
+ comment: |
+ WithMergeProtectedHeaders specify that when given multiple headers
+ as options to `jwe.Encrypt`, these headers should be merged instead
+ of overwritten
+ - ident: FS
+ interface: ReadFileOption
+ argument_type: fs.FS
+ comment: |
+ WithFS specifies the source `fs.FS` object to read the file from.
+ - ident: KeyUsed
+ interface: DecryptOption
+ argument_type: 'any'
+ comment: |
+ WithKeyUsed allows you to specify the `jwe.Decrypt()` function to
+ return the key used for decryption. This may be useful when
+ you specify multiple key sources or if you pass a `jwk.Set`
+ and you want to know which key was successful at decrypting the
+ CEK.
+
+ `v` must be a pointer to an empty `any`. Do not use
+ `jwk.Key` here unless you are 100% sure that all keys that you
+ have provided are instances of `jwk.Key` (remember that the
+ jwx API allows users to specify a raw key such as *rsa.PublicKey)
+ - ident: CEK
+ interface: DecryptOption
+ argument_type: '*[]byte'
+ comment: |
+ WithCEK allows users to specify a variable to store the CEK used in the
+ message upon successful decryption. The variable must be a pointer to
+ a byte slice, and it will only be populated if the decryption is successful.
+
+ This option is currently considered EXPERIMENTAL, and is subject to
+ future changes across minor/micro versions.
+ - ident: MaxPBES2Count
+ interface: GlobalOption
+ argument_type: int
+ comment: |
+ WithMaxPBES2Count specifies the maximum number of PBES2 iterations
+ to use when decrypting a message. If not specified, the default
+ value of 10,000 is used.
+
+ This option has a global effect.
+ - ident: MaxDecompressBufferSize
+ interface: GlobalDecryptOption
+ argument_type: int64
+ comment: |
+ WithMaxDecompressBufferSize specifies the maximum buffer size for used when
+ decompressing the payload of a JWE message. If a compressed JWE payload
+ exceeds this amount when decompressed, jwe.Decrypt will return an error.
+ The default value is 10MB.
+
+ This option can be used for `jwe.Settings()`, which changes the behavior
+ globally, or for `jwe.Decrypt()`, which changes the behavior for that
+ specific call.
+ - ident: CBCBufferSize
+ interface: GlobalOption
+ argument_type: int64
+ comment: |
+ WithCBCBufferSize specifies the maximum buffer size for internal
+ calculations, such as when AES-CBC is performed. The default value is 256MB.
+ If set to an invalid value, the default value is used.
+ In v2, this option was called MaxBufferSize.
+
+ This option has a global effect.
+ - ident: LegacyHeaderMerging
+ interface: EncryptOption
+ argument_type: bool
+ option_name: WithLegacyHeaderMerging
+ comment: |
+ WithLegacyHeaderMerging specifies whether to perform legacy header merging
+ when encrypting a JWE message in JSON serialization, when there is a single recipient.
+ This behavior is enabled by default for backwards compatibility.
+
+ When a JWE message is encrypted in JSON serialization, and there is only
+ one recipient, this library automatically serializes the message in
+ flattened JSON serialization format. In older versions of this library,
+ the protected headers and the per-recipient headers were merged together
+ before computing the AAD (Additional Authenticated Data), but the per-recipient
+ headers were kept as-is in the `header` field of the recipient object.
+
+ This behavior is not compliant with the JWE specification, which states that
+ the headers must be disjoint.
+
+ Passing this option with a value of `false` disables this legacy behavior,
+ and while the per-recipient headers and protected headers are still merged
+ for the purpose of computing AAD, the per-recipient headers are cleared
+ after merging, so that the resulting JWE message is compliant with the
+ specification.
+
+ This option has no effect when there are multiple recipients, or when
+ the serialization format is compact serialization. For multiple recipients
+ (i.e. full JSON serialization), the protected headers and per-recipient
+ headers are never merged, and it is the caller's responsibility to ensure
+ that the headers are disjoint. In compact serialization, there are no per-recipient
+ headers; in fact, the protected headers are the only headers that exist,
+ and therefore there is no possibility of header collision after merging
+ (note: while per-recipient headers do not make sense in compact serialization,
+ this library does not prevent you from setting them -- they are all just
+ merged into the protected headers).
+
+ In future versions, the new behavior will be the default. New users are
+ encouraged to set this option to `false` now to avoid future issues.
\ No newline at end of file
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwe/options_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwe/options_gen.go
new file mode 100644
index 0000000000..2d28eecb44
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwe/options_gen.go
@@ -0,0 +1,392 @@
+// Code generated by tools/cmd/genoptions/main.go. DO NOT EDIT.
+
+package jwe
+
+import (
+ "context"
+ "io/fs"
+
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/option/v2"
+)
+
+type Option = option.Interface
+
+// CompactOption describes options that can be passed to `jwe.Compact`
+type CompactOption interface {
+ Option
+ compactOption()
+}
+
+type compactOption struct {
+ Option
+}
+
+func (*compactOption) compactOption() {}
+
+// DecryptOption describes options that can be passed to `jwe.Decrypt`
+type DecryptOption interface {
+ Option
+ decryptOption()
+}
+
+type decryptOption struct {
+ Option
+}
+
+func (*decryptOption) decryptOption() {}
+
+// EncryptDecryptOption describes options that can be passed to either `jwe.Encrypt` or `jwe.Decrypt`
+type EncryptDecryptOption interface {
+ Option
+ encryptOption()
+ decryptOption()
+}
+
+type encryptDecryptOption struct {
+ Option
+}
+
+func (*encryptDecryptOption) encryptOption() {}
+
+func (*encryptDecryptOption) decryptOption() {}
+
+// EncryptOption describes options that can be passed to `jwe.Encrypt`
+type EncryptOption interface {
+ Option
+ encryptOption()
+}
+
+type encryptOption struct {
+ Option
+}
+
+func (*encryptOption) encryptOption() {}
+
+// GlobalDecryptOption describes options that changes global settings and for each call of the `jwe.Decrypt` function
+type GlobalDecryptOption interface {
+ Option
+ globalOption()
+ decryptOption()
+}
+
+type globalDecryptOption struct {
+ Option
+}
+
+func (*globalDecryptOption) globalOption() {}
+
+func (*globalDecryptOption) decryptOption() {}
+
+// GlobalOption describes options that changes global settings for this package
+type GlobalOption interface {
+ Option
+ globalOption()
+}
+
+type globalOption struct {
+ Option
+}
+
+func (*globalOption) globalOption() {}
+
+// ReadFileOption is a type of `Option` that can be passed to `jwe.Parse`
+type ParseOption interface {
+ Option
+ readFileOption()
+}
+
+type parseOption struct {
+ Option
+}
+
+func (*parseOption) readFileOption() {}
+
+// ReadFileOption is a type of `Option` that can be passed to `jwe.ReadFile`
+type ReadFileOption interface {
+ Option
+ readFileOption()
+}
+
+type readFileOption struct {
+ Option
+}
+
+func (*readFileOption) readFileOption() {}
+
+// JSONSuboption describes suboptions that can be passed to `jwe.WithJSON()` option
+type WithJSONSuboption interface {
+ Option
+ withJSONSuboption()
+}
+
+type withJSONSuboption struct {
+ Option
+}
+
+func (*withJSONSuboption) withJSONSuboption() {}
+
+// WithKeySetSuboption is a suboption passed to the WithKeySet() option
+type WithKeySetSuboption interface {
+ Option
+ withKeySetSuboption()
+}
+
+type withKeySetSuboption struct {
+ Option
+}
+
+func (*withKeySetSuboption) withKeySetSuboption() {}
+
+type identCBCBufferSize struct{}
+type identCEK struct{}
+type identCompress struct{}
+type identContentEncryptionAlgorithm struct{}
+type identContext struct{}
+type identFS struct{}
+type identKey struct{}
+type identKeyProvider struct{}
+type identKeyUsed struct{}
+type identLegacyHeaderMerging struct{}
+type identMaxDecompressBufferSize struct{}
+type identMaxPBES2Count struct{}
+type identMergeProtectedHeaders struct{}
+type identMessage struct{}
+type identPerRecipientHeaders struct{}
+type identPretty struct{}
+type identProtectedHeaders struct{}
+type identRequireKid struct{}
+type identSerialization struct{}
+
+func (identCBCBufferSize) String() string {
+ return "WithCBCBufferSize"
+}
+
+func (identCEK) String() string {
+ return "WithCEK"
+}
+
+func (identCompress) String() string {
+ return "WithCompress"
+}
+
+func (identContentEncryptionAlgorithm) String() string {
+ return "WithContentEncryption"
+}
+
+func (identContext) String() string {
+ return "WithContext"
+}
+
+func (identFS) String() string {
+ return "WithFS"
+}
+
+func (identKey) String() string {
+ return "WithKey"
+}
+
+func (identKeyProvider) String() string {
+ return "WithKeyProvider"
+}
+
+func (identKeyUsed) String() string {
+ return "WithKeyUsed"
+}
+
+func (identLegacyHeaderMerging) String() string {
+ return "WithLegacyHeaderMerging"
+}
+
+func (identMaxDecompressBufferSize) String() string {
+ return "WithMaxDecompressBufferSize"
+}
+
+func (identMaxPBES2Count) String() string {
+ return "WithMaxPBES2Count"
+}
+
+func (identMergeProtectedHeaders) String() string {
+ return "WithMergeProtectedHeaders"
+}
+
+func (identMessage) String() string {
+ return "WithMessage"
+}
+
+func (identPerRecipientHeaders) String() string {
+ return "WithPerRecipientHeaders"
+}
+
+func (identPretty) String() string {
+ return "WithPretty"
+}
+
+func (identProtectedHeaders) String() string {
+ return "WithProtectedHeaders"
+}
+
+func (identRequireKid) String() string {
+ return "WithRequireKid"
+}
+
+func (identSerialization) String() string {
+ return "WithSerialization"
+}
+
+// WithCBCBufferSize specifies the maximum buffer size for internal
+// calculations, such as when AES-CBC is performed. The default value is 256MB.
+// If set to an invalid value, the default value is used.
+// In v2, this option was called MaxBufferSize.
+//
+// This option has a global effect.
+func WithCBCBufferSize(v int64) GlobalOption {
+ return &globalOption{option.New(identCBCBufferSize{}, v)}
+}
+
+// WithCEK allows users to specify a variable to store the CEK used in the
+// message upon successful decryption. The variable must be a pointer to
+// a byte slice, and it will only be populated if the decryption is successful.
+//
+// This option is currently considered EXPERIMENTAL, and is subject to
+// future changes across minor/micro versions.
+func WithCEK(v *[]byte) DecryptOption {
+ return &decryptOption{option.New(identCEK{}, v)}
+}
+
+// WithCompress specifies the compression algorithm to use when encrypting
+// a payload using `jwe.Encrypt` (Yes, we know it can only be "" or "DEF",
+// but the way the specification is written it could allow for more options,
+// and therefore this option takes an argument)
+func WithCompress(v jwa.CompressionAlgorithm) EncryptOption {
+ return &encryptOption{option.New(identCompress{}, v)}
+}
+
+// WithContentEncryptionAlgorithm specifies the algorithm to encrypt the
+// JWE message content with. If not provided, `jwa.A256GCM` is used.
+func WithContentEncryption(v jwa.ContentEncryptionAlgorithm) EncryptOption {
+ return &encryptOption{option.New(identContentEncryptionAlgorithm{}, v)}
+}
+
+// WithContext specifies the context.Context object to use when decrypting a JWE message.
+// If not provided, context.Background() will be used.
+func WithContext(v context.Context) DecryptOption {
+ return &decryptOption{option.New(identContext{}, v)}
+}
+
+// WithFS specifies the source `fs.FS` object to read the file from.
+func WithFS(v fs.FS) ReadFileOption {
+ return &readFileOption{option.New(identFS{}, v)}
+}
+
+func WithKeyProvider(v KeyProvider) DecryptOption {
+ return &decryptOption{option.New(identKeyProvider{}, v)}
+}
+
+// WithKeyUsed allows you to specify the `jwe.Decrypt()` function to
+// return the key used for decryption. This may be useful when
+// you specify multiple key sources or if you pass a `jwk.Set`
+// and you want to know which key was successful at decrypting the
+// CEK.
+//
+// `v` must be a pointer to an empty `any`. Do not use
+// `jwk.Key` here unless you are 100% sure that all keys that you
+// have provided are instances of `jwk.Key` (remember that the
+// jwx API allows users to specify a raw key such as *rsa.PublicKey)
+func WithKeyUsed(v any) DecryptOption {
+ return &decryptOption{option.New(identKeyUsed{}, v)}
+}
+
+// WithLegacyHeaderMerging specifies whether to perform legacy header merging
+// when encrypting a JWE message in JSON serialization, when there is a single recipient.
+// This behavior is enabled by default for backwards compatibility.
+//
+// When a JWE message is encrypted in JSON serialization, and there is only
+// one recipient, this library automatically serializes the message in
+// flattened JSON serialization format. In older versions of this library,
+// the protected headers and the per-recipient headers were merged together
+// before computing the AAD (Additional Authenticated Data), but the per-recipient
+// headers were kept as-is in the `header` field of the recipient object.
+//
+// This behavior is not compliant with the JWE specification, which states that
+// the headers must be disjoint.
+//
+// Passing this option with a value of `false` disables this legacy behavior,
+// and while the per-recipient headers and protected headers are still merged
+// for the purpose of computing AAD, the per-recipient headers are cleared
+// after merging, so that the resulting JWE message is compliant with the
+// specification.
+//
+// This option has no effect when there are multiple recipients, or when
+// the serialization format is compact serialization. For multiple recipients
+// (i.e. full JSON serialization), the protected headers and per-recipient
+// headers are never merged, and it is the caller's responsibility to ensure
+// that the headers are disjoint. In compact serialization, there are no per-recipient
+// headers; in fact, the protected headers are the only headers that exist,
+// and therefore there is no possibility of header collision after merging
+// (note: while per-recipient headers do not make sense in compact serialization,
+// this library does not prevent you from setting them -- they are all just
+// merged into the protected headers).
+//
+// In future versions, the new behavior will be the default. New users are
+// encouraged to set this option to `false` now to avoid future issues.
+func WithLegacyHeaderMerging(v bool) EncryptOption {
+ return &encryptOption{option.New(identLegacyHeaderMerging{}, v)}
+}
+
+// WithMaxDecompressBufferSize specifies the maximum buffer size for used when
+// decompressing the payload of a JWE message. If a compressed JWE payload
+// exceeds this amount when decompressed, jwe.Decrypt will return an error.
+// The default value is 10MB.
+//
+// This option can be used for `jwe.Settings()`, which changes the behavior
+// globally, or for `jwe.Decrypt()`, which changes the behavior for that
+// specific call.
+func WithMaxDecompressBufferSize(v int64) GlobalDecryptOption {
+ return &globalDecryptOption{option.New(identMaxDecompressBufferSize{}, v)}
+}
+
+// WithMaxPBES2Count specifies the maximum number of PBES2 iterations
+// to use when decrypting a message. If not specified, the default
+// value of 10,000 is used.
+//
+// This option has a global effect.
+func WithMaxPBES2Count(v int) GlobalOption {
+ return &globalOption{option.New(identMaxPBES2Count{}, v)}
+}
+
+// WithMergeProtectedHeaders specify that when given multiple headers
+// as options to `jwe.Encrypt`, these headers should be merged instead
+// of overwritten
+func WithMergeProtectedHeaders(v bool) EncryptOption {
+ return &encryptOption{option.New(identMergeProtectedHeaders{}, v)}
+}
+
+// WithMessage provides a message object to be populated by `jwe.Decrypt`
+// Using this option allows you to decrypt AND obtain the `jwe.Message`
+// in one go.
+func WithMessage(v *Message) DecryptOption {
+ return &decryptOption{option.New(identMessage{}, v)}
+}
+
+// WithPretty specifies whether the JSON output should be formatted and
+// indented
+func WithPretty(v bool) WithJSONSuboption {
+ return &withJSONSuboption{option.New(identPretty{}, v)}
+}
+
+// WithRequiredKid specifies whether the keys in the jwk.Set should
+// only be matched if the target JWE message's Key ID and the Key ID
+// in the given key matches.
+func WithRequireKid(v bool) WithKeySetSuboption {
+ return &withKeySetSuboption{option.New(identRequireKid{}, v)}
+}
+
+// WithCompact specifies that the result of `jwe.Encrypt()` is serialized in
+// compact format.
+//
+// By default `jwe.Encrypt()` will opt to use compact format, so you usually
+// do not need to specify this option other than to be explicit about it
+func WithCompact() EncryptOption {
+ return &encryptOption{option.New(identSerialization{}, fmtCompact)}
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jwk/BUILD.bazel
new file mode 100644
index 0000000000..8e82e1f009
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/BUILD.bazel
@@ -0,0 +1,87 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "jwk",
+ srcs = [
+ "cache.go",
+ "convert.go",
+ "ecdsa.go",
+ "ecdsa_gen.go",
+ "errors.go",
+ "fetch.go",
+ "filter.go",
+ "interface.go",
+ "interface_gen.go",
+ "io.go",
+ "jwk.go",
+ "key_ops.go",
+ "okp.go",
+ "okp_gen.go",
+ "options.go",
+ "options_gen.go",
+ "parser.go",
+ "rsa.go",
+ "rsa_gen.go",
+ "set.go",
+ "symmetric.go",
+ "symmetric_gen.go",
+ "usage.go",
+ "whitelist.go",
+ "x509.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/jwk",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//cert",
+ "//internal/base64",
+ "//internal/ecutil",
+ "//transform",
+ "//internal/json",
+ "//internal/pool",
+ "//internal/tokens",
+ "//jwa",
+ "//jwk/ecdsa",
+ "//jwk/jwkbb",
+ "@com_github_lestrrat_go_blackmagic//:blackmagic",
+ "@com_github_lestrrat_go_httprc_v3//:httprc",
+ "@com_github_lestrrat_go_option_v2//:option",
+ ],
+)
+
+go_test(
+ name = "jwk_test",
+ srcs = [
+ "filter_test.go",
+ "headers_test.go",
+ "jwk_internal_test.go",
+ "jwk_test.go",
+ "options_gen_test.go",
+ "refresh_test.go",
+ "set_test.go",
+ "x5c_test.go",
+ ],
+ data = glob(["testdata/**"]),
+ embed = [":jwk"],
+ deps = [
+ "//cert",
+ "//internal/base64",
+ "//internal/jose",
+ "//internal/json",
+ "//internal/jwxtest",
+ "//internal/tokens",
+ "//jwa",
+ "//jwk/ecdsa",
+ "//jws",
+ "@com_github_lestrrat_go_blackmagic//:blackmagic",
+ "@com_github_lestrrat_go_httprc_v3//:httprc",
+ "@com_github_lestrrat_go_httprc_v3//tracesink",
+ "@com_github_stretchr_testify//assert",
+ "@com_github_stretchr_testify//require",
+ ],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":jwk",
+ visibility = ["//visibility:public"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/README.md b/vendor/github.com/lestrrat-go/jwx/v3/jwk/README.md
new file mode 100644
index 0000000000..741dd4647d
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/README.md
@@ -0,0 +1,215 @@
+# JWK [](https://pkg.go.dev/github.com/lestrrat-go/jwx/v3/jwk)
+
+Package jwk implements JWK as described in [RFC7517](https://tools.ietf.org/html/rfc7517).
+If you are looking to use JWT wit JWKs, look no further than [github.com/lestrrat-go/jwx](../jwt).
+
+* Parse and work with RSA/EC/Symmetric/OKP JWK types
+ * Convert to and from JSON
+ * Convert to and from raw key types (e.g. *rsa.PrivateKey)
+* Ability to keep a JWKS fresh using *jwk.AutoRefresh
+
+## Supported key types:
+
+| kty | Curve | Go Key Type |
+|:----|:------------------------|:----------------------------------------------|
+| RSA | N/A | rsa.PrivateKey / rsa.PublicKey (2) |
+| EC | P-256
P-384
P-521
secp256k1 (1) | ecdsa.PrivateKey / ecdsa.PublicKey (2) |
+| oct | N/A | []byte |
+| OKP | Ed25519 (1) | ed25519.PrivateKey / ed25519.PublicKey (2) |
+| | X25519 (1) | (jwx/)x25519.PrivateKey / x25519.PublicKey (2)|
+
+* Note 1: Experimental
+* Note 2: Either value or pointers accepted (e.g. rsa.PrivateKey or *rsa.PrivateKey)
+
+# Documentation
+
+Please read the [API reference](https://pkg.go.dev/github.com/lestrrat-go/jwx/v3/jwk), or
+the how-to style documentation on how to use JWK can be found in the [docs directory](../docs/04-jwk.md).
+
+# Auto-Refresh a key during a long-running process
+
+
+```go
+package examples_test
+
+import (
+ "context"
+ "fmt"
+ "time"
+
+ "github.com/lestrrat-go/httprc/v3"
+ "github.com/lestrrat-go/jwx/v3/jwk"
+)
+
+func Example_jwk_cache() {
+ ctx, cancel := context.WithCancel(context.Background())
+ defer cancel()
+
+ const googleCerts = `https://www.googleapis.com/oauth2/v3/certs`
+
+ // First, set up the `jwk.Cache` object. You need to pass it a
+ // `context.Context` object to control the lifecycle of the background fetching goroutine.
+ c, err := jwk.NewCache(ctx, httprc.NewClient())
+ if err != nil {
+ fmt.Printf("failed to create cache: %s\n", err)
+ return
+ }
+
+ // Tell *jwk.Cache that we only want to refresh this JWKS periodically.
+ if err := c.Register(ctx, googleCerts); err != nil {
+ fmt.Printf("failed to register google JWKS: %s\n", err)
+ return
+ }
+
+ // Pretend that this is your program's main loop
+MAIN:
+ for {
+ select {
+ case <-ctx.Done():
+ break MAIN
+ default:
+ }
+ keyset, err := c.Lookup(ctx, googleCerts)
+ if err != nil {
+ fmt.Printf("failed to fetch google JWKS: %s\n", err)
+ return
+ }
+ _ = keyset
+ // The returned `keyset` will always be "reasonably" new.
+ //
+ // By "reasonably" we mean that we cannot guarantee that the keys will be refreshed
+ // immediately after it has been rotated in the remote source. But it should be close\
+ // enough, and should you need to forcefully refresh the token using the `(jwk.Cache).Refresh()` method.
+ //
+ // If refetching the keyset fails, a cached version will be returned from the previous
+ // successful sync
+
+ // Do interesting stuff with the keyset... but here, we just
+ // sleep for a bit
+ time.Sleep(time.Second)
+
+ // Because we're a dummy program, we just cancel the loop now.
+ // If this were a real program, you presumably loop forever
+ cancel()
+ }
+ // OUTPUT:
+}
+```
+source: [examples/jwk_cache_example_test.go](https://github.com/lestrrat-go/jwx/blob/v3/examples/jwk_cache_example_test.go)
+
+
+Parse and use a JWK key:
+
+
+```go
+package examples_test
+
+import (
+ "context"
+ "fmt"
+ "log"
+
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/jwk"
+)
+
+func Example_jwk_usage() {
+ // Use jwk.Cache if you intend to keep reuse the JWKS over and over
+ set, err := jwk.Fetch(context.Background(), "https://www.googleapis.com/oauth2/v3/certs")
+ if err != nil {
+ log.Printf("failed to parse JWK: %s", err)
+ return
+ }
+
+ // Key sets can be serialized back to JSON
+ {
+ jsonbuf, err := json.Marshal(set)
+ if err != nil {
+ log.Printf("failed to marshal key set into JSON: %s", err)
+ return
+ }
+ log.Printf("%s", jsonbuf)
+ }
+
+ for i := 0; i < set.Len(); i++ {
+ var rawkey any // This is where we would like to store the raw key, like *rsa.PrivateKey or *ecdsa.PrivateKey
+ key, ok := set.Key(i) // This retrieves the corresponding jwk.Key
+ if !ok {
+ log.Printf("failed to get key at index %d", i)
+ return
+ }
+
+ // jws and jwe operations can be performed using jwk.Key, but you could also
+ // covert it to their "raw" forms, such as *rsa.PrivateKey or *ecdsa.PrivateKey
+ if err := jwk.Export(key, &rawkey); err != nil {
+ log.Printf("failed to create public key: %s", err)
+ return
+ }
+ _ = rawkey
+
+ // You can create jwk.Key from a raw key, too
+ fromRawKey, err := jwk.Import(rawkey)
+ if err != nil {
+ log.Printf("failed to acquire raw key from jwk.Key: %s", err)
+ return
+ }
+
+ // Keys can be serialized back to JSON
+ jsonbuf, err := json.Marshal(key)
+ if err != nil {
+ log.Printf("failed to marshal key into JSON: %s", err)
+ return
+ }
+
+ fromJSONKey, err := jwk.Parse(jsonbuf)
+ if err != nil {
+ log.Printf("failed to parse json: %s", err)
+ return
+ }
+ _ = fromJSONKey
+ _ = fromRawKey
+ }
+ // OUTPUT:
+}
+
+//nolint:govet
+func Example_jwk_marshal_json() {
+ // JWKs that inherently involve randomness such as RSA and EC keys are
+ // not used in this example, because they may produce different results
+ // depending on the environment.
+ //
+ // (In fact, even if you use a static source of randomness, tests may fail
+ // because of internal changes in the Go runtime).
+
+ raw := []byte("01234567890123456789012345678901234567890123456789ABCDEF")
+
+ // This would create a symmetric key
+ key, err := jwk.Import(raw)
+ if err != nil {
+ fmt.Printf("failed to create symmetric key: %s\n", err)
+ return
+ }
+ if _, ok := key.(jwk.SymmetricKey); !ok {
+ fmt.Printf("expected jwk.SymmetricKey, got %T\n", key)
+ return
+ }
+
+ key.Set(jwk.KeyIDKey, "mykey")
+
+ buf, err := json.MarshalIndent(key, "", " ")
+ if err != nil {
+ fmt.Printf("failed to marshal key into JSON: %s\n", err)
+ return
+ }
+ fmt.Printf("%s\n", buf)
+
+ // OUTPUT:
+ // {
+ // "k": "MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODlBQkNERUY",
+ // "kid": "mykey",
+ // "kty": "oct"
+ // }
+}
+```
+source: [examples/jwk_example_test.go](https://github.com/lestrrat-go/jwx/blob/v3/examples/jwk_example_test.go)
+
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/cache.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/cache.go
new file mode 100644
index 0000000000..6d5b00f056
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/cache.go
@@ -0,0 +1,362 @@
+package jwk
+
+import (
+ "context"
+ "fmt"
+ "io"
+ "net/http"
+
+ "github.com/lestrrat-go/httprc/v3"
+)
+
+type HTTPClient = httprc.HTTPClient
+type ErrorSink = httprc.ErrorSink
+type TraceSink = httprc.TraceSink
+
+// Cache is a container built on top of github.com/lestrrat-go/httprc/v3
+// that keeps track of Set object by their source URLs.
+// The Set objects are stored in memory, and are refreshed automatically
+// behind the scenes.
+//
+// Before retrieving the Set objects, the user must pre-register the
+// URLs they intend to use by calling `Register()`
+//
+// c := jwk.NewCache(ctx, httprc.NewClient())
+// c.Register(ctx, url, options...)
+//
+// Once registered, you can call `Get()` to retrieve the Set object.
+//
+// All JWKS objects that are retrieved via this mechanism should be
+// treated read-only, as they are shared among all consumers, as well
+// as the `jwk.Cache` object.
+//
+// There are cases where `jwk.Cache` and `jwk.CachedSet` should and
+// should not be used.
+//
+// First and foremost, do NOT use a cache for those JWKS objects that
+// need constant checking. For example, unreliable or user-provided JWKS (i.e. those
+// JWKS that are not from a well-known provider) should not be fetched
+// through a `jwk.Cache` or `jwk.CachedSet`.
+//
+// For example, if you have a flaky JWKS server for development
+// that can go down often, you should consider alternatives such as
+// providing `http.Client` with a caching `http.RoundTripper` configured
+// (see `jwk.WithHTTPClient`), setting up a reverse proxy, etc.
+// These techniques allow you to set up a more robust way to both cache
+// and report precise causes of the problems than using `jwk.Cache` or
+// `jwk.CachedSet`. If you handle the caching at the HTTP level like this,
+// you will be able to use a simple `jwk.Fetch` call and not worry about the cache.
+//
+// User-provided JWKS objects may also be problematic, as it may go down
+// unexpectedly (and frequently!), and it will be hard to detect when
+// the URLs or its contents are swapped.
+//
+// A good use-case for `jwk.Cache` and `jwk.CachedSet` are for "stable"
+// JWKS objects.
+//
+// When we say "stable", we are thinking of JWKS that should mostly be
+// ALWAYS available. A good example are those JWKS objects provided by
+// major cloud providers such as Google Cloud, AWS, or Azure.
+// Stable JWKS may still experience intermittent network connectivity problems,
+// but you can expect that they will eventually recover in relatively
+// short period of time. They rarely change URLs, and the contents are
+// expected to be valid or otherwise it would cause havoc to those providers
+//
+// We also know that these stable JWKS objects are rotated periodically,
+// which is a perfect use for `jwk.Cache` and `jwk.CachedSet`. The caches
+// can be configured to periodically refresh the JWKS thereby keeping them
+// fresh without extra intervention from the developer.
+//
+// Notice that for these recommended use-cases the requirement to check
+// the validity or the availability of the JWKS objects are non-existent,
+// as it is expected that they will be available and will be valid. The
+// caching mechanism can hide intermittent connectivity problems as well
+// as keep the objects mostly fresh.
+type Cache struct {
+ ctrl httprc.Controller
+}
+
+// Transformer is a specialized version of `httprc.Transformer` that implements
+// conversion from a `http.Response` object to a `jwk.Set` object. Use this in
+// conjection with `httprc.NewResource` to create a `httprc.Resource` object
+// to auto-update `jwk.Set` objects.
+type Transformer struct {
+ parseOptions []ParseOption
+}
+
+func (t Transformer) Transform(_ context.Context, res *http.Response) (Set, error) {
+ buf, err := io.ReadAll(res.Body)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to read response body status: %w`, err)
+ }
+
+ set, err := Parse(buf, t.parseOptions...)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to parse JWK set at %q: %w`, res.Request.URL.String(), err)
+ }
+
+ return set, nil
+}
+
+// NewCache creates a new `jwk.Cache` object.
+//
+// Under the hood, `jwk.Cache` uses `httprc.Client` manage the
+// fetching and caching of JWKS objects, and thus spawns multiple goroutines
+// per `jwk.Cache` object.
+//
+// The provided `httprc.Client` object must NOT be started prior to
+// passing it to `jwk.NewCache`. The `jwk.Cache` object will start
+// the `httprc.Client` object on its own.
+func NewCache(ctx context.Context, client *httprc.Client) (*Cache, error) {
+ ctrl, err := client.Start(ctx)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to start httprc.Client: %w`, err)
+ }
+
+ return &Cache{
+ ctrl: ctrl,
+ }, nil
+}
+
+// Register registers a URL to be managed by the cache. URLs must
+// be registered before issuing `Get`
+//
+// The `Register` method is a thin wrapper around `(httprc.Controller).Add`
+func (c *Cache) Register(ctx context.Context, u string, options ...RegisterOption) error {
+ var parseOptions []ParseOption
+ var resourceOptions []httprc.NewResourceOption
+ waitReady := true
+ for _, option := range options {
+ switch option := option.(type) {
+ case ParseOption:
+ parseOptions = append(parseOptions, option)
+ case ResourceOption:
+ var v httprc.NewResourceOption
+ if err := option.Value(&v); err != nil {
+ return fmt.Errorf(`failed to retrieve NewResourceOption option value: %w`, err)
+ }
+ resourceOptions = append(resourceOptions, v)
+ default:
+ switch option.Ident() {
+ case identHTTPClient{}:
+ var cli HTTPClient
+ if err := option.Value(&cli); err != nil {
+ return fmt.Errorf(`failed to retrieve HTTPClient option value: %w`, err)
+ }
+ resourceOptions = append(resourceOptions, httprc.WithHTTPClient(cli))
+ case identWaitReady{}:
+ if err := option.Value(&waitReady); err != nil {
+ return fmt.Errorf(`failed to retrieve WaitReady option value: %w`, err)
+ }
+ }
+ }
+ }
+
+ r, err := httprc.NewResource[Set](u, &Transformer{
+ parseOptions: parseOptions,
+ }, resourceOptions...)
+ if err != nil {
+ return fmt.Errorf(`failed to create httprc.Resource: %w`, err)
+ }
+ if err := c.ctrl.Add(ctx, r, httprc.WithWaitReady(waitReady)); err != nil {
+ return fmt.Errorf(`failed to add resource to httprc.Client: %w`, err)
+ }
+
+ return nil
+}
+
+// LookupResource returns the `httprc.Resource` object associated with the
+// given URL `u`. If the URL has not been registered, an error is returned.
+func (c *Cache) LookupResource(ctx context.Context, u string) (*httprc.ResourceBase[Set], error) {
+ r, err := c.ctrl.Lookup(ctx, u)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to lookup resource %q: %w`, u, err)
+ }
+ //nolint:forcetypeassert
+ return r.(*httprc.ResourceBase[Set]), nil
+}
+
+func (c *Cache) Lookup(ctx context.Context, u string) (Set, error) {
+ r, err := c.LookupResource(ctx, u)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to lookup resource %q: %w`, u, err)
+ }
+ set := r.Resource()
+ if set == nil {
+ return nil, fmt.Errorf(`resource %q is not ready`, u)
+ }
+ return set, nil
+}
+
+func (c *Cache) Ready(ctx context.Context, u string) bool {
+ r, err := c.LookupResource(ctx, u)
+ if err != nil {
+ return false
+ }
+ if err := r.Ready(ctx); err != nil {
+ return false
+ }
+ return true
+}
+
+// Refresh is identical to Get(), except it always fetches the
+// specified resource anew, and updates the cached content
+//
+// Please refer to the documentation for `(httprc.Cache).Refresh` for
+// more details
+func (c *Cache) Refresh(ctx context.Context, u string) (Set, error) {
+ if err := c.ctrl.Refresh(ctx, u); err != nil {
+ return nil, fmt.Errorf(`failed to refresh resource %q: %w`, u, err)
+ }
+ return c.Lookup(ctx, u)
+}
+
+// IsRegistered returns true if the given URL `u` has already been registered
+// in the cache.
+func (c *Cache) IsRegistered(ctx context.Context, u string) bool {
+ _, err := c.LookupResource(ctx, u)
+ return err == nil
+}
+
+// Unregister removes the given URL `u` from the cache.
+func (c *Cache) Unregister(ctx context.Context, u string) error {
+ return c.ctrl.Remove(ctx, u)
+}
+
+func (c *Cache) Shutdown(ctx context.Context) error {
+ return c.ctrl.ShutdownContext(ctx)
+}
+
+// CachedSet is a thin shim over jwk.Cache that allows the user to cloak
+// jwk.Cache as if it's a `jwk.Set`. Behind the scenes, the `jwk.Set` is
+// retrieved from the `jwk.Cache` for every operation.
+//
+// Since `jwk.CachedSet` always deals with a cached version of the `jwk.Set`,
+// all operations that mutate the object (such as AddKey(), RemoveKey(), et. al)
+// are no-ops and return an error.
+//
+// Note that since this is a utility shim over `jwk.Cache`, you _will_ lose
+// the ability to control the finer details (such as controlling how long to
+// wait for in case of a fetch failure using `context.Context`)
+//
+// Make sure that you read the documentation for `jwk.Cache` as well.
+type CachedSet interface {
+ Set
+ cached() (Set, error) // used as a marker
+}
+
+type cachedSet struct {
+ r *httprc.ResourceBase[Set]
+}
+
+func (c *Cache) CachedSet(u string) (CachedSet, error) {
+ r, err := c.LookupResource(context.Background(), u)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to lookup resource %q: %w`, u, err)
+ }
+ return NewCachedSet(r), nil
+}
+
+func NewCachedSet(r *httprc.ResourceBase[Set]) CachedSet {
+ return &cachedSet{
+ r: r,
+ }
+}
+
+func (cs *cachedSet) cached() (Set, error) {
+ if err := cs.r.Ready(context.Background()); err != nil {
+ return nil, fmt.Errorf(`failed to fetch resource: %w`, err)
+ }
+ return cs.r.Resource(), nil
+}
+
+// AddKey is a no-op for `jwk.CachedSet`, as the `jwk.Set` should be treated read-only
+func (*cachedSet) AddKey(_ Key) error {
+ return fmt.Errorf(`(jwk.Cachedset).AddKey: jwk.CachedSet is immutable`)
+}
+
+// Clear is a no-op for `jwk.CachedSet`, as the `jwk.Set` should be treated read-only
+func (*cachedSet) Clear() error {
+ return fmt.Errorf(`(jwk.cachedSet).Clear: jwk.CachedSet is immutable`)
+}
+
+// Set is a no-op for `jwk.CachedSet`, as the `jwk.Set` should be treated read-only
+func (*cachedSet) Set(_ string, _ any) error {
+ return fmt.Errorf(`(jwk.cachedSet).Set: jwk.CachedSet is immutable`)
+}
+
+// Remove is a no-op for `jwk.CachedSet`, as the `jwk.Set` should be treated read-only
+func (*cachedSet) Remove(_ string) error {
+ // TODO: Remove() should be renamed to Remove(string) error
+ return fmt.Errorf(`(jwk.cachedSet).Remove: jwk.CachedSet is immutable`)
+}
+
+// RemoveKey is a no-op for `jwk.CachedSet`, as the `jwk.Set` should be treated read-only
+func (*cachedSet) RemoveKey(_ Key) error {
+ return fmt.Errorf(`(jwk.cachedSet).RemoveKey: jwk.CachedSet is immutable`)
+}
+
+func (cs *cachedSet) Clone() (Set, error) {
+ set, err := cs.cached()
+ if err != nil {
+ return nil, fmt.Errorf(`failed to get cached jwk.Set: %w`, err)
+ }
+
+ return set.Clone()
+}
+
+// Get returns the value of non-Key field stored in the jwk.Set
+func (cs *cachedSet) Get(name string, dst any) error {
+ set, err := cs.cached()
+ if err != nil {
+ return err
+ }
+
+ return set.Get(name, dst)
+}
+
+// Key returns the Key at the specified index
+func (cs *cachedSet) Key(idx int) (Key, bool) {
+ set, err := cs.cached()
+ if err != nil {
+ return nil, false
+ }
+
+ return set.Key(idx)
+}
+
+func (cs *cachedSet) Index(key Key) int {
+ set, err := cs.cached()
+ if err != nil {
+ return -1
+ }
+
+ return set.Index(key)
+}
+
+func (cs *cachedSet) Keys() []string {
+ set, err := cs.cached()
+ if err != nil {
+ return nil
+ }
+
+ return set.Keys()
+}
+
+func (cs *cachedSet) Len() int {
+ set, err := cs.cached()
+ if err != nil {
+ return -1
+ }
+
+ return set.Len()
+}
+
+func (cs *cachedSet) LookupKeyID(kid string) (Key, bool) {
+ set, err := cs.cached()
+ if err != nil {
+ return nil, false
+ }
+
+ return set.LookupKeyID(kid)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/convert.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/convert.go
new file mode 100644
index 0000000000..057f4b02a0
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/convert.go
@@ -0,0 +1,399 @@
+package jwk
+
+import (
+ "crypto/ecdh"
+ "crypto/ecdsa"
+ "crypto/ed25519"
+ "crypto/elliptic"
+ "crypto/rsa"
+ "errors"
+ "fmt"
+ "math/big"
+ "reflect"
+ "sync"
+
+ "github.com/lestrrat-go/blackmagic"
+ "github.com/lestrrat-go/jwx/v3/internal/ecutil"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+// # Converting between Raw Keys and `jwk.Key`s
+//
+// A converter that converts from a raw key to a `jwk.Key` is called a KeyImporter.
+// A converter that converts from a `jwk.Key` to a raw key is called a KeyExporter.
+
+var keyImporters = make(map[reflect.Type]KeyImporter)
+var keyExporters = make(map[jwa.KeyType][]KeyExporter)
+
+var muKeyImporters sync.RWMutex
+var muKeyExporters sync.RWMutex
+
+// RegisterKeyImporter registers a KeyImporter for the given raw key. When `jwk.Import()` is called,
+// the library will look up the appropriate KeyImporter for the given raw key type (via `reflect`)
+// and execute the KeyImporters in succession until either one of them succeeds, or all of them fail.
+func RegisterKeyImporter(from any, conv KeyImporter) {
+ muKeyImporters.Lock()
+ defer muKeyImporters.Unlock()
+ keyImporters[reflect.TypeOf(from)] = conv
+}
+
+// RegisterKeyExporter registers a KeyExporter for the given key type. When `key.Raw()` is called,
+// the library will look up the appropriate KeyExporter for the given key type and execute the
+// KeyExporters in succession until either one of them succeeds, or all of them fail.
+func RegisterKeyExporter(kty jwa.KeyType, conv KeyExporter) {
+ muKeyExporters.Lock()
+ defer muKeyExporters.Unlock()
+ convs, ok := keyExporters[kty]
+ if !ok {
+ convs = []KeyExporter{conv}
+ } else {
+ convs = append([]KeyExporter{conv}, convs...)
+ }
+ keyExporters[kty] = convs
+}
+
+// KeyImporter is used to convert from a raw key to a `jwk.Key`. mneumonic: from the PoV of the `jwk.Key`,
+// we're _importing_ a raw key.
+type KeyImporter interface {
+ // Import takes the raw key to be converted, and returns a `jwk.Key` or an error if the conversion fails.
+ Import(any) (Key, error)
+}
+
+// KeyImportFunc is a convenience type to implement KeyImporter as a function.
+type KeyImportFunc func(any) (Key, error)
+
+func (f KeyImportFunc) Import(raw any) (Key, error) {
+ return f(raw)
+}
+
+// KeyExporter is used to convert from a `jwk.Key` to a raw key. mneumonic: from the PoV of the `jwk.Key`,
+// we're _exporting_ it to a raw key.
+type KeyExporter interface {
+ // Export takes the `jwk.Key` to be converted, and a hint (the raw key to be converted to).
+ // The hint is the object that the user requested the result to be assigned to.
+ // The method should return the converted raw key, or an error if the conversion fails.
+ //
+ // Third party modules MUST NOT modifiy the hint object.
+ //
+ // When the user calls `key.Export(dst)`, the `dst` object is a _pointer_ to the
+ // object that the user wants the result to be assigned to, but the converter
+ // receives the _value_ that this pointer points to, to make it easier to
+ // detect the type of the result.
+ //
+ // Note that the second argument may be an `any` (which means that the
+ // user has delegated the type detection to the converter).
+ //
+ // Export must NOT modify the hint object, and should return jwk.ContinueError
+ // if the hint object is not compatible with the converter.
+ Export(Key, any) (any, error)
+}
+
+// KeyExportFunc is a convenience type to implement KeyExporter as a function.
+type KeyExportFunc func(Key, any) (any, error)
+
+func (f KeyExportFunc) Export(key Key, hint any) (any, error) {
+ return f(key, hint)
+}
+
+func init() {
+ {
+ f := KeyImportFunc(rsaPrivateKeyToJWK)
+ k := rsa.PrivateKey{}
+ RegisterKeyImporter(k, f)
+ RegisterKeyImporter(&k, f)
+ }
+ {
+ f := KeyImportFunc(rsaPublicKeyToJWK)
+ k := rsa.PublicKey{}
+ RegisterKeyImporter(k, f)
+ RegisterKeyImporter(&k, f)
+ }
+ {
+ f := KeyImportFunc(ecdsaPrivateKeyToJWK)
+ k := ecdsa.PrivateKey{}
+ RegisterKeyImporter(k, f)
+ RegisterKeyImporter(&k, f)
+ }
+ {
+ f := KeyImportFunc(ecdsaPublicKeyToJWK)
+ k := ecdsa.PublicKey{}
+ RegisterKeyImporter(k, f)
+ RegisterKeyImporter(&k, f)
+ }
+ {
+ f := KeyImportFunc(okpPrivateKeyToJWK)
+ for _, k := range []any{ed25519.PrivateKey(nil)} {
+ RegisterKeyImporter(k, f)
+ }
+ }
+ {
+ f := KeyImportFunc(ecdhPrivateKeyToJWK)
+ for _, k := range []any{ecdh.PrivateKey{}, &ecdh.PrivateKey{}} {
+ RegisterKeyImporter(k, f)
+ }
+ }
+ {
+ f := KeyImportFunc(okpPublicKeyToJWK)
+ for _, k := range []any{ed25519.PublicKey(nil)} {
+ RegisterKeyImporter(k, f)
+ }
+ }
+ {
+ f := KeyImportFunc(ecdhPublicKeyToJWK)
+ for _, k := range []any{ecdh.PublicKey{}, &ecdh.PublicKey{}} {
+ RegisterKeyImporter(k, f)
+ }
+ }
+ RegisterKeyImporter([]byte(nil), KeyImportFunc(bytesToKey))
+}
+
+func ecdhPrivateKeyToJWK(src any) (Key, error) {
+ var raw *ecdh.PrivateKey
+ switch src := src.(type) {
+ case *ecdh.PrivateKey:
+ raw = src
+ case ecdh.PrivateKey:
+ raw = &src
+ default:
+ return nil, fmt.Errorf(`cannot convert key type '%T' to ECDH jwk.Key`, src)
+ }
+
+ switch raw.Curve() {
+ case ecdh.X25519():
+ return okpPrivateKeyToJWK(raw)
+ case ecdh.P256():
+ return ecdhPrivateKeyToECJWK(raw, elliptic.P256())
+ case ecdh.P384():
+ return ecdhPrivateKeyToECJWK(raw, elliptic.P384())
+ case ecdh.P521():
+ return ecdhPrivateKeyToECJWK(raw, elliptic.P521())
+ default:
+ return nil, fmt.Errorf(`unsupported curve %s`, raw.Curve())
+ }
+}
+
+func ecdhPrivateKeyToECJWK(raw *ecdh.PrivateKey, crv elliptic.Curve) (Key, error) {
+ pub := raw.PublicKey()
+ rawpub := pub.Bytes()
+
+ size := ecutil.CalculateKeySize(crv)
+ var x, y, d big.Int
+ x.SetBytes(rawpub[1 : 1+size])
+ y.SetBytes(rawpub[1+size:])
+ d.SetBytes(raw.Bytes())
+
+ var ecdsaPriv ecdsa.PrivateKey
+ ecdsaPriv.Curve = crv
+ ecdsaPriv.D = &d
+ ecdsaPriv.X = &x
+ ecdsaPriv.Y = &y
+ return ecdsaPrivateKeyToJWK(&ecdsaPriv)
+}
+
+func ecdhPublicKeyToJWK(src any) (Key, error) {
+ var raw *ecdh.PublicKey
+ switch src := src.(type) {
+ case *ecdh.PublicKey:
+ raw = src
+ case ecdh.PublicKey:
+ raw = &src
+ default:
+ return nil, fmt.Errorf(`cannot convert key type '%T' to ECDH jwk.Key`, src)
+ }
+
+ switch raw.Curve() {
+ case ecdh.X25519():
+ return okpPublicKeyToJWK(raw)
+ case ecdh.P256():
+ return ecdhPublicKeyToECJWK(raw, elliptic.P256())
+ case ecdh.P384():
+ return ecdhPublicKeyToECJWK(raw, elliptic.P384())
+ case ecdh.P521():
+ return ecdhPublicKeyToECJWK(raw, elliptic.P521())
+ default:
+ return nil, fmt.Errorf(`unsupported curve %s`, raw.Curve())
+ }
+}
+
+func ecdhPublicKeyToECJWK(raw *ecdh.PublicKey, crv elliptic.Curve) (Key, error) {
+ rawbytes := raw.Bytes()
+ size := ecutil.CalculateKeySize(crv)
+ var x, y big.Int
+
+ x.SetBytes(rawbytes[1 : 1+size])
+ y.SetBytes(rawbytes[1+size:])
+ var ecdsaPriv ecdsa.PublicKey
+ ecdsaPriv.Curve = crv
+ ecdsaPriv.X = &x
+ ecdsaPriv.Y = &y
+ return ecdsaPublicKeyToJWK(&ecdsaPriv)
+}
+
+// These may seem a bit repetitive and redandunt, but the problem is that
+// each key type has its own Import method -- for example, Import(*ecdsa.PrivateKey)
+// vs Import(*rsa.PrivateKey), and therefore they can't just be bundled into
+// a single function.
+func rsaPrivateKeyToJWK(src any) (Key, error) {
+ var raw *rsa.PrivateKey
+ switch src := src.(type) {
+ case *rsa.PrivateKey:
+ raw = src
+ case rsa.PrivateKey:
+ raw = &src
+ default:
+ return nil, fmt.Errorf(`cannot convert key type '%T' to RSA jwk.Key`, src)
+ }
+ k := newRSAPrivateKey()
+ if err := k.Import(raw); err != nil {
+ return nil, fmt.Errorf(`failed to initialize %T from %T: %w`, k, raw, err)
+ }
+ return k, nil
+}
+
+func rsaPublicKeyToJWK(src any) (Key, error) {
+ var raw *rsa.PublicKey
+ switch src := src.(type) {
+ case *rsa.PublicKey:
+ raw = src
+ case rsa.PublicKey:
+ raw = &src
+ default:
+ return nil, fmt.Errorf(`cannot convert key type '%T' to RSA jwk.Key`, src)
+ }
+ k := newRSAPublicKey()
+ if err := k.Import(raw); err != nil {
+ return nil, fmt.Errorf(`failed to initialize %T from %T: %w`, k, raw, err)
+ }
+ return k, nil
+}
+
+func ecdsaPrivateKeyToJWK(src any) (Key, error) {
+ var raw *ecdsa.PrivateKey
+ switch src := src.(type) {
+ case *ecdsa.PrivateKey:
+ raw = src
+ case ecdsa.PrivateKey:
+ raw = &src
+ default:
+ return nil, fmt.Errorf(`cannot convert key type '%T' to ECDSA jwk.Key`, src)
+ }
+ k := newECDSAPrivateKey()
+ if err := k.Import(raw); err != nil {
+ return nil, fmt.Errorf(`failed to initialize %T from %T: %w`, k, raw, err)
+ }
+ return k, nil
+}
+
+func ecdsaPublicKeyToJWK(src any) (Key, error) {
+ var raw *ecdsa.PublicKey
+ switch src := src.(type) {
+ case *ecdsa.PublicKey:
+ raw = src
+ case ecdsa.PublicKey:
+ raw = &src
+ default:
+ return nil, fmt.Errorf(`cannot convert key type '%T' to ECDSA jwk.Key`, src)
+ }
+ k := newECDSAPublicKey()
+ if err := k.Import(raw); err != nil {
+ return nil, fmt.Errorf(`failed to initialize %T from %T: %w`, k, raw, err)
+ }
+ return k, nil
+}
+
+func okpPrivateKeyToJWK(src any) (Key, error) {
+ var raw any
+ switch src.(type) {
+ case ed25519.PrivateKey, *ecdh.PrivateKey:
+ raw = src
+ case ecdh.PrivateKey:
+ raw = &src
+ default:
+ return nil, fmt.Errorf(`cannot convert key type '%T' to OKP jwk.Key`, src)
+ }
+ k := newOKPPrivateKey()
+ if err := k.Import(raw); err != nil {
+ return nil, fmt.Errorf(`failed to initialize %T from %T: %w`, k, raw, err)
+ }
+ return k, nil
+}
+
+func okpPublicKeyToJWK(src any) (Key, error) {
+ var raw any
+ switch src.(type) {
+ case ed25519.PublicKey, *ecdh.PublicKey:
+ raw = src
+ case ecdh.PublicKey:
+ raw = &src
+ default:
+ return nil, fmt.Errorf(`jwk: convert raw to OKP jwk.Key: cannot convert key type '%T' to OKP jwk.Key`, src)
+ }
+ k := newOKPPublicKey()
+ if err := k.Import(raw); err != nil {
+ return nil, fmt.Errorf(`failed to initialize %T from %T: %w`, k, raw, err)
+ }
+ return k, nil
+}
+
+func bytesToKey(src any) (Key, error) {
+ var raw []byte
+ switch src := src.(type) {
+ case []byte:
+ raw = src
+ default:
+ return nil, fmt.Errorf(`cannot convert key type '%T' to symmetric jwk.Key`, src)
+ }
+
+ k := newSymmetricKey()
+ if err := k.Import(raw); err != nil {
+ return nil, fmt.Errorf(`failed to initialize %T from %T: %w`, k, raw, err)
+ }
+ return k, nil
+}
+
+// Export converts a `jwk.Key` to a Export key. The dst argument must be a pointer to the
+// object that the user wants the result to be assigned to.
+//
+// Normally you would pass a pointer to the zero value of the raw key type
+// such as &(*rsa.PrivateKey) or &(*ecdsa.PublicKey), which gets assigned
+// the converted key.
+//
+// If you do not know the exact type of a jwk.Key before attempting
+// to obtain the raw key, you can simply pass a pointer to an
+// empty interface as the second argument
+//
+// If you already know the exact type, it is recommended that you
+// pass a pointer to the zero value of the actual key type for efficiency.
+//
+// Be careful when/if you are using a third party key type that implements
+// the `jwk.Key` interface, as the first argument. This function tries hard
+// to Do The Right Thing, but it is not guaranteed to work in all cases,
+// especially when the object implements the `jwk.Key` interface via
+// embedding.
+func Export(key Key, dst any) error {
+ // dst better be a pointer
+ rv := reflect.ValueOf(dst)
+ if rv.Kind() != reflect.Ptr {
+ return fmt.Errorf(`jwk.Export: destination object must be a pointer`)
+ }
+ muKeyExporters.RLock()
+ exporters, ok := keyExporters[key.KeyType()]
+ muKeyExporters.RUnlock()
+ if !ok {
+ return fmt.Errorf(`jwk.Export: no exporters registered for key type '%T'`, key)
+ }
+ for _, conv := range exporters {
+ v, err := conv.Export(key, dst)
+ if err != nil {
+ if errors.Is(err, ContinueError()) {
+ continue
+ }
+ return fmt.Errorf(`jwk.Export: failed to export jwk.Key to raw format: %w`, err)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, v); err != nil {
+ return fmt.Errorf(`jwk.Export: failed to assign key: %w`, err)
+ }
+ return nil
+ }
+ return fmt.Errorf(`jwk.Export: no suitable exporter found for key type '%T'`, key)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/doc.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/doc.go
new file mode 100644
index 0000000000..7df707521b
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/doc.go
@@ -0,0 +1,294 @@
+// Package jwk implements JWK as described in https://tools.ietf.org/html/rfc7517
+//
+// This package implements jwk.Key to represent a single JWK, and jwk.Set to represent
+// a set of JWKs.
+//
+// The `jwk.Key` type is an interface, which hides the underlying implementation for
+// each key type. Each key type can further be converted to interfaces for known
+// types, such as `jwk.ECDSAPrivateKey`, `jwk.RSAPublicKey`, etc. This may not necessarily
+// work for third party key types (see section on "Registering a key type" below).
+//
+// Users can create a JWK in two ways. One is to unmarshal a JSON representation of a
+// key. The second one is to use `jwk.Import()` to import a raw key and convert it to
+// a jwk.Key.
+//
+// # Simple Usage
+//
+// You can parse a JWK from a JSON payload:
+//
+// jwk.ParseKey([]byte(`{"kty":"EC",...}`))
+//
+// You can go back and forth between raw key types and JWKs:
+//
+// jwkKey, _ := jwk.Import(rsaPrivateKey)
+// var rawKey *rsa.PRrivateKey
+// jwkKey.Raw(&rawKey)
+//
+// You can use them to sign/verify/encrypt/decrypt:
+//
+// jws.Sign([]byte(`...`), jws.WithKey(jwa.RS256, jwkKey))
+// jwe.Encrypt([]byte(`...`), jwe.WithKey(jwa.RSA_OAEP, jwkKey))
+//
+// See examples/jwk_parse_example_test.go and other files in the exmaples/ directory for more.
+//
+// # Advanced Usage: Registering a custom key type and conversion routines
+//
+// Caveat Emptor: Functionality around registering keys
+// (KeyProbe/KeyParser/KeyImporter/KeyExporter) should be considered experimental.
+// While we expect that the functionality itself will remain, the API may
+// change in backward incompatible ways, even during minor version
+// releases.
+//
+// ## tl;dr
+//
+// * KeyProbe: Used for parsing JWKs in JSON format. Probes hint fields to be used for later parsing by KeyParser
+// * KeyParser: Used for parsing JWKs in JSON format. Parses the JSON payload into a jwk.Key using the KeyProbe as hint
+// * KeyImporter: Used for converting raw key into jwk.Key.
+// * KeyExporter: Used for converting jwk.Key into raw key.
+//
+// ## Overview
+//
+// You can add the ability to use a JWK type that this library does not
+// implement out of the box. You can do this by registering your own
+// KeyParser, KeyImporter, and KeyExporter instances.
+//
+// func init() {
+// jwk.RegiserProbeField(reflect.StructField{Name: "SomeHint", Type: reflect.TypeOf(""), Tag: `json:"some_hint"`})
+// jwk.RegisterKeyParser(&MyKeyParser{})
+// jwk.RegisterKeyImporter(&MyKeyImporter{})
+// jwk.RegisterKeyExporter(&MyKeyExporter{})
+// }
+//
+// The KeyParser is used to parse JSON payloads and conver them into a jwk.Key.
+// The KeyImporter is used to convert a raw key (e.g. *rsa.PrivateKey, *ecdsa.PrivateKey, etc) into a jwk.Key.
+// The KeyExporter is used to convert a jwk.Key into a raw key.
+//
+// Although we believe the mechanism has been streamline quite a lot, it is also true
+// that the entire process of parsing and converting keys are much more convoluted than you might
+// think. Please know before hand that if you intend to add support for a new key type,
+// it _WILL_ require you to learn this module pretty much in-and-out.
+//
+// Read on for more explanation.
+//
+// ## Registering a KeyParser
+//
+// In order to understand how parsing works, we need to explain how the `jwk.ParseKey()` works.
+//
+// The first thing that occurs when parsing a key is a partial
+// unmarshaling of the payload into a hint / probe object.
+//
+// Because the `json.Unmarshal` works by calling the `UnmarshalJSON`
+// method on a concrete object, we need to create a concrete object first.
+// In order/ to create the appropriate Go object, we need to know which concrete
+// object to create from the JSON payload, meaning we need to peek into the
+// payload and figure out what type of key it is.
+//
+// In order to do this, we effectively need to parse the JSON payload twice.
+// First, we "probe" the payload to figure out what kind of key it is, then
+// we parse it again to create the actual key object.
+//
+// For probing, we create a new "probe" object (KeyProbe, which is not
+// directly available to end users) to populate the object with hints from the payload.
+// For example, a JWK representing an RSA key would look like:
+//
+// { "kty": "RSA", "n": ..., "e": ..., ... }
+//
+// The default KeyProbe is constructed to unmarshal "kty" and "d" fields,
+// because that is enough information to determine what kind of key to
+// construct.
+//
+// For example, if the payload contains "kty" field with the value "RSA",
+// we know that it's an RSA key. If it contains "EC", we know that it's
+// an EC key. Furthermore, if the payload contains some value in the "d" field, we can
+// also tell that this is a private key, as only private keys need
+// this field.
+//
+// For most cases, the default KeyProbe implementation should be sufficient.
+// However, there may be cases in the future where there are new key types
+// that require further information. Perhaps you are embedding another hint
+// in your JWK to further specify what kind of key it is. In that case, you
+// would need to probe more.
+//
+// Normally you can only change how an object is unmarshaled by specifying
+// JSON tags when defining a struct, but we use `reflect` package capabilities
+// to create an object dynamically, which is shared among all parsing operations.
+//
+// To add a new field to be probed, you need to register a new `reflect.StructField`
+// object that has all of the information. For example, the code below would
+// register a field named "MyHint" that is of type string, and has a JSON tag
+// of "my_hint".
+//
+// jwk.RegisterProbeField(reflect.StructField{Name: "MyHint", Type: reflect.TypeOf(""), Tag: `json:"my_hint"`})
+//
+// The value of this field can be retrieved by calling `Get()` method on the
+// KeyProbe object (from the `KeyParser`'s `ParseKey()` method discussed later)
+//
+// var myhint string
+// _ = probe.Get("MyHint", &myhint)
+//
+// var kty string
+// _ = probe.Get("Kty", &kty)
+//
+// This mechanism allows you to be flexible when trying to determine the key type
+// to instantiate.
+//
+// ## Parse via the KeyParser
+//
+// When `jwk.Parse` / `jwk.ParseKey` is called, the library will first probe
+// the payload as discussed above.
+//
+// Once the probe is done, the library will iterate over the registered parsers
+// and attempt to parse the key by calling their `ParseKey()` methods.
+//
+// The parsers will be called in reverse order that they were registered.
+// This means that it will try all parsers that were registered by third
+// parties, and once those are exhausted, the default parser will be used.
+//
+// Each parser's `ParseKey()“ method will receive three arguments: the probe object, a
+// KeyUnmarshaler, and the raw payload. The probe object can be used
+// as a hint to determine what kind of key to instantiate. An example
+// pseudocode may look like this:
+//
+// var kty string
+// _ = probe.Get("Kty", &kty)
+// switch kty {
+// case "RSA":
+// // create an RSA key
+// case "EC":
+// // create an EC key
+// ...
+// }
+//
+// The `KeyUnmarshaler` is a thin wrapper around `json.Unmarshal`. It works almost
+// identical to `json.Unmarshal`, but it allows us to add extra magic that is
+// specific to this library (which users do not need to be aware of) before calling
+// the actual `json.Unmarshal`. Please use the `KeyUnmarshaler` to unmarshal JWKs instead of `json.Unmarshal`.
+//
+// Putting it all together, the boiler plate for registering a new parser may look like this:
+//
+// func init() {
+// jwk.RegisterFieldProbe(reflect.StructField{Name: "MyHint", Type: reflect.TypeOf(""), Tag: `json:"my_hint"`})
+// jwk.RegisterParser(&MyKeyParser{})
+// }
+//
+// type MyKeyParser struct { ... }
+// func(*MyKeyParser) ParseKey(rawProbe *KeyProbe, unmarshaler KeyUnmarshaler, data []byte) (jwk.Key, error) {
+// // Create concrete type
+// var hint string
+// if err := probe.Get("MyHint", &hint); err != nil {
+// // if it doesn't have the `my_hint` field, it probably means
+// // it's not for us, so we return ContinueParseError so that
+// // the next parser can pick it up
+// return nil, jwk.ContinueParseError()
+// }
+//
+// // Use hint to determine concrete key type
+// var key jwk.Key
+// switch hint {
+// case ...:
+// key = = myNewAwesomeJWK()
+// ...
+// }
+//
+// return unmarshaler.Unmarshal(data, key)
+// }
+//
+// ## Registering KeyImporter/KeyExporter
+//
+// If you are going to do anything with the key that was parsed by your KeyParser,
+// you will need to tell the library how to convert back and forth between
+// raw keys and JWKs. Conversion from raw keys to jwk.Keys are done by KeyImporters,
+// and conversion from jwk.Keys to raw keys are done by KeyExporters.
+//
+// ## Using jwk.Import() using KeyImporter
+//
+// Each KeyImporter is hooked to run against a specific raw key type.
+//
+// When `jwk.Import()` is called, the library will iterate over all registered
+// KeyImporters for the specified raw key type, and attempt to convert the raw
+// key to a JWK by calling the `Import()` method on each KeyImporter.
+//
+// The KeyImporter's `Import()` method will receive the raw key to be converted,
+// and should return a JWK or an error if the conversion fails, or the return
+// `jwk.ContinueError()` if the specified raw key cannot be handled by ths/ KeyImporter.
+//
+// Once a KeyImporter is available, you will be able to pass the raw key to `jwk.Import()`.
+// The following example shows how you might register a KeyImporter for a hypotheical
+// mypkg.SuperSecretKey:
+//
+// jwk.RegisterKeyImporter(&mypkg.SuperSecretKey{}, jwk.KeyImportFunc(imnportSuperSecretKey))
+//
+// func importSuperSecretKey(key any) (jwk.Key, error) {
+// mykey, ok := key.(*mypkg.SuperSecretKey)
+// if !ok {
+// // You must return jwk.ContinueError here, or otherwise
+// // processing will stop with an error
+// return nil, fmt.Errorf("invalid key type %T for importer: %w", key, jwk.ContinueError())
+// }
+//
+// return mypkg.SuperSecretJWK{ .... }, nil // You could reuse existing JWK types if you can
+// }
+//
+// ## Registering a KeyExporter
+//
+// KeyExporters are the opposite of KeyImporters: they convert a JWK to a raw key when `key.Raw(...)` is
+// called. If you intend to use `key.Raw(...)` for a JWK created using one of your KeyImporters,
+// you will also
+//
+// KeyExporters are registered by key type. For example, if you want to register a KeyExporter for
+// RSA keys, you would do:
+//
+// jwk.RegisterKeyExporter(jwa.RSA, jwk.KeyExportFunc(exportRSAKey))
+//
+// For a given JWK, it will be passed a "destination" object to store the exported raw key. For example,
+// an RSA-based private JWK can be exported to a `*rsa.PrivateKey` or to a `*any`, but not
+// to a `*ecdsa.PrivateKey`:
+//
+// var dst *rsa.PrivateKey
+// key.Raw(&dst) // OK
+//
+// var dst any
+// key.Raw(&dst) // OK
+//
+// var dst *ecdsa.PrivateKey
+// key.Raw(&dst) // Error, if key is an RSA key
+//
+// You will need to handle this distinction yourself in your KeyImporter. For example, certain
+// elliptic curve keys can be expressed in JWK in the same format, minus the "kty". In that case
+// you will need to check for the type of the destination object and return an error if it is
+// not compatible with your key.
+//
+// var raw mypkg.PrivateKey // assume a hypothetical private key type using a different curve than standard ones lie P-256
+// key, _ := jwk.Import(raw)
+// // key could be jwk.ECDSAPrivateKey, with different curve than P-256
+//
+// var dst *ecdsa.PrivateKey
+// key.Raw(&dst) // your KeyImporter will be called with *ecdsa.PrivateKey, which is not compatible with your key
+//
+// To implement this your code should look like the following:
+//
+// jwk.RegisterKeyExporter(jwk.EC, jwk.KeyExportFunc(exportMyKey))
+//
+// func exportMyKey(key jwk.Key, hint any) (any, error) {
+// // check if the type of object in hint is compatible with your key
+// switch hint.(type) {
+// case *mypkg.PrivateKey, *any:
+// // OK, we can proceed
+// default:
+// // Not compatible, return jwk.ContinueError
+// return nil, jwk.ContinueError()
+// }
+//
+// // key is a jwk.ECDSAPrivateKey or jwk.ECDSAPublicKey
+// switch key := key.(type) {
+// case jwk.ECDSAPrivateKey:
+// // convert key to mypkg.PrivateKey
+// case jwk.ECDSAPublicKey:
+// // convert key to mypkg.PublicKey
+// default:
+// // Not compatible, return jwk.ContinueError
+// return nil, jwk.ContinueError()
+// }
+// return ..., nil
+// }
+package jwk
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/ecdsa.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/ecdsa.go
new file mode 100644
index 0000000000..8f76d0508e
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/ecdsa.go
@@ -0,0 +1,402 @@
+package jwk
+
+import (
+ "crypto"
+ "crypto/ecdh"
+ "crypto/ecdsa"
+ "crypto/elliptic"
+ "fmt"
+ "math/big"
+ "reflect"
+
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/ecutil"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ ourecdsa "github.com/lestrrat-go/jwx/v3/jwk/ecdsa"
+)
+
+func init() {
+ ourecdsa.RegisterCurve(jwa.P256(), elliptic.P256())
+ ourecdsa.RegisterCurve(jwa.P384(), elliptic.P384())
+ ourecdsa.RegisterCurve(jwa.P521(), elliptic.P521())
+
+ RegisterKeyExporter(jwa.EC(), KeyExportFunc(ecdsaJWKToRaw))
+}
+
+func (k *ecdsaPublicKey) Import(rawKey *ecdsa.PublicKey) error {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+
+ if rawKey.X == nil {
+ return fmt.Errorf(`invalid ecdsa.PublicKey`)
+ }
+
+ if rawKey.Y == nil {
+ return fmt.Errorf(`invalid ecdsa.PublicKey`)
+ }
+
+ xbuf := ecutil.AllocECPointBuffer(rawKey.X, rawKey.Curve)
+ ybuf := ecutil.AllocECPointBuffer(rawKey.Y, rawKey.Curve)
+ defer ecutil.ReleaseECPointBuffer(xbuf)
+ defer ecutil.ReleaseECPointBuffer(ybuf)
+
+ k.x = make([]byte, len(xbuf))
+ copy(k.x, xbuf)
+ k.y = make([]byte, len(ybuf))
+ copy(k.y, ybuf)
+
+ alg, err := ourecdsa.AlgorithmFromCurve(rawKey.Curve)
+ if err != nil {
+ return fmt.Errorf(`jwk: failed to get algorithm for converting ECDSA public key to JWK: %w`, err)
+ }
+ k.crv = &alg
+
+ return nil
+}
+
+func (k *ecdsaPrivateKey) Import(rawKey *ecdsa.PrivateKey) error {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+
+ if rawKey.PublicKey.X == nil {
+ return fmt.Errorf(`invalid ecdsa.PrivateKey`)
+ }
+ if rawKey.PublicKey.Y == nil {
+ return fmt.Errorf(`invalid ecdsa.PrivateKey`)
+ }
+ if rawKey.D == nil {
+ return fmt.Errorf(`invalid ecdsa.PrivateKey`)
+ }
+
+ xbuf := ecutil.AllocECPointBuffer(rawKey.PublicKey.X, rawKey.Curve)
+ ybuf := ecutil.AllocECPointBuffer(rawKey.PublicKey.Y, rawKey.Curve)
+ dbuf := ecutil.AllocECPointBuffer(rawKey.D, rawKey.Curve)
+ defer ecutil.ReleaseECPointBuffer(xbuf)
+ defer ecutil.ReleaseECPointBuffer(ybuf)
+ defer ecutil.ReleaseECPointBuffer(dbuf)
+
+ k.x = make([]byte, len(xbuf))
+ copy(k.x, xbuf)
+ k.y = make([]byte, len(ybuf))
+ copy(k.y, ybuf)
+ k.d = make([]byte, len(dbuf))
+ copy(k.d, dbuf)
+
+ alg, err := ourecdsa.AlgorithmFromCurve(rawKey.Curve)
+ if err != nil {
+ return fmt.Errorf(`jwk: failed to get algorithm for converting ECDSA private key to JWK: %w`, err)
+ }
+ k.crv = &alg
+
+ return nil
+}
+
+func buildECDSAPublicKey(alg jwa.EllipticCurveAlgorithm, xbuf, ybuf []byte) (*ecdsa.PublicKey, error) {
+ crv, err := ourecdsa.CurveFromAlgorithm(alg)
+ if err != nil {
+ return nil, fmt.Errorf(`jwk: failed to get algorithm for ECDSA public key: %w`, err)
+ }
+
+ var x, y big.Int
+ x.SetBytes(xbuf)
+ y.SetBytes(ybuf)
+
+ return &ecdsa.PublicKey{Curve: crv, X: &x, Y: &y}, nil
+}
+
+func buildECDHPublicKey(alg jwa.EllipticCurveAlgorithm, xbuf, ybuf []byte) (*ecdh.PublicKey, error) {
+ var ecdhcrv ecdh.Curve
+ switch alg {
+ case jwa.X25519():
+ ecdhcrv = ecdh.X25519()
+ case jwa.P256():
+ ecdhcrv = ecdh.P256()
+ case jwa.P384():
+ ecdhcrv = ecdh.P384()
+ case jwa.P521():
+ ecdhcrv = ecdh.P521()
+ default:
+ return nil, fmt.Errorf(`jwk: unsupported ECDH curve %s`, alg)
+ }
+
+ return ecdhcrv.NewPublicKey(append([]byte{0x04}, append(xbuf, ybuf...)...))
+}
+
+func buildECDHPrivateKey(alg jwa.EllipticCurveAlgorithm, dbuf []byte) (*ecdh.PrivateKey, error) {
+ var ecdhcrv ecdh.Curve
+ switch alg {
+ case jwa.X25519():
+ ecdhcrv = ecdh.X25519()
+ case jwa.P256():
+ ecdhcrv = ecdh.P256()
+ case jwa.P384():
+ ecdhcrv = ecdh.P384()
+ case jwa.P521():
+ ecdhcrv = ecdh.P521()
+ default:
+ return nil, fmt.Errorf(`jwk: unsupported ECDH curve %s`, alg)
+ }
+
+ return ecdhcrv.NewPrivateKey(dbuf)
+}
+
+var ecdsaConvertibleTypes = []reflect.Type{
+ reflect.TypeFor[ECDSAPrivateKey](),
+ reflect.TypeFor[ECDSAPublicKey](),
+}
+
+func ecdsaJWKToRaw(keyif Key, hint any) (any, error) {
+ var isECDH bool
+
+ extracted, err := extractEmbeddedKey(keyif, ecdsaConvertibleTypes)
+ if err != nil {
+ return nil, fmt.Errorf(`jwk: failed to extract embedded key: %w`, err)
+ }
+
+ switch k := extracted.(type) {
+ case ECDSAPrivateKey:
+ switch hint.(type) {
+ case ecdsa.PrivateKey, *ecdsa.PrivateKey:
+ case ecdh.PrivateKey, *ecdh.PrivateKey:
+ isECDH = true
+ default:
+ rv := reflect.ValueOf(hint)
+ //nolint:revive
+ if rv.Kind() == reflect.Ptr && rv.Elem().Kind() == reflect.Interface {
+ // pointer to an interface value, presumably they want us to dynamically
+ // create an object of the right type
+ } else {
+ return nil, fmt.Errorf(`invalid destination object type %T: %w`, hint, ContinueError())
+ }
+ }
+
+ locker, ok := k.(rlocker)
+ if ok {
+ locker.rlock()
+ defer locker.runlock()
+ }
+
+ crv, ok := k.Crv()
+ if !ok {
+ return nil, fmt.Errorf(`missing "crv" field`)
+ }
+
+ if isECDH {
+ d, ok := k.D()
+ if !ok {
+ return nil, fmt.Errorf(`missing "d" field`)
+ }
+ return buildECDHPrivateKey(crv, d)
+ }
+
+ x, ok := k.X()
+ if !ok {
+ return nil, fmt.Errorf(`missing "x" field`)
+ }
+ y, ok := k.Y()
+ if !ok {
+ return nil, fmt.Errorf(`missing "y" field`)
+ }
+ pubk, err := buildECDSAPublicKey(crv, x, y)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to build public key: %w`, err)
+ }
+
+ var key ecdsa.PrivateKey
+ var d big.Int
+
+ origD, ok := k.D()
+ if !ok {
+ return nil, fmt.Errorf(`missing "d" field`)
+ }
+
+ d.SetBytes(origD)
+ key.D = &d
+ key.PublicKey = *pubk
+
+ return &key, nil
+ case ECDSAPublicKey:
+ switch hint.(type) {
+ case ecdsa.PublicKey, *ecdsa.PublicKey:
+ case ecdh.PublicKey, *ecdh.PublicKey:
+ isECDH = true
+ default:
+ rv := reflect.ValueOf(hint)
+ //nolint:revive
+ if rv.Kind() == reflect.Ptr && rv.Elem().Kind() == reflect.Interface {
+ // pointer to an interface value, presumably they want us to dynamically
+ // create an object of the right type
+ } else {
+ return nil, fmt.Errorf(`invalid destination object type %T: %w`, hint, ContinueError())
+ }
+ }
+
+ locker, ok := k.(rlocker)
+ if ok {
+ locker.rlock()
+ defer locker.runlock()
+ }
+
+ crv, ok := k.Crv()
+ if !ok {
+ return nil, fmt.Errorf(`missing "crv" field`)
+ }
+
+ x, ok := k.X()
+ if !ok {
+ return nil, fmt.Errorf(`missing "x" field`)
+ }
+
+ y, ok := k.Y()
+ if !ok {
+ return nil, fmt.Errorf(`missing "y" field`)
+ }
+ if isECDH {
+ return buildECDHPublicKey(crv, x, y)
+ }
+ return buildECDSAPublicKey(crv, x, y)
+ default:
+ return nil, ContinueError()
+ }
+}
+
+func makeECDSAPublicKey(src Key) (Key, error) {
+ newKey := newECDSAPublicKey()
+
+ // Iterate and copy everything except for the bits that should not be in the public key
+ for _, k := range src.Keys() {
+ switch k {
+ case ECDSADKey:
+ continue
+ default:
+ var v any
+ if err := src.Get(k, &v); err != nil {
+ return nil, fmt.Errorf(`ecdsa: makeECDSAPublicKey: failed to get field %q: %w`, k, err)
+ }
+
+ if err := newKey.Set(k, v); err != nil {
+ return nil, fmt.Errorf(`ecdsa: makeECDSAPublicKey: failed to set field %q: %w`, k, err)
+ }
+ }
+ }
+
+ return newKey, nil
+}
+
+func (k *ecdsaPrivateKey) PublicKey() (Key, error) {
+ return makeECDSAPublicKey(k)
+}
+
+func (k *ecdsaPublicKey) PublicKey() (Key, error) {
+ return makeECDSAPublicKey(k)
+}
+
+func ecdsaThumbprint(hash crypto.Hash, crv, x, y string) []byte {
+ h := hash.New()
+ fmt.Fprint(h, `{"crv":"`)
+ fmt.Fprint(h, crv)
+ fmt.Fprint(h, `","kty":"EC","x":"`)
+ fmt.Fprint(h, x)
+ fmt.Fprint(h, `","y":"`)
+ fmt.Fprint(h, y)
+ fmt.Fprint(h, `"}`)
+ return h.Sum(nil)
+}
+
+// Thumbprint returns the JWK thumbprint using the indicated
+// hashing algorithm, according to RFC 7638
+func (k ecdsaPublicKey) Thumbprint(hash crypto.Hash) ([]byte, error) {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+
+ var key ecdsa.PublicKey
+ if err := Export(&k, &key); err != nil {
+ return nil, fmt.Errorf(`failed to export ecdsa.PublicKey for thumbprint generation: %w`, err)
+ }
+
+ xbuf := ecutil.AllocECPointBuffer(key.X, key.Curve)
+ ybuf := ecutil.AllocECPointBuffer(key.Y, key.Curve)
+ defer ecutil.ReleaseECPointBuffer(xbuf)
+ defer ecutil.ReleaseECPointBuffer(ybuf)
+
+ return ecdsaThumbprint(
+ hash,
+ key.Curve.Params().Name,
+ base64.EncodeToString(xbuf),
+ base64.EncodeToString(ybuf),
+ ), nil
+}
+
+// Thumbprint returns the JWK thumbprint using the indicated
+// hashing algorithm, according to RFC 7638
+func (k ecdsaPrivateKey) Thumbprint(hash crypto.Hash) ([]byte, error) {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+
+ var key ecdsa.PrivateKey
+ if err := Export(&k, &key); err != nil {
+ return nil, fmt.Errorf(`failed to export ecdsa.PrivateKey for thumbprint generation: %w`, err)
+ }
+
+ xbuf := ecutil.AllocECPointBuffer(key.X, key.Curve)
+ ybuf := ecutil.AllocECPointBuffer(key.Y, key.Curve)
+ defer ecutil.ReleaseECPointBuffer(xbuf)
+ defer ecutil.ReleaseECPointBuffer(ybuf)
+
+ return ecdsaThumbprint(
+ hash,
+ key.Curve.Params().Name,
+ base64.EncodeToString(xbuf),
+ base64.EncodeToString(ybuf),
+ ), nil
+}
+
+func ecdsaValidateKey(k interface {
+ Crv() (jwa.EllipticCurveAlgorithm, bool)
+ X() ([]byte, bool)
+ Y() ([]byte, bool)
+}, checkPrivate bool) error {
+ crvtyp, ok := k.Crv()
+ if !ok {
+ return fmt.Errorf(`missing "crv" field`)
+ }
+
+ crv, err := ourecdsa.CurveFromAlgorithm(crvtyp)
+ if err != nil {
+ return fmt.Errorf(`invalid curve algorithm %q: %w`, crvtyp, err)
+ }
+
+ keySize := ecutil.CalculateKeySize(crv)
+ if x, ok := k.X(); !ok || len(x) != keySize {
+ return fmt.Errorf(`invalid "x" length (%d) for curve %q`, len(x), crv.Params().Name)
+ }
+
+ if y, ok := k.Y(); !ok || len(y) != keySize {
+ return fmt.Errorf(`invalid "y" length (%d) for curve %q`, len(y), crv.Params().Name)
+ }
+
+ if checkPrivate {
+ if priv, ok := k.(keyWithD); ok {
+ if d, ok := priv.D(); !ok || len(d) != keySize {
+ return fmt.Errorf(`invalid "d" length (%d) for curve %q`, len(d), crv.Params().Name)
+ }
+ } else {
+ return fmt.Errorf(`missing "d" value`)
+ }
+ }
+ return nil
+}
+
+func (k *ecdsaPrivateKey) Validate() error {
+ if err := ecdsaValidateKey(k, true); err != nil {
+ return NewKeyValidationError(fmt.Errorf(`jwk.ECDSAPrivateKey: %w`, err))
+ }
+ return nil
+}
+
+func (k *ecdsaPublicKey) Validate() error {
+ if err := ecdsaValidateKey(k, false); err != nil {
+ return NewKeyValidationError(fmt.Errorf(`jwk.ECDSAPublicKey: %w`, err))
+ }
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/ecdsa/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jwk/ecdsa/BUILD.bazel
new file mode 100644
index 0000000000..bf058aa649
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/ecdsa/BUILD.bazel
@@ -0,0 +1,15 @@
+load("@rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "ecdsa",
+ srcs = ["ecdsa.go"],
+ importpath = "github.com/lestrrat-go/jwx/v3/jwk/ecdsa",
+ visibility = ["//visibility:public"],
+ deps = ["//jwa"],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":ecdsa",
+ visibility = ["//visibility:public"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/ecdsa/ecdsa.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/ecdsa/ecdsa.go
new file mode 100644
index 0000000000..3392483218
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/ecdsa/ecdsa.go
@@ -0,0 +1,76 @@
+package ecdsa
+
+import (
+ "crypto/elliptic"
+ "fmt"
+ "sync"
+
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+var muCurves sync.RWMutex
+var algToCurveMap map[jwa.EllipticCurveAlgorithm]elliptic.Curve
+var curveToAlgMap map[elliptic.Curve]jwa.EllipticCurveAlgorithm
+var algList []jwa.EllipticCurveAlgorithm
+
+func init() {
+ muCurves.Lock()
+ algToCurveMap = make(map[jwa.EllipticCurveAlgorithm]elliptic.Curve)
+ curveToAlgMap = make(map[elliptic.Curve]jwa.EllipticCurveAlgorithm)
+ muCurves.Unlock()
+}
+
+// RegisterCurve registers a jwa.EllipticCurveAlgorithm constant and its
+// corresponding elliptic.Curve object. Users do not need to call this unless
+// they are registering a new ECDSA key type
+func RegisterCurve(alg jwa.EllipticCurveAlgorithm, crv elliptic.Curve) {
+ muCurves.Lock()
+ defer muCurves.Unlock()
+
+ algToCurveMap[alg] = crv
+ curveToAlgMap[crv] = alg
+ rebuildCurves()
+}
+
+func rebuildCurves() {
+ l := len(algToCurveMap)
+ if cap(algList) < l {
+ algList = make([]jwa.EllipticCurveAlgorithm, 0, l)
+ } else {
+ algList = algList[:0]
+ }
+
+ for alg := range algToCurveMap {
+ algList = append(algList, alg)
+ }
+}
+
+// Algorithms returns the list of registered jwa.EllipticCurveAlgorithms
+// that ca be used for ECDSA keys.
+func Algorithms() []jwa.EllipticCurveAlgorithm {
+ muCurves.RLock()
+ defer muCurves.RUnlock()
+
+ return algList
+}
+
+func AlgorithmFromCurve(crv elliptic.Curve) (jwa.EllipticCurveAlgorithm, error) {
+ alg, ok := curveToAlgMap[crv]
+ if !ok {
+ return jwa.InvalidEllipticCurve(), fmt.Errorf(`unknown elliptic curve: %q`, crv)
+ }
+ return alg, nil
+}
+
+func CurveFromAlgorithm(alg jwa.EllipticCurveAlgorithm) (elliptic.Curve, error) {
+ crv, ok := algToCurveMap[alg]
+ if !ok {
+ return nil, fmt.Errorf(`unknown elliptic curve algorithm: %q`, alg)
+ }
+ return crv, nil
+}
+
+func IsCurveAvailable(alg jwa.EllipticCurveAlgorithm) bool {
+ _, ok := algToCurveMap[alg]
+ return ok
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/ecdsa_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/ecdsa_gen.go
new file mode 100644
index 0000000000..39536de3d8
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/ecdsa_gen.go
@@ -0,0 +1,1432 @@
+// Code generated by tools/cmd/genjwk/main.go. DO NOT EDIT.
+
+package jwk
+
+import (
+ "bytes"
+ "fmt"
+ "sort"
+ "sync"
+
+ "github.com/lestrrat-go/blackmagic"
+ "github.com/lestrrat-go/jwx/v3/cert"
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+const (
+ ECDSACrvKey = "crv"
+ ECDSADKey = "d"
+ ECDSAXKey = "x"
+ ECDSAYKey = "y"
+)
+
+type ECDSAPublicKey interface {
+ Key
+ Crv() (jwa.EllipticCurveAlgorithm, bool)
+ X() ([]byte, bool)
+ Y() ([]byte, bool)
+}
+
+type ecdsaPublicKey struct {
+ algorithm *jwa.KeyAlgorithm // https://tools.ietf.org/html/rfc7517#section-4.4
+ crv *jwa.EllipticCurveAlgorithm
+ keyID *string // https://tools.ietf.org/html/rfc7515#section-4.1.4
+ keyOps *KeyOperationList // https://tools.ietf.org/html/rfc7517#section-4.3
+ keyUsage *string // https://tools.ietf.org/html/rfc7517#section-4.2
+ x []byte
+ x509CertChain *cert.Chain // https://tools.ietf.org/html/rfc7515#section-4.1.6
+ x509CertThumbprint *string // https://tools.ietf.org/html/rfc7515#section-4.1.7
+ x509CertThumbprintS256 *string // https://tools.ietf.org/html/rfc7515#section-4.1.8
+ x509URL *string // https://tools.ietf.org/html/rfc7515#section-4.1.5
+ y []byte
+ privateParams map[string]any
+ mu *sync.RWMutex
+ dc json.DecodeCtx
+}
+
+var _ ECDSAPublicKey = &ecdsaPublicKey{}
+var _ Key = &ecdsaPublicKey{}
+
+func newECDSAPublicKey() *ecdsaPublicKey {
+ return &ecdsaPublicKey{
+ mu: &sync.RWMutex{},
+ privateParams: make(map[string]any),
+ }
+}
+
+func (h ecdsaPublicKey) KeyType() jwa.KeyType {
+ return jwa.EC()
+}
+
+func (h ecdsaPublicKey) rlock() {
+ h.mu.RLock()
+}
+
+func (h ecdsaPublicKey) runlock() {
+ h.mu.RUnlock()
+}
+
+func (h ecdsaPublicKey) IsPrivate() bool {
+ return false
+}
+
+func (h *ecdsaPublicKey) Algorithm() (jwa.KeyAlgorithm, bool) {
+ if h.algorithm != nil {
+ return *(h.algorithm), true
+ }
+ return nil, false
+}
+
+func (h *ecdsaPublicKey) Crv() (jwa.EllipticCurveAlgorithm, bool) {
+ if h.crv != nil {
+ return *(h.crv), true
+ }
+ return jwa.InvalidEllipticCurve(), false
+}
+
+func (h *ecdsaPublicKey) KeyID() (string, bool) {
+ if h.keyID != nil {
+ return *(h.keyID), true
+ }
+ return "", false
+}
+
+func (h *ecdsaPublicKey) KeyOps() (KeyOperationList, bool) {
+ if h.keyOps != nil {
+ return *(h.keyOps), true
+ }
+ return nil, false
+}
+
+func (h *ecdsaPublicKey) KeyUsage() (string, bool) {
+ if h.keyUsage != nil {
+ return *(h.keyUsage), true
+ }
+ return "", false
+}
+
+func (h *ecdsaPublicKey) X() ([]byte, bool) {
+ if h.x != nil {
+ return h.x, true
+ }
+ return nil, false
+}
+
+func (h *ecdsaPublicKey) X509CertChain() (*cert.Chain, bool) {
+ return h.x509CertChain, true
+}
+
+func (h *ecdsaPublicKey) X509CertThumbprint() (string, bool) {
+ if h.x509CertThumbprint != nil {
+ return *(h.x509CertThumbprint), true
+ }
+ return "", false
+}
+
+func (h *ecdsaPublicKey) X509CertThumbprintS256() (string, bool) {
+ if h.x509CertThumbprintS256 != nil {
+ return *(h.x509CertThumbprintS256), true
+ }
+ return "", false
+}
+
+func (h *ecdsaPublicKey) X509URL() (string, bool) {
+ if h.x509URL != nil {
+ return *(h.x509URL), true
+ }
+ return "", false
+}
+
+func (h *ecdsaPublicKey) Y() ([]byte, bool) {
+ if h.y != nil {
+ return h.y, true
+ }
+ return nil, false
+}
+
+func (h *ecdsaPublicKey) Has(name string) bool {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case KeyTypeKey:
+ return true
+ case AlgorithmKey:
+ return h.algorithm != nil
+ case ECDSACrvKey:
+ return h.crv != nil
+ case KeyIDKey:
+ return h.keyID != nil
+ case KeyOpsKey:
+ return h.keyOps != nil
+ case KeyUsageKey:
+ return h.keyUsage != nil
+ case ECDSAXKey:
+ return h.x != nil
+ case X509CertChainKey:
+ return h.x509CertChain != nil
+ case X509CertThumbprintKey:
+ return h.x509CertThumbprint != nil
+ case X509CertThumbprintS256Key:
+ return h.x509CertThumbprintS256 != nil
+ case X509URLKey:
+ return h.x509URL != nil
+ case ECDSAYKey:
+ return h.y != nil
+ default:
+ _, ok := h.privateParams[name]
+ return ok
+ }
+}
+
+func (h *ecdsaPublicKey) Get(name string, dst any) error {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case KeyTypeKey:
+ if err := blackmagic.AssignIfCompatible(dst, h.KeyType()); err != nil {
+ return fmt.Errorf(`ecdsaPublicKey.Get: failed to assign value for field %q to destination object: %w`, name, err)
+ }
+ case AlgorithmKey:
+ if h.algorithm == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.algorithm)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case ECDSACrvKey:
+ if h.crv == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.crv)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyIDKey:
+ if h.keyID == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyID)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyOpsKey:
+ if h.keyOps == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyOps)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyUsageKey:
+ if h.keyUsage == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyUsage)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case ECDSAXKey:
+ if h.x == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.x); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertChainKey:
+ if h.x509CertChain == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.x509CertChain); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertThumbprintKey:
+ if h.x509CertThumbprint == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprint)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertThumbprintS256Key:
+ if h.x509CertThumbprintS256 == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprintS256)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509URLKey:
+ if h.x509URL == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509URL)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case ECDSAYKey:
+ if h.y == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.y); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ default:
+ v, ok := h.privateParams[name]
+ if !ok {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, v); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ }
+ return nil
+}
+
+func (h *ecdsaPublicKey) Set(name string, value any) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ return h.setNoLock(name, value)
+}
+
+func (h *ecdsaPublicKey) setNoLock(name string, value any) error {
+ switch name {
+ case "kty":
+ return nil
+ case AlgorithmKey:
+ switch v := value.(type) {
+ case string, jwa.SignatureAlgorithm, jwa.KeyEncryptionAlgorithm, jwa.ContentEncryptionAlgorithm:
+ tmp, err := jwa.KeyAlgorithmFrom(v)
+ if err != nil {
+ return fmt.Errorf(`invalid algorithm for %q key: %w`, AlgorithmKey, err)
+ }
+ h.algorithm = &tmp
+ default:
+ return fmt.Errorf(`invalid type for %q key: %T`, AlgorithmKey, value)
+ }
+ return nil
+ case ECDSACrvKey:
+ if v, ok := value.(jwa.EllipticCurveAlgorithm); ok {
+ h.crv = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, ECDSACrvKey, value)
+ case KeyIDKey:
+ if v, ok := value.(string); ok {
+ h.keyID = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, KeyIDKey, value)
+ case KeyOpsKey:
+ var acceptor KeyOperationList
+ if err := acceptor.Accept(value); err != nil {
+ return fmt.Errorf(`invalid value for %s key: %w`, KeyOpsKey, err)
+ }
+ h.keyOps = &acceptor
+ return nil
+ case KeyUsageKey:
+ switch v := value.(type) {
+ case KeyUsageType:
+ switch v {
+ case ForSignature, ForEncryption:
+ tmp := v.String()
+ h.keyUsage = &tmp
+ default:
+ return fmt.Errorf(`invalid key usage type %s`, v)
+ }
+ case string:
+ h.keyUsage = &v
+ default:
+ return fmt.Errorf(`invalid key usage type %s`, v)
+ }
+ case ECDSAXKey:
+ if v, ok := value.([]byte); ok {
+ h.x = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, ECDSAXKey, value)
+ case X509CertChainKey:
+ if v, ok := value.(*cert.Chain); ok {
+ h.x509CertChain = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertChainKey, value)
+ case X509CertThumbprintKey:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprint = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintKey, value)
+ case X509CertThumbprintS256Key:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprintS256 = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintS256Key, value)
+ case X509URLKey:
+ if v, ok := value.(string); ok {
+ h.x509URL = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509URLKey, value)
+ case ECDSAYKey:
+ if v, ok := value.([]byte); ok {
+ h.y = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, ECDSAYKey, value)
+ default:
+ if h.privateParams == nil {
+ h.privateParams = map[string]any{}
+ }
+ h.privateParams[name] = value
+ }
+ return nil
+}
+
+func (k *ecdsaPublicKey) Remove(key string) error {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+ switch key {
+ case AlgorithmKey:
+ k.algorithm = nil
+ case ECDSACrvKey:
+ k.crv = nil
+ case KeyIDKey:
+ k.keyID = nil
+ case KeyOpsKey:
+ k.keyOps = nil
+ case KeyUsageKey:
+ k.keyUsage = nil
+ case ECDSAXKey:
+ k.x = nil
+ case X509CertChainKey:
+ k.x509CertChain = nil
+ case X509CertThumbprintKey:
+ k.x509CertThumbprint = nil
+ case X509CertThumbprintS256Key:
+ k.x509CertThumbprintS256 = nil
+ case X509URLKey:
+ k.x509URL = nil
+ case ECDSAYKey:
+ k.y = nil
+ default:
+ delete(k.privateParams, key)
+ }
+ return nil
+}
+
+func (k *ecdsaPublicKey) Clone() (Key, error) {
+ key, err := cloneKey(k)
+ if err != nil {
+ return nil, fmt.Errorf(`ecdsaPublicKey.Clone: %w`, err)
+ }
+ return key, nil
+}
+
+func (k *ecdsaPublicKey) DecodeCtx() json.DecodeCtx {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+ return k.dc
+}
+
+func (k *ecdsaPublicKey) SetDecodeCtx(dc json.DecodeCtx) {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+ k.dc = dc
+}
+
+func (h *ecdsaPublicKey) UnmarshalJSON(buf []byte) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ h.algorithm = nil
+ h.crv = nil
+ h.keyID = nil
+ h.keyOps = nil
+ h.keyUsage = nil
+ h.x = nil
+ h.x509CertChain = nil
+ h.x509CertThumbprint = nil
+ h.x509CertThumbprintS256 = nil
+ h.x509URL = nil
+ h.y = nil
+ dec := json.NewDecoder(bytes.NewReader(buf))
+LOOP:
+ for {
+ tok, err := dec.Token()
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ switch tok := tok.(type) {
+ case json.Delim:
+ // Assuming we're doing everything correctly, we should ONLY
+ // get either tokens.OpenCurlyBracket or tokens.CloseCurlyBracket here.
+ if tok == tokens.CloseCurlyBracket { // End of object
+ break LOOP
+ } else if tok != tokens.OpenCurlyBracket {
+ return fmt.Errorf(`expected '%c' but got '%c'`, tokens.OpenCurlyBracket, tok)
+ }
+ case string: // Objects can only have string keys
+ switch tok {
+ case KeyTypeKey:
+ val, err := json.ReadNextStringToken(dec)
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ if val != jwa.EC().String() {
+ return fmt.Errorf(`invalid kty value for RSAPublicKey (%s)`, val)
+ }
+ case AlgorithmKey:
+ var s string
+ if err := dec.Decode(&s); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AlgorithmKey, err)
+ }
+ alg, err := jwa.KeyAlgorithmFrom(s)
+ if err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AlgorithmKey, err)
+ }
+ h.algorithm = &alg
+ case ECDSACrvKey:
+ var decoded jwa.EllipticCurveAlgorithm
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, ECDSACrvKey, err)
+ }
+ h.crv = &decoded
+ case KeyIDKey:
+ if err := json.AssignNextStringToken(&h.keyID, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyIDKey, err)
+ }
+ case KeyOpsKey:
+ var decoded KeyOperationList
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyOpsKey, err)
+ }
+ h.keyOps = &decoded
+ case KeyUsageKey:
+ if err := json.AssignNextStringToken(&h.keyUsage, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyUsageKey, err)
+ }
+ case ECDSAXKey:
+ if err := json.AssignNextBytesToken(&h.x, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, ECDSAXKey, err)
+ }
+ case X509CertChainKey:
+ var decoded cert.Chain
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertChainKey, err)
+ }
+ h.x509CertChain = &decoded
+ case X509CertThumbprintKey:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprint, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintKey, err)
+ }
+ case X509CertThumbprintS256Key:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprintS256, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintS256Key, err)
+ }
+ case X509URLKey:
+ if err := json.AssignNextStringToken(&h.x509URL, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509URLKey, err)
+ }
+ case ECDSAYKey:
+ if err := json.AssignNextBytesToken(&h.y, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, ECDSAYKey, err)
+ }
+ default:
+ if dc := h.dc; dc != nil {
+ if localReg := dc.Registry(); localReg != nil {
+ decoded, err := localReg.Decode(dec, tok)
+ if err == nil {
+ h.setNoLock(tok, decoded)
+ continue
+ }
+ }
+ }
+ decoded, err := registry.Decode(dec, tok)
+ if err == nil {
+ h.setNoLock(tok, decoded)
+ continue
+ }
+ return fmt.Errorf(`could not decode field %s: %w`, tok, err)
+ }
+ default:
+ return fmt.Errorf(`invalid token %T`, tok)
+ }
+ }
+ if h.crv == nil {
+ return fmt.Errorf(`required field crv is missing`)
+ }
+ if h.x == nil {
+ return fmt.Errorf(`required field x is missing`)
+ }
+ if h.y == nil {
+ return fmt.Errorf(`required field y is missing`)
+ }
+ return nil
+}
+
+func (h ecdsaPublicKey) MarshalJSON() ([]byte, error) {
+ data := make(map[string]any)
+ fields := make([]string, 0, 11)
+ data[KeyTypeKey] = jwa.EC()
+ fields = append(fields, KeyTypeKey)
+ if h.algorithm != nil {
+ data[AlgorithmKey] = *(h.algorithm)
+ fields = append(fields, AlgorithmKey)
+ }
+ if h.crv != nil {
+ data[ECDSACrvKey] = *(h.crv)
+ fields = append(fields, ECDSACrvKey)
+ }
+ if h.keyID != nil {
+ data[KeyIDKey] = *(h.keyID)
+ fields = append(fields, KeyIDKey)
+ }
+ if h.keyOps != nil {
+ data[KeyOpsKey] = *(h.keyOps)
+ fields = append(fields, KeyOpsKey)
+ }
+ if h.keyUsage != nil {
+ data[KeyUsageKey] = *(h.keyUsage)
+ fields = append(fields, KeyUsageKey)
+ }
+ if h.x != nil {
+ data[ECDSAXKey] = h.x
+ fields = append(fields, ECDSAXKey)
+ }
+ if h.x509CertChain != nil {
+ data[X509CertChainKey] = h.x509CertChain
+ fields = append(fields, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ data[X509CertThumbprintKey] = *(h.x509CertThumbprint)
+ fields = append(fields, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ data[X509CertThumbprintS256Key] = *(h.x509CertThumbprintS256)
+ fields = append(fields, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ data[X509URLKey] = *(h.x509URL)
+ fields = append(fields, X509URLKey)
+ }
+ if h.y != nil {
+ data[ECDSAYKey] = h.y
+ fields = append(fields, ECDSAYKey)
+ }
+ for k, v := range h.privateParams {
+ data[k] = v
+ fields = append(fields, k)
+ }
+
+ sort.Strings(fields)
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+ buf.WriteByte(tokens.OpenCurlyBracket)
+ enc := json.NewEncoder(buf)
+ for i, f := range fields {
+ if i > 0 {
+ buf.WriteRune(tokens.Comma)
+ }
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(f)
+ buf.WriteString(`":`)
+ v := data[f]
+ switch v := v.(type) {
+ case []byte:
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(base64.EncodeToString(v))
+ buf.WriteRune(tokens.DoubleQuote)
+ default:
+ if err := enc.Encode(v); err != nil {
+ return nil, fmt.Errorf(`failed to encode value for field %s: %w`, f, err)
+ }
+ buf.Truncate(buf.Len() - 1)
+ }
+ }
+ buf.WriteByte(tokens.CloseCurlyBracket)
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ return ret, nil
+}
+
+func (h *ecdsaPublicKey) Keys() []string {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ keys := make([]string, 0, 11+len(h.privateParams))
+ keys = append(keys, KeyTypeKey)
+ if h.algorithm != nil {
+ keys = append(keys, AlgorithmKey)
+ }
+ if h.crv != nil {
+ keys = append(keys, ECDSACrvKey)
+ }
+ if h.keyID != nil {
+ keys = append(keys, KeyIDKey)
+ }
+ if h.keyOps != nil {
+ keys = append(keys, KeyOpsKey)
+ }
+ if h.keyUsage != nil {
+ keys = append(keys, KeyUsageKey)
+ }
+ if h.x != nil {
+ keys = append(keys, ECDSAXKey)
+ }
+ if h.x509CertChain != nil {
+ keys = append(keys, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ keys = append(keys, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ keys = append(keys, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ keys = append(keys, X509URLKey)
+ }
+ if h.y != nil {
+ keys = append(keys, ECDSAYKey)
+ }
+ for k := range h.privateParams {
+ keys = append(keys, k)
+ }
+ return keys
+}
+
+type ECDSAPrivateKey interface {
+ Key
+ Crv() (jwa.EllipticCurveAlgorithm, bool)
+ D() ([]byte, bool)
+ X() ([]byte, bool)
+ Y() ([]byte, bool)
+}
+
+type ecdsaPrivateKey struct {
+ algorithm *jwa.KeyAlgorithm // https://tools.ietf.org/html/rfc7517#section-4.4
+ crv *jwa.EllipticCurveAlgorithm
+ d []byte
+ keyID *string // https://tools.ietf.org/html/rfc7515#section-4.1.4
+ keyOps *KeyOperationList // https://tools.ietf.org/html/rfc7517#section-4.3
+ keyUsage *string // https://tools.ietf.org/html/rfc7517#section-4.2
+ x []byte
+ x509CertChain *cert.Chain // https://tools.ietf.org/html/rfc7515#section-4.1.6
+ x509CertThumbprint *string // https://tools.ietf.org/html/rfc7515#section-4.1.7
+ x509CertThumbprintS256 *string // https://tools.ietf.org/html/rfc7515#section-4.1.8
+ x509URL *string // https://tools.ietf.org/html/rfc7515#section-4.1.5
+ y []byte
+ privateParams map[string]any
+ mu *sync.RWMutex
+ dc json.DecodeCtx
+}
+
+var _ ECDSAPrivateKey = &ecdsaPrivateKey{}
+var _ Key = &ecdsaPrivateKey{}
+
+func newECDSAPrivateKey() *ecdsaPrivateKey {
+ return &ecdsaPrivateKey{
+ mu: &sync.RWMutex{},
+ privateParams: make(map[string]any),
+ }
+}
+
+func (h ecdsaPrivateKey) KeyType() jwa.KeyType {
+ return jwa.EC()
+}
+
+func (h ecdsaPrivateKey) rlock() {
+ h.mu.RLock()
+}
+
+func (h ecdsaPrivateKey) runlock() {
+ h.mu.RUnlock()
+}
+
+func (h ecdsaPrivateKey) IsPrivate() bool {
+ return true
+}
+
+func (h *ecdsaPrivateKey) Algorithm() (jwa.KeyAlgorithm, bool) {
+ if h.algorithm != nil {
+ return *(h.algorithm), true
+ }
+ return nil, false
+}
+
+func (h *ecdsaPrivateKey) Crv() (jwa.EllipticCurveAlgorithm, bool) {
+ if h.crv != nil {
+ return *(h.crv), true
+ }
+ return jwa.InvalidEllipticCurve(), false
+}
+
+func (h *ecdsaPrivateKey) D() ([]byte, bool) {
+ if h.d != nil {
+ return h.d, true
+ }
+ return nil, false
+}
+
+func (h *ecdsaPrivateKey) KeyID() (string, bool) {
+ if h.keyID != nil {
+ return *(h.keyID), true
+ }
+ return "", false
+}
+
+func (h *ecdsaPrivateKey) KeyOps() (KeyOperationList, bool) {
+ if h.keyOps != nil {
+ return *(h.keyOps), true
+ }
+ return nil, false
+}
+
+func (h *ecdsaPrivateKey) KeyUsage() (string, bool) {
+ if h.keyUsage != nil {
+ return *(h.keyUsage), true
+ }
+ return "", false
+}
+
+func (h *ecdsaPrivateKey) X() ([]byte, bool) {
+ if h.x != nil {
+ return h.x, true
+ }
+ return nil, false
+}
+
+func (h *ecdsaPrivateKey) X509CertChain() (*cert.Chain, bool) {
+ return h.x509CertChain, true
+}
+
+func (h *ecdsaPrivateKey) X509CertThumbprint() (string, bool) {
+ if h.x509CertThumbprint != nil {
+ return *(h.x509CertThumbprint), true
+ }
+ return "", false
+}
+
+func (h *ecdsaPrivateKey) X509CertThumbprintS256() (string, bool) {
+ if h.x509CertThumbprintS256 != nil {
+ return *(h.x509CertThumbprintS256), true
+ }
+ return "", false
+}
+
+func (h *ecdsaPrivateKey) X509URL() (string, bool) {
+ if h.x509URL != nil {
+ return *(h.x509URL), true
+ }
+ return "", false
+}
+
+func (h *ecdsaPrivateKey) Y() ([]byte, bool) {
+ if h.y != nil {
+ return h.y, true
+ }
+ return nil, false
+}
+
+func (h *ecdsaPrivateKey) Has(name string) bool {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case KeyTypeKey:
+ return true
+ case AlgorithmKey:
+ return h.algorithm != nil
+ case ECDSACrvKey:
+ return h.crv != nil
+ case ECDSADKey:
+ return h.d != nil
+ case KeyIDKey:
+ return h.keyID != nil
+ case KeyOpsKey:
+ return h.keyOps != nil
+ case KeyUsageKey:
+ return h.keyUsage != nil
+ case ECDSAXKey:
+ return h.x != nil
+ case X509CertChainKey:
+ return h.x509CertChain != nil
+ case X509CertThumbprintKey:
+ return h.x509CertThumbprint != nil
+ case X509CertThumbprintS256Key:
+ return h.x509CertThumbprintS256 != nil
+ case X509URLKey:
+ return h.x509URL != nil
+ case ECDSAYKey:
+ return h.y != nil
+ default:
+ _, ok := h.privateParams[name]
+ return ok
+ }
+}
+
+func (h *ecdsaPrivateKey) Get(name string, dst any) error {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case KeyTypeKey:
+ if err := blackmagic.AssignIfCompatible(dst, h.KeyType()); err != nil {
+ return fmt.Errorf(`ecdsaPrivateKey.Get: failed to assign value for field %q to destination object: %w`, name, err)
+ }
+ case AlgorithmKey:
+ if h.algorithm == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.algorithm)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case ECDSACrvKey:
+ if h.crv == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.crv)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case ECDSADKey:
+ if h.d == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.d); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyIDKey:
+ if h.keyID == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyID)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyOpsKey:
+ if h.keyOps == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyOps)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyUsageKey:
+ if h.keyUsage == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyUsage)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case ECDSAXKey:
+ if h.x == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.x); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertChainKey:
+ if h.x509CertChain == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.x509CertChain); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertThumbprintKey:
+ if h.x509CertThumbprint == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprint)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertThumbprintS256Key:
+ if h.x509CertThumbprintS256 == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprintS256)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509URLKey:
+ if h.x509URL == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509URL)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case ECDSAYKey:
+ if h.y == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.y); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ default:
+ v, ok := h.privateParams[name]
+ if !ok {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, v); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ }
+ return nil
+}
+
+func (h *ecdsaPrivateKey) Set(name string, value any) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ return h.setNoLock(name, value)
+}
+
+func (h *ecdsaPrivateKey) setNoLock(name string, value any) error {
+ switch name {
+ case "kty":
+ return nil
+ case AlgorithmKey:
+ switch v := value.(type) {
+ case string, jwa.SignatureAlgorithm, jwa.KeyEncryptionAlgorithm, jwa.ContentEncryptionAlgorithm:
+ tmp, err := jwa.KeyAlgorithmFrom(v)
+ if err != nil {
+ return fmt.Errorf(`invalid algorithm for %q key: %w`, AlgorithmKey, err)
+ }
+ h.algorithm = &tmp
+ default:
+ return fmt.Errorf(`invalid type for %q key: %T`, AlgorithmKey, value)
+ }
+ return nil
+ case ECDSACrvKey:
+ if v, ok := value.(jwa.EllipticCurveAlgorithm); ok {
+ h.crv = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, ECDSACrvKey, value)
+ case ECDSADKey:
+ if v, ok := value.([]byte); ok {
+ h.d = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, ECDSADKey, value)
+ case KeyIDKey:
+ if v, ok := value.(string); ok {
+ h.keyID = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, KeyIDKey, value)
+ case KeyOpsKey:
+ var acceptor KeyOperationList
+ if err := acceptor.Accept(value); err != nil {
+ return fmt.Errorf(`invalid value for %s key: %w`, KeyOpsKey, err)
+ }
+ h.keyOps = &acceptor
+ return nil
+ case KeyUsageKey:
+ switch v := value.(type) {
+ case KeyUsageType:
+ switch v {
+ case ForSignature, ForEncryption:
+ tmp := v.String()
+ h.keyUsage = &tmp
+ default:
+ return fmt.Errorf(`invalid key usage type %s`, v)
+ }
+ case string:
+ h.keyUsage = &v
+ default:
+ return fmt.Errorf(`invalid key usage type %s`, v)
+ }
+ case ECDSAXKey:
+ if v, ok := value.([]byte); ok {
+ h.x = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, ECDSAXKey, value)
+ case X509CertChainKey:
+ if v, ok := value.(*cert.Chain); ok {
+ h.x509CertChain = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertChainKey, value)
+ case X509CertThumbprintKey:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprint = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintKey, value)
+ case X509CertThumbprintS256Key:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprintS256 = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintS256Key, value)
+ case X509URLKey:
+ if v, ok := value.(string); ok {
+ h.x509URL = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509URLKey, value)
+ case ECDSAYKey:
+ if v, ok := value.([]byte); ok {
+ h.y = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, ECDSAYKey, value)
+ default:
+ if h.privateParams == nil {
+ h.privateParams = map[string]any{}
+ }
+ h.privateParams[name] = value
+ }
+ return nil
+}
+
+func (k *ecdsaPrivateKey) Remove(key string) error {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+ switch key {
+ case AlgorithmKey:
+ k.algorithm = nil
+ case ECDSACrvKey:
+ k.crv = nil
+ case ECDSADKey:
+ k.d = nil
+ case KeyIDKey:
+ k.keyID = nil
+ case KeyOpsKey:
+ k.keyOps = nil
+ case KeyUsageKey:
+ k.keyUsage = nil
+ case ECDSAXKey:
+ k.x = nil
+ case X509CertChainKey:
+ k.x509CertChain = nil
+ case X509CertThumbprintKey:
+ k.x509CertThumbprint = nil
+ case X509CertThumbprintS256Key:
+ k.x509CertThumbprintS256 = nil
+ case X509URLKey:
+ k.x509URL = nil
+ case ECDSAYKey:
+ k.y = nil
+ default:
+ delete(k.privateParams, key)
+ }
+ return nil
+}
+
+func (k *ecdsaPrivateKey) Clone() (Key, error) {
+ key, err := cloneKey(k)
+ if err != nil {
+ return nil, fmt.Errorf(`ecdsaPrivateKey.Clone: %w`, err)
+ }
+ return key, nil
+}
+
+func (k *ecdsaPrivateKey) DecodeCtx() json.DecodeCtx {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+ return k.dc
+}
+
+func (k *ecdsaPrivateKey) SetDecodeCtx(dc json.DecodeCtx) {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+ k.dc = dc
+}
+
+func (h *ecdsaPrivateKey) UnmarshalJSON(buf []byte) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ h.algorithm = nil
+ h.crv = nil
+ h.d = nil
+ h.keyID = nil
+ h.keyOps = nil
+ h.keyUsage = nil
+ h.x = nil
+ h.x509CertChain = nil
+ h.x509CertThumbprint = nil
+ h.x509CertThumbprintS256 = nil
+ h.x509URL = nil
+ h.y = nil
+ dec := json.NewDecoder(bytes.NewReader(buf))
+LOOP:
+ for {
+ tok, err := dec.Token()
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ switch tok := tok.(type) {
+ case json.Delim:
+ // Assuming we're doing everything correctly, we should ONLY
+ // get either tokens.OpenCurlyBracket or tokens.CloseCurlyBracket here.
+ if tok == tokens.CloseCurlyBracket { // End of object
+ break LOOP
+ } else if tok != tokens.OpenCurlyBracket {
+ return fmt.Errorf(`expected '%c' but got '%c'`, tokens.OpenCurlyBracket, tok)
+ }
+ case string: // Objects can only have string keys
+ switch tok {
+ case KeyTypeKey:
+ val, err := json.ReadNextStringToken(dec)
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ if val != jwa.EC().String() {
+ return fmt.Errorf(`invalid kty value for RSAPublicKey (%s)`, val)
+ }
+ case AlgorithmKey:
+ var s string
+ if err := dec.Decode(&s); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AlgorithmKey, err)
+ }
+ alg, err := jwa.KeyAlgorithmFrom(s)
+ if err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AlgorithmKey, err)
+ }
+ h.algorithm = &alg
+ case ECDSACrvKey:
+ var decoded jwa.EllipticCurveAlgorithm
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, ECDSACrvKey, err)
+ }
+ h.crv = &decoded
+ case ECDSADKey:
+ if err := json.AssignNextBytesToken(&h.d, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, ECDSADKey, err)
+ }
+ case KeyIDKey:
+ if err := json.AssignNextStringToken(&h.keyID, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyIDKey, err)
+ }
+ case KeyOpsKey:
+ var decoded KeyOperationList
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyOpsKey, err)
+ }
+ h.keyOps = &decoded
+ case KeyUsageKey:
+ if err := json.AssignNextStringToken(&h.keyUsage, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyUsageKey, err)
+ }
+ case ECDSAXKey:
+ if err := json.AssignNextBytesToken(&h.x, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, ECDSAXKey, err)
+ }
+ case X509CertChainKey:
+ var decoded cert.Chain
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertChainKey, err)
+ }
+ h.x509CertChain = &decoded
+ case X509CertThumbprintKey:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprint, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintKey, err)
+ }
+ case X509CertThumbprintS256Key:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprintS256, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintS256Key, err)
+ }
+ case X509URLKey:
+ if err := json.AssignNextStringToken(&h.x509URL, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509URLKey, err)
+ }
+ case ECDSAYKey:
+ if err := json.AssignNextBytesToken(&h.y, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, ECDSAYKey, err)
+ }
+ default:
+ if dc := h.dc; dc != nil {
+ if localReg := dc.Registry(); localReg != nil {
+ decoded, err := localReg.Decode(dec, tok)
+ if err == nil {
+ h.setNoLock(tok, decoded)
+ continue
+ }
+ }
+ }
+ decoded, err := registry.Decode(dec, tok)
+ if err == nil {
+ h.setNoLock(tok, decoded)
+ continue
+ }
+ return fmt.Errorf(`could not decode field %s: %w`, tok, err)
+ }
+ default:
+ return fmt.Errorf(`invalid token %T`, tok)
+ }
+ }
+ if h.crv == nil {
+ return fmt.Errorf(`required field crv is missing`)
+ }
+ if h.d == nil {
+ return fmt.Errorf(`required field d is missing`)
+ }
+ if h.x == nil {
+ return fmt.Errorf(`required field x is missing`)
+ }
+ if h.y == nil {
+ return fmt.Errorf(`required field y is missing`)
+ }
+ return nil
+}
+
+func (h ecdsaPrivateKey) MarshalJSON() ([]byte, error) {
+ data := make(map[string]any)
+ fields := make([]string, 0, 12)
+ data[KeyTypeKey] = jwa.EC()
+ fields = append(fields, KeyTypeKey)
+ if h.algorithm != nil {
+ data[AlgorithmKey] = *(h.algorithm)
+ fields = append(fields, AlgorithmKey)
+ }
+ if h.crv != nil {
+ data[ECDSACrvKey] = *(h.crv)
+ fields = append(fields, ECDSACrvKey)
+ }
+ if h.d != nil {
+ data[ECDSADKey] = h.d
+ fields = append(fields, ECDSADKey)
+ }
+ if h.keyID != nil {
+ data[KeyIDKey] = *(h.keyID)
+ fields = append(fields, KeyIDKey)
+ }
+ if h.keyOps != nil {
+ data[KeyOpsKey] = *(h.keyOps)
+ fields = append(fields, KeyOpsKey)
+ }
+ if h.keyUsage != nil {
+ data[KeyUsageKey] = *(h.keyUsage)
+ fields = append(fields, KeyUsageKey)
+ }
+ if h.x != nil {
+ data[ECDSAXKey] = h.x
+ fields = append(fields, ECDSAXKey)
+ }
+ if h.x509CertChain != nil {
+ data[X509CertChainKey] = h.x509CertChain
+ fields = append(fields, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ data[X509CertThumbprintKey] = *(h.x509CertThumbprint)
+ fields = append(fields, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ data[X509CertThumbprintS256Key] = *(h.x509CertThumbprintS256)
+ fields = append(fields, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ data[X509URLKey] = *(h.x509URL)
+ fields = append(fields, X509URLKey)
+ }
+ if h.y != nil {
+ data[ECDSAYKey] = h.y
+ fields = append(fields, ECDSAYKey)
+ }
+ for k, v := range h.privateParams {
+ data[k] = v
+ fields = append(fields, k)
+ }
+
+ sort.Strings(fields)
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+ buf.WriteByte(tokens.OpenCurlyBracket)
+ enc := json.NewEncoder(buf)
+ for i, f := range fields {
+ if i > 0 {
+ buf.WriteRune(tokens.Comma)
+ }
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(f)
+ buf.WriteString(`":`)
+ v := data[f]
+ switch v := v.(type) {
+ case []byte:
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(base64.EncodeToString(v))
+ buf.WriteRune(tokens.DoubleQuote)
+ default:
+ if err := enc.Encode(v); err != nil {
+ return nil, fmt.Errorf(`failed to encode value for field %s: %w`, f, err)
+ }
+ buf.Truncate(buf.Len() - 1)
+ }
+ }
+ buf.WriteByte(tokens.CloseCurlyBracket)
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ return ret, nil
+}
+
+func (h *ecdsaPrivateKey) Keys() []string {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ keys := make([]string, 0, 12+len(h.privateParams))
+ keys = append(keys, KeyTypeKey)
+ if h.algorithm != nil {
+ keys = append(keys, AlgorithmKey)
+ }
+ if h.crv != nil {
+ keys = append(keys, ECDSACrvKey)
+ }
+ if h.d != nil {
+ keys = append(keys, ECDSADKey)
+ }
+ if h.keyID != nil {
+ keys = append(keys, KeyIDKey)
+ }
+ if h.keyOps != nil {
+ keys = append(keys, KeyOpsKey)
+ }
+ if h.keyUsage != nil {
+ keys = append(keys, KeyUsageKey)
+ }
+ if h.x != nil {
+ keys = append(keys, ECDSAXKey)
+ }
+ if h.x509CertChain != nil {
+ keys = append(keys, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ keys = append(keys, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ keys = append(keys, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ keys = append(keys, X509URLKey)
+ }
+ if h.y != nil {
+ keys = append(keys, ECDSAYKey)
+ }
+ for k := range h.privateParams {
+ keys = append(keys, k)
+ }
+ return keys
+}
+
+var ecdsaStandardFields KeyFilter
+
+func init() {
+ ecdsaStandardFields = NewFieldNameFilter(KeyTypeKey, KeyUsageKey, KeyOpsKey, AlgorithmKey, KeyIDKey, X509URLKey, X509CertChainKey, X509CertThumbprintKey, X509CertThumbprintS256Key, ECDSACrvKey, ECDSAXKey, ECDSAYKey, ECDSADKey)
+}
+
+// ECDSAStandardFieldsFilter returns a KeyFilter that filters out standard ECDSA fields.
+func ECDSAStandardFieldsFilter() KeyFilter {
+ return ecdsaStandardFields
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/errors.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/errors.go
new file mode 100644
index 0000000000..af7e00d952
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/errors.go
@@ -0,0 +1,79 @@
+package jwk
+
+import (
+ "errors"
+ "fmt"
+)
+
+var cpe = &continueError{}
+
+// ContinueError returns an opaque error that can be returned
+// when a `KeyParser`, `KeyImporter`, or `KeyExporter` cannot handle the given payload,
+// but would like the process to continue with the next handler.
+func ContinueError() error {
+ return cpe
+}
+
+type continueError struct{}
+
+func (e *continueError) Error() string {
+ return "continue parsing"
+}
+
+type importError struct {
+ error
+}
+
+func (e importError) Unwrap() error {
+ return e.error
+}
+
+func (importError) Is(err error) bool {
+ _, ok := err.(importError)
+ return ok
+}
+
+func importerr(f string, args ...any) error {
+ return importError{fmt.Errorf(`jwk.Import: `+f, args...)}
+}
+
+var errDefaultImportError = importError{errors.New(`import error`)}
+
+func ImportError() error {
+ return errDefaultImportError
+}
+
+type parseError struct {
+ error
+}
+
+func (e parseError) Unwrap() error {
+ return e.error
+}
+
+func (parseError) Is(err error) bool {
+ _, ok := err.(parseError)
+ return ok
+}
+
+func bparseerr(prefix string, f string, args ...any) error {
+ return parseError{fmt.Errorf(prefix+`: `+f, args...)}
+}
+
+func parseerr(f string, args ...any) error {
+ return bparseerr(`jwk.Parse`, f, args...)
+}
+
+func rparseerr(f string, args ...any) error {
+ return bparseerr(`jwk.ParseReader`, f, args...)
+}
+
+func sparseerr(f string, args ...any) error {
+ return bparseerr(`jwk.ParseString`, f, args...)
+}
+
+var errDefaultParseError = parseError{errors.New(`parse error`)}
+
+func ParseError() error {
+ return errDefaultParseError
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/es256k.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/es256k.go
new file mode 100644
index 0000000000..293988db4b
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/es256k.go
@@ -0,0 +1,13 @@
+//go:build jwx_es256k
+
+package jwk
+
+import (
+ "github.com/decred/dcrd/dcrec/secp256k1/v4"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ ourecdsa "github.com/lestrrat-go/jwx/v3/jwk/ecdsa"
+)
+
+func init() {
+ ourecdsa.RegisterCurve(jwa.Secp256k1(), secp256k1.S256())
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/fetch.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/fetch.go
new file mode 100644
index 0000000000..2c80a369dc
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/fetch.go
@@ -0,0 +1,117 @@
+package jwk
+
+import (
+ "context"
+ "fmt"
+ "io"
+ "net/http"
+)
+
+// Fetcher is an interface that represents an object that fetches a JWKS.
+// Currently this is only used in the `jws.WithVerifyAuto` option.
+//
+// Particularly, do not confuse this as the backend to `jwk.Fetch()` function.
+// If you need to control how `jwk.Fetch()` implements HTTP requests look into
+// providing a custom `http.Client` object via `jwk.WithHTTPClient` option
+type Fetcher interface {
+ Fetch(context.Context, string, ...FetchOption) (Set, error)
+}
+
+// FetchFunc describes a type of Fetcher that is represented as a function.
+//
+// You can use this to wrap functions (e.g. `jwk.Fetch“) as a Fetcher object.
+type FetchFunc func(context.Context, string, ...FetchOption) (Set, error)
+
+func (ff FetchFunc) Fetch(ctx context.Context, u string, options ...FetchOption) (Set, error) {
+ return ff(ctx, u, options...)
+}
+
+// CachedFetcher wraps `jwk.Cache` so that it can be used as a `jwk.Fetcher`.
+//
+// One notable diffence from a general use fetcher is that `jwk.CachedFetcher`
+// can only be used with JWKS URLs that have been registered with the cache.
+// Please read the documentation fo `(jwk.CachedFetcher).Fetch` for more details.
+//
+// This object is intended to be used with `jws.WithVerifyAuto` option, specifically
+// for a scenario where there is a very small number of JWKS URLs that are trusted
+// and used to verify JWS messages. It is NOT meant to be used as a general purpose
+// caching fetcher object.
+type CachedFetcher struct {
+ cache *Cache
+}
+
+// NewCachedFetcher creates a new `jwk.CachedFetcher` object.
+func NewCachedFetcher(cache *Cache) *CachedFetcher {
+ return &CachedFetcher{cache}
+}
+
+// Fetch fetches a JWKS from the cache. If the JWKS URL has not been registered with
+// the cache, an error is returned.
+func (f *CachedFetcher) Fetch(ctx context.Context, u string, _ ...FetchOption) (Set, error) {
+ if !f.cache.IsRegistered(ctx, u) {
+ return nil, fmt.Errorf(`jwk.CachedFetcher: url %q has not been registered`, u)
+ }
+ return f.cache.Lookup(ctx, u)
+}
+
+// Fetch fetches a JWK resource specified by a URL. The url must be
+// pointing to a resource that is supported by `net/http`.
+//
+// This function is just a wrapper around `net/http` and `jwk.Parse`.
+// There is nothing special here, so you are safe to use your own
+// mechanism to fetch the JWKS.
+//
+// If you are using the same `jwk.Set` for long periods of time during
+// the lifecycle of your program, and would like to periodically refresh the
+// contents of the object with the data at the remote resource,
+// consider using `jwk.Cache`, which automatically refreshes
+// jwk.Set objects asynchronously.
+func Fetch(ctx context.Context, u string, options ...FetchOption) (Set, error) {
+ var parseOptions []ParseOption
+ //nolint:revive // I want to keep the type of `wl` as `Whitelist` instead of `InsecureWhitelist`
+ var wl Whitelist = InsecureWhitelist{}
+ var client HTTPClient = http.DefaultClient
+ for _, option := range options {
+ if parseOpt, ok := option.(ParseOption); ok {
+ parseOptions = append(parseOptions, parseOpt)
+ continue
+ }
+
+ switch option.Ident() {
+ case identHTTPClient{}:
+ if err := option.Value(&client); err != nil {
+ return nil, fmt.Errorf(`failed to retrieve HTTPClient option value: %w`, err)
+ }
+ case identFetchWhitelist{}:
+ if err := option.Value(&wl); err != nil {
+ return nil, fmt.Errorf(`failed to retrieve fetch whitelist option value: %w`, err)
+ }
+ }
+ }
+
+ if !wl.IsAllowed(u) {
+ return nil, fmt.Errorf(`jwk.Fetch: url %q has been rejected by whitelist`, u)
+ }
+
+ req, err := http.NewRequestWithContext(ctx, http.MethodGet, u, nil)
+ if err != nil {
+ return nil, fmt.Errorf(`jwk.Fetch: failed to create new request: %w`, err)
+ }
+
+ res, err := client.Do(req)
+ if err != nil {
+ return nil, fmt.Errorf(`jwk.Fetch: request failed: %w`, err)
+ }
+ defer res.Body.Close()
+
+ if res.StatusCode != http.StatusOK {
+ return nil, fmt.Errorf(`jwk.Fetch: request returned status %d, expected 200`, res.StatusCode)
+ }
+
+ buf, err := io.ReadAll(res.Body)
+ if err != nil {
+ return nil, fmt.Errorf(`jwk.Fetch: failed to read response body for %q: %w`, u, err)
+ }
+
+ return Parse(buf, parseOptions...)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/filter.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/filter.go
new file mode 100644
index 0000000000..e73b0757da
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/filter.go
@@ -0,0 +1,28 @@
+package jwk
+
+import (
+ "github.com/lestrrat-go/jwx/v3/transform"
+)
+
+// KeyFilter is an interface that allows users to filter JWK key fields.
+// It provides two methods: Filter and Reject; Filter returns a new key with only
+// the fields that match the filter criteria, while Reject returns a new key with
+// only the fields that DO NOT match the filter.
+//
+// EXPERIMENTAL: This API is experimental and its interface and behavior is
+// subject to change in future releases. This API is not subject to semver
+// compatibility guarantees.
+type KeyFilter interface {
+ Filter(key Key) (Key, error)
+ Reject(key Key) (Key, error)
+}
+
+// NewFieldNameFilter creates a new FieldNameFilter with the specified field names.
+//
+// Note that because some JWK fields are associated with the type instead of
+// stored as data, this filter will not be able to remove them. An example would
+// be the `kty` field: it's associated with the underlying JWK key type, and will
+// always be present even if you attempt to remove it.
+func NewFieldNameFilter(names ...string) KeyFilter {
+ return transform.NewNameBasedFilter[Key](names...)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/interface.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/interface.go
new file mode 100644
index 0000000000..c5a22a43fb
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/interface.go
@@ -0,0 +1,148 @@
+package jwk
+
+import (
+ "sync"
+
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+)
+
+// AsymmetricKey describes a Key that represents a key in an asymmetric key pair,
+// which in turn can be either a private or a public key. This interface
+// allows those keys to be queried if they are one or the other.
+type AsymmetricKey interface {
+ IsPrivate() bool
+}
+
+// KeyUsageType is used to denote what this key should be used for
+type KeyUsageType string
+
+const (
+ // ForSignature is the value used in the headers to indicate that
+ // this key should be used for signatures
+ ForSignature KeyUsageType = "sig"
+ // ForEncryption is the value used in the headers to indicate that
+ // this key should be used for encrypting
+ ForEncryption KeyUsageType = "enc"
+)
+
+type KeyOperation string
+type KeyOperationList []KeyOperation
+
+const (
+ KeyOpSign KeyOperation = "sign" // (compute digital signature or MAC)
+ KeyOpVerify KeyOperation = "verify" // (verify digital signature or MAC)
+ KeyOpEncrypt KeyOperation = "encrypt" // (encrypt content)
+ KeyOpDecrypt KeyOperation = "decrypt" // (decrypt content and validate decryption, if applicable)
+ KeyOpWrapKey KeyOperation = "wrapKey" // (encrypt key)
+ KeyOpUnwrapKey KeyOperation = "unwrapKey" // (decrypt key and validate decryption, if applicable)
+ KeyOpDeriveKey KeyOperation = "deriveKey" // (derive key)
+ KeyOpDeriveBits KeyOperation = "deriveBits" // (derive bits not to be used as a key)
+)
+
+// Set represents JWKS object, a collection of jwk.Key objects.
+//
+// Sets can be safely converted to and from JSON using the standard
+// `"encoding/json".Marshal` and `"encoding/json".Unmarshal`. However,
+// if you do not know if the payload contains a single JWK or a JWK set,
+// consider using `jwk.Parse()` to always get a `jwk.Set` out of it.
+//
+// Since v1.2.12, JWK sets with private parameters can be parsed as well.
+// Such private parameters can be accessed via the `Field()` method.
+// If a resource contains a single JWK instead of a JWK set, private parameters
+// are stored in _both_ the resulting `jwk.Set` object and the `jwk.Key` object .
+//
+//nolint:interfacebloat
+type Set interface {
+ // AddKey adds the specified key. If the key already exists in the set,
+ // an error is returned.
+ AddKey(Key) error
+
+ // Clear resets the list of keys associated with this set, emptying the
+ // internal list of `jwk.Key`s, as well as clearing any other non-key
+ // fields
+ Clear() error
+
+ // Get returns the key at index `idx`. If the index is out of range,
+ // then the second return value is false.
+ Key(int) (Key, bool)
+
+ // Get returns the value of a private field in the key set.
+ //
+ // For the purposes of a key set, any field other than the "keys" field is
+ // considered to be a private field. In other words, you cannot use this
+ // method to directly access the list of keys in the set
+ Get(string, any) error
+
+ // Set sets the value of a single field.
+ //
+ // This method, which takes an `any`, exists because
+ // these objects can contain extra _arbitrary_ fields that users can
+ // specify, and there is no way of knowing what type they could be.
+ Set(string, any) error
+
+ // Remove removes the specified non-key field from the set.
+ // Keys may not be removed using this method. See RemoveKey for
+ // removing keys.
+ Remove(string) error
+
+ // Index returns the index where the given key exists, -1 otherwise
+ Index(Key) int
+
+ // Len returns the number of keys in the set
+ Len() int
+
+ // LookupKeyID returns the first key matching the given key id.
+ //
+ // The second return value is false if there are no keys matching the key id.
+ // The set *may* contain multiple keys with the same key id. If you
+ // need all of them, Len() and Key(int)
+ //
+ // This method is meant to be used to lookup a key with a unique ID.
+ // Bacauseof this, you cannot use this method to lookup keys with an empty key ID
+ // (i.e. `kid` is not specified, or is an empty string).
+ LookupKeyID(string) (Key, bool)
+
+ // RemoveKey removes the key from the set.
+ // RemoveKey returns an error when the specified key does not exist
+ // in set.
+ RemoveKey(Key) error
+
+ // Keys returns the list of keys present in the Set, except for `keys`.
+ // e.g. if you had `{"keys": ["a", "b"], "c": .., "d": ...}`, this method would
+ // return `["c", "d"]`. Note that the order of the keys is not guaranteed.
+ //
+ // TODO: name is confusing between this and Key()
+ Keys() []string
+
+ // Clone create a new set with identical keys. Keys themselves are not cloned.
+ Clone() (Set, error)
+}
+
+type set struct {
+ keys []Key
+ mu sync.RWMutex
+ dc DecodeCtx
+ privateParams map[string]any
+}
+
+type PublicKeyer interface {
+ // PublicKey creates the corresponding PublicKey type for this object.
+ // All fields are copied onto the new public key, except for those that are not allowed.
+ // Returned value must not be the receiver itself.
+ PublicKey() (Key, error)
+}
+
+type DecodeCtx interface {
+ json.DecodeCtx
+ IgnoreParseError() bool
+}
+type KeyWithDecodeCtx interface {
+ SetDecodeCtx(DecodeCtx)
+ DecodeCtx() DecodeCtx
+}
+
+// Used internally: It's used to lock a key
+type rlocker interface {
+ rlock()
+ runlock()
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/interface_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/interface_gen.go
new file mode 100644
index 0000000000..4f23d96cb0
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/interface_gen.go
@@ -0,0 +1,109 @@
+// Code generated by tools/cmd/genjwk/main.go. DO NOT EDIT.
+
+package jwk
+
+import (
+ "crypto"
+
+ "github.com/lestrrat-go/jwx/v3/cert"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+const (
+ KeyTypeKey = "kty"
+ KeyUsageKey = "use"
+ KeyOpsKey = "key_ops"
+ AlgorithmKey = "alg"
+ KeyIDKey = "kid"
+ X509URLKey = "x5u"
+ X509CertChainKey = "x5c"
+ X509CertThumbprintKey = "x5t"
+ X509CertThumbprintS256Key = "x5t#S256"
+)
+
+// Key defines the minimal interface for each of the
+// key types. Their use and implementation differ significantly
+// between each key type, so you should use type assertions
+// to perform more specific tasks with each key
+type Key interface {
+
+ // Has returns true if the specified field has a value, even if
+ // the value is empty-ish (e.g. 0, false, "") as long as it has been
+ // explicitly set.
+ Has(string) bool
+
+ // Get is used to extract the value of any field, including non-standard fields, out of the key.
+ //
+ // The first argument is the name of the field. The second argument is a pointer
+ // to a variable that will receive the value of the field. The method returns
+ // an error if the field does not exist, or if the value cannot be assigned to
+ // the destination variable. Note that a field is considered to "exist" even if
+ // the value is empty-ish (e.g. 0, false, ""), as long as it is explicitly set.
+ Get(string, any) error
+
+ // Set sets the value of a single field. Note that certain fields,
+ // notably "kty", cannot be altered, but will not return an error
+ //
+ // This method, which takes an `any`, exists because
+ // these objects can contain extra _arbitrary_ fields that users can
+ // specify, and there is no way of knowing what type they could be
+ Set(string, any) error
+
+ // Remove removes the field associated with the specified key.
+ // There is no way to remove the `kty` (key type). You will ALWAYS be left with one field in a jwk.Key.
+ Remove(string) error
+ // Validate performs _minimal_ checks if the data stored in the key are valid.
+ // By minimal, we mean that it does not check if the key is valid for use in
+ // cryptographic operations. For example, it does not check if an RSA key's
+ // `e` field is a valid exponent, or if the `n` field is a valid modulus.
+ // Instead, it checks for things such as the _presence_ of some required fields,
+ // or if certain keys' values are of particular length.
+ //
+ // Note that depending on th underlying key type, use of this method requires
+ // that multiple fields in the key are properly populated. For example, an EC
+ // key's "x", "y" fields cannot be validated unless the "crv" field is populated first.
+ //
+ // Validate is never called by `UnmarshalJSON()` or `Set`. It must explicitly be
+ // called by the user
+ Validate() error
+
+ // Thumbprint returns the JWK thumbprint using the indicated
+ // hashing algorithm, according to RFC 7638
+ Thumbprint(crypto.Hash) ([]byte, error)
+
+ // Keys returns a list of the keys contained in this jwk.Key.
+ Keys() []string
+
+ // Clone creates a new instance of the same type
+ Clone() (Key, error)
+
+ // PublicKey creates the corresponding PublicKey type for this object.
+ // All fields are copied onto the new public key, except for those that are not allowed.
+ //
+ // If the key is already a public key, it returns a new copy minus the disallowed fields as above.
+ PublicKey() (Key, error)
+
+ // KeyType returns the `kty` of a JWK
+ KeyType() jwa.KeyType
+ // KeyUsage returns `use` of a JWK
+ KeyUsage() (string, bool)
+ // KeyOps returns `key_ops` of a JWK
+ KeyOps() (KeyOperationList, bool)
+ // Algorithm returns `alg` of a JWK
+
+ // Algorithm returns the value of the `alg` field.
+ //
+ // This field may contain either `jwk.SignatureAlgorithm`, `jwk.KeyEncryptionAlgorithm`, or `jwk.ContentEncryptionAlgorithm`.
+ // This is why there exists a `jwa.KeyAlgorithm` type that encompasses both types.
+ Algorithm() (jwa.KeyAlgorithm, bool)
+ // KeyID returns `kid` of a JWK
+ KeyID() (string, bool)
+ // X509URL returns `x5u` of a JWK
+ X509URL() (string, bool)
+ // X509CertChain returns `x5c` of a JWK
+ X509CertChain() (*cert.Chain, bool)
+ // X509CertThumbprint returns `x5t` of a JWK
+ X509CertThumbprint() (string, bool)
+ // X509CertThumbprintS256 returns `x5t#S256` of a JWK
+ X509CertThumbprintS256() (string, bool)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/io.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/io.go
new file mode 100644
index 0000000000..29b30274cc
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/io.go
@@ -0,0 +1,42 @@
+// Code generated by tools/cmd/genreadfile/main.go. DO NOT EDIT.
+
+package jwk
+
+import (
+ "fmt"
+ "io/fs"
+ "os"
+)
+
+type sysFS struct{}
+
+func (sysFS) Open(path string) (fs.File, error) {
+ return os.Open(path)
+}
+
+func ReadFile(path string, options ...ReadFileOption) (Set, error) {
+ var parseOptions []ParseOption
+ for _, option := range options {
+ if po, ok := option.(ParseOption); ok {
+ parseOptions = append(parseOptions, po)
+ }
+ }
+
+ var srcFS fs.FS = sysFS{}
+ for _, option := range options {
+ switch option.Ident() {
+ case identFS{}:
+ if err := option.Value(&srcFS); err != nil {
+ return nil, fmt.Errorf("failed to set fs.FS: %w", err)
+ }
+ }
+ }
+
+ f, err := srcFS.Open(path)
+ if err != nil {
+ return nil, err
+ }
+
+ defer f.Close()
+ return ParseReader(f, parseOptions...)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/jwk.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/jwk.go
new file mode 100644
index 0000000000..22d4950d8f
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/jwk.go
@@ -0,0 +1,710 @@
+//go:generate ../tools/cmd/genjwk.sh
+
+package jwk
+
+import (
+ "bytes"
+ "crypto"
+ "crypto/ecdsa"
+ "crypto/x509"
+ "encoding/pem"
+ "errors"
+ "fmt"
+ "io"
+ "math/big"
+ "reflect"
+ "slices"
+
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+)
+
+var registry = json.NewRegistry()
+
+func bigIntToBytes(n *big.Int) ([]byte, error) {
+ if n == nil {
+ return nil, fmt.Errorf(`invalid *big.Int value`)
+ }
+ return n.Bytes(), nil
+}
+
+func init() {
+ if err := RegisterProbeField(reflect.StructField{
+ Name: "Kty",
+ Type: reflect.TypeFor[string](),
+ Tag: `json:"kty"`,
+ }); err != nil {
+ panic(fmt.Errorf("failed to register mandatory probe for 'kty' field: %w", err))
+ }
+ if err := RegisterProbeField(reflect.StructField{
+ Name: "D",
+ Type: reflect.TypeFor[json.RawMessage](),
+ Tag: `json:"d,omitempty"`,
+ }); err != nil {
+ panic(fmt.Errorf("failed to register mandatory probe for 'kty' field: %w", err))
+ }
+}
+
+// Import creates a jwk.Key from the given key (RSA/ECDSA/symmetric keys).
+//
+// The constructor auto-detects the type of key to be instantiated
+// based on the input type:
+//
+// - "crypto/rsa".PrivateKey and "crypto/rsa".PublicKey creates an RSA based key
+// - "crypto/ecdsa".PrivateKey and "crypto/ecdsa".PublicKey creates an EC based key
+// - "crypto/ed25519".PrivateKey and "crypto/ed25519".PublicKey creates an OKP based key
+// - "crypto/ecdh".PrivateKey and "crypto/ecdh".PublicKey creates an OKP based key
+// - []byte creates a symmetric key
+func Import(raw any) (Key, error) {
+ if raw == nil {
+ return nil, importerr(`a non-nil key is required`)
+ }
+
+ muKeyImporters.RLock()
+ conv, ok := keyImporters[reflect.TypeOf(raw)]
+ muKeyImporters.RUnlock()
+ if !ok {
+ return nil, importerr(`failed to convert %T to jwk.Key: no converters were able to convert`, raw)
+ }
+
+ return conv.Import(raw)
+}
+
+// PublicSetOf returns a new jwk.Set consisting of
+// public keys of the keys contained in the set.
+//
+// This is useful when you are generating a set of private keys, and
+// you want to generate the corresponding public versions for the
+// users to verify with.
+//
+// Be aware that all fields will be copied onto the new public key. It is the caller's
+// responsibility to remove any fields, if necessary.
+func PublicSetOf(v Set) (Set, error) {
+ newSet := NewSet()
+
+ n := v.Len()
+ for i := range n {
+ k, ok := v.Key(i)
+ if !ok {
+ return nil, fmt.Errorf(`key not found`)
+ }
+ pubKey, err := PublicKeyOf(k)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to get public key of %T: %w`, k, err)
+ }
+ if err := newSet.AddKey(pubKey); err != nil {
+ return nil, fmt.Errorf(`failed to add key to public key set: %w`, err)
+ }
+ }
+
+ return newSet, nil
+}
+
+// PublicKeyOf returns the corresponding public version of the jwk.Key.
+// If `v` is a SymmetricKey, then the same value is returned.
+// If `v` is already a public key, the key itself is returned.
+//
+// If `v` is a private key type that has a `PublicKey()` method, be aware
+// that all fields will be copied onto the new public key. It is the caller's
+// responsibility to remove any fields, if necessary
+//
+// If `v` is a raw key, the key is first converted to a `jwk.Key`
+func PublicKeyOf(v any) (Key, error) {
+ // This should catch all jwk.Key instances
+ if pk, ok := v.(PublicKeyer); ok {
+ return pk.PublicKey()
+ }
+
+ jk, err := Import(v)
+ if err != nil {
+ return nil, fmt.Errorf(`jwk.PublicKeyOf: failed to convert key into JWK: %w`, err)
+ }
+
+ return jk.PublicKey()
+}
+
+// PublicRawKeyOf returns the corresponding public key of the given
+// value `v` (e.g. given *rsa.PrivateKey, *rsa.PublicKey is returned)
+// If `v` is already a public key, the key itself is returned.
+//
+// The returned value will always be a pointer to the public key,
+// except when a []byte (e.g. symmetric key, ed25519 key) is passed to `v`.
+// In this case, the same []byte value is returned.
+//
+// This function must go through converting the object once to a jwk.Key,
+// then back to a raw key, so it's not exactly efficient.
+func PublicRawKeyOf(v any) (any, error) {
+ pk, ok := v.(PublicKeyer)
+ if !ok {
+ k, err := Import(v)
+ if err != nil {
+ return nil, fmt.Errorf(`jwk.PublicRawKeyOf: failed to convert key to jwk.Key: %w`, err)
+ }
+
+ pk, ok = k.(PublicKeyer)
+ if !ok {
+ return nil, fmt.Errorf(`jwk.PublicRawKeyOf: failed to convert key to jwk.PublicKeyer: %w`, err)
+ }
+ }
+
+ pubk, err := pk.PublicKey()
+ if err != nil {
+ return nil, fmt.Errorf(`jwk.PublicRawKeyOf: failed to obtain public key from %T: %w`, v, err)
+ }
+
+ var raw any
+ if err := Export(pubk, &raw); err != nil {
+ return nil, fmt.Errorf(`jwk.PublicRawKeyOf: failed to obtain raw key from %T: %w`, pubk, err)
+ }
+ return raw, nil
+}
+
+// ParseRawKey is a combination of ParseKey and Raw. It parses a single JWK key,
+// and assigns the "raw" key to the given parameter. The key must either be
+// a pointer to an empty interface, or a pointer to the actual raw key type
+// such as *rsa.PrivateKey, *ecdsa.PublicKey, *[]byte, etc.
+func ParseRawKey(data []byte, rawkey any) error {
+ key, err := ParseKey(data)
+ if err != nil {
+ return fmt.Errorf(`failed to parse key: %w`, err)
+ }
+
+ if err := Export(key, rawkey); err != nil {
+ return fmt.Errorf(`failed to assign to raw key variable: %w`, err)
+ }
+
+ return nil
+}
+
+type setDecodeCtx struct {
+ json.DecodeCtx
+
+ ignoreParseError bool
+}
+
+func (ctx *setDecodeCtx) IgnoreParseError() bool {
+ return ctx.ignoreParseError
+}
+
+// ParseKey parses a single key JWK. Unlike `jwk.Parse` this method will
+// report failure if you attempt to pass a JWK set. Only use this function
+// when you know that the data is a single JWK.
+//
+// Given a WithPEM(true) option, this function assumes that the given input
+// is PEM encoded ASN.1 DER format key.
+//
+// Note that a successful parsing of any type of key does NOT necessarily
+// guarantee a valid key. For example, no checks against expiration dates
+// are performed for certificate expiration, no checks against missing
+// parameters are performed, etc.
+func ParseKey(data []byte, options ...ParseOption) (Key, error) {
+ var parsePEM bool
+ var localReg *json.Registry
+ var pemDecoder PEMDecoder
+ for _, option := range options {
+ switch option.Ident() {
+ case identPEM{}:
+ if err := option.Value(&parsePEM); err != nil {
+ return nil, fmt.Errorf(`failed to retrieve PEM option value: %w`, err)
+ }
+ case identPEMDecoder{}:
+ if err := option.Value(&pemDecoder); err != nil {
+ return nil, fmt.Errorf(`failed to retrieve PEMDecoder option value: %w`, err)
+ }
+ case identLocalRegistry{}:
+ if err := option.Value(&localReg); err != nil {
+ return nil, fmt.Errorf(`failed to retrieve local registry option value: %w`, err)
+ }
+ case identTypedField{}:
+ var pair typedFieldPair // temporary var needed for typed field
+ if err := option.Value(&pair); err != nil {
+ return nil, fmt.Errorf(`failed to retrieve typed field option value: %w`, err)
+ }
+ if localReg == nil {
+ localReg = json.NewRegistry()
+ }
+ localReg.Register(pair.Name, pair.Value)
+ case identIgnoreParseError{}:
+ return nil, fmt.Errorf(`jwk.WithIgnoreParseError() cannot be used for ParseKey()`)
+ }
+ }
+
+ if parsePEM {
+ var raw any
+
+ // PEMDecoder should probably be deprecated, because of being a misnomer.
+ if pemDecoder != nil {
+ if err := decodeX509WithPEMDEcoder(&raw, data, pemDecoder); err != nil {
+ return nil, fmt.Errorf(`failed to decode PEM encoded key: %w`, err)
+ }
+ } else {
+ // This version takes into account the various X509 decoders that are
+ // pre-registered.
+ if err := decodeX509(&raw, data); err != nil {
+ return nil, fmt.Errorf(`failed to decode X.509 encoded key: %w`, err)
+ }
+ }
+ return Import(raw)
+ }
+
+ probe, err := keyProbe.Probe(data)
+ if err != nil {
+ return nil, fmt.Errorf(`jwk.Parse: failed to probe data: %w`, err)
+ }
+
+ unmarshaler := keyUnmarshaler{localReg: localReg}
+
+ muKeyParser.RLock()
+ parsers := make([]KeyParser, len(keyParsers))
+ copy(parsers, keyParsers)
+ muKeyParser.RUnlock()
+
+ for i := len(parsers) - 1; i >= 0; i-- {
+ parser := parsers[i]
+ key, err := parser.ParseKey(probe, &unmarshaler, data)
+ if err == nil {
+ return key, nil
+ }
+
+ if errors.Is(err, ContinueError()) {
+ continue
+ }
+
+ return nil, err
+ }
+ return nil, fmt.Errorf(`jwk.Parse: no parser was able to parse the key`)
+}
+
+// Parse parses JWK from the incoming []byte.
+//
+// For JWK sets, this is a convenience function. You could just as well
+// call `json.Unmarshal` against an empty set created by `jwk.NewSet()`
+// to parse a JSON buffer into a `jwk.Set`.
+//
+// This function exists because many times the user does not know before hand
+// if a JWK(s) resource at a remote location contains a single JWK key or
+// a JWK set, and `jwk.Parse()` can handle either case, returning a JWK Set
+// even if the data only contains a single JWK key
+//
+// If you are looking for more information on how JWKs are parsed, or if
+// you know for sure that you have a single key, please see the documentation
+// for `jwk.ParseKey()`.
+func Parse(src []byte, options ...ParseOption) (Set, error) {
+ var parsePEM bool
+ var parseX509 bool
+ var localReg *json.Registry
+ var ignoreParseError bool
+ var pemDecoder PEMDecoder
+ for _, option := range options {
+ switch option.Ident() {
+ case identPEM{}:
+ if err := option.Value(&parsePEM); err != nil {
+ return nil, parseerr(`failed to retrieve PEM option value: %w`, err)
+ }
+ case identX509{}:
+ if err := option.Value(&parseX509); err != nil {
+ return nil, parseerr(`failed to retrieve X509 option value: %w`, err)
+ }
+ case identPEMDecoder{}:
+ if err := option.Value(&pemDecoder); err != nil {
+ return nil, parseerr(`failed to retrieve PEMDecoder option value: %w`, err)
+ }
+ case identIgnoreParseError{}:
+ if err := option.Value(&ignoreParseError); err != nil {
+ return nil, parseerr(`failed to retrieve IgnoreParseError option value: %w`, err)
+ }
+ case identTypedField{}:
+ var pair typedFieldPair // temporary var needed for typed field
+ if err := option.Value(&pair); err != nil {
+ return nil, parseerr(`failed to retrieve typed field option value: %w`, err)
+ }
+ if localReg == nil {
+ localReg = json.NewRegistry()
+ }
+ localReg.Register(pair.Name, pair.Value)
+ }
+ }
+
+ s := NewSet()
+
+ if parsePEM || parseX509 {
+ if pemDecoder == nil {
+ pemDecoder = NewPEMDecoder()
+ }
+ src = bytes.TrimSpace(src)
+ for len(src) > 0 {
+ raw, rest, err := pemDecoder.Decode(src)
+ if err != nil {
+ return nil, parseerr(`failed to parse PEM encoded key: %w`, err)
+ }
+ key, err := Import(raw)
+ if err != nil {
+ return nil, parseerr(`failed to create jwk.Key from %T: %w`, raw, err)
+ }
+ if err := s.AddKey(key); err != nil {
+ return nil, parseerr(`failed to add jwk.Key to set: %w`, err)
+ }
+ src = bytes.TrimSpace(rest)
+ }
+ return s, nil
+ }
+
+ if localReg != nil || ignoreParseError {
+ dcKs, ok := s.(KeyWithDecodeCtx)
+ if !ok {
+ return nil, parseerr(`typed field was requested, but the key set (%T) does not support DecodeCtx`, s)
+ }
+ dc := &setDecodeCtx{
+ DecodeCtx: json.NewDecodeCtx(localReg),
+ ignoreParseError: ignoreParseError,
+ }
+ dcKs.SetDecodeCtx(dc)
+ defer func() { dcKs.SetDecodeCtx(nil) }()
+ }
+
+ if err := json.Unmarshal(src, s); err != nil {
+ return nil, parseerr(`failed to unmarshal JWK set: %w`, err)
+ }
+
+ return s, nil
+}
+
+// ParseReader parses a JWK set from the incoming byte buffer.
+func ParseReader(src io.Reader, options ...ParseOption) (Set, error) {
+ // meh, there's no way to tell if a stream has "ended" a single
+ // JWKs except when we encounter an EOF, so just... ReadAll
+ buf, err := io.ReadAll(src)
+ if err != nil {
+ return nil, rparseerr(`failed to read from io.Reader: %w`, err)
+ }
+
+ set, err := Parse(buf, options...)
+ if err != nil {
+ return nil, rparseerr(`failed to parse reader: %w`, err)
+ }
+ return set, nil
+}
+
+// ParseString parses a JWK set from the incoming string.
+func ParseString(s string, options ...ParseOption) (Set, error) {
+ set, err := Parse([]byte(s), options...)
+ if err != nil {
+ return nil, sparseerr(`failed to parse string: %w`, err)
+ }
+ return set, nil
+}
+
+// AssignKeyID is a convenience function to automatically assign the "kid"
+// section of the key, if it already doesn't have one. It uses Key.Thumbprint
+// method with crypto.SHA256 as the default hashing algorithm
+func AssignKeyID(key Key, options ...AssignKeyIDOption) error {
+ if key.Has(KeyIDKey) {
+ return nil
+ }
+
+ hash := crypto.SHA256
+ for _, option := range options {
+ switch option.Ident() {
+ case identThumbprintHash{}:
+ if err := option.Value(&hash); err != nil {
+ return fmt.Errorf(`failed to retrieve thumbprint hash option value: %w`, err)
+ }
+ }
+ }
+
+ h, err := key.Thumbprint(hash)
+ if err != nil {
+ return fmt.Errorf(`failed to generate thumbprint: %w`, err)
+ }
+
+ if err := key.Set(KeyIDKey, base64.EncodeToString(h)); err != nil {
+ return fmt.Errorf(`failed to set "kid": %w`, err)
+ }
+
+ return nil
+}
+
+// NOTE: may need to remove this to allow pluggale key types
+func cloneKey(src Key) (Key, error) {
+ var dst Key
+ switch src.(type) {
+ case RSAPrivateKey:
+ dst = newRSAPrivateKey()
+ case RSAPublicKey:
+ dst = newRSAPublicKey()
+ case ECDSAPrivateKey:
+ dst = newECDSAPrivateKey()
+ case ECDSAPublicKey:
+ dst = newECDSAPublicKey()
+ case OKPPrivateKey:
+ dst = newOKPPrivateKey()
+ case OKPPublicKey:
+ dst = newOKPPublicKey()
+ case SymmetricKey:
+ dst = newSymmetricKey()
+ default:
+ return nil, fmt.Errorf(`jwk.cloneKey: unknown key type %T`, src)
+ }
+
+ for _, k := range src.Keys() {
+ // It's absolutely
+ var v any
+ if err := src.Get(k, &v); err != nil {
+ return nil, fmt.Errorf(`jwk.cloneKey: failed to get %q: %w`, k, err)
+ }
+ if err := dst.Set(k, v); err != nil {
+ return nil, fmt.Errorf(`jwk.cloneKey: failed to set %q: %w`, k, err)
+ }
+ }
+ return dst, nil
+}
+
+// Pem serializes the given jwk.Key in PEM encoded ASN.1 DER format,
+// using either PKCS8 for private keys and PKIX for public keys.
+// If you need to encode using PKCS1 or SEC1, you must do it yourself.
+//
+// # Argument must be of type jwk.Key or jwk.Set
+//
+// Currently only EC (including Ed25519) and RSA keys (and jwk.Set
+// comprised of these key types) are supported.
+func Pem(v any) ([]byte, error) {
+ var set Set
+ switch v := v.(type) {
+ case Key:
+ set = NewSet()
+ if err := set.AddKey(v); err != nil {
+ return nil, fmt.Errorf(`failed to add key to set: %w`, err)
+ }
+ case Set:
+ set = v
+ default:
+ return nil, fmt.Errorf(`argument to Pem must be either jwk.Key or jwk.Set: %T`, v)
+ }
+
+ var ret []byte
+ for i := range set.Len() {
+ key, _ := set.Key(i)
+ typ, buf, err := asnEncode(key)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encode content for key #%d: %w`, i, err)
+ }
+
+ var block pem.Block
+ block.Type = typ
+ block.Bytes = buf
+ ret = append(ret, pem.EncodeToMemory(&block)...)
+ }
+ return ret, nil
+}
+
+func asnEncode(key Key) (string, []byte, error) {
+ switch key := key.(type) {
+ case ECDSAPrivateKey:
+ var rawkey ecdsa.PrivateKey
+ if err := Export(key, &rawkey); err != nil {
+ return "", nil, fmt.Errorf(`failed to get raw key from jwk.Key: %w`, err)
+ }
+ buf, err := x509.MarshalECPrivateKey(&rawkey)
+ if err != nil {
+ return "", nil, fmt.Errorf(`failed to marshal PKCS8: %w`, err)
+ }
+ return pmECPrivateKey, buf, nil
+ case RSAPrivateKey, OKPPrivateKey:
+ var rawkey any
+ if err := Export(key, &rawkey); err != nil {
+ return "", nil, fmt.Errorf(`failed to get raw key from jwk.Key: %w`, err)
+ }
+ buf, err := x509.MarshalPKCS8PrivateKey(rawkey)
+ if err != nil {
+ return "", nil, fmt.Errorf(`failed to marshal PKCS8: %w`, err)
+ }
+ return pmPrivateKey, buf, nil
+ case RSAPublicKey, ECDSAPublicKey, OKPPublicKey:
+ var rawkey any
+ if err := Export(key, &rawkey); err != nil {
+ return "", nil, fmt.Errorf(`failed to get raw key from jwk.Key: %w`, err)
+ }
+ buf, err := x509.MarshalPKIXPublicKey(rawkey)
+ if err != nil {
+ return "", nil, fmt.Errorf(`failed to marshal PKIX: %w`, err)
+ }
+ return pmPublicKey, buf, nil
+ default:
+ return "", nil, fmt.Errorf(`unsupported key type %T`, key)
+ }
+}
+
+type CustomDecoder = json.CustomDecoder
+type CustomDecodeFunc = json.CustomDecodeFunc
+
+// RegisterCustomField allows users to specify that a private field
+// be decoded as an instance of the specified type. This option has
+// a global effect.
+//
+// For example, suppose you have a custom field `x-birthday`, which
+// you want to represent as a string formatted in RFC3339 in JSON,
+// but want it back as `time.Time`.
+//
+// In such case you would register a custom field as follows
+//
+// jwk.RegisterCustomField(`x-birthday`, time.Time{})
+//
+// Then you can use a `time.Time` variable to extract the value
+// of `x-birthday` field, instead of having to use `any`
+// and later convert it to `time.Time`
+//
+// var bday time.Time
+// _ = key.Get(`x-birthday`, &bday)
+//
+// If you need a more fine-tuned control over the decoding process,
+// you can register a `CustomDecoder`. For example, below shows
+// how to register a decoder that can parse RFC1123 format string:
+//
+// jwk.RegisterCustomField(`x-birthday`, jwk.CustomDecodeFunc(func(data []byte) (any, error) {
+// return time.Parse(time.RFC1123, string(data))
+// }))
+//
+// Please note that use of custom fields can be problematic if you
+// are using a library that does not implement MarshalJSON/UnmarshalJSON
+// and you try to roundtrip from an object to JSON, and then back to an object.
+// For example, in the above example, you can _parse_ time values formatted
+// in the format specified in RFC822, but when you convert an object into
+// JSON, it will be formatted in RFC3339, because that's what `time.Time`
+// likes to do. To avoid this, it's always better to use a custom type
+// that wraps your desired type (in this case `time.Time`) and implement
+// MarshalJSON and UnmashalJSON.
+func RegisterCustomField(name string, object any) {
+ registry.Register(name, object)
+}
+
+// Equal compares two keys and returns true if they are equal. The comparison
+// is solely done against the thumbprints of k1 and k2. It is possible for keys
+// that have, for example, different key IDs, key usage, etc, to be considered equal.
+func Equal(k1, k2 Key) bool {
+ h := crypto.SHA256
+ tp1, err := k1.Thumbprint(h)
+ if err != nil {
+ return false // can't report error
+ }
+ tp2, err := k2.Thumbprint(h)
+ if err != nil {
+ return false // can't report error
+ }
+
+ return bytes.Equal(tp1, tp2)
+}
+
+// IsPrivateKey returns true if the supplied key is a private key of an
+// asymmetric key pair. The argument `k` must implement the `AsymmetricKey`
+// interface.
+//
+// An error is returned if the supplied key is not an `AsymmetricKey`.
+func IsPrivateKey(k Key) (bool, error) {
+ asymmetric, ok := k.(AsymmetricKey)
+ if ok {
+ return asymmetric.IsPrivate(), nil
+ }
+ return false, fmt.Errorf("jwk.IsPrivateKey: %T is not an asymmetric key", k)
+}
+
+type keyValidationError struct {
+ err error
+}
+
+func (e *keyValidationError) Error() string {
+ return fmt.Sprintf(`key validation failed: %s`, e.err)
+}
+
+func (e *keyValidationError) Unwrap() error {
+ return e.err
+}
+
+func (e *keyValidationError) Is(target error) bool {
+ _, ok := target.(*keyValidationError)
+ return ok
+}
+
+// NewKeyValidationError wraps the given error with an error that denotes
+// `key.Validate()` has failed. This error type should ONLY be used as
+// return value from the `Validate()` method.
+func NewKeyValidationError(err error) error {
+ return &keyValidationError{err: err}
+}
+
+func IsKeyValidationError(err error) bool {
+ var kve keyValidationError
+ return errors.Is(err, &kve)
+}
+
+// Configure is used to configure global behavior of the jwk package.
+func Configure(options ...GlobalOption) {
+ var strictKeyUsagePtr *bool
+ for _, option := range options {
+ switch option.Ident() {
+ case identStrictKeyUsage{}:
+ var v bool
+ if err := option.Value(&v); err != nil {
+ continue
+ }
+ strictKeyUsagePtr = &v
+ }
+ }
+
+ if strictKeyUsagePtr != nil {
+ strictKeyUsage.Store(*strictKeyUsagePtr)
+ }
+}
+
+// These are used when validating keys.
+type keyWithD interface {
+ D() ([]byte, bool)
+}
+
+var _ keyWithD = &okpPrivateKey{}
+
+func extractEmbeddedKey(keyif Key, concretTypes []reflect.Type) (Key, error) {
+ rv := reflect.ValueOf(keyif)
+
+ // If the value can be converted to one of the concrete types, then we're done
+ if slices.ContainsFunc(concretTypes, func(t reflect.Type) bool {
+ return rv.Type().ConvertibleTo(t)
+ }) {
+ return keyif, nil
+ }
+
+ // When a struct implements the Key interface via embedding, you unfortunately
+ // cannot use a type switch to determine the concrete type, because
+ if rv.Kind() == reflect.Ptr {
+ if rv.IsNil() {
+ return nil, fmt.Errorf(`invalid key value (0): %w`, ContinueError())
+ }
+ rv = rv.Elem()
+ }
+
+ if rv.Kind() != reflect.Struct {
+ return nil, fmt.Errorf(`invalid key value type %T (1): %w`, keyif, ContinueError())
+ }
+ if rv.NumField() == 0 {
+ return nil, fmt.Errorf(`invalid key value type %T (2): %w`, keyif, ContinueError())
+ }
+ // Iterate through the fields of the struct to find the first field that
+ // implements the Key interface
+ rt := rv.Type()
+ for i := range rv.NumField() {
+ field := rv.Field(i)
+ ft := rt.Field(i)
+ if !ft.Anonymous {
+ // We can only salvage this object if the object implements jwk.Key
+ // via embedding, so we skip fields that are not anonymous
+ continue
+ }
+
+ if field.CanInterface() {
+ if k, ok := field.Interface().(Key); ok {
+ return extractEmbeddedKey(k, concretTypes)
+ }
+ }
+ }
+
+ return nil, fmt.Errorf(`invalid key value type %T (3): %w`, keyif, ContinueError())
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/jwkbb/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jwk/jwkbb/BUILD.bazel
new file mode 100644
index 0000000000..68a4ccdc19
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/jwkbb/BUILD.bazel
@@ -0,0 +1,17 @@
+load("@rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "jwkbb",
+ srcs = ["x509.go"],
+ importpath = "github.com/lestrrat-go/jwx/v3/jwk/jwkbb",
+ visibility = ["//visibility:public"],
+ deps = [
+ "@com_github_lestrrat_go_blackmagic//:blackmagic",
+ ],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":jwkbb",
+ visibility = ["//visibility:public"],
+)
\ No newline at end of file
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/jwkbb/x509.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/jwkbb/x509.go
new file mode 100644
index 0000000000..3c827cfa6f
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/jwkbb/x509.go
@@ -0,0 +1,111 @@
+package jwkbb
+
+import (
+ "crypto/ecdsa"
+ "crypto/ed25519"
+ "crypto/rsa"
+ "crypto/x509"
+ "encoding/pem"
+ "fmt"
+
+ "github.com/lestrrat-go/blackmagic"
+)
+
+const (
+ PrivateKeyBlockType = `PRIVATE KEY`
+ PublicKeyBlockType = `PUBLIC KEY`
+ ECPrivateKeyBlockType = `EC PRIVATE KEY`
+ RSAPublicKeyBlockType = `RSA PUBLIC KEY`
+ RSAPrivateKeyBlockType = `RSA PRIVATE KEY`
+ CertificateBlockType = `CERTIFICATE`
+)
+
+// EncodeX509 encodes the given value into ASN.1 DER format, and returns
+// the encoded bytes. The value must be one of the following types:
+// *rsa.PrivateKey, *ecdsa.PrivateKey, ed25519.PrivateKey,
+// *rsa.PublicKey, *ecdsa.PublicKey, ed25519.PublicKey.
+//
+// Users can pass a pre-allocated byte slice (but make sure its length is
+// changed so that the encoded buffer is appended to the correct location)
+// as `dst` to avoid allocations.
+func EncodeX509(dst []byte, v any) ([]byte, error) {
+ var block pem.Block
+ // Try to convert it into a certificate
+ switch v := v.(type) {
+ case *rsa.PrivateKey:
+ block.Type = RSAPrivateKeyBlockType
+ block.Bytes = x509.MarshalPKCS1PrivateKey(v)
+ case *ecdsa.PrivateKey:
+ marshaled, err := x509.MarshalECPrivateKey(v)
+ if err != nil {
+ return nil, err
+ }
+ block.Type = ECPrivateKeyBlockType
+ block.Bytes = marshaled
+ case ed25519.PrivateKey:
+ marshaled, err := x509.MarshalPKCS8PrivateKey(v)
+ if err != nil {
+ return nil, err
+ }
+ block.Type = PrivateKeyBlockType
+ block.Bytes = marshaled
+ case *rsa.PublicKey, *ecdsa.PublicKey, ed25519.PublicKey:
+ marshaled, err := x509.MarshalPKIXPublicKey(v)
+ if err != nil {
+ return nil, err
+ }
+ block.Type = PublicKeyBlockType
+ block.Bytes = marshaled
+ default:
+ return nil, fmt.Errorf(`unsupported type %T for ASN.1 DER encoding`, v)
+ }
+
+ encoded := pem.EncodeToMemory(&block)
+ dst = append(dst, encoded...)
+ return dst, nil
+}
+
+func DecodeX509(dst any, block *pem.Block) error {
+ switch block.Type {
+ // Handle the semi-obvious cases
+ case RSAPrivateKeyBlockType:
+ key, err := x509.ParsePKCS1PrivateKey(block.Bytes)
+ if err != nil {
+ return fmt.Errorf(`failed to parse PKCS1 private key: %w`, err)
+ }
+ return blackmagic.AssignIfCompatible(dst, key)
+ case RSAPublicKeyBlockType:
+ key, err := x509.ParsePKCS1PublicKey(block.Bytes)
+ if err != nil {
+ return fmt.Errorf(`failed to parse PKCS1 public key: %w`, err)
+ }
+ return blackmagic.AssignIfCompatible(dst, key)
+ case ECPrivateKeyBlockType:
+ key, err := x509.ParseECPrivateKey(block.Bytes)
+ if err != nil {
+ return fmt.Errorf(`failed to parse EC private key: %w`, err)
+ }
+ return blackmagic.AssignIfCompatible(dst, key)
+ case PublicKeyBlockType:
+ // XXX *could* return dsa.PublicKey
+ key, err := x509.ParsePKIXPublicKey(block.Bytes)
+ if err != nil {
+ return fmt.Errorf(`failed to parse PKIX public key: %w`, err)
+ }
+ return blackmagic.AssignIfCompatible(dst, key)
+ case PrivateKeyBlockType:
+ key, err := x509.ParsePKCS8PrivateKey(block.Bytes)
+ if err != nil {
+ return fmt.Errorf(`failed to parse PKCS8 private key: %w`, err)
+ }
+ return blackmagic.AssignIfCompatible(dst, key)
+ case CertificateBlockType:
+ cert, err := x509.ParseCertificate(block.Bytes)
+ if err != nil {
+ return fmt.Errorf(`failed to parse certificate: %w`, err)
+ }
+ return blackmagic.AssignIfCompatible(dst, cert.PublicKey)
+ default:
+ return fmt.Errorf(`invalid PEM block type %s`, block.Type)
+ }
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/key_ops.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/key_ops.go
new file mode 100644
index 0000000000..b8c229b3af
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/key_ops.go
@@ -0,0 +1,58 @@
+package jwk
+
+import "fmt"
+
+func (ops *KeyOperationList) Get() KeyOperationList {
+ if ops == nil {
+ return nil
+ }
+ return *ops
+}
+
+func (ops *KeyOperationList) Accept(v any) error {
+ switch x := v.(type) {
+ case string:
+ return ops.Accept([]string{x})
+ case []any:
+ l := make([]string, len(x))
+ for i, e := range x {
+ if es, ok := e.(string); ok {
+ l[i] = es
+ } else {
+ return fmt.Errorf(`invalid list element type: expected string, got %T`, v)
+ }
+ }
+ return ops.Accept(l)
+ case []string:
+ list := make(KeyOperationList, len(x))
+ for i, e := range x {
+ switch e := KeyOperation(e); e {
+ case KeyOpSign, KeyOpVerify, KeyOpEncrypt, KeyOpDecrypt, KeyOpWrapKey, KeyOpUnwrapKey, KeyOpDeriveKey, KeyOpDeriveBits:
+ list[i] = e
+ default:
+ return fmt.Errorf(`invalid keyoperation %v`, e)
+ }
+ }
+
+ *ops = list
+ return nil
+ case []KeyOperation:
+ list := make(KeyOperationList, len(x))
+ for i, e := range x {
+ switch e {
+ case KeyOpSign, KeyOpVerify, KeyOpEncrypt, KeyOpDecrypt, KeyOpWrapKey, KeyOpUnwrapKey, KeyOpDeriveKey, KeyOpDeriveBits:
+ list[i] = e
+ default:
+ return fmt.Errorf(`invalid keyoperation %v`, e)
+ }
+ }
+
+ *ops = list
+ return nil
+ case KeyOperationList:
+ *ops = x
+ return nil
+ default:
+ return fmt.Errorf(`invalid value %T`, v)
+ }
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/okp.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/okp.go
new file mode 100644
index 0000000000..7cbf66c2d8
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/okp.go
@@ -0,0 +1,321 @@
+package jwk
+
+import (
+ "bytes"
+ "crypto"
+ "crypto/ecdh"
+ "crypto/ed25519"
+ "fmt"
+ "reflect"
+
+ "github.com/lestrrat-go/blackmagic"
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+func init() {
+ RegisterKeyExporter(jwa.OKP(), KeyExportFunc(okpJWKToRaw))
+}
+
+// Mental note:
+//
+// Curve25519 refers to a particular curve, and is represented in its Montgomery form.
+//
+// Ed25519 refers to the biratinally equivalent curve of Curve25519, except it's in Edwards form.
+// Ed25519 is the name of the curve and the also the signature scheme using that curve.
+// The full name of the scheme is Edwards Curve Digital Signature Algorithm, and thus it is
+// also referred to as EdDSA.
+//
+// X25519 refers to the Diffie-Hellman key exchange protocol that uses Cruve25519.
+// Because this is an elliptic curve based Diffie Hellman protocol, it is also referred to
+// as ECDH.
+//
+// OKP keys are used to represent private/public pairs of thse elliptic curve
+// keys. But note that the name just means Octet Key Pair.
+
+func (k *okpPublicKey) Import(rawKeyIf any) error {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+
+ var crv jwa.EllipticCurveAlgorithm
+ switch rawKey := rawKeyIf.(type) {
+ case ed25519.PublicKey:
+ k.x = rawKey
+ crv = jwa.Ed25519()
+ k.crv = &crv
+ case *ecdh.PublicKey:
+ k.x = rawKey.Bytes()
+ crv = jwa.X25519()
+ k.crv = &crv
+ default:
+ return fmt.Errorf(`unknown key type %T`, rawKeyIf)
+ }
+
+ return nil
+}
+
+func (k *okpPrivateKey) Import(rawKeyIf any) error {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+
+ var crv jwa.EllipticCurveAlgorithm
+ switch rawKey := rawKeyIf.(type) {
+ case ed25519.PrivateKey:
+ k.d = rawKey.Seed()
+ k.x = rawKey.Public().(ed25519.PublicKey) //nolint:forcetypeassert
+ crv = jwa.Ed25519()
+ k.crv = &crv
+ case *ecdh.PrivateKey:
+ // k.d = rawKey.Seed()
+ k.d = rawKey.Bytes()
+ k.x = rawKey.PublicKey().Bytes()
+ crv = jwa.X25519()
+ k.crv = &crv
+ default:
+ return fmt.Errorf(`unknown key type %T`, rawKeyIf)
+ }
+
+ return nil
+}
+
+func buildOKPPublicKey(alg jwa.EllipticCurveAlgorithm, xbuf []byte) (any, error) {
+ switch alg {
+ case jwa.Ed25519():
+ return ed25519.PublicKey(xbuf), nil
+ case jwa.X25519():
+ ret, err := ecdh.X25519().NewPublicKey(xbuf)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to parse x25519 public key %x (size %d): %w`, xbuf, len(xbuf), err)
+ }
+ return ret, nil
+ default:
+ return nil, fmt.Errorf(`invalid curve algorithm %s`, alg)
+ }
+}
+
+// Raw returns the EC-DSA public key represented by this JWK
+func (k *okpPublicKey) Raw(v any) error {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+
+ crv, ok := k.Crv()
+ if !ok {
+ return fmt.Errorf(`missing "crv" field`)
+ }
+
+ pubk, err := buildOKPPublicKey(crv, k.x)
+ if err != nil {
+ return fmt.Errorf(`jwk.OKPPublicKey: failed to build public key: %w`, err)
+ }
+
+ if err := blackmagic.AssignIfCompatible(v, pubk); err != nil {
+ return fmt.Errorf(`jwk.OKPPublicKey: failed to assign to destination variable: %w`, err)
+ }
+ return nil
+}
+
+func buildOKPPrivateKey(alg jwa.EllipticCurveAlgorithm, xbuf []byte, dbuf []byte) (any, error) {
+ if len(dbuf) == 0 {
+ return nil, fmt.Errorf(`cannot use empty seed`)
+ }
+ switch alg {
+ case jwa.Ed25519():
+ if len(dbuf) != ed25519.SeedSize {
+ return nil, fmt.Errorf(`ed25519: wrong private key size`)
+ }
+ ret := ed25519.NewKeyFromSeed(dbuf)
+ //nolint:forcetypeassert
+ if !bytes.Equal(xbuf, ret.Public().(ed25519.PublicKey)) {
+ return nil, fmt.Errorf(`ed25519: invalid x value given d value`)
+ }
+ return ret, nil
+ case jwa.X25519():
+ ret, err := ecdh.X25519().NewPrivateKey(dbuf)
+ if err != nil {
+ return nil, fmt.Errorf(`x25519: unable to construct x25519 private key from seed: %w`, err)
+ }
+ return ret, nil
+ default:
+ return nil, fmt.Errorf(`invalid curve algorithm %s`, alg)
+ }
+}
+
+var okpConvertibleKeys = []reflect.Type{
+ reflect.TypeFor[OKPPrivateKey](),
+ reflect.TypeFor[OKPPublicKey](),
+}
+
+// This is half baked. I think it will blow up if we used ecdh.* keys and/or x25519 keys
+func okpJWKToRaw(key Key, _ any /* this is unused because this is half baked */) (any, error) {
+ extracted, err := extractEmbeddedKey(key, okpConvertibleKeys)
+ if err != nil {
+ return nil, fmt.Errorf(`jwk.OKP: failed to extract embedded key: %w`, err)
+ }
+
+ switch key := extracted.(type) {
+ case OKPPrivateKey:
+ locker, ok := key.(rlocker)
+ if ok {
+ locker.rlock()
+ defer locker.runlock()
+ }
+
+ crv, ok := key.Crv()
+ if !ok {
+ return nil, fmt.Errorf(`missing "crv" field`)
+ }
+
+ x, ok := key.X()
+ if !ok {
+ return nil, fmt.Errorf(`missing "x" field`)
+ }
+
+ d, ok := key.D()
+ if !ok {
+ return nil, fmt.Errorf(`missing "d" field`)
+ }
+
+ privk, err := buildOKPPrivateKey(crv, x, d)
+ if err != nil {
+ return nil, fmt.Errorf(`jwk.OKPPrivateKey: failed to build private key: %w`, err)
+ }
+ return privk, nil
+ case OKPPublicKey:
+ locker, ok := key.(rlocker)
+ if ok {
+ locker.rlock()
+ defer locker.runlock()
+ }
+
+ crv, ok := key.Crv()
+ if !ok {
+ return nil, fmt.Errorf(`missing "crv" field`)
+ }
+
+ x, ok := key.X()
+ if !ok {
+ return nil, fmt.Errorf(`missing "x" field`)
+ }
+ pubk, err := buildOKPPublicKey(crv, x)
+ if err != nil {
+ return nil, fmt.Errorf(`jwk.OKPPublicKey: failed to build public key: %w`, err)
+ }
+ return pubk, nil
+ default:
+ return nil, ContinueError()
+ }
+}
+
+func makeOKPPublicKey(src Key) (Key, error) {
+ newKey := newOKPPublicKey()
+
+ // Iterate and copy everything except for the bits that should not be in the public key
+ for _, k := range src.Keys() {
+ switch k {
+ case OKPDKey:
+ continue
+ default:
+ var v any
+ if err := src.Get(k, &v); err != nil {
+ return nil, fmt.Errorf(`failed to get field %q: %w`, k, err)
+ }
+
+ if err := newKey.Set(k, v); err != nil {
+ return nil, fmt.Errorf(`failed to set field %q: %w`, k, err)
+ }
+ }
+ }
+
+ return newKey, nil
+}
+
+func (k *okpPrivateKey) PublicKey() (Key, error) {
+ return makeOKPPublicKey(k)
+}
+
+func (k *okpPublicKey) PublicKey() (Key, error) {
+ return makeOKPPublicKey(k)
+}
+
+func okpThumbprint(hash crypto.Hash, crv, x string) []byte {
+ h := hash.New()
+ fmt.Fprint(h, `{"crv":"`)
+ fmt.Fprint(h, crv)
+ fmt.Fprint(h, `","kty":"OKP","x":"`)
+ fmt.Fprint(h, x)
+ fmt.Fprint(h, `"}`)
+ return h.Sum(nil)
+}
+
+// Thumbprint returns the JWK thumbprint using the indicated
+// hashing algorithm, according to RFC 7638 / 8037
+func (k okpPublicKey) Thumbprint(hash crypto.Hash) ([]byte, error) {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+
+ crv, ok := k.Crv()
+ if !ok {
+ return nil, fmt.Errorf(`missing "crv" field`)
+ }
+ return okpThumbprint(
+ hash,
+ crv.String(),
+ base64.EncodeToString(k.x),
+ ), nil
+}
+
+// Thumbprint returns the JWK thumbprint using the indicated
+// hashing algorithm, according to RFC 7638 / 8037
+func (k okpPrivateKey) Thumbprint(hash crypto.Hash) ([]byte, error) {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+
+ crv, ok := k.Crv()
+ if !ok {
+ return nil, fmt.Errorf(`missing "crv" field`)
+ }
+
+ return okpThumbprint(
+ hash,
+ crv.String(),
+ base64.EncodeToString(k.x),
+ ), nil
+}
+
+func validateOKPKey(key interface {
+ Crv() (jwa.EllipticCurveAlgorithm, bool)
+ X() ([]byte, bool)
+}) error {
+ if v, ok := key.Crv(); !ok || v == jwa.InvalidEllipticCurve() {
+ return fmt.Errorf(`invalid curve algorithm`)
+ }
+
+ if v, ok := key.X(); !ok || len(v) == 0 {
+ return fmt.Errorf(`missing "x" field`)
+ }
+
+ if priv, ok := key.(keyWithD); ok {
+ if d, ok := priv.D(); !ok || len(d) == 0 {
+ return fmt.Errorf(`missing "d" field`)
+ }
+ }
+ return nil
+}
+
+func (k *okpPublicKey) Validate() error {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+ if err := validateOKPKey(k); err != nil {
+ return NewKeyValidationError(fmt.Errorf(`jwk.OKPPublicKey: %w`, err))
+ }
+ return nil
+}
+
+func (k *okpPrivateKey) Validate() error {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+ if err := validateOKPKey(k); err != nil {
+ return NewKeyValidationError(fmt.Errorf(`jwk.OKPPrivateKey: %w`, err))
+ }
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/okp_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/okp_gen.go
new file mode 100644
index 0000000000..0bde986147
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/okp_gen.go
@@ -0,0 +1,1347 @@
+// Code generated by tools/cmd/genjwk/main.go. DO NOT EDIT.
+
+package jwk
+
+import (
+ "bytes"
+ "fmt"
+ "sort"
+ "sync"
+
+ "github.com/lestrrat-go/blackmagic"
+ "github.com/lestrrat-go/jwx/v3/cert"
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+const (
+ OKPCrvKey = "crv"
+ OKPDKey = "d"
+ OKPXKey = "x"
+)
+
+type OKPPublicKey interface {
+ Key
+ Crv() (jwa.EllipticCurveAlgorithm, bool)
+ X() ([]byte, bool)
+}
+
+type okpPublicKey struct {
+ algorithm *jwa.KeyAlgorithm // https://tools.ietf.org/html/rfc7517#section-4.4
+ crv *jwa.EllipticCurveAlgorithm
+ keyID *string // https://tools.ietf.org/html/rfc7515#section-4.1.4
+ keyOps *KeyOperationList // https://tools.ietf.org/html/rfc7517#section-4.3
+ keyUsage *string // https://tools.ietf.org/html/rfc7517#section-4.2
+ x []byte
+ x509CertChain *cert.Chain // https://tools.ietf.org/html/rfc7515#section-4.1.6
+ x509CertThumbprint *string // https://tools.ietf.org/html/rfc7515#section-4.1.7
+ x509CertThumbprintS256 *string // https://tools.ietf.org/html/rfc7515#section-4.1.8
+ x509URL *string // https://tools.ietf.org/html/rfc7515#section-4.1.5
+ privateParams map[string]any
+ mu *sync.RWMutex
+ dc json.DecodeCtx
+}
+
+var _ OKPPublicKey = &okpPublicKey{}
+var _ Key = &okpPublicKey{}
+
+func newOKPPublicKey() *okpPublicKey {
+ return &okpPublicKey{
+ mu: &sync.RWMutex{},
+ privateParams: make(map[string]any),
+ }
+}
+
+func (h okpPublicKey) KeyType() jwa.KeyType {
+ return jwa.OKP()
+}
+
+func (h okpPublicKey) rlock() {
+ h.mu.RLock()
+}
+
+func (h okpPublicKey) runlock() {
+ h.mu.RUnlock()
+}
+
+func (h okpPublicKey) IsPrivate() bool {
+ return false
+}
+
+func (h *okpPublicKey) Algorithm() (jwa.KeyAlgorithm, bool) {
+ if h.algorithm != nil {
+ return *(h.algorithm), true
+ }
+ return nil, false
+}
+
+func (h *okpPublicKey) Crv() (jwa.EllipticCurveAlgorithm, bool) {
+ if h.crv != nil {
+ return *(h.crv), true
+ }
+ return jwa.InvalidEllipticCurve(), false
+}
+
+func (h *okpPublicKey) KeyID() (string, bool) {
+ if h.keyID != nil {
+ return *(h.keyID), true
+ }
+ return "", false
+}
+
+func (h *okpPublicKey) KeyOps() (KeyOperationList, bool) {
+ if h.keyOps != nil {
+ return *(h.keyOps), true
+ }
+ return nil, false
+}
+
+func (h *okpPublicKey) KeyUsage() (string, bool) {
+ if h.keyUsage != nil {
+ return *(h.keyUsage), true
+ }
+ return "", false
+}
+
+func (h *okpPublicKey) X() ([]byte, bool) {
+ if h.x != nil {
+ return h.x, true
+ }
+ return nil, false
+}
+
+func (h *okpPublicKey) X509CertChain() (*cert.Chain, bool) {
+ return h.x509CertChain, true
+}
+
+func (h *okpPublicKey) X509CertThumbprint() (string, bool) {
+ if h.x509CertThumbprint != nil {
+ return *(h.x509CertThumbprint), true
+ }
+ return "", false
+}
+
+func (h *okpPublicKey) X509CertThumbprintS256() (string, bool) {
+ if h.x509CertThumbprintS256 != nil {
+ return *(h.x509CertThumbprintS256), true
+ }
+ return "", false
+}
+
+func (h *okpPublicKey) X509URL() (string, bool) {
+ if h.x509URL != nil {
+ return *(h.x509URL), true
+ }
+ return "", false
+}
+
+func (h *okpPublicKey) Has(name string) bool {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case KeyTypeKey:
+ return true
+ case AlgorithmKey:
+ return h.algorithm != nil
+ case OKPCrvKey:
+ return h.crv != nil
+ case KeyIDKey:
+ return h.keyID != nil
+ case KeyOpsKey:
+ return h.keyOps != nil
+ case KeyUsageKey:
+ return h.keyUsage != nil
+ case OKPXKey:
+ return h.x != nil
+ case X509CertChainKey:
+ return h.x509CertChain != nil
+ case X509CertThumbprintKey:
+ return h.x509CertThumbprint != nil
+ case X509CertThumbprintS256Key:
+ return h.x509CertThumbprintS256 != nil
+ case X509URLKey:
+ return h.x509URL != nil
+ default:
+ _, ok := h.privateParams[name]
+ return ok
+ }
+}
+
+func (h *okpPublicKey) Get(name string, dst any) error {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case KeyTypeKey:
+ if err := blackmagic.AssignIfCompatible(dst, h.KeyType()); err != nil {
+ return fmt.Errorf(`okpPublicKey.Get: failed to assign value for field %q to destination object: %w`, name, err)
+ }
+ case AlgorithmKey:
+ if h.algorithm == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.algorithm)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case OKPCrvKey:
+ if h.crv == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.crv)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyIDKey:
+ if h.keyID == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyID)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyOpsKey:
+ if h.keyOps == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyOps)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyUsageKey:
+ if h.keyUsage == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyUsage)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case OKPXKey:
+ if h.x == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.x); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertChainKey:
+ if h.x509CertChain == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.x509CertChain); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertThumbprintKey:
+ if h.x509CertThumbprint == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprint)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertThumbprintS256Key:
+ if h.x509CertThumbprintS256 == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprintS256)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509URLKey:
+ if h.x509URL == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509URL)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ default:
+ v, ok := h.privateParams[name]
+ if !ok {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, v); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ }
+ return nil
+}
+
+func (h *okpPublicKey) Set(name string, value any) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ return h.setNoLock(name, value)
+}
+
+func (h *okpPublicKey) setNoLock(name string, value any) error {
+ switch name {
+ case "kty":
+ return nil
+ case AlgorithmKey:
+ switch v := value.(type) {
+ case string, jwa.SignatureAlgorithm, jwa.KeyEncryptionAlgorithm, jwa.ContentEncryptionAlgorithm:
+ tmp, err := jwa.KeyAlgorithmFrom(v)
+ if err != nil {
+ return fmt.Errorf(`invalid algorithm for %q key: %w`, AlgorithmKey, err)
+ }
+ h.algorithm = &tmp
+ default:
+ return fmt.Errorf(`invalid type for %q key: %T`, AlgorithmKey, value)
+ }
+ return nil
+ case OKPCrvKey:
+ if v, ok := value.(jwa.EllipticCurveAlgorithm); ok {
+ h.crv = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, OKPCrvKey, value)
+ case KeyIDKey:
+ if v, ok := value.(string); ok {
+ h.keyID = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, KeyIDKey, value)
+ case KeyOpsKey:
+ var acceptor KeyOperationList
+ if err := acceptor.Accept(value); err != nil {
+ return fmt.Errorf(`invalid value for %s key: %w`, KeyOpsKey, err)
+ }
+ h.keyOps = &acceptor
+ return nil
+ case KeyUsageKey:
+ switch v := value.(type) {
+ case KeyUsageType:
+ switch v {
+ case ForSignature, ForEncryption:
+ tmp := v.String()
+ h.keyUsage = &tmp
+ default:
+ return fmt.Errorf(`invalid key usage type %s`, v)
+ }
+ case string:
+ h.keyUsage = &v
+ default:
+ return fmt.Errorf(`invalid key usage type %s`, v)
+ }
+ case OKPXKey:
+ if v, ok := value.([]byte); ok {
+ h.x = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, OKPXKey, value)
+ case X509CertChainKey:
+ if v, ok := value.(*cert.Chain); ok {
+ h.x509CertChain = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertChainKey, value)
+ case X509CertThumbprintKey:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprint = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintKey, value)
+ case X509CertThumbprintS256Key:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprintS256 = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintS256Key, value)
+ case X509URLKey:
+ if v, ok := value.(string); ok {
+ h.x509URL = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509URLKey, value)
+ default:
+ if h.privateParams == nil {
+ h.privateParams = map[string]any{}
+ }
+ h.privateParams[name] = value
+ }
+ return nil
+}
+
+func (k *okpPublicKey) Remove(key string) error {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+ switch key {
+ case AlgorithmKey:
+ k.algorithm = nil
+ case OKPCrvKey:
+ k.crv = nil
+ case KeyIDKey:
+ k.keyID = nil
+ case KeyOpsKey:
+ k.keyOps = nil
+ case KeyUsageKey:
+ k.keyUsage = nil
+ case OKPXKey:
+ k.x = nil
+ case X509CertChainKey:
+ k.x509CertChain = nil
+ case X509CertThumbprintKey:
+ k.x509CertThumbprint = nil
+ case X509CertThumbprintS256Key:
+ k.x509CertThumbprintS256 = nil
+ case X509URLKey:
+ k.x509URL = nil
+ default:
+ delete(k.privateParams, key)
+ }
+ return nil
+}
+
+func (k *okpPublicKey) Clone() (Key, error) {
+ key, err := cloneKey(k)
+ if err != nil {
+ return nil, fmt.Errorf(`okpPublicKey.Clone: %w`, err)
+ }
+ return key, nil
+}
+
+func (k *okpPublicKey) DecodeCtx() json.DecodeCtx {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+ return k.dc
+}
+
+func (k *okpPublicKey) SetDecodeCtx(dc json.DecodeCtx) {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+ k.dc = dc
+}
+
+func (h *okpPublicKey) UnmarshalJSON(buf []byte) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ h.algorithm = nil
+ h.crv = nil
+ h.keyID = nil
+ h.keyOps = nil
+ h.keyUsage = nil
+ h.x = nil
+ h.x509CertChain = nil
+ h.x509CertThumbprint = nil
+ h.x509CertThumbprintS256 = nil
+ h.x509URL = nil
+ dec := json.NewDecoder(bytes.NewReader(buf))
+LOOP:
+ for {
+ tok, err := dec.Token()
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ switch tok := tok.(type) {
+ case json.Delim:
+ // Assuming we're doing everything correctly, we should ONLY
+ // get either tokens.OpenCurlyBracket or tokens.CloseCurlyBracket here.
+ if tok == tokens.CloseCurlyBracket { // End of object
+ break LOOP
+ } else if tok != tokens.OpenCurlyBracket {
+ return fmt.Errorf(`expected '%c' but got '%c'`, tokens.OpenCurlyBracket, tok)
+ }
+ case string: // Objects can only have string keys
+ switch tok {
+ case KeyTypeKey:
+ val, err := json.ReadNextStringToken(dec)
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ if val != jwa.OKP().String() {
+ return fmt.Errorf(`invalid kty value for RSAPublicKey (%s)`, val)
+ }
+ case AlgorithmKey:
+ var s string
+ if err := dec.Decode(&s); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AlgorithmKey, err)
+ }
+ alg, err := jwa.KeyAlgorithmFrom(s)
+ if err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AlgorithmKey, err)
+ }
+ h.algorithm = &alg
+ case OKPCrvKey:
+ var decoded jwa.EllipticCurveAlgorithm
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, OKPCrvKey, err)
+ }
+ h.crv = &decoded
+ case KeyIDKey:
+ if err := json.AssignNextStringToken(&h.keyID, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyIDKey, err)
+ }
+ case KeyOpsKey:
+ var decoded KeyOperationList
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyOpsKey, err)
+ }
+ h.keyOps = &decoded
+ case KeyUsageKey:
+ if err := json.AssignNextStringToken(&h.keyUsage, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyUsageKey, err)
+ }
+ case OKPXKey:
+ if err := json.AssignNextBytesToken(&h.x, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, OKPXKey, err)
+ }
+ case X509CertChainKey:
+ var decoded cert.Chain
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertChainKey, err)
+ }
+ h.x509CertChain = &decoded
+ case X509CertThumbprintKey:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprint, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintKey, err)
+ }
+ case X509CertThumbprintS256Key:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprintS256, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintS256Key, err)
+ }
+ case X509URLKey:
+ if err := json.AssignNextStringToken(&h.x509URL, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509URLKey, err)
+ }
+ default:
+ if dc := h.dc; dc != nil {
+ if localReg := dc.Registry(); localReg != nil {
+ decoded, err := localReg.Decode(dec, tok)
+ if err == nil {
+ h.setNoLock(tok, decoded)
+ continue
+ }
+ }
+ }
+ decoded, err := registry.Decode(dec, tok)
+ if err == nil {
+ h.setNoLock(tok, decoded)
+ continue
+ }
+ return fmt.Errorf(`could not decode field %s: %w`, tok, err)
+ }
+ default:
+ return fmt.Errorf(`invalid token %T`, tok)
+ }
+ }
+ if h.crv == nil {
+ return fmt.Errorf(`required field crv is missing`)
+ }
+ if h.x == nil {
+ return fmt.Errorf(`required field x is missing`)
+ }
+ return nil
+}
+
+func (h okpPublicKey) MarshalJSON() ([]byte, error) {
+ data := make(map[string]any)
+ fields := make([]string, 0, 10)
+ data[KeyTypeKey] = jwa.OKP()
+ fields = append(fields, KeyTypeKey)
+ if h.algorithm != nil {
+ data[AlgorithmKey] = *(h.algorithm)
+ fields = append(fields, AlgorithmKey)
+ }
+ if h.crv != nil {
+ data[OKPCrvKey] = *(h.crv)
+ fields = append(fields, OKPCrvKey)
+ }
+ if h.keyID != nil {
+ data[KeyIDKey] = *(h.keyID)
+ fields = append(fields, KeyIDKey)
+ }
+ if h.keyOps != nil {
+ data[KeyOpsKey] = *(h.keyOps)
+ fields = append(fields, KeyOpsKey)
+ }
+ if h.keyUsage != nil {
+ data[KeyUsageKey] = *(h.keyUsage)
+ fields = append(fields, KeyUsageKey)
+ }
+ if h.x != nil {
+ data[OKPXKey] = h.x
+ fields = append(fields, OKPXKey)
+ }
+ if h.x509CertChain != nil {
+ data[X509CertChainKey] = h.x509CertChain
+ fields = append(fields, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ data[X509CertThumbprintKey] = *(h.x509CertThumbprint)
+ fields = append(fields, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ data[X509CertThumbprintS256Key] = *(h.x509CertThumbprintS256)
+ fields = append(fields, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ data[X509URLKey] = *(h.x509URL)
+ fields = append(fields, X509URLKey)
+ }
+ for k, v := range h.privateParams {
+ data[k] = v
+ fields = append(fields, k)
+ }
+
+ sort.Strings(fields)
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+ buf.WriteByte(tokens.OpenCurlyBracket)
+ enc := json.NewEncoder(buf)
+ for i, f := range fields {
+ if i > 0 {
+ buf.WriteRune(tokens.Comma)
+ }
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(f)
+ buf.WriteString(`":`)
+ v := data[f]
+ switch v := v.(type) {
+ case []byte:
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(base64.EncodeToString(v))
+ buf.WriteRune(tokens.DoubleQuote)
+ default:
+ if err := enc.Encode(v); err != nil {
+ return nil, fmt.Errorf(`failed to encode value for field %s: %w`, f, err)
+ }
+ buf.Truncate(buf.Len() - 1)
+ }
+ }
+ buf.WriteByte(tokens.CloseCurlyBracket)
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ return ret, nil
+}
+
+func (h *okpPublicKey) Keys() []string {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ keys := make([]string, 0, 10+len(h.privateParams))
+ keys = append(keys, KeyTypeKey)
+ if h.algorithm != nil {
+ keys = append(keys, AlgorithmKey)
+ }
+ if h.crv != nil {
+ keys = append(keys, OKPCrvKey)
+ }
+ if h.keyID != nil {
+ keys = append(keys, KeyIDKey)
+ }
+ if h.keyOps != nil {
+ keys = append(keys, KeyOpsKey)
+ }
+ if h.keyUsage != nil {
+ keys = append(keys, KeyUsageKey)
+ }
+ if h.x != nil {
+ keys = append(keys, OKPXKey)
+ }
+ if h.x509CertChain != nil {
+ keys = append(keys, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ keys = append(keys, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ keys = append(keys, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ keys = append(keys, X509URLKey)
+ }
+ for k := range h.privateParams {
+ keys = append(keys, k)
+ }
+ return keys
+}
+
+type OKPPrivateKey interface {
+ Key
+ Crv() (jwa.EllipticCurveAlgorithm, bool)
+ D() ([]byte, bool)
+ X() ([]byte, bool)
+}
+
+type okpPrivateKey struct {
+ algorithm *jwa.KeyAlgorithm // https://tools.ietf.org/html/rfc7517#section-4.4
+ crv *jwa.EllipticCurveAlgorithm
+ d []byte
+ keyID *string // https://tools.ietf.org/html/rfc7515#section-4.1.4
+ keyOps *KeyOperationList // https://tools.ietf.org/html/rfc7517#section-4.3
+ keyUsage *string // https://tools.ietf.org/html/rfc7517#section-4.2
+ x []byte
+ x509CertChain *cert.Chain // https://tools.ietf.org/html/rfc7515#section-4.1.6
+ x509CertThumbprint *string // https://tools.ietf.org/html/rfc7515#section-4.1.7
+ x509CertThumbprintS256 *string // https://tools.ietf.org/html/rfc7515#section-4.1.8
+ x509URL *string // https://tools.ietf.org/html/rfc7515#section-4.1.5
+ privateParams map[string]any
+ mu *sync.RWMutex
+ dc json.DecodeCtx
+}
+
+var _ OKPPrivateKey = &okpPrivateKey{}
+var _ Key = &okpPrivateKey{}
+
+func newOKPPrivateKey() *okpPrivateKey {
+ return &okpPrivateKey{
+ mu: &sync.RWMutex{},
+ privateParams: make(map[string]any),
+ }
+}
+
+func (h okpPrivateKey) KeyType() jwa.KeyType {
+ return jwa.OKP()
+}
+
+func (h okpPrivateKey) rlock() {
+ h.mu.RLock()
+}
+
+func (h okpPrivateKey) runlock() {
+ h.mu.RUnlock()
+}
+
+func (h okpPrivateKey) IsPrivate() bool {
+ return true
+}
+
+func (h *okpPrivateKey) Algorithm() (jwa.KeyAlgorithm, bool) {
+ if h.algorithm != nil {
+ return *(h.algorithm), true
+ }
+ return nil, false
+}
+
+func (h *okpPrivateKey) Crv() (jwa.EllipticCurveAlgorithm, bool) {
+ if h.crv != nil {
+ return *(h.crv), true
+ }
+ return jwa.InvalidEllipticCurve(), false
+}
+
+func (h *okpPrivateKey) D() ([]byte, bool) {
+ if h.d != nil {
+ return h.d, true
+ }
+ return nil, false
+}
+
+func (h *okpPrivateKey) KeyID() (string, bool) {
+ if h.keyID != nil {
+ return *(h.keyID), true
+ }
+ return "", false
+}
+
+func (h *okpPrivateKey) KeyOps() (KeyOperationList, bool) {
+ if h.keyOps != nil {
+ return *(h.keyOps), true
+ }
+ return nil, false
+}
+
+func (h *okpPrivateKey) KeyUsage() (string, bool) {
+ if h.keyUsage != nil {
+ return *(h.keyUsage), true
+ }
+ return "", false
+}
+
+func (h *okpPrivateKey) X() ([]byte, bool) {
+ if h.x != nil {
+ return h.x, true
+ }
+ return nil, false
+}
+
+func (h *okpPrivateKey) X509CertChain() (*cert.Chain, bool) {
+ return h.x509CertChain, true
+}
+
+func (h *okpPrivateKey) X509CertThumbprint() (string, bool) {
+ if h.x509CertThumbprint != nil {
+ return *(h.x509CertThumbprint), true
+ }
+ return "", false
+}
+
+func (h *okpPrivateKey) X509CertThumbprintS256() (string, bool) {
+ if h.x509CertThumbprintS256 != nil {
+ return *(h.x509CertThumbprintS256), true
+ }
+ return "", false
+}
+
+func (h *okpPrivateKey) X509URL() (string, bool) {
+ if h.x509URL != nil {
+ return *(h.x509URL), true
+ }
+ return "", false
+}
+
+func (h *okpPrivateKey) Has(name string) bool {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case KeyTypeKey:
+ return true
+ case AlgorithmKey:
+ return h.algorithm != nil
+ case OKPCrvKey:
+ return h.crv != nil
+ case OKPDKey:
+ return h.d != nil
+ case KeyIDKey:
+ return h.keyID != nil
+ case KeyOpsKey:
+ return h.keyOps != nil
+ case KeyUsageKey:
+ return h.keyUsage != nil
+ case OKPXKey:
+ return h.x != nil
+ case X509CertChainKey:
+ return h.x509CertChain != nil
+ case X509CertThumbprintKey:
+ return h.x509CertThumbprint != nil
+ case X509CertThumbprintS256Key:
+ return h.x509CertThumbprintS256 != nil
+ case X509URLKey:
+ return h.x509URL != nil
+ default:
+ _, ok := h.privateParams[name]
+ return ok
+ }
+}
+
+func (h *okpPrivateKey) Get(name string, dst any) error {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case KeyTypeKey:
+ if err := blackmagic.AssignIfCompatible(dst, h.KeyType()); err != nil {
+ return fmt.Errorf(`okpPrivateKey.Get: failed to assign value for field %q to destination object: %w`, name, err)
+ }
+ case AlgorithmKey:
+ if h.algorithm == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.algorithm)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case OKPCrvKey:
+ if h.crv == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.crv)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case OKPDKey:
+ if h.d == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.d); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyIDKey:
+ if h.keyID == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyID)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyOpsKey:
+ if h.keyOps == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyOps)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyUsageKey:
+ if h.keyUsage == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyUsage)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case OKPXKey:
+ if h.x == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.x); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertChainKey:
+ if h.x509CertChain == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.x509CertChain); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertThumbprintKey:
+ if h.x509CertThumbprint == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprint)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertThumbprintS256Key:
+ if h.x509CertThumbprintS256 == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprintS256)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509URLKey:
+ if h.x509URL == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509URL)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ default:
+ v, ok := h.privateParams[name]
+ if !ok {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, v); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ }
+ return nil
+}
+
+func (h *okpPrivateKey) Set(name string, value any) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ return h.setNoLock(name, value)
+}
+
+func (h *okpPrivateKey) setNoLock(name string, value any) error {
+ switch name {
+ case "kty":
+ return nil
+ case AlgorithmKey:
+ switch v := value.(type) {
+ case string, jwa.SignatureAlgorithm, jwa.KeyEncryptionAlgorithm, jwa.ContentEncryptionAlgorithm:
+ tmp, err := jwa.KeyAlgorithmFrom(v)
+ if err != nil {
+ return fmt.Errorf(`invalid algorithm for %q key: %w`, AlgorithmKey, err)
+ }
+ h.algorithm = &tmp
+ default:
+ return fmt.Errorf(`invalid type for %q key: %T`, AlgorithmKey, value)
+ }
+ return nil
+ case OKPCrvKey:
+ if v, ok := value.(jwa.EllipticCurveAlgorithm); ok {
+ h.crv = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, OKPCrvKey, value)
+ case OKPDKey:
+ if v, ok := value.([]byte); ok {
+ h.d = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, OKPDKey, value)
+ case KeyIDKey:
+ if v, ok := value.(string); ok {
+ h.keyID = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, KeyIDKey, value)
+ case KeyOpsKey:
+ var acceptor KeyOperationList
+ if err := acceptor.Accept(value); err != nil {
+ return fmt.Errorf(`invalid value for %s key: %w`, KeyOpsKey, err)
+ }
+ h.keyOps = &acceptor
+ return nil
+ case KeyUsageKey:
+ switch v := value.(type) {
+ case KeyUsageType:
+ switch v {
+ case ForSignature, ForEncryption:
+ tmp := v.String()
+ h.keyUsage = &tmp
+ default:
+ return fmt.Errorf(`invalid key usage type %s`, v)
+ }
+ case string:
+ h.keyUsage = &v
+ default:
+ return fmt.Errorf(`invalid key usage type %s`, v)
+ }
+ case OKPXKey:
+ if v, ok := value.([]byte); ok {
+ h.x = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, OKPXKey, value)
+ case X509CertChainKey:
+ if v, ok := value.(*cert.Chain); ok {
+ h.x509CertChain = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertChainKey, value)
+ case X509CertThumbprintKey:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprint = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintKey, value)
+ case X509CertThumbprintS256Key:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprintS256 = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintS256Key, value)
+ case X509URLKey:
+ if v, ok := value.(string); ok {
+ h.x509URL = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509URLKey, value)
+ default:
+ if h.privateParams == nil {
+ h.privateParams = map[string]any{}
+ }
+ h.privateParams[name] = value
+ }
+ return nil
+}
+
+func (k *okpPrivateKey) Remove(key string) error {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+ switch key {
+ case AlgorithmKey:
+ k.algorithm = nil
+ case OKPCrvKey:
+ k.crv = nil
+ case OKPDKey:
+ k.d = nil
+ case KeyIDKey:
+ k.keyID = nil
+ case KeyOpsKey:
+ k.keyOps = nil
+ case KeyUsageKey:
+ k.keyUsage = nil
+ case OKPXKey:
+ k.x = nil
+ case X509CertChainKey:
+ k.x509CertChain = nil
+ case X509CertThumbprintKey:
+ k.x509CertThumbprint = nil
+ case X509CertThumbprintS256Key:
+ k.x509CertThumbprintS256 = nil
+ case X509URLKey:
+ k.x509URL = nil
+ default:
+ delete(k.privateParams, key)
+ }
+ return nil
+}
+
+func (k *okpPrivateKey) Clone() (Key, error) {
+ key, err := cloneKey(k)
+ if err != nil {
+ return nil, fmt.Errorf(`okpPrivateKey.Clone: %w`, err)
+ }
+ return key, nil
+}
+
+func (k *okpPrivateKey) DecodeCtx() json.DecodeCtx {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+ return k.dc
+}
+
+func (k *okpPrivateKey) SetDecodeCtx(dc json.DecodeCtx) {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+ k.dc = dc
+}
+
+func (h *okpPrivateKey) UnmarshalJSON(buf []byte) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ h.algorithm = nil
+ h.crv = nil
+ h.d = nil
+ h.keyID = nil
+ h.keyOps = nil
+ h.keyUsage = nil
+ h.x = nil
+ h.x509CertChain = nil
+ h.x509CertThumbprint = nil
+ h.x509CertThumbprintS256 = nil
+ h.x509URL = nil
+ dec := json.NewDecoder(bytes.NewReader(buf))
+LOOP:
+ for {
+ tok, err := dec.Token()
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ switch tok := tok.(type) {
+ case json.Delim:
+ // Assuming we're doing everything correctly, we should ONLY
+ // get either tokens.OpenCurlyBracket or tokens.CloseCurlyBracket here.
+ if tok == tokens.CloseCurlyBracket { // End of object
+ break LOOP
+ } else if tok != tokens.OpenCurlyBracket {
+ return fmt.Errorf(`expected '%c' but got '%c'`, tokens.OpenCurlyBracket, tok)
+ }
+ case string: // Objects can only have string keys
+ switch tok {
+ case KeyTypeKey:
+ val, err := json.ReadNextStringToken(dec)
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ if val != jwa.OKP().String() {
+ return fmt.Errorf(`invalid kty value for RSAPublicKey (%s)`, val)
+ }
+ case AlgorithmKey:
+ var s string
+ if err := dec.Decode(&s); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AlgorithmKey, err)
+ }
+ alg, err := jwa.KeyAlgorithmFrom(s)
+ if err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AlgorithmKey, err)
+ }
+ h.algorithm = &alg
+ case OKPCrvKey:
+ var decoded jwa.EllipticCurveAlgorithm
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, OKPCrvKey, err)
+ }
+ h.crv = &decoded
+ case OKPDKey:
+ if err := json.AssignNextBytesToken(&h.d, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, OKPDKey, err)
+ }
+ case KeyIDKey:
+ if err := json.AssignNextStringToken(&h.keyID, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyIDKey, err)
+ }
+ case KeyOpsKey:
+ var decoded KeyOperationList
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyOpsKey, err)
+ }
+ h.keyOps = &decoded
+ case KeyUsageKey:
+ if err := json.AssignNextStringToken(&h.keyUsage, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyUsageKey, err)
+ }
+ case OKPXKey:
+ if err := json.AssignNextBytesToken(&h.x, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, OKPXKey, err)
+ }
+ case X509CertChainKey:
+ var decoded cert.Chain
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertChainKey, err)
+ }
+ h.x509CertChain = &decoded
+ case X509CertThumbprintKey:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprint, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintKey, err)
+ }
+ case X509CertThumbprintS256Key:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprintS256, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintS256Key, err)
+ }
+ case X509URLKey:
+ if err := json.AssignNextStringToken(&h.x509URL, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509URLKey, err)
+ }
+ default:
+ if dc := h.dc; dc != nil {
+ if localReg := dc.Registry(); localReg != nil {
+ decoded, err := localReg.Decode(dec, tok)
+ if err == nil {
+ h.setNoLock(tok, decoded)
+ continue
+ }
+ }
+ }
+ decoded, err := registry.Decode(dec, tok)
+ if err == nil {
+ h.setNoLock(tok, decoded)
+ continue
+ }
+ return fmt.Errorf(`could not decode field %s: %w`, tok, err)
+ }
+ default:
+ return fmt.Errorf(`invalid token %T`, tok)
+ }
+ }
+ if h.crv == nil {
+ return fmt.Errorf(`required field crv is missing`)
+ }
+ if h.d == nil {
+ return fmt.Errorf(`required field d is missing`)
+ }
+ if h.x == nil {
+ return fmt.Errorf(`required field x is missing`)
+ }
+ return nil
+}
+
+func (h okpPrivateKey) MarshalJSON() ([]byte, error) {
+ data := make(map[string]any)
+ fields := make([]string, 0, 11)
+ data[KeyTypeKey] = jwa.OKP()
+ fields = append(fields, KeyTypeKey)
+ if h.algorithm != nil {
+ data[AlgorithmKey] = *(h.algorithm)
+ fields = append(fields, AlgorithmKey)
+ }
+ if h.crv != nil {
+ data[OKPCrvKey] = *(h.crv)
+ fields = append(fields, OKPCrvKey)
+ }
+ if h.d != nil {
+ data[OKPDKey] = h.d
+ fields = append(fields, OKPDKey)
+ }
+ if h.keyID != nil {
+ data[KeyIDKey] = *(h.keyID)
+ fields = append(fields, KeyIDKey)
+ }
+ if h.keyOps != nil {
+ data[KeyOpsKey] = *(h.keyOps)
+ fields = append(fields, KeyOpsKey)
+ }
+ if h.keyUsage != nil {
+ data[KeyUsageKey] = *(h.keyUsage)
+ fields = append(fields, KeyUsageKey)
+ }
+ if h.x != nil {
+ data[OKPXKey] = h.x
+ fields = append(fields, OKPXKey)
+ }
+ if h.x509CertChain != nil {
+ data[X509CertChainKey] = h.x509CertChain
+ fields = append(fields, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ data[X509CertThumbprintKey] = *(h.x509CertThumbprint)
+ fields = append(fields, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ data[X509CertThumbprintS256Key] = *(h.x509CertThumbprintS256)
+ fields = append(fields, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ data[X509URLKey] = *(h.x509URL)
+ fields = append(fields, X509URLKey)
+ }
+ for k, v := range h.privateParams {
+ data[k] = v
+ fields = append(fields, k)
+ }
+
+ sort.Strings(fields)
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+ buf.WriteByte(tokens.OpenCurlyBracket)
+ enc := json.NewEncoder(buf)
+ for i, f := range fields {
+ if i > 0 {
+ buf.WriteRune(tokens.Comma)
+ }
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(f)
+ buf.WriteString(`":`)
+ v := data[f]
+ switch v := v.(type) {
+ case []byte:
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(base64.EncodeToString(v))
+ buf.WriteRune(tokens.DoubleQuote)
+ default:
+ if err := enc.Encode(v); err != nil {
+ return nil, fmt.Errorf(`failed to encode value for field %s: %w`, f, err)
+ }
+ buf.Truncate(buf.Len() - 1)
+ }
+ }
+ buf.WriteByte(tokens.CloseCurlyBracket)
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ return ret, nil
+}
+
+func (h *okpPrivateKey) Keys() []string {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ keys := make([]string, 0, 11+len(h.privateParams))
+ keys = append(keys, KeyTypeKey)
+ if h.algorithm != nil {
+ keys = append(keys, AlgorithmKey)
+ }
+ if h.crv != nil {
+ keys = append(keys, OKPCrvKey)
+ }
+ if h.d != nil {
+ keys = append(keys, OKPDKey)
+ }
+ if h.keyID != nil {
+ keys = append(keys, KeyIDKey)
+ }
+ if h.keyOps != nil {
+ keys = append(keys, KeyOpsKey)
+ }
+ if h.keyUsage != nil {
+ keys = append(keys, KeyUsageKey)
+ }
+ if h.x != nil {
+ keys = append(keys, OKPXKey)
+ }
+ if h.x509CertChain != nil {
+ keys = append(keys, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ keys = append(keys, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ keys = append(keys, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ keys = append(keys, X509URLKey)
+ }
+ for k := range h.privateParams {
+ keys = append(keys, k)
+ }
+ return keys
+}
+
+var okpStandardFields KeyFilter
+
+func init() {
+ okpStandardFields = NewFieldNameFilter(KeyTypeKey, KeyUsageKey, KeyOpsKey, AlgorithmKey, KeyIDKey, X509URLKey, X509CertChainKey, X509CertThumbprintKey, X509CertThumbprintS256Key, OKPCrvKey, OKPXKey, OKPDKey)
+}
+
+// OKPStandardFieldsFilter returns a KeyFilter that filters out standard OKP fields.
+func OKPStandardFieldsFilter() KeyFilter {
+ return okpStandardFields
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/options.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/options.go
new file mode 100644
index 0000000000..56cc52625f
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/options.go
@@ -0,0 +1,76 @@
+package jwk
+
+import (
+ "time"
+
+ "github.com/lestrrat-go/httprc/v3"
+ "github.com/lestrrat-go/option/v2"
+)
+
+type identTypedField struct{}
+
+type typedFieldPair struct {
+ Name string
+ Value any
+}
+
+// WithTypedField allows a private field to be parsed into the object type of
+// your choice. It works much like the RegisterCustomField, but the effect
+// is only applicable to the jwt.Parse function call which receives this option.
+//
+// While this can be extremely useful, this option should be used with caution:
+// There are many caveats that your entire team/user-base needs to be aware of,
+// and therefore in general its use is discouraged. Only use it when you know
+// what you are doing, and you document its use clearly for others.
+//
+// First and foremost, this is a "per-object" option. Meaning that given the same
+// serialized format, it is possible to generate two objects whose internal
+// representations may differ. That is, if you parse one _WITH_ the option,
+// and the other _WITHOUT_, their internal representation may completely differ.
+// This could potentially lead to problems.
+//
+// Second, specifying this option will slightly slow down the decoding process
+// as it needs to consult multiple definitions sources (global and local), so
+// be careful if you are decoding a large number of tokens, as the effects will stack up.
+func WithTypedField(name string, object any) ParseOption {
+ return &parseOption{
+ option.New(identTypedField{},
+ typedFieldPair{Name: name, Value: object},
+ ),
+ }
+}
+
+type registerResourceOption struct {
+ option.Interface
+}
+
+func (registerResourceOption) registerOption() {}
+func (registerResourceOption) resourceOption() {}
+
+type identNewResourceOption struct{}
+
+// WithHttprcResourceOption can be used to pass arbitrary `httprc.NewResourceOption`
+// to `(httprc.Client).Add` by way of `(jwk.Cache).Register`.
+func WithHttprcResourceOption(o httprc.NewResourceOption) RegisterOption {
+ return ®isterResourceOption{
+ option.New(identNewResourceOption{}, o),
+ }
+}
+
+// WithConstantInterval can be used to pass `httprc.WithConstantInterval` option to
+// `(httprc.Client).Add` by way of `(jwk.Cache).Register`.
+func WithConstantInterval(d time.Duration) RegisterOption {
+ return WithHttprcResourceOption(httprc.WithConstantInterval(d))
+}
+
+// WithMinInterval can be used to pass `httprc.WithMinInterval` option to
+// `(httprc.Client).Add` by way of `(jwk.Cache).Register`.
+func WithMinInterval(d time.Duration) RegisterOption {
+ return WithHttprcResourceOption(httprc.WithMinInterval(d))
+}
+
+// WithMaxInterval can be used to pass `httprc.WithMaxInterval` option to
+// `(httprc.Client).Add` by way of `(jwk.Cache).Register`.
+func WithMaxInterval(d time.Duration) RegisterOption {
+ return WithHttprcResourceOption(httprc.WithMaxInterval(d))
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/options.yaml b/vendor/github.com/lestrrat-go/jwx/v3/jwk/options.yaml
new file mode 100644
index 0000000000..879dcba158
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/options.yaml
@@ -0,0 +1,143 @@
+package_name: jwk
+output: jwk/options_gen.go
+interfaces:
+ - name: CacheOption
+ comment: |
+ CacheOption is a type of Option that can be passed to the
+ the `jwk.NewCache()` function.
+ - name: ResourceOption
+ comment: |
+ ResourceOption is a type of Option that can be passed to the `httprc.NewResource` function
+ by way of RegisterOption.
+ - name: AssignKeyIDOption
+ - name: FetchOption
+ methods:
+ - fetchOption
+ - parseOption
+ - registerOption
+ comment: |
+ FetchOption is a type of Option that can be passed to `jwk.Fetch()`
+ FetchOption also implements the `RegisterOption`, and thus can
+ safely be passed to `(*jwk.Cache).Register()`
+ - name: ParseOption
+ methods:
+ - fetchOption
+ - registerOption
+ - readFileOption
+ comment: |
+ ParseOption is a type of Option that can be passed to `jwk.Parse()`
+ ParseOption also implements the `ReadFileOption` and `NewCacheOption`,
+ and thus safely be passed to `jwk.ReadFile` and `(*jwk.Cache).Configure()`
+ - name: ReadFileOption
+ comment: |
+ ReadFileOption is a type of `Option` that can be passed to `jwk.ReadFile`
+ - name: RegisterOption
+ comment: |
+ RegisterOption describes options that can be passed to `(jwk.Cache).Register()`
+ - name: RegisterFetchOption
+ methods:
+ - fetchOption
+ - registerOption
+ - parseOption
+ comment: |
+ RegisterFetchOption describes options that can be passed to `(jwk.Cache).Register()` and `jwk.Fetch()`
+ - name: GlobalOption
+ comment: |
+ GlobalOption is a type of Option that can be passed to the `jwk.Configure()` to
+ change the global configuration of the jwk package.
+options:
+ - ident: HTTPClient
+ interface: RegisterFetchOption
+ argument_type: HTTPClient
+ comment: |
+ WithHTTPClient allows users to specify the "net/http".Client object that
+ is used when fetching jwk.Set objects.
+ - ident: ThumbprintHash
+ interface: AssignKeyIDOption
+ argument_type: crypto.Hash
+ - ident: LocalRegistry
+ option_name: withLocalRegistry
+ interface: ParseOption
+ argument_type: '*json.Registry'
+ comment: This option is only available for internal code. Users don't get to play with it
+ - ident: PEM
+ interface: ParseOption
+ argument_type: bool
+ comment: |
+ WithPEM specifies that the input to `Parse()` is a PEM encoded key.
+
+ This option is planned to be deprecated in the future. The plan is to
+ replace it with `jwk.WithX509(true)`
+ - ident: X509
+ interface: ParseOption
+ argument_type: bool
+ comment: |
+ WithX509 specifies that the input to `Parse()` is an X.509 encoded key
+ - ident: PEMDecoder
+ interface: ParseOption
+ argument_type: PEMDecoder
+ comment: |
+ WithPEMDecoder specifies the PEMDecoder object to use when decoding
+ PEM encoded keys. This option can be passed to `jwk.Parse()`
+
+ This option is planned to be deprecated in the future. The plan is to
+ use `jwk.RegisterX509Decoder()` to register a custom X.509 decoder globally.
+ - ident: FetchWhitelist
+ interface: FetchOption
+ argument_type: Whitelist
+ comment: |
+ WithFetchWhitelist specifies the Whitelist object to use when
+ fetching JWKs from a remote source. This option can be passed
+ to both `jwk.Fetch()`
+ - ident: IgnoreParseError
+ interface: ParseOption
+ argument_type: bool
+ comment: |
+ WithIgnoreParseError is only applicable when used with `jwk.Parse()`
+ (i.e. to parse JWK sets). If passed to `jwk.ParseKey()`, the function
+ will return an error no matter what the input is.
+
+ DO NOT USE WITHOUT EXHAUSTING ALL OTHER ROUTES FIRST.
+
+ The option specifies that errors found during parsing of individual
+ keys are ignored. For example, if you had keys A, B, C where B is
+ invalid (e.g. it does not contain the required fields), then the
+ resulting JWKS will contain keys A and C only.
+
+ This options exists as an escape hatch for those times when a
+ key in a JWKS that is irrelevant for your use case is causing
+ your JWKS parsing to fail, and you want to get to the rest of the
+ keys in the JWKS.
+
+ Again, DO NOT USE unless you have exhausted all other routes.
+ When you use this option, you will not be able to tell if you are
+ using a faulty JWKS, except for when there are JSON syntax errors.
+ - ident: FS
+ interface: ReadFileOption
+ argument_type: fs.FS
+ comment: |
+ WithFS specifies the source `fs.FS` object to read the file from.
+ - ident: WaitReady
+ interface: RegisterOption
+ argument_type: bool
+ comment: |
+ WithWaitReady specifies that the `jwk.Cache` should wait until the
+ first fetch is done before returning from the `Register()` call.
+
+ This option is by default true. Specify a false value if you would
+ like to return immediately from the `Register()` call.
+
+ This options is exactly the same as `httprc.WithWaitReady()`
+ - ident: StrictKeyUsage
+ interface: GlobalOption
+ argument_type: bool
+ comment: |
+ WithStrictKeyUsage specifies if during JWK parsing, the "use" field
+ should be confined to the values that have been registered via
+ `jwk.RegisterKeyType()`. By default this option is true, and the
+ initial allowed values are "use" and "enc" only.
+
+ If this option is set to false, then the "use" field can be any
+ value. If this options is set to true, then the "use" field must
+ be one of the registered values, and otherwise an error will be
+ reported during parsing / assignment to `jwk.KeyUsageType`
\ No newline at end of file
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/options_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/options_gen.go
new file mode 100644
index 0000000000..99e66c3e7e
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/options_gen.go
@@ -0,0 +1,297 @@
+// Code generated by tools/cmd/genoptions/main.go. DO NOT EDIT.
+
+package jwk
+
+import (
+ "crypto"
+ "io/fs"
+
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/option/v2"
+)
+
+type Option = option.Interface
+
+type AssignKeyIDOption interface {
+ Option
+ assignKeyIDOption()
+}
+
+type assignKeyIDOption struct {
+ Option
+}
+
+func (*assignKeyIDOption) assignKeyIDOption() {}
+
+// CacheOption is a type of Option that can be passed to the
+// the `jwk.NewCache()` function.
+type CacheOption interface {
+ Option
+ cacheOption()
+}
+
+type cacheOption struct {
+ Option
+}
+
+func (*cacheOption) cacheOption() {}
+
+// FetchOption is a type of Option that can be passed to `jwk.Fetch()`
+// FetchOption also implements the `RegisterOption`, and thus can
+// safely be passed to `(*jwk.Cache).Register()`
+type FetchOption interface {
+ Option
+ fetchOption()
+ parseOption()
+ registerOption()
+}
+
+type fetchOption struct {
+ Option
+}
+
+func (*fetchOption) fetchOption() {}
+
+func (*fetchOption) parseOption() {}
+
+func (*fetchOption) registerOption() {}
+
+// GlobalOption is a type of Option that can be passed to the `jwk.Configure()` to
+// change the global configuration of the jwk package.
+type GlobalOption interface {
+ Option
+ globalOption()
+}
+
+type globalOption struct {
+ Option
+}
+
+func (*globalOption) globalOption() {}
+
+// ParseOption is a type of Option that can be passed to `jwk.Parse()`
+// ParseOption also implements the `ReadFileOption` and `NewCacheOption`,
+// and thus safely be passed to `jwk.ReadFile` and `(*jwk.Cache).Configure()`
+type ParseOption interface {
+ Option
+ fetchOption()
+ registerOption()
+ readFileOption()
+}
+
+type parseOption struct {
+ Option
+}
+
+func (*parseOption) fetchOption() {}
+
+func (*parseOption) registerOption() {}
+
+func (*parseOption) readFileOption() {}
+
+// ReadFileOption is a type of `Option` that can be passed to `jwk.ReadFile`
+type ReadFileOption interface {
+ Option
+ readFileOption()
+}
+
+type readFileOption struct {
+ Option
+}
+
+func (*readFileOption) readFileOption() {}
+
+// RegisterFetchOption describes options that can be passed to `(jwk.Cache).Register()` and `jwk.Fetch()`
+type RegisterFetchOption interface {
+ Option
+ fetchOption()
+ registerOption()
+ parseOption()
+}
+
+type registerFetchOption struct {
+ Option
+}
+
+func (*registerFetchOption) fetchOption() {}
+
+func (*registerFetchOption) registerOption() {}
+
+func (*registerFetchOption) parseOption() {}
+
+// RegisterOption describes options that can be passed to `(jwk.Cache).Register()`
+type RegisterOption interface {
+ Option
+ registerOption()
+}
+
+type registerOption struct {
+ Option
+}
+
+func (*registerOption) registerOption() {}
+
+// ResourceOption is a type of Option that can be passed to the `httprc.NewResource` function
+// by way of RegisterOption.
+type ResourceOption interface {
+ Option
+ resourceOption()
+}
+
+type resourceOption struct {
+ Option
+}
+
+func (*resourceOption) resourceOption() {}
+
+type identFS struct{}
+type identFetchWhitelist struct{}
+type identHTTPClient struct{}
+type identIgnoreParseError struct{}
+type identLocalRegistry struct{}
+type identPEM struct{}
+type identPEMDecoder struct{}
+type identStrictKeyUsage struct{}
+type identThumbprintHash struct{}
+type identWaitReady struct{}
+type identX509 struct{}
+
+func (identFS) String() string {
+ return "WithFS"
+}
+
+func (identFetchWhitelist) String() string {
+ return "WithFetchWhitelist"
+}
+
+func (identHTTPClient) String() string {
+ return "WithHTTPClient"
+}
+
+func (identIgnoreParseError) String() string {
+ return "WithIgnoreParseError"
+}
+
+func (identLocalRegistry) String() string {
+ return "withLocalRegistry"
+}
+
+func (identPEM) String() string {
+ return "WithPEM"
+}
+
+func (identPEMDecoder) String() string {
+ return "WithPEMDecoder"
+}
+
+func (identStrictKeyUsage) String() string {
+ return "WithStrictKeyUsage"
+}
+
+func (identThumbprintHash) String() string {
+ return "WithThumbprintHash"
+}
+
+func (identWaitReady) String() string {
+ return "WithWaitReady"
+}
+
+func (identX509) String() string {
+ return "WithX509"
+}
+
+// WithFS specifies the source `fs.FS` object to read the file from.
+func WithFS(v fs.FS) ReadFileOption {
+ return &readFileOption{option.New(identFS{}, v)}
+}
+
+// WithFetchWhitelist specifies the Whitelist object to use when
+// fetching JWKs from a remote source. This option can be passed
+// to both `jwk.Fetch()`
+func WithFetchWhitelist(v Whitelist) FetchOption {
+ return &fetchOption{option.New(identFetchWhitelist{}, v)}
+}
+
+// WithHTTPClient allows users to specify the "net/http".Client object that
+// is used when fetching jwk.Set objects.
+func WithHTTPClient(v HTTPClient) RegisterFetchOption {
+ return ®isterFetchOption{option.New(identHTTPClient{}, v)}
+}
+
+// WithIgnoreParseError is only applicable when used with `jwk.Parse()`
+// (i.e. to parse JWK sets). If passed to `jwk.ParseKey()`, the function
+// will return an error no matter what the input is.
+//
+// DO NOT USE WITHOUT EXHAUSTING ALL OTHER ROUTES FIRST.
+//
+// The option specifies that errors found during parsing of individual
+// keys are ignored. For example, if you had keys A, B, C where B is
+// invalid (e.g. it does not contain the required fields), then the
+// resulting JWKS will contain keys A and C only.
+//
+// This options exists as an escape hatch for those times when a
+// key in a JWKS that is irrelevant for your use case is causing
+// your JWKS parsing to fail, and you want to get to the rest of the
+// keys in the JWKS.
+//
+// Again, DO NOT USE unless you have exhausted all other routes.
+// When you use this option, you will not be able to tell if you are
+// using a faulty JWKS, except for when there are JSON syntax errors.
+func WithIgnoreParseError(v bool) ParseOption {
+ return &parseOption{option.New(identIgnoreParseError{}, v)}
+}
+
+// This option is only available for internal code. Users don't get to play with it
+func withLocalRegistry(v *json.Registry) ParseOption {
+ return &parseOption{option.New(identLocalRegistry{}, v)}
+}
+
+// WithPEM specifies that the input to `Parse()` is a PEM encoded key.
+//
+// This option is planned to be deprecated in the future. The plan is to
+// replace it with `jwk.WithX509(true)`
+func WithPEM(v bool) ParseOption {
+ return &parseOption{option.New(identPEM{}, v)}
+}
+
+// WithPEMDecoder specifies the PEMDecoder object to use when decoding
+// PEM encoded keys. This option can be passed to `jwk.Parse()`
+//
+// This option is planned to be deprecated in the future. The plan is to
+// use `jwk.RegisterX509Decoder()` to register a custom X.509 decoder globally.
+func WithPEMDecoder(v PEMDecoder) ParseOption {
+ return &parseOption{option.New(identPEMDecoder{}, v)}
+}
+
+// WithStrictKeyUsage specifies if during JWK parsing, the "use" field
+// should be confined to the values that have been registered via
+// `jwk.RegisterKeyType()`. By default this option is true, and the
+// initial allowed values are "use" and "enc" only.
+//
+// If this option is set to false, then the "use" field can be any
+// value. If this options is set to true, then the "use" field must
+// be one of the registered values, and otherwise an error will be
+// reported during parsing / assignment to `jwk.KeyUsageType`
+func WithStrictKeyUsage(v bool) GlobalOption {
+ return &globalOption{option.New(identStrictKeyUsage{}, v)}
+}
+
+func WithThumbprintHash(v crypto.Hash) AssignKeyIDOption {
+ return &assignKeyIDOption{option.New(identThumbprintHash{}, v)}
+}
+
+// WithWaitReady specifies that the `jwk.Cache` should wait until the
+// first fetch is done before returning from the `Register()` call.
+//
+// This option is by default true. Specify a false value if you would
+// like to return immediately from the `Register()` call.
+//
+// This options is exactly the same as `httprc.WithWaitReady()`
+func WithWaitReady(v bool) RegisterOption {
+ return ®isterOption{option.New(identWaitReady{}, v)}
+}
+
+// WithX509 specifies that the input to `Parse()` is an X.509 encoded key
+func WithX509(v bool) ParseOption {
+ return &parseOption{option.New(identX509{}, v)}
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/parser.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/parser.go
new file mode 100644
index 0000000000..fa8764ef72
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/parser.go
@@ -0,0 +1,244 @@
+package jwk
+
+import (
+ "fmt"
+ "reflect"
+ "sync"
+
+ "github.com/lestrrat-go/blackmagic"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+// KeyParser represents a type that can parse a JSON representation of a JWK into
+// a jwk.Key.
+// See KeyConvertor for a type that can convert a raw key into a jwk.Key
+type KeyParser interface {
+ // ParseKey parses a JSON payload to a `jwk.Key` object. The first
+ // argument is an object that contains some hints as to what kind of
+ // key the JSON payload contains.
+ //
+ // If your KeyParser decides that the payload is not something
+ // you can parse, and you would like to continue parsing with
+ // the remaining KeyParser instances that are registered,
+ // return a `jwk.ContinueParseError`. Any other errors will immediately
+ // halt the parsing process.
+ //
+ // When unmarshaling JSON, use the unmarshaler object supplied as
+ // the second argument. This will ensure that the JSON is unmarshaled
+ // in a way that is compatible with the rest of the library.
+ ParseKey(probe *KeyProbe, unmarshaler KeyUnmarshaler, payload []byte) (Key, error)
+}
+
+// KeyParseFunc is a type of KeyParser that is based on a function/closure
+type KeyParseFunc func(probe *KeyProbe, unmarshaler KeyUnmarshaler, payload []byte) (Key, error)
+
+func (f KeyParseFunc) ParseKey(probe *KeyProbe, unmarshaler KeyUnmarshaler, payload []byte) (Key, error) {
+ return f(probe, unmarshaler, payload)
+}
+
+// protects keyParsers
+var muKeyParser sync.RWMutex
+
+// list of parsers
+var keyParsers = []KeyParser{KeyParseFunc(defaultParseKey)}
+
+// RegisterKeyParser adds a new KeyParser. Parsers are called in FILO order.
+// That is, the last parser to be registered is called first. There is no
+// check for duplicate entries.
+func RegisterKeyParser(kp KeyParser) {
+ muKeyParser.Lock()
+ defer muKeyParser.Unlock()
+ keyParsers = append(keyParsers, kp)
+}
+
+func defaultParseKey(probe *KeyProbe, unmarshaler KeyUnmarshaler, data []byte) (Key, error) {
+ var key Key
+ var kty string
+ var d json.RawMessage
+ if err := probe.Get("Kty", &kty); err != nil {
+ return nil, fmt.Errorf(`jwk.Parse: failed to get "kty" hint: %w`, err)
+ }
+ // We ignore errors from this field, as it's optional
+ _ = probe.Get("D", &d)
+ switch v, _ := jwa.LookupKeyType(kty); v {
+ case jwa.RSA():
+ if d != nil {
+ key = newRSAPrivateKey()
+ } else {
+ key = newRSAPublicKey()
+ }
+ case jwa.EC():
+ if d != nil {
+ key = newECDSAPrivateKey()
+ } else {
+ key = newECDSAPublicKey()
+ }
+ case jwa.OctetSeq():
+ key = newSymmetricKey()
+ case jwa.OKP():
+ if d != nil {
+ key = newOKPPrivateKey()
+ } else {
+ key = newOKPPublicKey()
+ }
+ default:
+ return nil, fmt.Errorf(`invalid key type from JSON (%s)`, kty)
+ }
+
+ if err := unmarshaler.UnmarshalKey(data, key); err != nil {
+ return nil, fmt.Errorf(`failed to unmarshal JSON into key (%T): %w`, key, err)
+ }
+ return key, nil
+}
+
+type keyUnmarshaler struct {
+ localReg *json.Registry
+}
+
+func (ku *keyUnmarshaler) UnmarshalKey(data []byte, key any) error {
+ if ku.localReg != nil {
+ dcKey, ok := key.(json.DecodeCtxContainer)
+ if !ok {
+ return fmt.Errorf(`typed field was requested, but the key (%T) does not support DecodeCtx`, key)
+ }
+ dc := json.NewDecodeCtx(ku.localReg)
+ dcKey.SetDecodeCtx(dc)
+ defer func() { dcKey.SetDecodeCtx(nil) }()
+ }
+
+ if err := json.Unmarshal(data, key); err != nil {
+ return fmt.Errorf(`failed to unmarshal JSON into key (%T): %w`, key, err)
+ }
+
+ return nil
+}
+
+// keyProber is the object that starts the probing. When Probe() is called,
+// it creates (possibly from a cached value) an object that is used to
+// hold hint values.
+type keyProber struct {
+ mu sync.RWMutex
+ pool *sync.Pool
+ fields map[string]reflect.StructField
+ typ reflect.Type
+}
+
+func (kp *keyProber) AddField(field reflect.StructField) error {
+ kp.mu.Lock()
+ defer kp.mu.Unlock()
+
+ if _, ok := kp.fields[field.Name]; ok {
+ return fmt.Errorf(`field name %s is already registered`, field.Name)
+ }
+ kp.fields[field.Name] = field
+ kp.makeStructType()
+
+ // Update pool (note: the logic is the same, but we need to recreate it
+ // so that we don't accidentally use old stored values)
+ kp.pool = &sync.Pool{
+ New: kp.makeStruct,
+ }
+ return nil
+}
+
+func (kp *keyProber) makeStructType() {
+ // DOES NOT LOCK
+ fields := make([]reflect.StructField, 0, len(kp.fields))
+ for _, f := range kp.fields {
+ fields = append(fields, f)
+ }
+ kp.typ = reflect.StructOf(fields)
+}
+
+func (kp *keyProber) makeStruct() any {
+ return reflect.New(kp.typ)
+}
+
+func (kp *keyProber) Probe(data []byte) (*KeyProbe, error) {
+ kp.mu.RLock()
+ defer kp.mu.RUnlock()
+
+ // if the field list unchanged, so is the pool object, so effectively
+ // we should be using the cached version
+ v := kp.pool.Get()
+ if v == nil {
+ return nil, fmt.Errorf(`probe: failed to get object from pool`)
+ }
+ rv, ok := v.(reflect.Value)
+ if !ok {
+ return nil, fmt.Errorf(`probe: value returned from pool as of type %T, expected reflect.Value`, v)
+ }
+
+ if err := json.Unmarshal(data, rv.Interface()); err != nil {
+ return nil, fmt.Errorf(`probe: failed to unmarshal data: %w`, err)
+ }
+
+ return &KeyProbe{data: rv}, nil
+}
+
+// KeyProbe is the object that carries the hints when parsing a key.
+// The exact list of fields can vary depending on the types of key
+// that are registered.
+//
+// Use `Get()` to access the value of a field.
+//
+// The underlying data stored in a KeyProbe is recycled each
+// time a value is parsed, therefore you are not allowed to hold
+// onto this object after ParseKey() is done.
+type KeyProbe struct {
+ data reflect.Value
+}
+
+// Get returns the value of the field with the given `name“.
+// `dst` must be a pointer to a value that can hold the type of
+// the value of the field, which is determined by the
+// field type registered through `jwk.RegisterProbeField()`
+func (kp *KeyProbe) Get(name string, dst any) error {
+ f := kp.data.Elem().FieldByName(name)
+ if !f.IsValid() {
+ return fmt.Errorf(`field %s not found`, name)
+ }
+
+ if err := blackmagic.AssignIfCompatible(dst, f.Addr().Interface()); err != nil {
+ return fmt.Errorf(`failed to assign value of field %q to %T: %w`, name, dst, err)
+ }
+ return nil
+}
+
+// We don't really need the object, we need to know its type
+var keyProbe = &keyProber{
+ fields: make(map[string]reflect.StructField),
+}
+
+// RegisterProbeField adds a new field to be probed during the initial
+// phase of parsing. This is done by partially parsing the JSON payload,
+// and we do this by calling `json.Unmarshal` using a dynamic type that
+// can possibly be modified during runtime. This function is used to
+// add a new field to this dynamic type.
+//
+// Note that the `Name` field for the given `reflect.StructField` must start
+// with an upper case alphabet, such that it is treated as an exported field.
+// So for example, if you want to probe the "my_hint" field, you should specify
+// the field name as "MyHint" or similar.
+//
+// Also the field name must be unique. If you believe that your field name may
+// collide with other packages that may want to add their own probes,
+// it is the responsibility of the caller
+// to ensure that the field name is unique (possibly by prefixing the field
+// name with a unique string). It is important to note that the field name
+// need not be the same as the JSON field name. For example, your field name
+// could be "MyPkg_MyHint", while the actual JSON field name could be "my_hint".
+//
+// If the field name is not unique, an error is returned.
+func RegisterProbeField(p reflect.StructField) error {
+ // locking is done inside keyProbe
+ return keyProbe.AddField(p)
+}
+
+// KeyUnmarshaler is a thin wrapper around json.Unmarshal. It behaves almost
+// exactly like json.Unmarshal, but it allows us to add extra magic that
+// is specific to this library before calling the actual json.Unmarshal.
+type KeyUnmarshaler interface {
+ UnmarshalKey(data []byte, key any) error
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/rsa.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/rsa.go
new file mode 100644
index 0000000000..ca27681587
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/rsa.go
@@ -0,0 +1,360 @@
+package jwk
+
+import (
+ "crypto"
+ "crypto/rsa"
+ "encoding/binary"
+ "fmt"
+ "math/big"
+ "reflect"
+
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+func init() {
+ RegisterKeyExporter(jwa.RSA(), KeyExportFunc(rsaJWKToRaw))
+}
+
+func (k *rsaPrivateKey) Import(rawKey *rsa.PrivateKey) error {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+
+ d, err := bigIntToBytes(rawKey.D)
+ if err != nil {
+ return fmt.Errorf(`invalid rsa.PrivateKey: %w`, err)
+ }
+ k.d = d
+
+ l := len(rawKey.Primes)
+
+ if l < 0 /* I know, I'm being paranoid */ || l > 2 {
+ return fmt.Errorf(`invalid number of primes in rsa.PrivateKey: need 0 to 2, but got %d`, len(rawKey.Primes))
+ }
+
+ if l > 0 {
+ p, err := bigIntToBytes(rawKey.Primes[0])
+ if err != nil {
+ return fmt.Errorf(`invalid rsa.PrivateKey: %w`, err)
+ }
+ k.p = p
+ }
+
+ if l > 1 {
+ q, err := bigIntToBytes(rawKey.Primes[1])
+ if err != nil {
+ return fmt.Errorf(`invalid rsa.PrivateKey: %w`, err)
+ }
+ k.q = q
+ }
+
+ // dp, dq, qi are optional values
+ if v, err := bigIntToBytes(rawKey.Precomputed.Dp); err == nil {
+ k.dp = v
+ }
+ if v, err := bigIntToBytes(rawKey.Precomputed.Dq); err == nil {
+ k.dq = v
+ }
+ if v, err := bigIntToBytes(rawKey.Precomputed.Qinv); err == nil {
+ k.qi = v
+ }
+
+ // public key part
+ n, e, err := importRsaPublicKeyByteValues(&rawKey.PublicKey)
+ if err != nil {
+ return fmt.Errorf(`invalid rsa.PrivateKey: %w`, err)
+ }
+ k.n = n
+ k.e = e
+
+ return nil
+}
+
+func importRsaPublicKeyByteValues(rawKey *rsa.PublicKey) ([]byte, []byte, error) {
+ n, err := bigIntToBytes(rawKey.N)
+ if err != nil {
+ return nil, nil, fmt.Errorf(`invalid rsa.PublicKey: %w`, err)
+ }
+
+ data := make([]byte, 8)
+ binary.BigEndian.PutUint64(data, uint64(rawKey.E))
+ i := 0
+ for ; i < len(data); i++ {
+ if data[i] != 0x0 {
+ break
+ }
+ }
+ return n, data[i:], nil
+}
+
+func (k *rsaPublicKey) Import(rawKey *rsa.PublicKey) error {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+
+ n, e, err := importRsaPublicKeyByteValues(rawKey)
+ if err != nil {
+ return fmt.Errorf(`invalid rsa.PrivateKey: %w`, err)
+ }
+ k.n = n
+ k.e = e
+
+ return nil
+}
+
+func buildRSAPublicKey(key *rsa.PublicKey, n, e []byte) {
+ bin := pool.BigInt().Get()
+ bie := pool.BigInt().Get()
+ defer pool.BigInt().Put(bie)
+
+ bin.SetBytes(n)
+ bie.SetBytes(e)
+
+ key.N = bin
+ key.E = int(bie.Int64())
+}
+
+var rsaConvertibleKeys = []reflect.Type{
+ reflect.TypeFor[RSAPrivateKey](),
+ reflect.TypeFor[RSAPublicKey](),
+}
+
+func rsaJWKToRaw(key Key, hint any) (any, error) {
+ extracted, err := extractEmbeddedKey(key, rsaConvertibleKeys)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to extract embedded key: %w`, err)
+ }
+ switch key := extracted.(type) {
+ case RSAPrivateKey:
+ switch hint.(type) {
+ case *rsa.PrivateKey, *any:
+ default:
+ return nil, fmt.Errorf(`invalid destination object type %T for private RSA JWK: %w`, hint, ContinueError())
+ }
+
+ locker, ok := key.(rlocker)
+ if !ok {
+ locker.rlock()
+ defer locker.runlock()
+ }
+
+ od, ok := key.D()
+ if !ok {
+ return nil, fmt.Errorf(`missing "d" value`)
+ }
+
+ oq, ok := key.Q()
+ if !ok {
+ return nil, fmt.Errorf(`missing "q" value`)
+ }
+
+ op, ok := key.P()
+ if !ok {
+ return nil, fmt.Errorf(`missing "p" value`)
+ }
+
+ var d, q, p big.Int // note: do not use from sync.Pool
+
+ d.SetBytes(od)
+ q.SetBytes(oq)
+ p.SetBytes(op)
+
+ // optional fields
+ var dp, dq, qi *big.Int
+
+ if odp, ok := key.DP(); ok {
+ dp = &big.Int{} // note: do not use from sync.Pool
+ dp.SetBytes(odp)
+ }
+
+ if odq, ok := key.DQ(); ok {
+ dq = &big.Int{} // note: do not use from sync.Pool
+ dq.SetBytes(odq)
+ }
+
+ if oqi, ok := key.QI(); ok {
+ qi = &big.Int{} // note: do not use from sync.Pool
+ qi.SetBytes(oqi)
+ }
+
+ n, ok := key.N()
+ if !ok {
+ return nil, fmt.Errorf(`missing "n" value`)
+ }
+
+ e, ok := key.E()
+ if !ok {
+ return nil, fmt.Errorf(`missing "e" value`)
+ }
+
+ var privkey rsa.PrivateKey
+ buildRSAPublicKey(&privkey.PublicKey, n, e)
+ privkey.D = &d
+ privkey.Primes = []*big.Int{&p, &q}
+
+ if dp != nil {
+ privkey.Precomputed.Dp = dp
+ }
+ if dq != nil {
+ privkey.Precomputed.Dq = dq
+ }
+ if qi != nil {
+ privkey.Precomputed.Qinv = qi
+ }
+ // This may look like a no-op, but it's required if we want to
+ // compare it against a key generated by rsa.GenerateKey
+ privkey.Precomputed.CRTValues = []rsa.CRTValue{}
+ return &privkey, nil
+ case RSAPublicKey:
+ switch hint.(type) {
+ case *rsa.PublicKey, *any:
+ default:
+ return nil, fmt.Errorf(`invalid destination object type %T for public RSA JWK: %w`, hint, ContinueError())
+ }
+
+ locker, ok := key.(rlocker)
+ if !ok {
+ locker.rlock()
+ defer locker.runlock()
+ }
+
+ n, ok := key.N()
+ if !ok {
+ return nil, fmt.Errorf(`missing "n" value`)
+ }
+
+ e, ok := key.E()
+ if !ok {
+ return nil, fmt.Errorf(`missing "e" value`)
+ }
+
+ var pubkey rsa.PublicKey
+ buildRSAPublicKey(&pubkey, n, e)
+
+ return &pubkey, nil
+
+ default:
+ return nil, ContinueError()
+ }
+}
+
+func makeRSAPublicKey(src Key) (Key, error) {
+ newKey := newRSAPublicKey()
+
+ // Iterate and copy everything except for the bits that should not be in the public key
+ for _, k := range src.Keys() {
+ switch k {
+ case RSADKey, RSADPKey, RSADQKey, RSAPKey, RSAQKey, RSAQIKey:
+ continue
+ default:
+ var v any
+ if err := src.Get(k, &v); err != nil {
+ return nil, fmt.Errorf(`rsa: makeRSAPublicKey: failed to get field %q: %w`, k, err)
+ }
+ if err := newKey.Set(k, v); err != nil {
+ return nil, fmt.Errorf(`rsa: makeRSAPublicKey: failed to set field %q: %w`, k, err)
+ }
+ }
+ }
+
+ return newKey, nil
+}
+
+func (k *rsaPrivateKey) PublicKey() (Key, error) {
+ return makeRSAPublicKey(k)
+}
+
+func (k *rsaPublicKey) PublicKey() (Key, error) {
+ return makeRSAPublicKey(k)
+}
+
+// Thumbprint returns the JWK thumbprint using the indicated
+// hashing algorithm, according to RFC 7638
+func (k rsaPrivateKey) Thumbprint(hash crypto.Hash) ([]byte, error) {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+
+ var key rsa.PrivateKey
+ if err := Export(&k, &key); err != nil {
+ return nil, fmt.Errorf(`failed to export RSA private key: %w`, err)
+ }
+ return rsaThumbprint(hash, &key.PublicKey)
+}
+
+func (k rsaPublicKey) Thumbprint(hash crypto.Hash) ([]byte, error) {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+
+ var key rsa.PublicKey
+ if err := Export(&k, &key); err != nil {
+ return nil, fmt.Errorf(`failed to export RSA public key: %w`, err)
+ }
+ return rsaThumbprint(hash, &key)
+}
+
+func rsaThumbprint(hash crypto.Hash, key *rsa.PublicKey) ([]byte, error) {
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+
+ buf.WriteString(`{"e":"`)
+ buf.WriteString(base64.EncodeUint64ToString(uint64(key.E)))
+ buf.WriteString(`","kty":"RSA","n":"`)
+ buf.WriteString(base64.EncodeToString(key.N.Bytes()))
+ buf.WriteString(`"}`)
+
+ h := hash.New()
+ if _, err := buf.WriteTo(h); err != nil {
+ return nil, fmt.Errorf(`failed to write rsaThumbprint: %w`, err)
+ }
+ return h.Sum(nil), nil
+}
+
+func validateRSAKey(key interface {
+ N() ([]byte, bool)
+ E() ([]byte, bool)
+}, checkPrivate bool) error {
+ n, ok := key.N()
+ if !ok {
+ return fmt.Errorf(`missing "n" value`)
+ }
+
+ e, ok := key.E()
+ if !ok {
+ return fmt.Errorf(`missing "e" value`)
+ }
+
+ if len(n) == 0 {
+ // Ideally we would like to check for the actual length, but unlike
+ // EC keys, we have nothing in the key itself that will tell us
+ // how many bits this key should have.
+ return fmt.Errorf(`missing "n" value`)
+ }
+ if len(e) == 0 {
+ return fmt.Errorf(`missing "e" value`)
+ }
+ if checkPrivate {
+ if priv, ok := key.(keyWithD); ok {
+ if d, ok := priv.D(); !ok || len(d) == 0 {
+ return fmt.Errorf(`missing "d" value`)
+ }
+ } else {
+ return fmt.Errorf(`missing "d" value`)
+ }
+ }
+
+ return nil
+}
+
+func (k *rsaPrivateKey) Validate() error {
+ if err := validateRSAKey(k, true); err != nil {
+ return NewKeyValidationError(fmt.Errorf(`jwk.RSAPrivateKey: %w`, err))
+ }
+ return nil
+}
+
+func (k *rsaPublicKey) Validate() error {
+ if err := validateRSAKey(k, false); err != nil {
+ return NewKeyValidationError(fmt.Errorf(`jwk.RSAPublicKey: %w`, err))
+ }
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/rsa_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/rsa_gen.go
new file mode 100644
index 0000000000..8e2a4f085b
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/rsa_gen.go
@@ -0,0 +1,1543 @@
+// Code generated by tools/cmd/genjwk/main.go. DO NOT EDIT.
+
+package jwk
+
+import (
+ "bytes"
+ "fmt"
+ "sort"
+ "sync"
+
+ "github.com/lestrrat-go/blackmagic"
+ "github.com/lestrrat-go/jwx/v3/cert"
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+const (
+ RSADKey = "d"
+ RSADPKey = "dp"
+ RSADQKey = "dq"
+ RSAEKey = "e"
+ RSANKey = "n"
+ RSAPKey = "p"
+ RSAQIKey = "qi"
+ RSAQKey = "q"
+)
+
+type RSAPublicKey interface {
+ Key
+ E() ([]byte, bool)
+ N() ([]byte, bool)
+}
+
+type rsaPublicKey struct {
+ algorithm *jwa.KeyAlgorithm // https://tools.ietf.org/html/rfc7517#section-4.4
+ e []byte
+ keyID *string // https://tools.ietf.org/html/rfc7515#section-4.1.4
+ keyOps *KeyOperationList // https://tools.ietf.org/html/rfc7517#section-4.3
+ keyUsage *string // https://tools.ietf.org/html/rfc7517#section-4.2
+ n []byte
+ x509CertChain *cert.Chain // https://tools.ietf.org/html/rfc7515#section-4.1.6
+ x509CertThumbprint *string // https://tools.ietf.org/html/rfc7515#section-4.1.7
+ x509CertThumbprintS256 *string // https://tools.ietf.org/html/rfc7515#section-4.1.8
+ x509URL *string // https://tools.ietf.org/html/rfc7515#section-4.1.5
+ privateParams map[string]any
+ mu *sync.RWMutex
+ dc json.DecodeCtx
+}
+
+var _ RSAPublicKey = &rsaPublicKey{}
+var _ Key = &rsaPublicKey{}
+
+func newRSAPublicKey() *rsaPublicKey {
+ return &rsaPublicKey{
+ mu: &sync.RWMutex{},
+ privateParams: make(map[string]any),
+ }
+}
+
+func (h rsaPublicKey) KeyType() jwa.KeyType {
+ return jwa.RSA()
+}
+
+func (h rsaPublicKey) rlock() {
+ h.mu.RLock()
+}
+
+func (h rsaPublicKey) runlock() {
+ h.mu.RUnlock()
+}
+
+func (h rsaPublicKey) IsPrivate() bool {
+ return false
+}
+
+func (h *rsaPublicKey) Algorithm() (jwa.KeyAlgorithm, bool) {
+ if h.algorithm != nil {
+ return *(h.algorithm), true
+ }
+ return nil, false
+}
+
+func (h *rsaPublicKey) E() ([]byte, bool) {
+ if h.e != nil {
+ return h.e, true
+ }
+ return nil, false
+}
+
+func (h *rsaPublicKey) KeyID() (string, bool) {
+ if h.keyID != nil {
+ return *(h.keyID), true
+ }
+ return "", false
+}
+
+func (h *rsaPublicKey) KeyOps() (KeyOperationList, bool) {
+ if h.keyOps != nil {
+ return *(h.keyOps), true
+ }
+ return nil, false
+}
+
+func (h *rsaPublicKey) KeyUsage() (string, bool) {
+ if h.keyUsage != nil {
+ return *(h.keyUsage), true
+ }
+ return "", false
+}
+
+func (h *rsaPublicKey) N() ([]byte, bool) {
+ if h.n != nil {
+ return h.n, true
+ }
+ return nil, false
+}
+
+func (h *rsaPublicKey) X509CertChain() (*cert.Chain, bool) {
+ return h.x509CertChain, true
+}
+
+func (h *rsaPublicKey) X509CertThumbprint() (string, bool) {
+ if h.x509CertThumbprint != nil {
+ return *(h.x509CertThumbprint), true
+ }
+ return "", false
+}
+
+func (h *rsaPublicKey) X509CertThumbprintS256() (string, bool) {
+ if h.x509CertThumbprintS256 != nil {
+ return *(h.x509CertThumbprintS256), true
+ }
+ return "", false
+}
+
+func (h *rsaPublicKey) X509URL() (string, bool) {
+ if h.x509URL != nil {
+ return *(h.x509URL), true
+ }
+ return "", false
+}
+
+func (h *rsaPublicKey) Has(name string) bool {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case KeyTypeKey:
+ return true
+ case AlgorithmKey:
+ return h.algorithm != nil
+ case RSAEKey:
+ return h.e != nil
+ case KeyIDKey:
+ return h.keyID != nil
+ case KeyOpsKey:
+ return h.keyOps != nil
+ case KeyUsageKey:
+ return h.keyUsage != nil
+ case RSANKey:
+ return h.n != nil
+ case X509CertChainKey:
+ return h.x509CertChain != nil
+ case X509CertThumbprintKey:
+ return h.x509CertThumbprint != nil
+ case X509CertThumbprintS256Key:
+ return h.x509CertThumbprintS256 != nil
+ case X509URLKey:
+ return h.x509URL != nil
+ default:
+ _, ok := h.privateParams[name]
+ return ok
+ }
+}
+
+func (h *rsaPublicKey) Get(name string, dst any) error {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case KeyTypeKey:
+ if err := blackmagic.AssignIfCompatible(dst, h.KeyType()); err != nil {
+ return fmt.Errorf(`rsaPublicKey.Get: failed to assign value for field %q to destination object: %w`, name, err)
+ }
+ case AlgorithmKey:
+ if h.algorithm == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.algorithm)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case RSAEKey:
+ if h.e == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.e); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyIDKey:
+ if h.keyID == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyID)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyOpsKey:
+ if h.keyOps == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyOps)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyUsageKey:
+ if h.keyUsage == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyUsage)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case RSANKey:
+ if h.n == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.n); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertChainKey:
+ if h.x509CertChain == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.x509CertChain); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertThumbprintKey:
+ if h.x509CertThumbprint == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprint)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertThumbprintS256Key:
+ if h.x509CertThumbprintS256 == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprintS256)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509URLKey:
+ if h.x509URL == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509URL)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ default:
+ v, ok := h.privateParams[name]
+ if !ok {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, v); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ }
+ return nil
+}
+
+func (h *rsaPublicKey) Set(name string, value any) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ return h.setNoLock(name, value)
+}
+
+func (h *rsaPublicKey) setNoLock(name string, value any) error {
+ switch name {
+ case "kty":
+ return nil
+ case AlgorithmKey:
+ switch v := value.(type) {
+ case string, jwa.SignatureAlgorithm, jwa.KeyEncryptionAlgorithm, jwa.ContentEncryptionAlgorithm:
+ tmp, err := jwa.KeyAlgorithmFrom(v)
+ if err != nil {
+ return fmt.Errorf(`invalid algorithm for %q key: %w`, AlgorithmKey, err)
+ }
+ h.algorithm = &tmp
+ default:
+ return fmt.Errorf(`invalid type for %q key: %T`, AlgorithmKey, value)
+ }
+ return nil
+ case RSAEKey:
+ if v, ok := value.([]byte); ok {
+ h.e = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, RSAEKey, value)
+ case KeyIDKey:
+ if v, ok := value.(string); ok {
+ h.keyID = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, KeyIDKey, value)
+ case KeyOpsKey:
+ var acceptor KeyOperationList
+ if err := acceptor.Accept(value); err != nil {
+ return fmt.Errorf(`invalid value for %s key: %w`, KeyOpsKey, err)
+ }
+ h.keyOps = &acceptor
+ return nil
+ case KeyUsageKey:
+ switch v := value.(type) {
+ case KeyUsageType:
+ switch v {
+ case ForSignature, ForEncryption:
+ tmp := v.String()
+ h.keyUsage = &tmp
+ default:
+ return fmt.Errorf(`invalid key usage type %s`, v)
+ }
+ case string:
+ h.keyUsage = &v
+ default:
+ return fmt.Errorf(`invalid key usage type %s`, v)
+ }
+ case RSANKey:
+ if v, ok := value.([]byte); ok {
+ h.n = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, RSANKey, value)
+ case X509CertChainKey:
+ if v, ok := value.(*cert.Chain); ok {
+ h.x509CertChain = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertChainKey, value)
+ case X509CertThumbprintKey:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprint = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintKey, value)
+ case X509CertThumbprintS256Key:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprintS256 = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintS256Key, value)
+ case X509URLKey:
+ if v, ok := value.(string); ok {
+ h.x509URL = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509URLKey, value)
+ default:
+ if h.privateParams == nil {
+ h.privateParams = map[string]any{}
+ }
+ h.privateParams[name] = value
+ }
+ return nil
+}
+
+func (k *rsaPublicKey) Remove(key string) error {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+ switch key {
+ case AlgorithmKey:
+ k.algorithm = nil
+ case RSAEKey:
+ k.e = nil
+ case KeyIDKey:
+ k.keyID = nil
+ case KeyOpsKey:
+ k.keyOps = nil
+ case KeyUsageKey:
+ k.keyUsage = nil
+ case RSANKey:
+ k.n = nil
+ case X509CertChainKey:
+ k.x509CertChain = nil
+ case X509CertThumbprintKey:
+ k.x509CertThumbprint = nil
+ case X509CertThumbprintS256Key:
+ k.x509CertThumbprintS256 = nil
+ case X509URLKey:
+ k.x509URL = nil
+ default:
+ delete(k.privateParams, key)
+ }
+ return nil
+}
+
+func (k *rsaPublicKey) Clone() (Key, error) {
+ key, err := cloneKey(k)
+ if err != nil {
+ return nil, fmt.Errorf(`rsaPublicKey.Clone: %w`, err)
+ }
+ return key, nil
+}
+
+func (k *rsaPublicKey) DecodeCtx() json.DecodeCtx {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+ return k.dc
+}
+
+func (k *rsaPublicKey) SetDecodeCtx(dc json.DecodeCtx) {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+ k.dc = dc
+}
+
+func (h *rsaPublicKey) UnmarshalJSON(buf []byte) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ h.algorithm = nil
+ h.e = nil
+ h.keyID = nil
+ h.keyOps = nil
+ h.keyUsage = nil
+ h.n = nil
+ h.x509CertChain = nil
+ h.x509CertThumbprint = nil
+ h.x509CertThumbprintS256 = nil
+ h.x509URL = nil
+ dec := json.NewDecoder(bytes.NewReader(buf))
+LOOP:
+ for {
+ tok, err := dec.Token()
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ switch tok := tok.(type) {
+ case json.Delim:
+ // Assuming we're doing everything correctly, we should ONLY
+ // get either tokens.OpenCurlyBracket or tokens.CloseCurlyBracket here.
+ if tok == tokens.CloseCurlyBracket { // End of object
+ break LOOP
+ } else if tok != tokens.OpenCurlyBracket {
+ return fmt.Errorf(`expected '%c' but got '%c'`, tokens.OpenCurlyBracket, tok)
+ }
+ case string: // Objects can only have string keys
+ switch tok {
+ case KeyTypeKey:
+ val, err := json.ReadNextStringToken(dec)
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ if val != jwa.RSA().String() {
+ return fmt.Errorf(`invalid kty value for RSAPublicKey (%s)`, val)
+ }
+ case AlgorithmKey:
+ var s string
+ if err := dec.Decode(&s); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AlgorithmKey, err)
+ }
+ alg, err := jwa.KeyAlgorithmFrom(s)
+ if err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AlgorithmKey, err)
+ }
+ h.algorithm = &alg
+ case RSAEKey:
+ if err := json.AssignNextBytesToken(&h.e, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, RSAEKey, err)
+ }
+ case KeyIDKey:
+ if err := json.AssignNextStringToken(&h.keyID, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyIDKey, err)
+ }
+ case KeyOpsKey:
+ var decoded KeyOperationList
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyOpsKey, err)
+ }
+ h.keyOps = &decoded
+ case KeyUsageKey:
+ if err := json.AssignNextStringToken(&h.keyUsage, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyUsageKey, err)
+ }
+ case RSANKey:
+ if err := json.AssignNextBytesToken(&h.n, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, RSANKey, err)
+ }
+ case X509CertChainKey:
+ var decoded cert.Chain
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertChainKey, err)
+ }
+ h.x509CertChain = &decoded
+ case X509CertThumbprintKey:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprint, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintKey, err)
+ }
+ case X509CertThumbprintS256Key:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprintS256, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintS256Key, err)
+ }
+ case X509URLKey:
+ if err := json.AssignNextStringToken(&h.x509URL, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509URLKey, err)
+ }
+ default:
+ if dc := h.dc; dc != nil {
+ if localReg := dc.Registry(); localReg != nil {
+ decoded, err := localReg.Decode(dec, tok)
+ if err == nil {
+ h.setNoLock(tok, decoded)
+ continue
+ }
+ }
+ }
+ decoded, err := registry.Decode(dec, tok)
+ if err == nil {
+ h.setNoLock(tok, decoded)
+ continue
+ }
+ return fmt.Errorf(`could not decode field %s: %w`, tok, err)
+ }
+ default:
+ return fmt.Errorf(`invalid token %T`, tok)
+ }
+ }
+ if h.e == nil {
+ return fmt.Errorf(`required field e is missing`)
+ }
+ if h.n == nil {
+ return fmt.Errorf(`required field n is missing`)
+ }
+ return nil
+}
+
+func (h rsaPublicKey) MarshalJSON() ([]byte, error) {
+ data := make(map[string]any)
+ fields := make([]string, 0, 10)
+ data[KeyTypeKey] = jwa.RSA()
+ fields = append(fields, KeyTypeKey)
+ if h.algorithm != nil {
+ data[AlgorithmKey] = *(h.algorithm)
+ fields = append(fields, AlgorithmKey)
+ }
+ if h.e != nil {
+ data[RSAEKey] = h.e
+ fields = append(fields, RSAEKey)
+ }
+ if h.keyID != nil {
+ data[KeyIDKey] = *(h.keyID)
+ fields = append(fields, KeyIDKey)
+ }
+ if h.keyOps != nil {
+ data[KeyOpsKey] = *(h.keyOps)
+ fields = append(fields, KeyOpsKey)
+ }
+ if h.keyUsage != nil {
+ data[KeyUsageKey] = *(h.keyUsage)
+ fields = append(fields, KeyUsageKey)
+ }
+ if h.n != nil {
+ data[RSANKey] = h.n
+ fields = append(fields, RSANKey)
+ }
+ if h.x509CertChain != nil {
+ data[X509CertChainKey] = h.x509CertChain
+ fields = append(fields, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ data[X509CertThumbprintKey] = *(h.x509CertThumbprint)
+ fields = append(fields, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ data[X509CertThumbprintS256Key] = *(h.x509CertThumbprintS256)
+ fields = append(fields, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ data[X509URLKey] = *(h.x509URL)
+ fields = append(fields, X509URLKey)
+ }
+ for k, v := range h.privateParams {
+ data[k] = v
+ fields = append(fields, k)
+ }
+
+ sort.Strings(fields)
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+ buf.WriteByte(tokens.OpenCurlyBracket)
+ enc := json.NewEncoder(buf)
+ for i, f := range fields {
+ if i > 0 {
+ buf.WriteRune(tokens.Comma)
+ }
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(f)
+ buf.WriteString(`":`)
+ v := data[f]
+ switch v := v.(type) {
+ case []byte:
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(base64.EncodeToString(v))
+ buf.WriteRune(tokens.DoubleQuote)
+ default:
+ if err := enc.Encode(v); err != nil {
+ return nil, fmt.Errorf(`failed to encode value for field %s: %w`, f, err)
+ }
+ buf.Truncate(buf.Len() - 1)
+ }
+ }
+ buf.WriteByte(tokens.CloseCurlyBracket)
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ return ret, nil
+}
+
+func (h *rsaPublicKey) Keys() []string {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ keys := make([]string, 0, 10+len(h.privateParams))
+ keys = append(keys, KeyTypeKey)
+ if h.algorithm != nil {
+ keys = append(keys, AlgorithmKey)
+ }
+ if h.e != nil {
+ keys = append(keys, RSAEKey)
+ }
+ if h.keyID != nil {
+ keys = append(keys, KeyIDKey)
+ }
+ if h.keyOps != nil {
+ keys = append(keys, KeyOpsKey)
+ }
+ if h.keyUsage != nil {
+ keys = append(keys, KeyUsageKey)
+ }
+ if h.n != nil {
+ keys = append(keys, RSANKey)
+ }
+ if h.x509CertChain != nil {
+ keys = append(keys, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ keys = append(keys, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ keys = append(keys, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ keys = append(keys, X509URLKey)
+ }
+ for k := range h.privateParams {
+ keys = append(keys, k)
+ }
+ return keys
+}
+
+type RSAPrivateKey interface {
+ Key
+ D() ([]byte, bool)
+ DP() ([]byte, bool)
+ DQ() ([]byte, bool)
+ E() ([]byte, bool)
+ N() ([]byte, bool)
+ P() ([]byte, bool)
+ Q() ([]byte, bool)
+ QI() ([]byte, bool)
+}
+
+type rsaPrivateKey struct {
+ algorithm *jwa.KeyAlgorithm // https://tools.ietf.org/html/rfc7517#section-4.4
+ d []byte
+ dp []byte
+ dq []byte
+ e []byte
+ keyID *string // https://tools.ietf.org/html/rfc7515#section-4.1.4
+ keyOps *KeyOperationList // https://tools.ietf.org/html/rfc7517#section-4.3
+ keyUsage *string // https://tools.ietf.org/html/rfc7517#section-4.2
+ n []byte
+ p []byte
+ q []byte
+ qi []byte
+ x509CertChain *cert.Chain // https://tools.ietf.org/html/rfc7515#section-4.1.6
+ x509CertThumbprint *string // https://tools.ietf.org/html/rfc7515#section-4.1.7
+ x509CertThumbprintS256 *string // https://tools.ietf.org/html/rfc7515#section-4.1.8
+ x509URL *string // https://tools.ietf.org/html/rfc7515#section-4.1.5
+ privateParams map[string]any
+ mu *sync.RWMutex
+ dc json.DecodeCtx
+}
+
+var _ RSAPrivateKey = &rsaPrivateKey{}
+var _ Key = &rsaPrivateKey{}
+
+func newRSAPrivateKey() *rsaPrivateKey {
+ return &rsaPrivateKey{
+ mu: &sync.RWMutex{},
+ privateParams: make(map[string]any),
+ }
+}
+
+func (h rsaPrivateKey) KeyType() jwa.KeyType {
+ return jwa.RSA()
+}
+
+func (h rsaPrivateKey) rlock() {
+ h.mu.RLock()
+}
+
+func (h rsaPrivateKey) runlock() {
+ h.mu.RUnlock()
+}
+
+func (h rsaPrivateKey) IsPrivate() bool {
+ return true
+}
+
+func (h *rsaPrivateKey) Algorithm() (jwa.KeyAlgorithm, bool) {
+ if h.algorithm != nil {
+ return *(h.algorithm), true
+ }
+ return nil, false
+}
+
+func (h *rsaPrivateKey) D() ([]byte, bool) {
+ if h.d != nil {
+ return h.d, true
+ }
+ return nil, false
+}
+
+func (h *rsaPrivateKey) DP() ([]byte, bool) {
+ if h.dp != nil {
+ return h.dp, true
+ }
+ return nil, false
+}
+
+func (h *rsaPrivateKey) DQ() ([]byte, bool) {
+ if h.dq != nil {
+ return h.dq, true
+ }
+ return nil, false
+}
+
+func (h *rsaPrivateKey) E() ([]byte, bool) {
+ if h.e != nil {
+ return h.e, true
+ }
+ return nil, false
+}
+
+func (h *rsaPrivateKey) KeyID() (string, bool) {
+ if h.keyID != nil {
+ return *(h.keyID), true
+ }
+ return "", false
+}
+
+func (h *rsaPrivateKey) KeyOps() (KeyOperationList, bool) {
+ if h.keyOps != nil {
+ return *(h.keyOps), true
+ }
+ return nil, false
+}
+
+func (h *rsaPrivateKey) KeyUsage() (string, bool) {
+ if h.keyUsage != nil {
+ return *(h.keyUsage), true
+ }
+ return "", false
+}
+
+func (h *rsaPrivateKey) N() ([]byte, bool) {
+ if h.n != nil {
+ return h.n, true
+ }
+ return nil, false
+}
+
+func (h *rsaPrivateKey) P() ([]byte, bool) {
+ if h.p != nil {
+ return h.p, true
+ }
+ return nil, false
+}
+
+func (h *rsaPrivateKey) Q() ([]byte, bool) {
+ if h.q != nil {
+ return h.q, true
+ }
+ return nil, false
+}
+
+func (h *rsaPrivateKey) QI() ([]byte, bool) {
+ if h.qi != nil {
+ return h.qi, true
+ }
+ return nil, false
+}
+
+func (h *rsaPrivateKey) X509CertChain() (*cert.Chain, bool) {
+ return h.x509CertChain, true
+}
+
+func (h *rsaPrivateKey) X509CertThumbprint() (string, bool) {
+ if h.x509CertThumbprint != nil {
+ return *(h.x509CertThumbprint), true
+ }
+ return "", false
+}
+
+func (h *rsaPrivateKey) X509CertThumbprintS256() (string, bool) {
+ if h.x509CertThumbprintS256 != nil {
+ return *(h.x509CertThumbprintS256), true
+ }
+ return "", false
+}
+
+func (h *rsaPrivateKey) X509URL() (string, bool) {
+ if h.x509URL != nil {
+ return *(h.x509URL), true
+ }
+ return "", false
+}
+
+func (h *rsaPrivateKey) Has(name string) bool {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case KeyTypeKey:
+ return true
+ case AlgorithmKey:
+ return h.algorithm != nil
+ case RSADKey:
+ return h.d != nil
+ case RSADPKey:
+ return h.dp != nil
+ case RSADQKey:
+ return h.dq != nil
+ case RSAEKey:
+ return h.e != nil
+ case KeyIDKey:
+ return h.keyID != nil
+ case KeyOpsKey:
+ return h.keyOps != nil
+ case KeyUsageKey:
+ return h.keyUsage != nil
+ case RSANKey:
+ return h.n != nil
+ case RSAPKey:
+ return h.p != nil
+ case RSAQKey:
+ return h.q != nil
+ case RSAQIKey:
+ return h.qi != nil
+ case X509CertChainKey:
+ return h.x509CertChain != nil
+ case X509CertThumbprintKey:
+ return h.x509CertThumbprint != nil
+ case X509CertThumbprintS256Key:
+ return h.x509CertThumbprintS256 != nil
+ case X509URLKey:
+ return h.x509URL != nil
+ default:
+ _, ok := h.privateParams[name]
+ return ok
+ }
+}
+
+func (h *rsaPrivateKey) Get(name string, dst any) error {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case KeyTypeKey:
+ if err := blackmagic.AssignIfCompatible(dst, h.KeyType()); err != nil {
+ return fmt.Errorf(`rsaPrivateKey.Get: failed to assign value for field %q to destination object: %w`, name, err)
+ }
+ case AlgorithmKey:
+ if h.algorithm == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.algorithm)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case RSADKey:
+ if h.d == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.d); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case RSADPKey:
+ if h.dp == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.dp); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case RSADQKey:
+ if h.dq == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.dq); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case RSAEKey:
+ if h.e == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.e); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyIDKey:
+ if h.keyID == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyID)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyOpsKey:
+ if h.keyOps == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyOps)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyUsageKey:
+ if h.keyUsage == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyUsage)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case RSANKey:
+ if h.n == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.n); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case RSAPKey:
+ if h.p == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.p); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case RSAQKey:
+ if h.q == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.q); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case RSAQIKey:
+ if h.qi == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.qi); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertChainKey:
+ if h.x509CertChain == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.x509CertChain); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertThumbprintKey:
+ if h.x509CertThumbprint == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprint)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertThumbprintS256Key:
+ if h.x509CertThumbprintS256 == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprintS256)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509URLKey:
+ if h.x509URL == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509URL)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ default:
+ v, ok := h.privateParams[name]
+ if !ok {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, v); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ }
+ return nil
+}
+
+func (h *rsaPrivateKey) Set(name string, value any) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ return h.setNoLock(name, value)
+}
+
+func (h *rsaPrivateKey) setNoLock(name string, value any) error {
+ switch name {
+ case "kty":
+ return nil
+ case AlgorithmKey:
+ switch v := value.(type) {
+ case string, jwa.SignatureAlgorithm, jwa.KeyEncryptionAlgorithm, jwa.ContentEncryptionAlgorithm:
+ tmp, err := jwa.KeyAlgorithmFrom(v)
+ if err != nil {
+ return fmt.Errorf(`invalid algorithm for %q key: %w`, AlgorithmKey, err)
+ }
+ h.algorithm = &tmp
+ default:
+ return fmt.Errorf(`invalid type for %q key: %T`, AlgorithmKey, value)
+ }
+ return nil
+ case RSADKey:
+ if v, ok := value.([]byte); ok {
+ h.d = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, RSADKey, value)
+ case RSADPKey:
+ if v, ok := value.([]byte); ok {
+ h.dp = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, RSADPKey, value)
+ case RSADQKey:
+ if v, ok := value.([]byte); ok {
+ h.dq = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, RSADQKey, value)
+ case RSAEKey:
+ if v, ok := value.([]byte); ok {
+ h.e = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, RSAEKey, value)
+ case KeyIDKey:
+ if v, ok := value.(string); ok {
+ h.keyID = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, KeyIDKey, value)
+ case KeyOpsKey:
+ var acceptor KeyOperationList
+ if err := acceptor.Accept(value); err != nil {
+ return fmt.Errorf(`invalid value for %s key: %w`, KeyOpsKey, err)
+ }
+ h.keyOps = &acceptor
+ return nil
+ case KeyUsageKey:
+ switch v := value.(type) {
+ case KeyUsageType:
+ switch v {
+ case ForSignature, ForEncryption:
+ tmp := v.String()
+ h.keyUsage = &tmp
+ default:
+ return fmt.Errorf(`invalid key usage type %s`, v)
+ }
+ case string:
+ h.keyUsage = &v
+ default:
+ return fmt.Errorf(`invalid key usage type %s`, v)
+ }
+ case RSANKey:
+ if v, ok := value.([]byte); ok {
+ h.n = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, RSANKey, value)
+ case RSAPKey:
+ if v, ok := value.([]byte); ok {
+ h.p = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, RSAPKey, value)
+ case RSAQKey:
+ if v, ok := value.([]byte); ok {
+ h.q = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, RSAQKey, value)
+ case RSAQIKey:
+ if v, ok := value.([]byte); ok {
+ h.qi = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, RSAQIKey, value)
+ case X509CertChainKey:
+ if v, ok := value.(*cert.Chain); ok {
+ h.x509CertChain = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertChainKey, value)
+ case X509CertThumbprintKey:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprint = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintKey, value)
+ case X509CertThumbprintS256Key:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprintS256 = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintS256Key, value)
+ case X509URLKey:
+ if v, ok := value.(string); ok {
+ h.x509URL = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509URLKey, value)
+ default:
+ if h.privateParams == nil {
+ h.privateParams = map[string]any{}
+ }
+ h.privateParams[name] = value
+ }
+ return nil
+}
+
+func (k *rsaPrivateKey) Remove(key string) error {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+ switch key {
+ case AlgorithmKey:
+ k.algorithm = nil
+ case RSADKey:
+ k.d = nil
+ case RSADPKey:
+ k.dp = nil
+ case RSADQKey:
+ k.dq = nil
+ case RSAEKey:
+ k.e = nil
+ case KeyIDKey:
+ k.keyID = nil
+ case KeyOpsKey:
+ k.keyOps = nil
+ case KeyUsageKey:
+ k.keyUsage = nil
+ case RSANKey:
+ k.n = nil
+ case RSAPKey:
+ k.p = nil
+ case RSAQKey:
+ k.q = nil
+ case RSAQIKey:
+ k.qi = nil
+ case X509CertChainKey:
+ k.x509CertChain = nil
+ case X509CertThumbprintKey:
+ k.x509CertThumbprint = nil
+ case X509CertThumbprintS256Key:
+ k.x509CertThumbprintS256 = nil
+ case X509URLKey:
+ k.x509URL = nil
+ default:
+ delete(k.privateParams, key)
+ }
+ return nil
+}
+
+func (k *rsaPrivateKey) Clone() (Key, error) {
+ key, err := cloneKey(k)
+ if err != nil {
+ return nil, fmt.Errorf(`rsaPrivateKey.Clone: %w`, err)
+ }
+ return key, nil
+}
+
+func (k *rsaPrivateKey) DecodeCtx() json.DecodeCtx {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+ return k.dc
+}
+
+func (k *rsaPrivateKey) SetDecodeCtx(dc json.DecodeCtx) {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+ k.dc = dc
+}
+
+func (h *rsaPrivateKey) UnmarshalJSON(buf []byte) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ h.algorithm = nil
+ h.d = nil
+ h.dp = nil
+ h.dq = nil
+ h.e = nil
+ h.keyID = nil
+ h.keyOps = nil
+ h.keyUsage = nil
+ h.n = nil
+ h.p = nil
+ h.q = nil
+ h.qi = nil
+ h.x509CertChain = nil
+ h.x509CertThumbprint = nil
+ h.x509CertThumbprintS256 = nil
+ h.x509URL = nil
+ dec := json.NewDecoder(bytes.NewReader(buf))
+LOOP:
+ for {
+ tok, err := dec.Token()
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ switch tok := tok.(type) {
+ case json.Delim:
+ // Assuming we're doing everything correctly, we should ONLY
+ // get either tokens.OpenCurlyBracket or tokens.CloseCurlyBracket here.
+ if tok == tokens.CloseCurlyBracket { // End of object
+ break LOOP
+ } else if tok != tokens.OpenCurlyBracket {
+ return fmt.Errorf(`expected '%c' but got '%c'`, tokens.OpenCurlyBracket, tok)
+ }
+ case string: // Objects can only have string keys
+ switch tok {
+ case KeyTypeKey:
+ val, err := json.ReadNextStringToken(dec)
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ if val != jwa.RSA().String() {
+ return fmt.Errorf(`invalid kty value for RSAPublicKey (%s)`, val)
+ }
+ case AlgorithmKey:
+ var s string
+ if err := dec.Decode(&s); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AlgorithmKey, err)
+ }
+ alg, err := jwa.KeyAlgorithmFrom(s)
+ if err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AlgorithmKey, err)
+ }
+ h.algorithm = &alg
+ case RSADKey:
+ if err := json.AssignNextBytesToken(&h.d, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, RSADKey, err)
+ }
+ case RSADPKey:
+ if err := json.AssignNextBytesToken(&h.dp, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, RSADPKey, err)
+ }
+ case RSADQKey:
+ if err := json.AssignNextBytesToken(&h.dq, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, RSADQKey, err)
+ }
+ case RSAEKey:
+ if err := json.AssignNextBytesToken(&h.e, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, RSAEKey, err)
+ }
+ case KeyIDKey:
+ if err := json.AssignNextStringToken(&h.keyID, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyIDKey, err)
+ }
+ case KeyOpsKey:
+ var decoded KeyOperationList
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyOpsKey, err)
+ }
+ h.keyOps = &decoded
+ case KeyUsageKey:
+ if err := json.AssignNextStringToken(&h.keyUsage, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyUsageKey, err)
+ }
+ case RSANKey:
+ if err := json.AssignNextBytesToken(&h.n, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, RSANKey, err)
+ }
+ case RSAPKey:
+ if err := json.AssignNextBytesToken(&h.p, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, RSAPKey, err)
+ }
+ case RSAQKey:
+ if err := json.AssignNextBytesToken(&h.q, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, RSAQKey, err)
+ }
+ case RSAQIKey:
+ if err := json.AssignNextBytesToken(&h.qi, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, RSAQIKey, err)
+ }
+ case X509CertChainKey:
+ var decoded cert.Chain
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertChainKey, err)
+ }
+ h.x509CertChain = &decoded
+ case X509CertThumbprintKey:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprint, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintKey, err)
+ }
+ case X509CertThumbprintS256Key:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprintS256, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintS256Key, err)
+ }
+ case X509URLKey:
+ if err := json.AssignNextStringToken(&h.x509URL, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509URLKey, err)
+ }
+ default:
+ if dc := h.dc; dc != nil {
+ if localReg := dc.Registry(); localReg != nil {
+ decoded, err := localReg.Decode(dec, tok)
+ if err == nil {
+ h.setNoLock(tok, decoded)
+ continue
+ }
+ }
+ }
+ decoded, err := registry.Decode(dec, tok)
+ if err == nil {
+ h.setNoLock(tok, decoded)
+ continue
+ }
+ return fmt.Errorf(`could not decode field %s: %w`, tok, err)
+ }
+ default:
+ return fmt.Errorf(`invalid token %T`, tok)
+ }
+ }
+ if h.d == nil {
+ return fmt.Errorf(`required field d is missing`)
+ }
+ if h.e == nil {
+ return fmt.Errorf(`required field e is missing`)
+ }
+ if h.n == nil {
+ return fmt.Errorf(`required field n is missing`)
+ }
+ return nil
+}
+
+func (h rsaPrivateKey) MarshalJSON() ([]byte, error) {
+ data := make(map[string]any)
+ fields := make([]string, 0, 16)
+ data[KeyTypeKey] = jwa.RSA()
+ fields = append(fields, KeyTypeKey)
+ if h.algorithm != nil {
+ data[AlgorithmKey] = *(h.algorithm)
+ fields = append(fields, AlgorithmKey)
+ }
+ if h.d != nil {
+ data[RSADKey] = h.d
+ fields = append(fields, RSADKey)
+ }
+ if h.dp != nil {
+ data[RSADPKey] = h.dp
+ fields = append(fields, RSADPKey)
+ }
+ if h.dq != nil {
+ data[RSADQKey] = h.dq
+ fields = append(fields, RSADQKey)
+ }
+ if h.e != nil {
+ data[RSAEKey] = h.e
+ fields = append(fields, RSAEKey)
+ }
+ if h.keyID != nil {
+ data[KeyIDKey] = *(h.keyID)
+ fields = append(fields, KeyIDKey)
+ }
+ if h.keyOps != nil {
+ data[KeyOpsKey] = *(h.keyOps)
+ fields = append(fields, KeyOpsKey)
+ }
+ if h.keyUsage != nil {
+ data[KeyUsageKey] = *(h.keyUsage)
+ fields = append(fields, KeyUsageKey)
+ }
+ if h.n != nil {
+ data[RSANKey] = h.n
+ fields = append(fields, RSANKey)
+ }
+ if h.p != nil {
+ data[RSAPKey] = h.p
+ fields = append(fields, RSAPKey)
+ }
+ if h.q != nil {
+ data[RSAQKey] = h.q
+ fields = append(fields, RSAQKey)
+ }
+ if h.qi != nil {
+ data[RSAQIKey] = h.qi
+ fields = append(fields, RSAQIKey)
+ }
+ if h.x509CertChain != nil {
+ data[X509CertChainKey] = h.x509CertChain
+ fields = append(fields, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ data[X509CertThumbprintKey] = *(h.x509CertThumbprint)
+ fields = append(fields, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ data[X509CertThumbprintS256Key] = *(h.x509CertThumbprintS256)
+ fields = append(fields, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ data[X509URLKey] = *(h.x509URL)
+ fields = append(fields, X509URLKey)
+ }
+ for k, v := range h.privateParams {
+ data[k] = v
+ fields = append(fields, k)
+ }
+
+ sort.Strings(fields)
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+ buf.WriteByte(tokens.OpenCurlyBracket)
+ enc := json.NewEncoder(buf)
+ for i, f := range fields {
+ if i > 0 {
+ buf.WriteRune(tokens.Comma)
+ }
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(f)
+ buf.WriteString(`":`)
+ v := data[f]
+ switch v := v.(type) {
+ case []byte:
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(base64.EncodeToString(v))
+ buf.WriteRune(tokens.DoubleQuote)
+ default:
+ if err := enc.Encode(v); err != nil {
+ return nil, fmt.Errorf(`failed to encode value for field %s: %w`, f, err)
+ }
+ buf.Truncate(buf.Len() - 1)
+ }
+ }
+ buf.WriteByte(tokens.CloseCurlyBracket)
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ return ret, nil
+}
+
+func (h *rsaPrivateKey) Keys() []string {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ keys := make([]string, 0, 16+len(h.privateParams))
+ keys = append(keys, KeyTypeKey)
+ if h.algorithm != nil {
+ keys = append(keys, AlgorithmKey)
+ }
+ if h.d != nil {
+ keys = append(keys, RSADKey)
+ }
+ if h.dp != nil {
+ keys = append(keys, RSADPKey)
+ }
+ if h.dq != nil {
+ keys = append(keys, RSADQKey)
+ }
+ if h.e != nil {
+ keys = append(keys, RSAEKey)
+ }
+ if h.keyID != nil {
+ keys = append(keys, KeyIDKey)
+ }
+ if h.keyOps != nil {
+ keys = append(keys, KeyOpsKey)
+ }
+ if h.keyUsage != nil {
+ keys = append(keys, KeyUsageKey)
+ }
+ if h.n != nil {
+ keys = append(keys, RSANKey)
+ }
+ if h.p != nil {
+ keys = append(keys, RSAPKey)
+ }
+ if h.q != nil {
+ keys = append(keys, RSAQKey)
+ }
+ if h.qi != nil {
+ keys = append(keys, RSAQIKey)
+ }
+ if h.x509CertChain != nil {
+ keys = append(keys, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ keys = append(keys, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ keys = append(keys, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ keys = append(keys, X509URLKey)
+ }
+ for k := range h.privateParams {
+ keys = append(keys, k)
+ }
+ return keys
+}
+
+var rsaStandardFields KeyFilter
+
+func init() {
+ rsaStandardFields = NewFieldNameFilter(KeyTypeKey, KeyUsageKey, KeyOpsKey, AlgorithmKey, KeyIDKey, X509URLKey, X509CertChainKey, X509CertThumbprintKey, X509CertThumbprintS256Key, RSAEKey, RSANKey, RSADKey, RSADPKey, RSADQKey, RSAPKey, RSAQKey, RSAQIKey)
+}
+
+// RSAStandardFieldsFilter returns a KeyFilter that filters out standard RSA fields.
+func RSAStandardFieldsFilter() KeyFilter {
+ return rsaStandardFields
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/set.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/set.go
new file mode 100644
index 0000000000..6f339649a8
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/set.go
@@ -0,0 +1,319 @@
+package jwk
+
+import (
+ "bytes"
+ "fmt"
+ "maps"
+ "reflect"
+ "sort"
+
+ "github.com/lestrrat-go/blackmagic"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+)
+
+const keysKey = `keys` // appease linter
+
+func newSet() *set {
+ return &set{
+ privateParams: make(map[string]any),
+ }
+}
+
+// NewSet creates and empty `jwk.Set` object
+func NewSet() Set {
+ return newSet()
+}
+
+func (s *set) Set(n string, v any) error {
+ s.mu.RLock()
+ defer s.mu.RUnlock()
+
+ if n == keysKey {
+ vl, ok := v.([]Key)
+ if !ok {
+ return fmt.Errorf(`value for field "keys" must be []jwk.Key`)
+ }
+ s.keys = vl
+ return nil
+ }
+
+ s.privateParams[n] = v
+ return nil
+}
+
+func (s *set) Get(name string, dst any) error {
+ s.mu.RLock()
+ defer s.mu.RUnlock()
+
+ v, ok := s.privateParams[name]
+ if !ok {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, v); err != nil {
+ return fmt.Errorf(`failed to assign value to dst: %w`, err)
+ }
+ return nil
+}
+
+func (s *set) Key(idx int) (Key, bool) {
+ s.mu.RLock()
+ defer s.mu.RUnlock()
+
+ if idx >= 0 && idx < len(s.keys) {
+ return s.keys[idx], true
+ }
+ return nil, false
+}
+
+func (s *set) Len() int {
+ s.mu.RLock()
+ defer s.mu.RUnlock()
+
+ return len(s.keys)
+}
+
+// indexNL is Index(), but without the locking
+func (s *set) indexNL(key Key) int {
+ for i, k := range s.keys {
+ if k == key {
+ return i
+ }
+ }
+ return -1
+}
+
+func (s *set) Index(key Key) int {
+ s.mu.RLock()
+ defer s.mu.RUnlock()
+
+ return s.indexNL(key)
+}
+
+func (s *set) AddKey(key Key) error {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+
+ if reflect.ValueOf(key).IsNil() {
+ panic("nil key")
+ }
+
+ if i := s.indexNL(key); i > -1 {
+ return fmt.Errorf(`(jwk.Set).AddKey: key already exists`)
+ }
+ s.keys = append(s.keys, key)
+ return nil
+}
+
+func (s *set) Remove(name string) error {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+
+ delete(s.privateParams, name)
+ return nil
+}
+
+func (s *set) RemoveKey(key Key) error {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+
+ for i, k := range s.keys {
+ if k == key {
+ switch i {
+ case 0:
+ s.keys = s.keys[1:]
+ case len(s.keys) - 1:
+ s.keys = s.keys[:i]
+ default:
+ s.keys = append(s.keys[:i], s.keys[i+1:]...)
+ }
+ return nil
+ }
+ }
+ return fmt.Errorf(`(jwk.Set).RemoveKey: specified key does not exist in set`)
+}
+
+func (s *set) Clear() error {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+
+ s.keys = nil
+ s.privateParams = make(map[string]any)
+ return nil
+}
+
+func (s *set) Keys() []string {
+ ret := make([]string, len(s.privateParams))
+ var i int
+ for k := range s.privateParams {
+ ret[i] = k
+ i++
+ }
+ return ret
+}
+
+func (s *set) MarshalJSON() ([]byte, error) {
+ s.mu.RLock()
+ defer s.mu.RUnlock()
+
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+ enc := json.NewEncoder(buf)
+
+ fields := []string{keysKey}
+ for k := range s.privateParams {
+ fields = append(fields, k)
+ }
+ sort.Strings(fields)
+
+ buf.WriteByte(tokens.OpenCurlyBracket)
+ for i, field := range fields {
+ if i > 0 {
+ buf.WriteByte(tokens.Comma)
+ }
+ fmt.Fprintf(buf, `%q:`, field)
+ if field != keysKey {
+ if err := enc.Encode(s.privateParams[field]); err != nil {
+ return nil, fmt.Errorf(`failed to marshal field %q: %w`, field, err)
+ }
+ } else {
+ buf.WriteByte(tokens.OpenSquareBracket)
+ for j, k := range s.keys {
+ if j > 0 {
+ buf.WriteByte(tokens.Comma)
+ }
+ if err := enc.Encode(k); err != nil {
+ return nil, fmt.Errorf(`failed to marshal key #%d: %w`, i, err)
+ }
+ }
+ buf.WriteByte(tokens.CloseSquareBracket)
+ }
+ }
+ buf.WriteByte(tokens.CloseCurlyBracket)
+
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ return ret, nil
+}
+
+func (s *set) UnmarshalJSON(data []byte) error {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+
+ s.privateParams = make(map[string]any)
+ s.keys = nil
+
+ var options []ParseOption
+ var ignoreParseError bool
+ if dc := s.dc; dc != nil {
+ if localReg := dc.Registry(); localReg != nil {
+ options = append(options, withLocalRegistry(localReg))
+ }
+ ignoreParseError = dc.IgnoreParseError()
+ }
+
+ var sawKeysField bool
+ dec := json.NewDecoder(bytes.NewReader(data))
+LOOP:
+ for {
+ tok, err := dec.Token()
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+
+ switch tok := tok.(type) {
+ case json.Delim:
+ // Assuming we're doing everything correctly, we should ONLY
+ // get either tokens.OpenCurlyBracket or tokens.CloseCurlyBracket here.
+ if tok == tokens.CloseCurlyBracket { // End of object
+ break LOOP
+ } else if tok != tokens.OpenCurlyBracket {
+ return fmt.Errorf(`expected '%c' but got '%c'`, tokens.OpenCurlyBracket, tok)
+ }
+ case string:
+ switch tok {
+ case "keys":
+ sawKeysField = true
+ var list []json.RawMessage
+ if err := dec.Decode(&list); err != nil {
+ return fmt.Errorf(`failed to decode "keys": %w`, err)
+ }
+
+ for i, keysrc := range list {
+ key, err := ParseKey(keysrc, options...)
+ if err != nil {
+ if !ignoreParseError {
+ return fmt.Errorf(`failed to decode key #%d in "keys": %w`, i, err)
+ }
+ continue
+ }
+ s.keys = append(s.keys, key)
+ }
+ default:
+ var v any
+ if err := dec.Decode(&v); err != nil {
+ return fmt.Errorf(`failed to decode value for key %q: %w`, tok, err)
+ }
+ s.privateParams[tok] = v
+ }
+ }
+ }
+
+ // This is really silly, but we can only detect the
+ // lack of the "keys" field after going through the
+ // entire object once
+ // Not checking for len(s.keys) == 0, because it could be
+ // an empty key set
+ if !sawKeysField {
+ key, err := ParseKey(data, options...)
+ if err != nil {
+ return fmt.Errorf(`failed to parse sole key in key set`)
+ }
+ s.keys = append(s.keys, key)
+ }
+ return nil
+}
+
+func (s *set) LookupKeyID(kid string) (Key, bool) {
+ s.mu.RLock()
+ defer s.mu.RUnlock()
+
+ for i := range s.Len() {
+ key, ok := s.Key(i)
+ if !ok {
+ return nil, false
+ }
+ gotkid, ok := key.KeyID()
+ if ok && gotkid == kid {
+ return key, true
+ }
+ }
+ return nil, false
+}
+
+func (s *set) DecodeCtx() DecodeCtx {
+ s.mu.RLock()
+ defer s.mu.RUnlock()
+ return s.dc
+}
+
+func (s *set) SetDecodeCtx(dc DecodeCtx) {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+ s.dc = dc
+}
+
+func (s *set) Clone() (Set, error) {
+ s2 := newSet()
+
+ s.mu.RLock()
+ defer s.mu.RUnlock()
+
+ s2.keys = make([]Key, len(s.keys))
+ copy(s2.keys, s.keys)
+
+ maps.Copy(s2.privateParams, s.privateParams)
+
+ return s2, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/symmetric.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/symmetric.go
new file mode 100644
index 0000000000..7db5e1591a
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/symmetric.go
@@ -0,0 +1,105 @@
+package jwk
+
+import (
+ "crypto"
+ "fmt"
+ "reflect"
+
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+func init() {
+ RegisterKeyExporter(jwa.OctetSeq(), KeyExportFunc(octetSeqToRaw))
+}
+
+func (k *symmetricKey) Import(rawKey []byte) error {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+
+ if len(rawKey) == 0 {
+ return fmt.Errorf(`non-empty []byte key required`)
+ }
+
+ k.octets = rawKey
+
+ return nil
+}
+
+var symmetricConvertibleKeys = []reflect.Type{
+ reflect.TypeFor[SymmetricKey](),
+}
+
+func octetSeqToRaw(key Key, hint any) (any, error) {
+ extracted, err := extractEmbeddedKey(key, symmetricConvertibleKeys)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to extract embedded key: %w`, err)
+ }
+
+ switch key := extracted.(type) {
+ case SymmetricKey:
+ switch hint.(type) {
+ case *[]byte, *any:
+ default:
+ return nil, fmt.Errorf(`invalid destination object type %T for symmetric key: %w`, hint, ContinueError())
+ }
+
+ locker, ok := key.(rlocker)
+ if ok {
+ locker.rlock()
+ defer locker.runlock()
+ }
+
+ ooctets, ok := key.Octets()
+ if !ok {
+ return nil, fmt.Errorf(`jwk.SymmetricKey: missing "k" field`)
+ }
+
+ octets := make([]byte, len(ooctets))
+ copy(octets, ooctets)
+ return octets, nil
+ default:
+ return nil, ContinueError()
+ }
+}
+
+// Thumbprint returns the JWK thumbprint using the indicated
+// hashing algorithm, according to RFC 7638
+func (k *symmetricKey) Thumbprint(hash crypto.Hash) ([]byte, error) {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+ var octets []byte
+ if err := Export(k, &octets); err != nil {
+ return nil, fmt.Errorf(`failed to export symmetric key: %w`, err)
+ }
+
+ h := hash.New()
+ fmt.Fprint(h, `{"k":"`)
+ fmt.Fprint(h, base64.EncodeToString(octets))
+ fmt.Fprint(h, `","kty":"oct"}`)
+ return h.Sum(nil), nil
+}
+
+func (k *symmetricKey) PublicKey() (Key, error) {
+ newKey := newSymmetricKey()
+
+ for _, key := range k.Keys() {
+ var v any
+ if err := k.Get(key, &v); err != nil {
+ return nil, fmt.Errorf(`failed to get field %q: %w`, key, err)
+ }
+
+ if err := newKey.Set(key, v); err != nil {
+ return nil, fmt.Errorf(`failed to set field %q: %w`, key, err)
+ }
+ }
+ return newKey, nil
+}
+
+func (k *symmetricKey) Validate() error {
+ octets, ok := k.Octets()
+ if !ok || len(octets) == 0 {
+ return NewKeyValidationError(fmt.Errorf(`jwk.SymmetricKey: missing "k" field`))
+ }
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/symmetric_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/symmetric_gen.go
new file mode 100644
index 0000000000..bfd2f8497d
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/symmetric_gen.go
@@ -0,0 +1,620 @@
+// Code generated by tools/cmd/genjwk/main.go. DO NOT EDIT.
+
+package jwk
+
+import (
+ "bytes"
+ "fmt"
+ "sort"
+ "sync"
+
+ "github.com/lestrrat-go/blackmagic"
+ "github.com/lestrrat-go/jwx/v3/cert"
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+const (
+ SymmetricOctetsKey = "k"
+)
+
+type SymmetricKey interface {
+ Key
+ Octets() ([]byte, bool)
+}
+
+type symmetricKey struct {
+ algorithm *jwa.KeyAlgorithm // https://tools.ietf.org/html/rfc7517#section-4.4
+ keyID *string // https://tools.ietf.org/html/rfc7515#section-4.1.4
+ keyOps *KeyOperationList // https://tools.ietf.org/html/rfc7517#section-4.3
+ keyUsage *string // https://tools.ietf.org/html/rfc7517#section-4.2
+ octets []byte
+ x509CertChain *cert.Chain // https://tools.ietf.org/html/rfc7515#section-4.1.6
+ x509CertThumbprint *string // https://tools.ietf.org/html/rfc7515#section-4.1.7
+ x509CertThumbprintS256 *string // https://tools.ietf.org/html/rfc7515#section-4.1.8
+ x509URL *string // https://tools.ietf.org/html/rfc7515#section-4.1.5
+ privateParams map[string]any
+ mu *sync.RWMutex
+ dc json.DecodeCtx
+}
+
+var _ SymmetricKey = &symmetricKey{}
+var _ Key = &symmetricKey{}
+
+func newSymmetricKey() *symmetricKey {
+ return &symmetricKey{
+ mu: &sync.RWMutex{},
+ privateParams: make(map[string]any),
+ }
+}
+
+func (h symmetricKey) KeyType() jwa.KeyType {
+ return jwa.OctetSeq()
+}
+
+func (h symmetricKey) rlock() {
+ h.mu.RLock()
+}
+
+func (h symmetricKey) runlock() {
+ h.mu.RUnlock()
+}
+
+func (h *symmetricKey) Algorithm() (jwa.KeyAlgorithm, bool) {
+ if h.algorithm != nil {
+ return *(h.algorithm), true
+ }
+ return nil, false
+}
+
+func (h *symmetricKey) KeyID() (string, bool) {
+ if h.keyID != nil {
+ return *(h.keyID), true
+ }
+ return "", false
+}
+
+func (h *symmetricKey) KeyOps() (KeyOperationList, bool) {
+ if h.keyOps != nil {
+ return *(h.keyOps), true
+ }
+ return nil, false
+}
+
+func (h *symmetricKey) KeyUsage() (string, bool) {
+ if h.keyUsage != nil {
+ return *(h.keyUsage), true
+ }
+ return "", false
+}
+
+func (h *symmetricKey) Octets() ([]byte, bool) {
+ if h.octets != nil {
+ return h.octets, true
+ }
+ return nil, false
+}
+
+func (h *symmetricKey) X509CertChain() (*cert.Chain, bool) {
+ return h.x509CertChain, true
+}
+
+func (h *symmetricKey) X509CertThumbprint() (string, bool) {
+ if h.x509CertThumbprint != nil {
+ return *(h.x509CertThumbprint), true
+ }
+ return "", false
+}
+
+func (h *symmetricKey) X509CertThumbprintS256() (string, bool) {
+ if h.x509CertThumbprintS256 != nil {
+ return *(h.x509CertThumbprintS256), true
+ }
+ return "", false
+}
+
+func (h *symmetricKey) X509URL() (string, bool) {
+ if h.x509URL != nil {
+ return *(h.x509URL), true
+ }
+ return "", false
+}
+
+func (h *symmetricKey) Has(name string) bool {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case KeyTypeKey:
+ return true
+ case AlgorithmKey:
+ return h.algorithm != nil
+ case KeyIDKey:
+ return h.keyID != nil
+ case KeyOpsKey:
+ return h.keyOps != nil
+ case KeyUsageKey:
+ return h.keyUsage != nil
+ case SymmetricOctetsKey:
+ return h.octets != nil
+ case X509CertChainKey:
+ return h.x509CertChain != nil
+ case X509CertThumbprintKey:
+ return h.x509CertThumbprint != nil
+ case X509CertThumbprintS256Key:
+ return h.x509CertThumbprintS256 != nil
+ case X509URLKey:
+ return h.x509URL != nil
+ default:
+ _, ok := h.privateParams[name]
+ return ok
+ }
+}
+
+func (h *symmetricKey) Get(name string, dst any) error {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case KeyTypeKey:
+ if err := blackmagic.AssignIfCompatible(dst, h.KeyType()); err != nil {
+ return fmt.Errorf(`symmetricKey.Get: failed to assign value for field %q to destination object: %w`, name, err)
+ }
+ case AlgorithmKey:
+ if h.algorithm == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.algorithm)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyIDKey:
+ if h.keyID == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyID)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyOpsKey:
+ if h.keyOps == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyOps)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyUsageKey:
+ if h.keyUsage == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyUsage)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case SymmetricOctetsKey:
+ if h.octets == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.octets); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertChainKey:
+ if h.x509CertChain == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, h.x509CertChain); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertThumbprintKey:
+ if h.x509CertThumbprint == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprint)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertThumbprintS256Key:
+ if h.x509CertThumbprintS256 == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprintS256)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509URLKey:
+ if h.x509URL == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509URL)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ default:
+ v, ok := h.privateParams[name]
+ if !ok {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, v); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ }
+ return nil
+}
+
+func (h *symmetricKey) Set(name string, value any) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ return h.setNoLock(name, value)
+}
+
+func (h *symmetricKey) setNoLock(name string, value any) error {
+ switch name {
+ case "kty":
+ return nil
+ case AlgorithmKey:
+ switch v := value.(type) {
+ case string, jwa.SignatureAlgorithm, jwa.KeyEncryptionAlgorithm, jwa.ContentEncryptionAlgorithm:
+ tmp, err := jwa.KeyAlgorithmFrom(v)
+ if err != nil {
+ return fmt.Errorf(`invalid algorithm for %q key: %w`, AlgorithmKey, err)
+ }
+ h.algorithm = &tmp
+ default:
+ return fmt.Errorf(`invalid type for %q key: %T`, AlgorithmKey, value)
+ }
+ return nil
+ case KeyIDKey:
+ if v, ok := value.(string); ok {
+ h.keyID = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, KeyIDKey, value)
+ case KeyOpsKey:
+ var acceptor KeyOperationList
+ if err := acceptor.Accept(value); err != nil {
+ return fmt.Errorf(`invalid value for %s key: %w`, KeyOpsKey, err)
+ }
+ h.keyOps = &acceptor
+ return nil
+ case KeyUsageKey:
+ switch v := value.(type) {
+ case KeyUsageType:
+ switch v {
+ case ForSignature, ForEncryption:
+ tmp := v.String()
+ h.keyUsage = &tmp
+ default:
+ return fmt.Errorf(`invalid key usage type %s`, v)
+ }
+ case string:
+ h.keyUsage = &v
+ default:
+ return fmt.Errorf(`invalid key usage type %s`, v)
+ }
+ case SymmetricOctetsKey:
+ if v, ok := value.([]byte); ok {
+ h.octets = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, SymmetricOctetsKey, value)
+ case X509CertChainKey:
+ if v, ok := value.(*cert.Chain); ok {
+ h.x509CertChain = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertChainKey, value)
+ case X509CertThumbprintKey:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprint = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintKey, value)
+ case X509CertThumbprintS256Key:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprintS256 = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintS256Key, value)
+ case X509URLKey:
+ if v, ok := value.(string); ok {
+ h.x509URL = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509URLKey, value)
+ default:
+ if h.privateParams == nil {
+ h.privateParams = map[string]any{}
+ }
+ h.privateParams[name] = value
+ }
+ return nil
+}
+
+func (k *symmetricKey) Remove(key string) error {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+ switch key {
+ case AlgorithmKey:
+ k.algorithm = nil
+ case KeyIDKey:
+ k.keyID = nil
+ case KeyOpsKey:
+ k.keyOps = nil
+ case KeyUsageKey:
+ k.keyUsage = nil
+ case SymmetricOctetsKey:
+ k.octets = nil
+ case X509CertChainKey:
+ k.x509CertChain = nil
+ case X509CertThumbprintKey:
+ k.x509CertThumbprint = nil
+ case X509CertThumbprintS256Key:
+ k.x509CertThumbprintS256 = nil
+ case X509URLKey:
+ k.x509URL = nil
+ default:
+ delete(k.privateParams, key)
+ }
+ return nil
+}
+
+func (k *symmetricKey) Clone() (Key, error) {
+ key, err := cloneKey(k)
+ if err != nil {
+ return nil, fmt.Errorf(`symmetricKey.Clone: %w`, err)
+ }
+ return key, nil
+}
+
+func (k *symmetricKey) DecodeCtx() json.DecodeCtx {
+ k.mu.RLock()
+ defer k.mu.RUnlock()
+ return k.dc
+}
+
+func (k *symmetricKey) SetDecodeCtx(dc json.DecodeCtx) {
+ k.mu.Lock()
+ defer k.mu.Unlock()
+ k.dc = dc
+}
+
+func (h *symmetricKey) UnmarshalJSON(buf []byte) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ h.algorithm = nil
+ h.keyID = nil
+ h.keyOps = nil
+ h.keyUsage = nil
+ h.octets = nil
+ h.x509CertChain = nil
+ h.x509CertThumbprint = nil
+ h.x509CertThumbprintS256 = nil
+ h.x509URL = nil
+ dec := json.NewDecoder(bytes.NewReader(buf))
+LOOP:
+ for {
+ tok, err := dec.Token()
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ switch tok := tok.(type) {
+ case json.Delim:
+ // Assuming we're doing everything correctly, we should ONLY
+ // get either tokens.OpenCurlyBracket or tokens.CloseCurlyBracket here.
+ if tok == tokens.CloseCurlyBracket { // End of object
+ break LOOP
+ } else if tok != tokens.OpenCurlyBracket {
+ return fmt.Errorf(`expected '%c' but got '%c'`, tokens.OpenCurlyBracket, tok)
+ }
+ case string: // Objects can only have string keys
+ switch tok {
+ case KeyTypeKey:
+ val, err := json.ReadNextStringToken(dec)
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ if val != jwa.OctetSeq().String() {
+ return fmt.Errorf(`invalid kty value for RSAPublicKey (%s)`, val)
+ }
+ case AlgorithmKey:
+ var s string
+ if err := dec.Decode(&s); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AlgorithmKey, err)
+ }
+ alg, err := jwa.KeyAlgorithmFrom(s)
+ if err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AlgorithmKey, err)
+ }
+ h.algorithm = &alg
+ case KeyIDKey:
+ if err := json.AssignNextStringToken(&h.keyID, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyIDKey, err)
+ }
+ case KeyOpsKey:
+ var decoded KeyOperationList
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyOpsKey, err)
+ }
+ h.keyOps = &decoded
+ case KeyUsageKey:
+ if err := json.AssignNextStringToken(&h.keyUsage, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyUsageKey, err)
+ }
+ case SymmetricOctetsKey:
+ if err := json.AssignNextBytesToken(&h.octets, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, SymmetricOctetsKey, err)
+ }
+ case X509CertChainKey:
+ var decoded cert.Chain
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertChainKey, err)
+ }
+ h.x509CertChain = &decoded
+ case X509CertThumbprintKey:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprint, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintKey, err)
+ }
+ case X509CertThumbprintS256Key:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprintS256, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintS256Key, err)
+ }
+ case X509URLKey:
+ if err := json.AssignNextStringToken(&h.x509URL, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509URLKey, err)
+ }
+ default:
+ if dc := h.dc; dc != nil {
+ if localReg := dc.Registry(); localReg != nil {
+ decoded, err := localReg.Decode(dec, tok)
+ if err == nil {
+ h.setNoLock(tok, decoded)
+ continue
+ }
+ }
+ }
+ decoded, err := registry.Decode(dec, tok)
+ if err == nil {
+ h.setNoLock(tok, decoded)
+ continue
+ }
+ return fmt.Errorf(`could not decode field %s: %w`, tok, err)
+ }
+ default:
+ return fmt.Errorf(`invalid token %T`, tok)
+ }
+ }
+ if h.octets == nil {
+ return fmt.Errorf(`required field k is missing`)
+ }
+ return nil
+}
+
+func (h symmetricKey) MarshalJSON() ([]byte, error) {
+ data := make(map[string]any)
+ fields := make([]string, 0, 9)
+ data[KeyTypeKey] = jwa.OctetSeq()
+ fields = append(fields, KeyTypeKey)
+ if h.algorithm != nil {
+ data[AlgorithmKey] = *(h.algorithm)
+ fields = append(fields, AlgorithmKey)
+ }
+ if h.keyID != nil {
+ data[KeyIDKey] = *(h.keyID)
+ fields = append(fields, KeyIDKey)
+ }
+ if h.keyOps != nil {
+ data[KeyOpsKey] = *(h.keyOps)
+ fields = append(fields, KeyOpsKey)
+ }
+ if h.keyUsage != nil {
+ data[KeyUsageKey] = *(h.keyUsage)
+ fields = append(fields, KeyUsageKey)
+ }
+ if h.octets != nil {
+ data[SymmetricOctetsKey] = h.octets
+ fields = append(fields, SymmetricOctetsKey)
+ }
+ if h.x509CertChain != nil {
+ data[X509CertChainKey] = h.x509CertChain
+ fields = append(fields, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ data[X509CertThumbprintKey] = *(h.x509CertThumbprint)
+ fields = append(fields, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ data[X509CertThumbprintS256Key] = *(h.x509CertThumbprintS256)
+ fields = append(fields, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ data[X509URLKey] = *(h.x509URL)
+ fields = append(fields, X509URLKey)
+ }
+ for k, v := range h.privateParams {
+ data[k] = v
+ fields = append(fields, k)
+ }
+
+ sort.Strings(fields)
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+ buf.WriteByte(tokens.OpenCurlyBracket)
+ enc := json.NewEncoder(buf)
+ for i, f := range fields {
+ if i > 0 {
+ buf.WriteRune(tokens.Comma)
+ }
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(f)
+ buf.WriteString(`":`)
+ v := data[f]
+ switch v := v.(type) {
+ case []byte:
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(base64.EncodeToString(v))
+ buf.WriteRune(tokens.DoubleQuote)
+ default:
+ if err := enc.Encode(v); err != nil {
+ return nil, fmt.Errorf(`failed to encode value for field %s: %w`, f, err)
+ }
+ buf.Truncate(buf.Len() - 1)
+ }
+ }
+ buf.WriteByte(tokens.CloseCurlyBracket)
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ return ret, nil
+}
+
+func (h *symmetricKey) Keys() []string {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ keys := make([]string, 0, 9+len(h.privateParams))
+ keys = append(keys, KeyTypeKey)
+ if h.algorithm != nil {
+ keys = append(keys, AlgorithmKey)
+ }
+ if h.keyID != nil {
+ keys = append(keys, KeyIDKey)
+ }
+ if h.keyOps != nil {
+ keys = append(keys, KeyOpsKey)
+ }
+ if h.keyUsage != nil {
+ keys = append(keys, KeyUsageKey)
+ }
+ if h.octets != nil {
+ keys = append(keys, SymmetricOctetsKey)
+ }
+ if h.x509CertChain != nil {
+ keys = append(keys, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ keys = append(keys, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ keys = append(keys, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ keys = append(keys, X509URLKey)
+ }
+ for k := range h.privateParams {
+ keys = append(keys, k)
+ }
+ return keys
+}
+
+var symmetricStandardFields KeyFilter
+
+func init() {
+ symmetricStandardFields = NewFieldNameFilter(KeyTypeKey, KeyUsageKey, KeyOpsKey, AlgorithmKey, KeyIDKey, X509URLKey, X509CertChainKey, X509CertThumbprintKey, X509CertThumbprintS256Key, SymmetricOctetsKey)
+}
+
+// SymmetricStandardFieldsFilter returns a KeyFilter that filters out standard Symmetric fields.
+func SymmetricStandardFieldsFilter() KeyFilter {
+ return symmetricStandardFields
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/usage.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/usage.go
new file mode 100644
index 0000000000..ed724153b8
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/usage.go
@@ -0,0 +1,74 @@
+package jwk
+
+import (
+ "fmt"
+ "sync"
+ "sync/atomic"
+)
+
+var strictKeyUsage = atomic.Bool{}
+var keyUsageNames = map[string]struct{}{}
+var muKeyUsageName sync.RWMutex
+
+// RegisterKeyUsage registers a possible value that can be used for KeyUsageType.
+// Normally, key usage (or the "use" field in a JWK) is either "sig" or "enc",
+// but other values may be used.
+//
+// While this module only works with "sig" and "enc", it is possible that
+// systems choose to use other values. This function allows users to register
+// new values to be accepted as valid key usage types. Values are case sensitive.
+//
+// Furthermore, the check against registered values can be completely turned off
+// by setting the global option `jwk.WithStrictKeyUsage(false)`.
+func RegisterKeyUsage(v string) {
+ muKeyUsageName.Lock()
+ defer muKeyUsageName.Unlock()
+ keyUsageNames[v] = struct{}{}
+}
+
+func UnregisterKeyUsage(v string) {
+ muKeyUsageName.Lock()
+ defer muKeyUsageName.Unlock()
+ delete(keyUsageNames, v)
+}
+
+func init() {
+ strictKeyUsage.Store(true)
+ RegisterKeyUsage("sig")
+ RegisterKeyUsage("enc")
+}
+
+func isValidUsage(v string) bool {
+ // This function can return true if strictKeyUsage is false
+ if !strictKeyUsage.Load() {
+ return true
+ }
+
+ muKeyUsageName.RLock()
+ defer muKeyUsageName.RUnlock()
+ _, ok := keyUsageNames[v]
+ return ok
+}
+
+func (k KeyUsageType) String() string {
+ return string(k)
+}
+
+func (k *KeyUsageType) Accept(v any) error {
+ switch v := v.(type) {
+ case KeyUsageType:
+ if !isValidUsage(v.String()) {
+ return fmt.Errorf("invalid key usage type: %q", v)
+ }
+ *k = v
+ return nil
+ case string:
+ if !isValidUsage(v) {
+ return fmt.Errorf("invalid key usage type: %q", v)
+ }
+ *k = KeyUsageType(v)
+ return nil
+ }
+
+ return fmt.Errorf("invalid Go type for key usage type: %T", v)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/whitelist.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/whitelist.go
new file mode 100644
index 0000000000..0b0df701ae
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/whitelist.go
@@ -0,0 +1,38 @@
+package jwk
+
+import "github.com/lestrrat-go/httprc/v3"
+
+type Whitelist = httprc.Whitelist
+type WhitelistFunc = httprc.WhitelistFunc
+
+// InsecureWhitelist is an alias to httprc.InsecureWhitelist. Use
+// functions in the `httprc` package to interact with this type.
+type InsecureWhitelist = httprc.InsecureWhitelist
+
+func NewInsecureWhitelist() InsecureWhitelist {
+ return httprc.NewInsecureWhitelist()
+}
+
+// BlockAllWhitelist is an alias to httprc.BlockAllWhitelist. Use
+// functions in the `httprc` package to interact with this type.
+type BlockAllWhitelist = httprc.BlockAllWhitelist
+
+func NewBlockAllWhitelist() BlockAllWhitelist {
+ return httprc.NewBlockAllWhitelist()
+}
+
+// RegexpWhitelist is an alias to httprc.RegexpWhitelist. Use
+// functions in the `httprc` package to interact with this type.
+type RegexpWhitelist = httprc.RegexpWhitelist
+
+func NewRegexpWhitelist() *RegexpWhitelist {
+ return httprc.NewRegexpWhitelist()
+}
+
+// MapWhitelist is an alias to httprc.MapWhitelist. Use
+// functions in the `httprc` package to interact with this type.
+type MapWhitelist = httprc.MapWhitelist
+
+func NewMapWhitelist() MapWhitelist {
+ return httprc.NewMapWhitelist()
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwk/x509.go b/vendor/github.com/lestrrat-go/jwx/v3/jwk/x509.go
new file mode 100644
index 0000000000..f06063c6ed
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwk/x509.go
@@ -0,0 +1,249 @@
+package jwk
+
+import (
+ "crypto/ecdsa"
+ "crypto/ed25519"
+ "crypto/rsa"
+ "crypto/x509"
+ "encoding/pem"
+ "errors"
+ "fmt"
+ "sync"
+
+ "github.com/lestrrat-go/blackmagic"
+ "github.com/lestrrat-go/jwx/v3/jwk/jwkbb"
+)
+
+// PEMDecoder is an interface to describe an object that can decode
+// a key from PEM encoded ASN.1 DER format.
+//
+// A PEMDecoder can be specified as an option to `jwk.Parse()` or `jwk.ParseKey()`
+// along with the `jwk.WithPEM()` option.
+type PEMDecoder interface {
+ Decode([]byte) (any, []byte, error)
+}
+
+// PEMEncoder is an interface to describe an object that can encode
+// a key into PEM encoded ASN.1 DER format.
+//
+// `jwk.Key` instances do not implement a way to encode themselves into
+// PEM format. Normally you can just use `jwk.EncodePEM()` to do this, but
+// this interface allows you to generalize the encoding process by
+// abstracting the `jwk.EncodePEM()` function using `jwk.PEMEncodeFunc`
+// along with alternate implementations, should you need them.
+type PEMEncoder interface {
+ Encode(any) (string, []byte, error)
+}
+
+type PEMEncodeFunc func(any) (string, []byte, error)
+
+func (f PEMEncodeFunc) Encode(v any) (string, []byte, error) {
+ return f(v)
+}
+
+func encodeX509(v any) (string, []byte, error) {
+ // we can't import jwk, so just use the interface
+ if key, ok := v.(Key); ok {
+ var raw any
+ if err := Export(key, &raw); err != nil {
+ return "", nil, fmt.Errorf(`failed to get raw key out of %T: %w`, key, err)
+ }
+
+ v = raw
+ }
+
+ // Try to convert it into a certificate
+ switch v := v.(type) {
+ case *rsa.PrivateKey:
+ return pmRSAPrivateKey, x509.MarshalPKCS1PrivateKey(v), nil
+ case *ecdsa.PrivateKey:
+ marshaled, err := x509.MarshalECPrivateKey(v)
+ if err != nil {
+ return "", nil, err
+ }
+ return pmECPrivateKey, marshaled, nil
+ case ed25519.PrivateKey:
+ marshaled, err := x509.MarshalPKCS8PrivateKey(v)
+ if err != nil {
+ return "", nil, err
+ }
+ return pmPrivateKey, marshaled, nil
+ case *rsa.PublicKey, *ecdsa.PublicKey, ed25519.PublicKey:
+ marshaled, err := x509.MarshalPKIXPublicKey(v)
+ if err != nil {
+ return "", nil, err
+ }
+ return pmPublicKey, marshaled, nil
+ default:
+ return "", nil, fmt.Errorf(`unsupported type %T for ASN.1 DER encoding`, v)
+ }
+}
+
+// EncodePEM encodes the key into a PEM encoded ASN.1 DER format.
+// The key can be a jwk.Key or a raw key instance, but it must be one of
+// the types supported by `x509` package.
+//
+// Internally, it uses the same routine as `jwk.EncodeX509()`, and therefore
+// the same caveats apply
+func EncodePEM(v any) ([]byte, error) {
+ typ, marshaled, err := encodeX509(v)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encode key in x509: %w`, err)
+ }
+
+ block := &pem.Block{
+ Type: typ,
+ Bytes: marshaled,
+ }
+ return pem.EncodeToMemory(block), nil
+}
+
+const (
+ pmPrivateKey = `PRIVATE KEY`
+ pmPublicKey = `PUBLIC KEY`
+ pmECPrivateKey = `EC PRIVATE KEY`
+ pmRSAPublicKey = `RSA PUBLIC KEY`
+ pmRSAPrivateKey = `RSA PRIVATE KEY`
+)
+
+// NewPEMDecoder returns a PEMDecoder that decodes keys in PEM encoded ASN.1 DER format.
+// You can use it as argument to `jwk.WithPEMDecoder()` option.
+//
+// The use of this function is planned to be deprecated. The plan is to replace the
+// `jwk.WithPEMDecoder()` option with globally available custom X509 decoders which
+// can be registered via `jwk.RegisterX509Decoder()` function.
+func NewPEMDecoder() PEMDecoder {
+ return pemDecoder{}
+}
+
+type pemDecoder struct{}
+
+// Decode decodes a key in PEM encoded ASN.1 DER format.
+// and returns a raw key.
+func (pemDecoder) Decode(src []byte) (any, []byte, error) {
+ block, rest := pem.Decode(src)
+ if block == nil {
+ return nil, rest, fmt.Errorf(`failed to decode PEM data`)
+ }
+ var ret any
+ if err := jwkbb.DecodeX509(&ret, block); err != nil {
+ return nil, rest, err
+ }
+ return ret, rest, nil
+}
+
+// X509Decoder is an interface that describes an object that can decode
+// a PEM encoded ASN.1 DER format into a specific type of key.
+//
+// This interface is experimental, and may change in the future.
+type X509Decoder interface {
+ // DecodeX509 decodes the given PEM block into the destination object.
+ // The destination object must be a pointer to a type that can hold the
+ // decoded key, such as *rsa.PrivateKey, *ecdsa.PrivateKey, etc.
+ DecodeX509(dst any, block *pem.Block) error
+}
+
+// X509DecodeFunc is a function type that implements the X509Decoder interface.
+// It allows you to create a custom X509Decoder by providing a function
+// that takes a destination and a PEM block, and returns an error if the decoding fails.
+//
+// This interface is experimental, and may change in the future.
+type X509DecodeFunc func(dst any, block *pem.Block) error
+
+func (f X509DecodeFunc) DecodeX509(dst any, block *pem.Block) error {
+ return f(dst, block)
+}
+
+var muX509Decoders sync.Mutex
+var x509Decoders = map[any]int{}
+var x509DecoderList = []X509Decoder{}
+
+type identDefaultX509Decoder struct{}
+
+func init() {
+ RegisterX509Decoder(identDefaultX509Decoder{}, X509DecodeFunc(jwkbb.DecodeX509))
+}
+
+// RegisterX509Decoder registers a new X509Decoder that can decode PEM encoded ASN.1 DER format.
+// Because the decoder could be non-comparable, you must provide an identifier that can be used
+// as a map key to identify the decoder.
+//
+// This function is experimental, and may change in the future.
+func RegisterX509Decoder(ident any, decoder X509Decoder) {
+ if decoder == nil {
+ panic(`jwk.RegisterX509Decoder: decoder cannot be nil`)
+ }
+
+ muX509Decoders.Lock()
+ defer muX509Decoders.Unlock()
+ if _, ok := x509Decoders[ident]; ok {
+ return // already registered
+ }
+
+ x509Decoders[ident] = len(x509DecoderList)
+ x509DecoderList = append(x509DecoderList, decoder)
+}
+
+// UnregisterX509Decoder unregisters the X509Decoder identified by the given identifier.
+// If the identifier is not registered, it does nothing.
+//
+// This function is experimental, and may change in the future.
+func UnregisterX509Decoder(ident any) {
+ muX509Decoders.Lock()
+ defer muX509Decoders.Unlock()
+ idx, ok := x509Decoders[ident]
+ if !ok {
+ return // not registered
+ }
+
+ delete(x509Decoders, ident)
+
+ l := len(x509DecoderList)
+ switch idx {
+ case l - 1:
+ // if the last element, just truncate the slice
+ x509DecoderList = x509DecoderList[:l-1]
+ case 0:
+ // if the first element, just shift the slice
+ x509DecoderList = x509DecoderList[1:]
+ default:
+ // if the element is in the middle, remove it by slicing
+ // and appending the two slices together
+ x509DecoderList = append(x509DecoderList[:idx], x509DecoderList[idx+1:]...)
+ }
+}
+
+// decodeX509 decodes a PEM encoded ASN.1 DER format into the given destination.
+// It tries all registered X509 decoders until one of them succeeds.
+// If no decoder can handle the PEM block, it returns an error.
+func decodeX509(dst any, src []byte) error {
+ block, _ := pem.Decode(src)
+ if block == nil {
+ return fmt.Errorf(`failed to decode PEM data`)
+ }
+
+ var errs []error
+ for _, d := range x509DecoderList {
+ if err := d.DecodeX509(dst, block); err != nil {
+ errs = append(errs, err)
+ continue
+ }
+ // successfully decoded
+ return nil
+ }
+
+ return fmt.Errorf(`failed to decode X509 data using any of the decoders: %w`, errors.Join(errs...))
+}
+
+func decodeX509WithPEMDEcoder(dst any, src []byte, decoder PEMDecoder) error {
+ ret, _, err := decoder.Decode(src)
+ if err != nil {
+ return fmt.Errorf(`failed to decode PEM data: %w`, err)
+ }
+
+ if err := blackmagic.AssignIfCompatible(dst, ret); err != nil {
+ return fmt.Errorf(`failed to assign decoded key to destination: %w`, err)
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jws/BUILD.bazel
new file mode 100644
index 0000000000..920d3f87b1
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/BUILD.bazel
@@ -0,0 +1,76 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "jws",
+ srcs = [
+ "errors.go",
+ "filter.go",
+ "headers.go",
+ "headers_gen.go",
+ "interface.go",
+ "io.go",
+ "jws.go",
+ "key_provider.go",
+ "legacy.go",
+ "message.go",
+ "options.go",
+ "options_gen.go",
+ "signer.go",
+ "sign_context.go",
+ "signature_builder.go",
+ "verifier.go",
+ "verify_context.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/jws",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//cert",
+ "//internal/base64",
+ "//internal/ecutil",
+ "//internal/json",
+ "//internal/jwxio",
+ "//internal/tokens",
+ "//internal/keyconv",
+ "//internal/pool",
+ "//jwa",
+ "//jwk",
+ "//jws/internal/keytype",
+ "//jws/jwsbb",
+ "//jws/legacy",
+ "//transform",
+ "@com_github_lestrrat_go_blackmagic//:blackmagic",
+ "@com_github_lestrrat_go_option_v2//:option",
+ ],
+)
+
+go_test(
+ name = "jws_test",
+ srcs = [
+ "es256k_test.go",
+ "filter_test.go",
+ "headers_test.go",
+ "jws_test.go",
+ "message_test.go",
+ "options_gen_test.go",
+ "signer_test.go",
+ ],
+ embed = [":jws"],
+ deps = [
+ "//cert",
+ "//internal/base64",
+ "//internal/ecutil",
+ "//internal/json",
+ "//internal/jwxtest",
+ "//jwa",
+ "//jwk",
+ "//jwt",
+ "@com_github_lestrrat_go_httprc_v3//:httprc",
+ "@com_github_stretchr_testify//require",
+ ],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":jws",
+ visibility = ["//visibility:public"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/README.md b/vendor/github.com/lestrrat-go/jwx/v3/jws/README.md
new file mode 100644
index 0000000000..29ca7218e4
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/README.md
@@ -0,0 +1,111 @@
+# JWS [](https://pkg.go.dev/github.com/lestrrat-go/jwx/v3/jws)
+
+Package jws implements JWS as described in [RFC7515](https://tools.ietf.org/html/rfc7515) and [RFC7797](https://tools.ietf.org/html/rfc7797)
+
+* Parse and generate compact or JSON serializations
+* Sign and verify arbitrary payload
+* Use any of the keys supported in [github.com/lestrrat-go/jwx/v3/jwk](../jwk)
+* Add arbitrary fields in the JWS object
+* Ability to add/replace existing signature methods
+* Respect "b64" settings for RFC7797
+
+How-to style documentation can be found in the [docs directory](../docs).
+
+Examples are located in the examples directory ([jws_example_test.go](../examples/jws_example_test.go))
+
+Supported signature algorithms:
+
+| Algorithm | Supported? | Constant in [jwa](../jwa) |
+|:----------------------------------------|:-----------|:-------------------------|
+| HMAC using SHA-256 | YES | jwa.HS256 |
+| HMAC using SHA-384 | YES | jwa.HS384 |
+| HMAC using SHA-512 | YES | jwa.HS512 |
+| RSASSA-PKCS-v1.5 using SHA-256 | YES | jwa.RS256 |
+| RSASSA-PKCS-v1.5 using SHA-384 | YES | jwa.RS384 |
+| RSASSA-PKCS-v1.5 using SHA-512 | YES | jwa.RS512 |
+| ECDSA using P-256 and SHA-256 | YES | jwa.ES256 |
+| ECDSA using P-384 and SHA-384 | YES | jwa.ES384 |
+| ECDSA using P-521 and SHA-512 | YES | jwa.ES512 |
+| ECDSA using secp256k1 and SHA-256 (2) | YES | jwa.ES256K |
+| RSASSA-PSS using SHA256 and MGF1-SHA256 | YES | jwa.PS256 |
+| RSASSA-PSS using SHA384 and MGF1-SHA384 | YES | jwa.PS384 |
+| RSASSA-PSS using SHA512 and MGF1-SHA512 | YES | jwa.PS512 |
+| EdDSA (1) | YES | jwa.EdDSA |
+
+* Note 1: Experimental
+* Note 2: Experimental, and must be toggled using `-tags jwx_es256k` build tag
+
+# SYNOPSIS
+
+## Sign and verify arbitrary data
+
+```go
+import(
+ "crypto/rand"
+ "crypto/rsa"
+ "log"
+
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jws"
+)
+
+func main() {
+ privkey, err := rsa.GenerateKey(rand.Reader, 2048)
+ if err != nil {
+ log.Printf("failed to generate private key: %s", err)
+ return
+ }
+
+ buf, err := jws.Sign([]byte("Lorem ipsum"), jws.WithKey(jwa.RS256, privkey))
+ if err != nil {
+ log.Printf("failed to created JWS message: %s", err)
+ return
+ }
+
+ // When you receive a JWS message, you can verify the signature
+ // and grab the payload sent in the message in one go:
+ verified, err := jws.Verify(buf, jws.WithKey(jwa.RS256, &privkey.PublicKey))
+ if err != nil {
+ log.Printf("failed to verify message: %s", err)
+ return
+ }
+
+ log.Printf("signed message verified! -> %s", verified)
+}
+```
+
+## Programmatically manipulate `jws.Message`
+
+```go
+func ExampleMessage() {
+ // initialization for the following variables have been omitted.
+ // please see jws_example_test.go for details
+ var decodedPayload, decodedSig1, decodedSig2 []byte
+ var public1, protected1, public2, protected2 jws.Header
+
+ // Construct a message. DO NOT use values that are base64 encoded
+ m := jws.NewMessage().
+ SetPayload(decodedPayload).
+ AppendSignature(
+ jws.NewSignature().
+ SetSignature(decodedSig1).
+ SetProtectedHeaders(public1).
+ SetPublicHeaders(protected1),
+ ).
+ AppendSignature(
+ jws.NewSignature().
+ SetSignature(decodedSig2).
+ SetProtectedHeaders(public2).
+ SetPublicHeaders(protected2),
+ )
+
+ buf, err := json.MarshalIndent(m, "", " ")
+ if err != nil {
+ fmt.Printf("%s\n", err)
+ return
+ }
+
+ _ = buf
+}
+```
+
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/errors.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/errors.go
new file mode 100644
index 0000000000..d5e1762a6a
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/errors.go
@@ -0,0 +1,112 @@
+package jws
+
+import (
+ "fmt"
+)
+
+type signError struct {
+ error
+}
+
+var errDefaultSignError = signerr(`unknown error`)
+
+// SignError returns an error that can be passed to `errors.Is` to check if the error is a sign error.
+func SignError() error {
+ return errDefaultSignError
+}
+
+func (e signError) Unwrap() error {
+ return e.error
+}
+
+func (signError) Is(err error) bool {
+ _, ok := err.(signError)
+ return ok
+}
+
+func signerr(f string, args ...any) error {
+ return signError{fmt.Errorf(`jws.Sign: `+f, args...)}
+}
+
+// This error is returned when jws.Verify fails, but note that there's another type of
+// message that can be returned by jws.Verify, which is `errVerification`.
+type verifyError struct {
+ error
+}
+
+var errDefaultVerifyError = verifyerr(`unknown error`)
+
+// VerifyError returns an error that can be passed to `errors.Is` to check if the error is a verify error.
+func VerifyError() error {
+ return errDefaultVerifyError
+}
+
+func (e verifyError) Unwrap() error {
+ return e.error
+}
+
+func (verifyError) Is(err error) bool {
+ _, ok := err.(verifyError)
+ return ok
+}
+
+func verifyerr(f string, args ...any) error {
+ return verifyError{fmt.Errorf(`jws.Verify: `+f, args...)}
+}
+
+// verificationError is returned when the actual _verification_ of the key/payload fails.
+type verificationError struct {
+ error
+}
+
+var errDefaultVerificationError = verificationError{fmt.Errorf(`unknown verification error`)}
+
+// VerificationError returns an error that can be passed to `errors.Is` to check if the error is a verification error.
+func VerificationError() error {
+ return errDefaultVerificationError
+}
+
+func (e verificationError) Unwrap() error {
+ return e.error
+}
+
+func (verificationError) Is(err error) bool {
+ _, ok := err.(verificationError)
+ return ok
+}
+
+type parseError struct {
+ error
+}
+
+var errDefaultParseError = parseerr(`unknown error`)
+
+// ParseError returns an error that can be passed to `errors.Is` to check if the error is a parse error.
+func ParseError() error {
+ return errDefaultParseError
+}
+
+func (e parseError) Unwrap() error {
+ return e.error
+}
+
+func (parseError) Is(err error) bool {
+ _, ok := err.(parseError)
+ return ok
+}
+
+func bparseerr(prefix string, f string, args ...any) error {
+ return parseError{fmt.Errorf(prefix+": "+f, args...)}
+}
+
+func parseerr(f string, args ...any) error {
+ return bparseerr(`jws.Parse`, f, args...)
+}
+
+func sparseerr(f string, args ...any) error {
+ return bparseerr(`jws.ParseString`, f, args...)
+}
+
+func rparseerr(f string, args ...any) error {
+ return bparseerr(`jws.ParseReader`, f, args...)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/es256k.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/es256k.go
new file mode 100644
index 0000000000..28ebd2ea0e
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/es256k.go
@@ -0,0 +1,12 @@
+//go:build jwx_es256k
+
+package jws
+
+import (
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+func init() {
+ // Register ES256K to EC algorithm family
+ addAlgorithmForKeyType(jwa.EC(), jwa.ES256K())
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/filter.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/filter.go
new file mode 100644
index 0000000000..9351ab870b
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/filter.go
@@ -0,0 +1,36 @@
+package jws
+
+import (
+ "github.com/lestrrat-go/jwx/v3/transform"
+)
+
+// HeaderFilter is an interface that allows users to filter JWS header fields.
+// It provides two methods: Filter and Reject; Filter returns a new header with only
+// the fields that match the filter criteria, while Reject returns a new header with
+// only the fields that DO NOT match the filter.
+//
+// EXPERIMENTAL: This API is experimental and its interface and behavior is
+// subject to change in future releases. This API is not subject to semver
+// compatibility guarantees.
+type HeaderFilter interface {
+ Filter(header Headers) (Headers, error)
+ Reject(header Headers) (Headers, error)
+}
+
+// StandardHeadersFilter returns a HeaderFilter that filters out standard JWS header fields.
+//
+// You can use this filter to create headers that either only have standard fields
+// or only custom fields.
+//
+// If you need to configure the filter more precisely, consider
+// using the HeaderNameFilter directly.
+func StandardHeadersFilter() HeaderFilter {
+ return stdHeadersFilter
+}
+
+var stdHeadersFilter = NewHeaderNameFilter(stdHeaderNames...)
+
+// NewHeaderNameFilter creates a new HeaderNameFilter with the specified field names.
+func NewHeaderNameFilter(names ...string) HeaderFilter {
+ return transform.NewNameBasedFilter[Headers](names...)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/headers.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/headers.go
new file mode 100644
index 0000000000..45f8e8959e
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/headers.go
@@ -0,0 +1,52 @@
+package jws
+
+import (
+ "fmt"
+)
+
+func (h *stdHeaders) Copy(dst Headers) error {
+ for _, k := range h.Keys() {
+ var v any
+ if err := h.Get(k, &v); err != nil {
+ return fmt.Errorf(`failed to get header %q: %w`, k, err)
+ }
+ if err := dst.Set(k, v); err != nil {
+ return fmt.Errorf(`failed to set header %q: %w`, k, err)
+ }
+ }
+ return nil
+}
+
+// mergeHeaders merges two headers, and works even if the first Header
+// object is nil. This is not exported because ATM it felt like this
+// function is not frequently used, and MergeHeaders seemed a clunky name
+func mergeHeaders(h1, h2 Headers) (Headers, error) {
+ h3 := NewHeaders()
+
+ if h1 != nil {
+ if err := h1.Copy(h3); err != nil {
+ return nil, fmt.Errorf(`failed to copy headers from first Header: %w`, err)
+ }
+ }
+
+ if h2 != nil {
+ if err := h2.Copy(h3); err != nil {
+ return nil, fmt.Errorf(`failed to copy headers from second Header: %w`, err)
+ }
+ }
+
+ return h3, nil
+}
+
+func (h *stdHeaders) Merge(h2 Headers) (Headers, error) {
+ return mergeHeaders(h, h2)
+}
+
+// Clone creates a deep copy of the header
+func (h *stdHeaders) Clone() (Headers, error) {
+ dst := NewHeaders()
+ if err := h.Copy(dst); err != nil {
+ return nil, fmt.Errorf(`failed to copy header: %w`, err)
+ }
+ return dst, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/headers_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/headers_gen.go
new file mode 100644
index 0000000000..8465eda2b1
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/headers_gen.go
@@ -0,0 +1,704 @@
+// Code generated by tools/cmd/genjws/main.go. DO NOT EDIT.
+
+package jws
+
+import (
+ "bytes"
+ "fmt"
+ "sort"
+ "sync"
+
+ "github.com/lestrrat-go/blackmagic"
+ "github.com/lestrrat-go/jwx/v3/cert"
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwk"
+)
+
+const (
+ AlgorithmKey = "alg"
+ ContentTypeKey = "cty"
+ CriticalKey = "crit"
+ JWKKey = "jwk"
+ JWKSetURLKey = "jku"
+ KeyIDKey = "kid"
+ TypeKey = "typ"
+ X509CertChainKey = "x5c"
+ X509CertThumbprintKey = "x5t"
+ X509CertThumbprintS256Key = "x5t#S256"
+ X509URLKey = "x5u"
+)
+
+// Headers describe a standard JWS Header set. It is part of the JWS message
+// and is used to represet both Public or Protected headers, which in turn
+// can be found in each Signature object. If you are not sure how this works,
+// it is strongly recommended that you read RFC7515, especially the section
+// that describes the full JSON serialization format of JWS messages.
+//
+// In most cases, you likely want to use the protected headers, as this is part of the signed content.
+type Headers interface {
+ Algorithm() (jwa.SignatureAlgorithm, bool)
+ ContentType() (string, bool)
+ Critical() ([]string, bool)
+ JWK() (jwk.Key, bool)
+ JWKSetURL() (string, bool)
+ KeyID() (string, bool)
+ Type() (string, bool)
+ X509CertChain() (*cert.Chain, bool)
+ X509CertThumbprint() (string, bool)
+ X509CertThumbprintS256() (string, bool)
+ X509URL() (string, bool)
+ Copy(Headers) error
+ Merge(Headers) (Headers, error)
+ Clone() (Headers, error)
+ // Get is used to extract the value of any field, including non-standard fields, out of the header.
+ //
+ // The first argument is the name of the field. The second argument is a pointer
+ // to a variable that will receive the value of the field. The method returns
+ // an error if the field does not exist, or if the value cannot be assigned to
+ // the destination variable. Note that a field is considered to "exist" even if
+ // the value is empty-ish (e.g. 0, false, ""), as long as it is explicitly set.
+ Get(string, any) error
+ Set(string, any) error
+ Remove(string) error
+ // Has returns true if the specified header has a value, even if
+ // the value is empty-ish (e.g. 0, false, "") as long as it has been
+ // explicitly set.
+ Has(string) bool
+ Keys() []string
+}
+
+// stdHeaderNames is a list of all standard header names defined in the JWS specification.
+var stdHeaderNames = []string{AlgorithmKey, ContentTypeKey, CriticalKey, JWKKey, JWKSetURLKey, KeyIDKey, TypeKey, X509CertChainKey, X509CertThumbprintKey, X509CertThumbprintS256Key, X509URLKey}
+
+type stdHeaders struct {
+ algorithm *jwa.SignatureAlgorithm // https://tools.ietf.org/html/rfc7515#section-4.1.1
+ contentType *string // https://tools.ietf.org/html/rfc7515#section-4.1.10
+ critical []string // https://tools.ietf.org/html/rfc7515#section-4.1.11
+ jwk jwk.Key // https://tools.ietf.org/html/rfc7515#section-4.1.3
+ jwkSetURL *string // https://tools.ietf.org/html/rfc7515#section-4.1.2
+ keyID *string // https://tools.ietf.org/html/rfc7515#section-4.1.4
+ typ *string // https://tools.ietf.org/html/rfc7515#section-4.1.9
+ x509CertChain *cert.Chain // https://tools.ietf.org/html/rfc7515#section-4.1.6
+ x509CertThumbprint *string // https://tools.ietf.org/html/rfc7515#section-4.1.7
+ x509CertThumbprintS256 *string // https://tools.ietf.org/html/rfc7515#section-4.1.8
+ x509URL *string // https://tools.ietf.org/html/rfc7515#section-4.1.5
+ privateParams map[string]any
+ mu *sync.RWMutex
+ dc DecodeCtx
+ raw []byte // stores the raw version of the header so it can be used later
+}
+
+func NewHeaders() Headers {
+ return &stdHeaders{
+ mu: &sync.RWMutex{},
+ }
+}
+
+func (h *stdHeaders) Algorithm() (jwa.SignatureAlgorithm, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.algorithm == nil {
+ return jwa.EmptySignatureAlgorithm(), false
+ }
+ return *(h.algorithm), true
+}
+
+func (h *stdHeaders) ContentType() (string, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.contentType == nil {
+ return "", false
+ }
+ return *(h.contentType), true
+}
+
+func (h *stdHeaders) Critical() ([]string, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ return h.critical, true
+}
+
+func (h *stdHeaders) JWK() (jwk.Key, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ return h.jwk, true
+}
+
+func (h *stdHeaders) JWKSetURL() (string, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.jwkSetURL == nil {
+ return "", false
+ }
+ return *(h.jwkSetURL), true
+}
+
+func (h *stdHeaders) KeyID() (string, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.keyID == nil {
+ return "", false
+ }
+ return *(h.keyID), true
+}
+
+func (h *stdHeaders) Type() (string, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.typ == nil {
+ return "", false
+ }
+ return *(h.typ), true
+}
+
+func (h *stdHeaders) X509CertChain() (*cert.Chain, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ return h.x509CertChain, true
+}
+
+func (h *stdHeaders) X509CertThumbprint() (string, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.x509CertThumbprint == nil {
+ return "", false
+ }
+ return *(h.x509CertThumbprint), true
+}
+
+func (h *stdHeaders) X509CertThumbprintS256() (string, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.x509CertThumbprintS256 == nil {
+ return "", false
+ }
+ return *(h.x509CertThumbprintS256), true
+}
+
+func (h *stdHeaders) X509URL() (string, bool) {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ if h.x509URL == nil {
+ return "", false
+ }
+ return *(h.x509URL), true
+}
+
+func (h *stdHeaders) clear() {
+ h.algorithm = nil
+ h.contentType = nil
+ h.critical = nil
+ h.jwk = nil
+ h.jwkSetURL = nil
+ h.keyID = nil
+ h.typ = nil
+ h.x509CertChain = nil
+ h.x509CertThumbprint = nil
+ h.x509CertThumbprintS256 = nil
+ h.x509URL = nil
+ h.privateParams = nil
+ h.raw = nil
+}
+
+func (h *stdHeaders) DecodeCtx() DecodeCtx {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ return h.dc
+}
+
+func (h *stdHeaders) SetDecodeCtx(dc DecodeCtx) {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ h.dc = dc
+}
+
+func (h *stdHeaders) rawBuffer() []byte {
+ return h.raw
+}
+
+func (h *stdHeaders) PrivateParams() map[string]any {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ return h.privateParams
+}
+
+func (h *stdHeaders) Has(name string) bool {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case AlgorithmKey:
+ return h.algorithm != nil
+ case ContentTypeKey:
+ return h.contentType != nil
+ case CriticalKey:
+ return h.critical != nil
+ case JWKKey:
+ return h.jwk != nil
+ case JWKSetURLKey:
+ return h.jwkSetURL != nil
+ case KeyIDKey:
+ return h.keyID != nil
+ case TypeKey:
+ return h.typ != nil
+ case X509CertChainKey:
+ return h.x509CertChain != nil
+ case X509CertThumbprintKey:
+ return h.x509CertThumbprint != nil
+ case X509CertThumbprintS256Key:
+ return h.x509CertThumbprintS256 != nil
+ case X509URLKey:
+ return h.x509URL != nil
+ default:
+ _, ok := h.privateParams[name]
+ return ok
+ }
+}
+
+func (h *stdHeaders) Get(name string, dst any) error {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ switch name {
+ case AlgorithmKey:
+ if h.algorithm == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.algorithm)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case ContentTypeKey:
+ if h.contentType == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.contentType)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case CriticalKey:
+ if h.critical == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst,
+ h.critical); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case JWKKey:
+ if h.jwk == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst,
+ h.jwk); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case JWKSetURLKey:
+ if h.jwkSetURL == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.jwkSetURL)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case KeyIDKey:
+ if h.keyID == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.keyID)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case TypeKey:
+ if h.typ == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.typ)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertChainKey:
+ if h.x509CertChain == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst,
+ h.x509CertChain); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertThumbprintKey:
+ if h.x509CertThumbprint == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprint)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509CertThumbprintS256Key:
+ if h.x509CertThumbprintS256 == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509CertThumbprintS256)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ case X509URLKey:
+ if h.x509URL == nil {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(h.x509URL)); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ return nil
+ default:
+ v, ok := h.privateParams[name]
+ if !ok {
+ return fmt.Errorf(`field %q not found`, name)
+ }
+ if err := blackmagic.AssignIfCompatible(dst, v); err != nil {
+ return fmt.Errorf(`failed to assign value for field %q: %w`, name, err)
+ }
+ }
+ return nil
+}
+
+func (h *stdHeaders) Set(name string, value any) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ return h.setNoLock(name, value)
+}
+
+func (h *stdHeaders) setNoLock(name string, value any) error {
+ switch name {
+ case AlgorithmKey:
+ alg, err := jwa.KeyAlgorithmFrom(value)
+ if err != nil {
+ return fmt.Errorf("invalid value for %s key: %w", AlgorithmKey, err)
+ }
+ if salg, ok := alg.(jwa.SignatureAlgorithm); ok {
+ h.algorithm = &salg
+ return nil
+ }
+ return fmt.Errorf("expecte jwa.SignatureAlgorithm, received %T", alg)
+ case ContentTypeKey:
+ if v, ok := value.(string); ok {
+ h.contentType = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, ContentTypeKey, value)
+ case CriticalKey:
+ if v, ok := value.([]string); ok {
+ h.critical = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, CriticalKey, value)
+ case JWKKey:
+ if v, ok := value.(jwk.Key); ok {
+ h.jwk = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, JWKKey, value)
+ case JWKSetURLKey:
+ if v, ok := value.(string); ok {
+ h.jwkSetURL = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, JWKSetURLKey, value)
+ case KeyIDKey:
+ if v, ok := value.(string); ok {
+ h.keyID = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, KeyIDKey, value)
+ case TypeKey:
+ if v, ok := value.(string); ok {
+ h.typ = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, TypeKey, value)
+ case X509CertChainKey:
+ if v, ok := value.(*cert.Chain); ok {
+ h.x509CertChain = v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertChainKey, value)
+ case X509CertThumbprintKey:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprint = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintKey, value)
+ case X509CertThumbprintS256Key:
+ if v, ok := value.(string); ok {
+ h.x509CertThumbprintS256 = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509CertThumbprintS256Key, value)
+ case X509URLKey:
+ if v, ok := value.(string); ok {
+ h.x509URL = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, X509URLKey, value)
+ default:
+ if h.privateParams == nil {
+ h.privateParams = map[string]any{}
+ }
+ h.privateParams[name] = value
+ }
+ return nil
+}
+
+func (h *stdHeaders) Remove(key string) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ switch key {
+ case AlgorithmKey:
+ h.algorithm = nil
+ case ContentTypeKey:
+ h.contentType = nil
+ case CriticalKey:
+ h.critical = nil
+ case JWKKey:
+ h.jwk = nil
+ case JWKSetURLKey:
+ h.jwkSetURL = nil
+ case KeyIDKey:
+ h.keyID = nil
+ case TypeKey:
+ h.typ = nil
+ case X509CertChainKey:
+ h.x509CertChain = nil
+ case X509CertThumbprintKey:
+ h.x509CertThumbprint = nil
+ case X509CertThumbprintS256Key:
+ h.x509CertThumbprintS256 = nil
+ case X509URLKey:
+ h.x509URL = nil
+ default:
+ delete(h.privateParams, key)
+ }
+ return nil
+}
+
+func (h *stdHeaders) UnmarshalJSON(buf []byte) error {
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ h.clear()
+ dec := json.NewDecoder(bytes.NewReader(buf))
+LOOP:
+ for {
+ tok, err := dec.Token()
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ switch tok := tok.(type) {
+ case json.Delim:
+ // Assuming we're doing everything correctly, we should ONLY
+ // get either tokens.OpenCurlyBracket or tokens.CloseCurlyBracket here.
+ if tok == tokens.CloseCurlyBracket { // End of object
+ break LOOP
+ } else if tok != tokens.OpenCurlyBracket {
+ return fmt.Errorf(`expected '%c' but got '%c'`, tokens.OpenCurlyBracket, tok)
+ }
+ case string: // Objects can only have string keys
+ switch tok {
+ case AlgorithmKey:
+ var decoded jwa.SignatureAlgorithm
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AlgorithmKey, err)
+ }
+ h.algorithm = &decoded
+ case ContentTypeKey:
+ if err := json.AssignNextStringToken(&h.contentType, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, ContentTypeKey, err)
+ }
+ case CriticalKey:
+ var decoded []string
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, CriticalKey, err)
+ }
+ h.critical = decoded
+ case JWKKey:
+ var buf json.RawMessage
+ if err := dec.Decode(&buf); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, JWKKey, err)
+ }
+ key, err := jwk.ParseKey(buf)
+ if err != nil {
+ return fmt.Errorf(`failed to parse JWK for key %s: %w`, JWKKey, err)
+ }
+ h.jwk = key
+ case JWKSetURLKey:
+ if err := json.AssignNextStringToken(&h.jwkSetURL, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, JWKSetURLKey, err)
+ }
+ case KeyIDKey:
+ if err := json.AssignNextStringToken(&h.keyID, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, KeyIDKey, err)
+ }
+ case TypeKey:
+ if err := json.AssignNextStringToken(&h.typ, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, TypeKey, err)
+ }
+ case X509CertChainKey:
+ var decoded cert.Chain
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertChainKey, err)
+ }
+ h.x509CertChain = &decoded
+ case X509CertThumbprintKey:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprint, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintKey, err)
+ }
+ case X509CertThumbprintS256Key:
+ if err := json.AssignNextStringToken(&h.x509CertThumbprintS256, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509CertThumbprintS256Key, err)
+ }
+ case X509URLKey:
+ if err := json.AssignNextStringToken(&h.x509URL, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, X509URLKey, err)
+ }
+ default:
+ decoded, err := registry.Decode(dec, tok)
+ if err != nil {
+ return err
+ }
+ h.setNoLock(tok, decoded)
+ }
+ default:
+ return fmt.Errorf(`invalid token %T`, tok)
+ }
+ }
+ h.raw = buf
+ return nil
+}
+
+func (h *stdHeaders) Keys() []string {
+ h.mu.RLock()
+ defer h.mu.RUnlock()
+ keys := make([]string, 0, 11+len(h.privateParams))
+ if h.algorithm != nil {
+ keys = append(keys, AlgorithmKey)
+ }
+ if h.contentType != nil {
+ keys = append(keys, ContentTypeKey)
+ }
+ if h.critical != nil {
+ keys = append(keys, CriticalKey)
+ }
+ if h.jwk != nil {
+ keys = append(keys, JWKKey)
+ }
+ if h.jwkSetURL != nil {
+ keys = append(keys, JWKSetURLKey)
+ }
+ if h.keyID != nil {
+ keys = append(keys, KeyIDKey)
+ }
+ if h.typ != nil {
+ keys = append(keys, TypeKey)
+ }
+ if h.x509CertChain != nil {
+ keys = append(keys, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ keys = append(keys, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ keys = append(keys, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ keys = append(keys, X509URLKey)
+ }
+ for k := range h.privateParams {
+ keys = append(keys, k)
+ }
+ return keys
+}
+
+func (h stdHeaders) MarshalJSON() ([]byte, error) {
+ h.mu.RLock()
+ data := make(map[string]any)
+ keys := make([]string, 0, 11+len(h.privateParams))
+ if h.algorithm != nil {
+ data[AlgorithmKey] = *(h.algorithm)
+ keys = append(keys, AlgorithmKey)
+ }
+ if h.contentType != nil {
+ data[ContentTypeKey] = *(h.contentType)
+ keys = append(keys, ContentTypeKey)
+ }
+ if h.critical != nil {
+ data[CriticalKey] = h.critical
+ keys = append(keys, CriticalKey)
+ }
+ if h.jwk != nil {
+ data[JWKKey] = h.jwk
+ keys = append(keys, JWKKey)
+ }
+ if h.jwkSetURL != nil {
+ data[JWKSetURLKey] = *(h.jwkSetURL)
+ keys = append(keys, JWKSetURLKey)
+ }
+ if h.keyID != nil {
+ data[KeyIDKey] = *(h.keyID)
+ keys = append(keys, KeyIDKey)
+ }
+ if h.typ != nil {
+ data[TypeKey] = *(h.typ)
+ keys = append(keys, TypeKey)
+ }
+ if h.x509CertChain != nil {
+ data[X509CertChainKey] = h.x509CertChain
+ keys = append(keys, X509CertChainKey)
+ }
+ if h.x509CertThumbprint != nil {
+ data[X509CertThumbprintKey] = *(h.x509CertThumbprint)
+ keys = append(keys, X509CertThumbprintKey)
+ }
+ if h.x509CertThumbprintS256 != nil {
+ data[X509CertThumbprintS256Key] = *(h.x509CertThumbprintS256)
+ keys = append(keys, X509CertThumbprintS256Key)
+ }
+ if h.x509URL != nil {
+ data[X509URLKey] = *(h.x509URL)
+ keys = append(keys, X509URLKey)
+ }
+ for k, v := range h.privateParams {
+ data[k] = v
+ keys = append(keys, k)
+ }
+ h.mu.RUnlock()
+ sort.Strings(keys)
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+ enc := json.NewEncoder(buf)
+ buf.WriteByte(tokens.OpenCurlyBracket)
+ for i, k := range keys {
+ if i > 0 {
+ buf.WriteRune(tokens.Comma)
+ }
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(k)
+ buf.WriteString(`":`)
+ switch v := data[k].(type) {
+ case []byte:
+ buf.WriteRune(tokens.DoubleQuote)
+ buf.WriteString(base64.EncodeToString(v))
+ buf.WriteRune(tokens.DoubleQuote)
+ default:
+ if err := enc.Encode(v); err != nil {
+ return nil, fmt.Errorf(`failed to encode value for field %s: %w`, k, err)
+ }
+ buf.Truncate(buf.Len() - 1)
+ }
+ }
+ buf.WriteByte(tokens.CloseCurlyBracket)
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ return ret, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/interface.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/interface.go
new file mode 100644
index 0000000000..e3ad296844
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/interface.go
@@ -0,0 +1,80 @@
+package jws
+
+import (
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/jws/legacy"
+)
+
+type Signer = legacy.Signer
+type Verifier = legacy.Verifier
+type HMACSigner = legacy.HMACSigner
+type HMACVerifier = legacy.HMACVerifier
+
+// Base64Encoder is an interface that can be used when encoding JWS message
+// components to base64. This is useful when you want to use a non-standard
+// base64 encoder while generating or verifying signatures. By default JWS
+// uses raw url base64 encoding (without padding), but there are apparently
+// some cases where you may want to use a base64 encoders that uses padding.
+//
+// For example, apparently AWS ALB User Claims is provided in JWT format,
+// but it uses a base64 encoding with padding.
+type Base64Encoder = base64.Encoder
+
+type DecodeCtx interface {
+ CollectRaw() bool
+}
+
+// Message represents a full JWS encoded message. Flattened serialization
+// is not supported as a struct, but rather it's represented as a
+// Message struct with only one `signature` element.
+//
+// Do not expect to use the Message object to verify or construct a
+// signed payload with. You should only use this when you want to actually
+// programmatically view the contents of the full JWS payload.
+//
+// As of this version, there is one big incompatibility when using Message
+// objects to convert between compact and JSON representations.
+// The protected header is sometimes encoded differently from the original
+// message and the JSON serialization that we use in Go.
+//
+// For example, the protected header `eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9`
+// decodes to
+//
+// {"typ":"JWT",
+// "alg":"HS256"}
+//
+// However, when we parse this into a message, we create a jws.Header object,
+// which, when we marshal into a JSON object again, becomes
+//
+// {"typ":"JWT","alg":"HS256"}
+//
+// Notice that serialization lacks a line break and a space between `"JWT",`
+// and `"alg"`. This causes a problem when verifying the signatures AFTER
+// a compact JWS message has been unmarshaled into a jws.Message.
+//
+// jws.Verify() doesn't go through this step, and therefore this does not
+// manifest itself. However, you may see this discrepancy when you manually
+// go through these conversions, and/or use the `jwx` tool like so:
+//
+// jwx jws parse message.jws | jwx jws verify --key somekey.jwk --stdin
+//
+// In this scenario, the first `jwx jws parse` outputs a parsed jws.Message
+// which is marshaled into JSON. At this point the message's protected
+// headers and the signatures don't match.
+//
+// To sign and verify, use the appropriate `Sign()` and `Verify()` functions.
+type Message struct {
+ dc DecodeCtx
+ payload []byte
+ signatures []*Signature
+ b64 bool // true if payload should be base64 encoded
+}
+
+type Signature struct {
+ encoder Base64Encoder
+ dc DecodeCtx
+ headers Headers // Unprotected Headers
+ protected Headers // Protected Headers
+ signature []byte // Signature
+ detached bool
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/internal/keytype/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jws/internal/keytype/BUILD.bazel
new file mode 100644
index 0000000000..eb8bd94acb
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/internal/keytype/BUILD.bazel
@@ -0,0 +1,11 @@
+load("@rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "keytype",
+ srcs = ["keytype.go"],
+ importpath = "github.com/lestrrat-go/jwx/v3/jws/internal/keytype",
+ visibility = ["//jws:__subpackages__"],
+ deps = [
+ "//jwk",
+ ],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/internal/keytype/keytype.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/internal/keytype/keytype.go
new file mode 100644
index 0000000000..6b57ed10d8
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/internal/keytype/keytype.go
@@ -0,0 +1,57 @@
+package keytype
+
+import (
+ "crypto/ecdsa"
+ "crypto/ed25519"
+ "crypto/rsa"
+
+ "github.com/lestrrat-go/jwx/v3/jwk"
+)
+
+// Because the keys defined in github.com/lestrrat-go/jwx/jwk may also implement
+// crypto.Signer, it would be possible for to mix up key types when signing/verifying
+// for example, when we specify jws.WithKey(jwa.RSA256, cryptoSigner), the cryptoSigner
+// can be for RSA, or any other type that implements crypto.Signer... even if it's for the
+// wrong algorithm.
+//
+// These functions are there to differentiate between the valid KNOWN key types.
+// For any other key type that is outside of the Go std library and our own code,
+// we must rely on the user to be vigilant.
+//
+// Notes: symmetric keys are obviously not part of this. for v2 OKP keys,
+// x25519 does not implement Sign()
+func IsValidRSAKey(key any) bool {
+ switch key.(type) {
+ case
+ ecdsa.PrivateKey, *ecdsa.PrivateKey,
+ ed25519.PrivateKey,
+ jwk.ECDSAPrivateKey, jwk.OKPPrivateKey:
+ // these are NOT ok
+ return false
+ }
+ return true
+}
+
+func IsValidECDSAKey(key any) bool {
+ switch key.(type) {
+ case
+ ed25519.PrivateKey,
+ rsa.PrivateKey, *rsa.PrivateKey,
+ jwk.RSAPrivateKey, jwk.OKPPrivateKey:
+ // these are NOT ok
+ return false
+ }
+ return true
+}
+
+func IsValidEDDSAKey(key any) bool {
+ switch key.(type) {
+ case
+ ecdsa.PrivateKey, *ecdsa.PrivateKey,
+ rsa.PrivateKey, *rsa.PrivateKey,
+ jwk.RSAPrivateKey, jwk.ECDSAPrivateKey:
+ // these are NOT ok
+ return false
+ }
+ return true
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/io.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/io.go
new file mode 100644
index 0000000000..77a084cfda
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/io.go
@@ -0,0 +1,36 @@
+// Code generated by tools/cmd/genreadfile/main.go. DO NOT EDIT.
+
+package jws
+
+import (
+ "fmt"
+ "io/fs"
+ "os"
+)
+
+type sysFS struct{}
+
+func (sysFS) Open(path string) (fs.File, error) {
+ return os.Open(path)
+}
+
+func ReadFile(path string, options ...ReadFileOption) (*Message, error) {
+
+ var srcFS fs.FS = sysFS{}
+ for _, option := range options {
+ switch option.Ident() {
+ case identFS{}:
+ if err := option.Value(&srcFS); err != nil {
+ return nil, fmt.Errorf("failed to set fs.FS: %w", err)
+ }
+ }
+ }
+
+ f, err := srcFS.Open(path)
+ if err != nil {
+ return nil, err
+ }
+
+ defer f.Close()
+ return ParseReader(f)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/jws.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/jws.go
new file mode 100644
index 0000000000..f09e40db2d
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/jws.go
@@ -0,0 +1,665 @@
+//go:generate ../tools/cmd/genjws.sh
+
+// Package jws implements the digital signature on JSON based data
+// structures as described in https://tools.ietf.org/html/rfc7515
+//
+// If you do not care about the details, the only things that you
+// would need to use are the following functions:
+//
+// jws.Sign(payload, jws.WithKey(algorithm, key))
+// jws.Verify(serialized, jws.WithKey(algorithm, key))
+//
+// To sign, simply use `jws.Sign`. `payload` is a []byte buffer that
+// contains whatever data you want to sign. `alg` is one of the
+// jwa.SignatureAlgorithm constants from package jwa. For RSA and
+// ECDSA family of algorithms, you will need to prepare a private key.
+// For HMAC family, you just need a []byte value. The `jws.Sign`
+// function will return the encoded JWS message on success.
+//
+// To verify, use `jws.Verify`. It will parse the `encodedjws` buffer
+// and verify the result using `algorithm` and `key`. Upon successful
+// verification, the original payload is returned, so you can work on it.
+//
+// As a sidenote, consider using github.com/lestrrat-go/htmsig if you
+// looking for HTTP Message Signatures (RFC9421) -- it uses the same
+// underlying signing/verification mechanisms as this module.
+package jws
+
+import (
+ "bufio"
+ "crypto/ecdh"
+ "crypto/ecdsa"
+ "crypto/ed25519"
+ "crypto/rsa"
+ "errors"
+ "fmt"
+ "io"
+ "reflect"
+ "sync"
+ "unicode"
+ "unicode/utf8"
+
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/internal/jwxio"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwk"
+ "github.com/lestrrat-go/jwx/v3/jws/jwsbb"
+)
+
+var registry = json.NewRegistry()
+
+var signers = make(map[jwa.SignatureAlgorithm]Signer)
+var muSigner = &sync.Mutex{}
+
+func removeSigner(alg jwa.SignatureAlgorithm) {
+ muSigner.Lock()
+ defer muSigner.Unlock()
+ delete(signers, alg)
+}
+
+type defaultSigner struct {
+ alg jwa.SignatureAlgorithm
+}
+
+func (s defaultSigner) Algorithm() jwa.SignatureAlgorithm {
+ return s.alg
+}
+
+func (s defaultSigner) Sign(key any, payload []byte) ([]byte, error) {
+ return jwsbb.Sign(key, s.alg.String(), payload, nil)
+}
+
+type signerAdapter struct {
+ signer Signer
+}
+
+func (s signerAdapter) Algorithm() jwa.SignatureAlgorithm {
+ return s.signer.Algorithm()
+}
+
+func (s signerAdapter) Sign(key any, payload []byte) ([]byte, error) {
+ return s.signer.Sign(payload, key)
+}
+
+const (
+ fmtInvalid = 1 << iota
+ fmtCompact
+ fmtJSON
+ fmtJSONPretty
+ fmtMax
+)
+
+// silence linters
+var _ = fmtInvalid
+var _ = fmtMax
+
+func validateKeyBeforeUse(key any) error {
+ jwkKey, ok := key.(jwk.Key)
+ if !ok {
+ converted, err := jwk.Import(key)
+ if err != nil {
+ return fmt.Errorf(`could not convert key of type %T to jwk.Key for validation: %w`, key, err)
+ }
+ jwkKey = converted
+ }
+ return jwkKey.Validate()
+}
+
+// Sign generates a JWS message for the given payload and returns
+// it in serialized form, which can be in either compact or
+// JSON format. Default is compact.
+//
+// You must pass at least one key to `jws.Sign()` by using `jws.WithKey()`
+// option.
+//
+// jws.Sign(payload, jws.WithKey(alg, key))
+// jws.Sign(payload, jws.WithJSON(), jws.WithKey(alg1, key1), jws.WithKey(alg2, key2))
+//
+// Note that in the second example the `jws.WithJSON()` option is
+// specified as well. This is because the compact serialization
+// format does not support multiple signatures, and users must
+// specifically ask for the JSON serialization format.
+//
+// Read the documentation for `jws.WithKey()` to learn more about the
+// possible values that can be used for `alg` and `key`.
+//
+// You may create JWS messages with the "none" (jwa.NoSignature) algorithm
+// if you use the `jws.WithInsecureNoSignature()` option. This option
+// can be combined with one or more signature keys, as well as the
+// `jws.WithJSON()` option to generate multiple signatures (though
+// the usefulness of such constructs is highly debatable)
+//
+// Note that this library does not allow you to successfully call `jws.Verify()` on
+// signatures with the "none" algorithm. To parse these, use `jws.Parse()` instead.
+//
+// If you want to use a detached payload, use `jws.WithDetachedPayload()` as
+// one of the options. When you use this option, you must always set the
+// first parameter (`payload`) to `nil`, or the function will return an error
+//
+// You may also want to look at how to pass protected headers to the
+// signing process, as you will likely be required to set the `b64` field
+// when using detached payload.
+//
+// Look for options that return `jws.SignOption` or `jws.SignVerifyOption`
+// for a complete list of options that can be passed to this function.
+//
+// You can use `errors.Is` with `jws.SignError()` to check if an error is from this function.
+func Sign(payload []byte, options ...SignOption) ([]byte, error) {
+ sc := signContextPool.Get()
+ defer signContextPool.Put(sc)
+
+ sc.payload = payload
+
+ if err := sc.ProcessOptions(options); err != nil {
+ return nil, signerr(`failed to process options: %w`, err)
+ }
+
+ lsigner := len(sc.sigbuilders)
+ if lsigner == 0 {
+ return nil, signerr(`no signers available. Specify an algorithm and a key using jws.WithKey()`)
+ }
+
+ // Design note: while we could have easily set format = fmtJSON when
+ // lsigner > 1, I believe the decision to change serialization formats
+ // must be explicitly stated by the caller. Otherwise, I'm pretty sure
+ // there would be people filing issues saying "I get JSON when I expected
+ // compact serialization".
+ //
+ // Therefore, instead of making implicit format conversions, we force the
+ // user to spell it out as `jws.Sign(..., jws.WithJSON(), jws.WithKey(...), jws.WithKey(...))`
+ if sc.format == fmtCompact && lsigner != 1 {
+ return nil, signerr(`cannot have multiple signers (keys) specified for compact serialization. Use only one jws.WithKey()`)
+ }
+
+ // Create a Message object with all the bits and bobs, and we'll
+ // serialize it in the end
+ var result Message
+
+ if err := sc.PopulateMessage(&result); err != nil {
+ return nil, signerr(`failed to populate message: %w`, err)
+ }
+ switch sc.format {
+ case fmtJSON:
+ return json.Marshal(result)
+ case fmtJSONPretty:
+ return json.MarshalIndent(result, "", " ")
+ case fmtCompact:
+ // Take the only signature object, and convert it into a Compact
+ // serialization format
+ var compactOpts []CompactOption
+ if sc.detached {
+ compactOpts = append(compactOpts, WithDetached(true))
+ }
+ for _, option := range options {
+ if copt, ok := option.(CompactOption); ok {
+ compactOpts = append(compactOpts, copt)
+ }
+ }
+ return Compact(&result, compactOpts...)
+ default:
+ return nil, signerr(`invalid serialization format`)
+ }
+}
+
+var allowNoneWhitelist = jwk.WhitelistFunc(func(string) bool {
+ return false
+})
+
+// Verify checks if the given JWS message is verifiable using `alg` and `key`.
+// `key` may be a "raw" key (e.g. rsa.PublicKey) or a jwk.Key
+//
+// If the verification is successful, `err` is nil, and the content of the
+// payload that was signed is returned. If you need more fine-grained
+// control of the verification process, manually generate a
+// `Verifier` in `verify` subpackage, and call `Verify` method on it.
+// If you need to access signatures and JOSE headers in a JWS message,
+// use `Parse` function to get `Message` object.
+//
+// Because the use of "none" (jwa.NoSignature) algorithm is strongly discouraged,
+// this function DOES NOT consider it a success when `{"alg":"none"}` is
+// encountered in the message (it would also be counterintuitive when the code says
+// it _verified_ something when in fact it did no such thing). If you want to
+// accept messages with "none" signature algorithm, use `jws.Parse` to get the
+// raw JWS message.
+//
+// The error returned by this function is of type can be checked against
+// `jws.VerifyError()` and `jws.VerificationError()`. The latter is returned
+// when the verification process itself fails (e.g. invalid signature, wrong key),
+// while the former is returned when any other part of the `jws.Verify()`
+// function fails.
+func Verify(buf []byte, options ...VerifyOption) ([]byte, error) {
+ vc := verifyContextPool.Get()
+ defer verifyContextPool.Put(vc)
+
+ if err := vc.ProcessOptions(options); err != nil {
+ return nil, verifyerr(`failed to process options: %w`, err)
+ }
+
+ return vc.VerifyMessage(buf)
+}
+
+// get the value of b64 header field.
+// If the field does not exist, returns true (default)
+// Otherwise return the value specified by the header field.
+func getB64Value(hdr Headers) bool {
+ var b64 bool
+ if err := hdr.Get("b64", &b64); err != nil {
+ return true // default
+ }
+
+ return b64
+}
+
+// Parse parses contents from the given source and creates a jws.Message
+// struct. By default the input can be in either compact or full JSON serialization.
+//
+// You may pass `jws.WithJSON()` and/or `jws.WithCompact()` to specify
+// explicitly which format to use. If neither or both is specified, the function
+// will attempt to autodetect the format. If one or the other is specified,
+// only the specified format will be attempted.
+//
+// On error, returns a jws.ParseError.
+func Parse(src []byte, options ...ParseOption) (*Message, error) {
+ var formats int
+ for _, option := range options {
+ switch option.Ident() {
+ case identSerialization{}:
+ var v int
+ if err := option.Value(&v); err != nil {
+ return nil, parseerr(`failed to retrieve serialization option value: %w`, err)
+ }
+ switch v {
+ case fmtJSON:
+ formats |= fmtJSON
+ case fmtCompact:
+ formats |= fmtCompact
+ }
+ }
+ }
+
+ // if format is 0 or both JSON/Compact, auto detect
+ if v := formats & (fmtJSON | fmtCompact); v == 0 || v == fmtJSON|fmtCompact {
+ CHECKLOOP:
+ for i := range src {
+ r := rune(src[i])
+ if r >= utf8.RuneSelf {
+ r, _ = utf8.DecodeRune(src)
+ }
+ if !unicode.IsSpace(r) {
+ if r == tokens.OpenCurlyBracket {
+ formats = fmtJSON
+ } else {
+ formats = fmtCompact
+ }
+ break CHECKLOOP
+ }
+ }
+ }
+
+ if formats&fmtCompact == fmtCompact {
+ msg, err := parseCompact(src)
+ if err != nil {
+ return nil, parseerr(`failed to parse compact format: %w`, err)
+ }
+ return msg, nil
+ } else if formats&fmtJSON == fmtJSON {
+ msg, err := parseJSON(src)
+ if err != nil {
+ return nil, parseerr(`failed to parse JSON format: %w`, err)
+ }
+ return msg, nil
+ }
+
+ return nil, parseerr(`invalid byte sequence`)
+}
+
+// ParseString parses contents from the given source and creates a jws.Message
+// struct. The input can be in either compact or full JSON serialization.
+//
+// On error, returns a jws.ParseError.
+func ParseString(src string) (*Message, error) {
+ msg, err := Parse([]byte(src))
+ if err != nil {
+ return nil, sparseerr(`failed to parse string: %w`, err)
+ }
+ return msg, nil
+}
+
+// ParseReader parses contents from the given source and creates a jws.Message
+// struct. The input can be in either compact or full JSON serialization.
+//
+// On error, returns a jws.ParseError.
+func ParseReader(src io.Reader) (*Message, error) {
+ data, err := jwxio.ReadAllFromFiniteSource(src)
+ if err == nil {
+ return Parse(data)
+ }
+
+ if !errors.Is(err, jwxio.NonFiniteSourceError()) {
+ return nil, rparseerr(`failed to read from finite source: %w`, err)
+ }
+
+ rdr := bufio.NewReader(src)
+ var first rune
+ for {
+ r, _, err := rdr.ReadRune()
+ if err != nil {
+ return nil, rparseerr(`failed to read rune: %w`, err)
+ }
+ if !unicode.IsSpace(r) {
+ first = r
+ if err := rdr.UnreadRune(); err != nil {
+ return nil, rparseerr(`failed to unread rune: %w`, err)
+ }
+
+ break
+ }
+ }
+
+ var parser func(io.Reader) (*Message, error)
+ if first == tokens.OpenCurlyBracket {
+ parser = parseJSONReader
+ } else {
+ parser = parseCompactReader
+ }
+
+ m, err := parser(rdr)
+ if err != nil {
+ return nil, rparseerr(`failed to parse reader: %w`, err)
+ }
+
+ return m, nil
+}
+
+func parseJSONReader(src io.Reader) (result *Message, err error) {
+ var m Message
+ if err := json.NewDecoder(src).Decode(&m); err != nil {
+ return nil, fmt.Errorf(`failed to unmarshal jws message: %w`, err)
+ }
+ return &m, nil
+}
+
+func parseJSON(data []byte) (result *Message, err error) {
+ var m Message
+ if err := json.Unmarshal(data, &m); err != nil {
+ return nil, fmt.Errorf(`failed to unmarshal jws message: %w`, err)
+ }
+ return &m, nil
+}
+
+// SplitCompact splits a JWS in compact format and returns its three parts
+// separately: protected headers, payload and signature.
+// On error, returns a jws.ParseError.
+//
+// This function will be deprecated in v4. It is a low-level API, and
+// thus will be available in the `jwsbb` package.
+func SplitCompact(src []byte) ([]byte, []byte, []byte, error) {
+ hdr, payload, signature, err := jwsbb.SplitCompact(src)
+ if err != nil {
+ return nil, nil, nil, parseerr(`%w`, err)
+ }
+ return hdr, payload, signature, nil
+}
+
+// SplitCompactString splits a JWT and returns its three parts
+// separately: protected headers, payload and signature.
+// On error, returns a jws.ParseError.
+//
+// This function will be deprecated in v4. It is a low-level API, and
+// thus will be available in the `jwsbb` package.
+func SplitCompactString(src string) ([]byte, []byte, []byte, error) {
+ hdr, payload, signature, err := jwsbb.SplitCompactString(src)
+ if err != nil {
+ return nil, nil, nil, parseerr(`%w`, err)
+ }
+ return hdr, payload, signature, nil
+}
+
+// SplitCompactReader splits a JWT and returns its three parts
+// separately: protected headers, payload and signature.
+// On error, returns a jws.ParseError.
+//
+// This function will be deprecated in v4. It is a low-level API, and
+// thus will be available in the `jwsbb` package.
+func SplitCompactReader(rdr io.Reader) ([]byte, []byte, []byte, error) {
+ hdr, payload, signature, err := jwsbb.SplitCompactReader(rdr)
+ if err != nil {
+ return nil, nil, nil, parseerr(`%w`, err)
+ }
+ return hdr, payload, signature, nil
+}
+
+// parseCompactReader parses a JWS value serialized via compact serialization.
+func parseCompactReader(rdr io.Reader) (m *Message, err error) {
+ protected, payload, signature, err := SplitCompactReader(rdr)
+ if err != nil {
+ return nil, fmt.Errorf(`invalid compact serialization format: %w`, err)
+ }
+ return parse(protected, payload, signature)
+}
+
+func parseCompact(data []byte) (m *Message, err error) {
+ protected, payload, signature, err := SplitCompact(data)
+ if err != nil {
+ return nil, fmt.Errorf(`invalid compact serialization format: %w`, err)
+ }
+ return parse(protected, payload, signature)
+}
+
+func parse(protected, payload, signature []byte) (*Message, error) {
+ decodedHeader, err := base64.Decode(protected)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to decode protected headers: %w`, err)
+ }
+
+ hdr := NewHeaders()
+ if err := json.Unmarshal(decodedHeader, hdr); err != nil {
+ return nil, fmt.Errorf(`failed to parse JOSE headers: %w`, err)
+ }
+
+ var decodedPayload []byte
+ b64 := getB64Value(hdr)
+ if !b64 {
+ decodedPayload = payload
+ } else {
+ v, err := base64.Decode(payload)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to decode payload: %w`, err)
+ }
+ decodedPayload = v
+ }
+
+ decodedSignature, err := base64.Decode(signature)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to decode signature: %w`, err)
+ }
+
+ var msg Message
+ msg.payload = decodedPayload
+ msg.signatures = append(msg.signatures, &Signature{
+ protected: hdr,
+ signature: decodedSignature,
+ })
+ msg.b64 = b64
+ return &msg, nil
+}
+
+type CustomDecoder = json.CustomDecoder
+type CustomDecodeFunc = json.CustomDecodeFunc
+
+// RegisterCustomField allows users to specify that a private field
+// be decoded as an instance of the specified type. This option has
+// a global effect.
+//
+// For example, suppose you have a custom field `x-birthday`, which
+// you want to represent as a string formatted in RFC3339 in JSON,
+// but want it back as `time.Time`.
+//
+// In such case you would register a custom field as follows
+//
+// jws.RegisterCustomField(`x-birthday`, time.Time{})
+//
+// Then you can use a `time.Time` variable to extract the value
+// of `x-birthday` field, instead of having to use `any`
+// and later convert it to `time.Time`
+//
+// var bday time.Time
+// _ = hdr.Get(`x-birthday`, &bday)
+//
+// If you need a more fine-tuned control over the decoding process,
+// you can register a `CustomDecoder`. For example, below shows
+// how to register a decoder that can parse RFC1123 format string:
+//
+// jws.RegisterCustomField(`x-birthday`, jws.CustomDecodeFunc(func(data []byte) (any, error) {
+// return time.Parse(time.RFC1123, string(data))
+// }))
+//
+// Please note that use of custom fields can be problematic if you
+// are using a library that does not implement MarshalJSON/UnmarshalJSON
+// and you try to roundtrip from an object to JSON, and then back to an object.
+// For example, in the above example, you can _parse_ time values formatted
+// in the format specified in RFC822, but when you convert an object into
+// JSON, it will be formatted in RFC3339, because that's what `time.Time`
+// likes to do. To avoid this, it's always better to use a custom type
+// that wraps your desired type (in this case `time.Time`) and implement
+// MarshalJSON and UnmashalJSON.
+func RegisterCustomField(name string, object any) {
+ registry.Register(name, object)
+}
+
+// Helpers for signature verification
+var rawKeyToKeyType = make(map[reflect.Type]jwa.KeyType)
+var keyTypeToAlgorithms = make(map[jwa.KeyType][]jwa.SignatureAlgorithm)
+
+func init() {
+ rawKeyToKeyType[reflect.TypeFor[[]byte]()] = jwa.OctetSeq()
+ rawKeyToKeyType[reflect.TypeFor[ed25519.PublicKey]()] = jwa.OKP()
+ rawKeyToKeyType[reflect.TypeFor[rsa.PublicKey]()] = jwa.RSA()
+ rawKeyToKeyType[reflect.TypeFor[*rsa.PublicKey]()] = jwa.RSA()
+ rawKeyToKeyType[reflect.TypeFor[ecdsa.PublicKey]()] = jwa.EC()
+ rawKeyToKeyType[reflect.TypeFor[*ecdsa.PublicKey]()] = jwa.EC()
+
+ addAlgorithmForKeyType(jwa.OKP(), jwa.EdDSA())
+ for _, alg := range []jwa.SignatureAlgorithm{jwa.HS256(), jwa.HS384(), jwa.HS512()} {
+ addAlgorithmForKeyType(jwa.OctetSeq(), alg)
+ }
+ for _, alg := range []jwa.SignatureAlgorithm{jwa.RS256(), jwa.RS384(), jwa.RS512(), jwa.PS256(), jwa.PS384(), jwa.PS512()} {
+ addAlgorithmForKeyType(jwa.RSA(), alg)
+ }
+ for _, alg := range []jwa.SignatureAlgorithm{jwa.ES256(), jwa.ES384(), jwa.ES512()} {
+ addAlgorithmForKeyType(jwa.EC(), alg)
+ }
+}
+
+func addAlgorithmForKeyType(kty jwa.KeyType, alg jwa.SignatureAlgorithm) {
+ keyTypeToAlgorithms[kty] = append(keyTypeToAlgorithms[kty], alg)
+}
+
+// AlgorithmsForKey returns the possible signature algorithms that can
+// be used for a given key. It only takes in consideration keys/algorithms
+// for verification purposes, as this is the only usage where one may need
+// dynamically figure out which method to use.
+func AlgorithmsForKey(key any) ([]jwa.SignatureAlgorithm, error) {
+ var kty jwa.KeyType
+ switch key := key.(type) {
+ case jwk.Key:
+ kty = key.KeyType()
+ case rsa.PublicKey, *rsa.PublicKey, rsa.PrivateKey, *rsa.PrivateKey:
+ kty = jwa.RSA()
+ case ecdsa.PublicKey, *ecdsa.PublicKey, ecdsa.PrivateKey, *ecdsa.PrivateKey:
+ kty = jwa.EC()
+ case ed25519.PublicKey, ed25519.PrivateKey, *ecdh.PublicKey, ecdh.PublicKey, *ecdh.PrivateKey, ecdh.PrivateKey:
+ kty = jwa.OKP()
+ case []byte:
+ kty = jwa.OctetSeq()
+ default:
+ return nil, fmt.Errorf(`unknown key type %T`, key)
+ }
+
+ algs, ok := keyTypeToAlgorithms[kty]
+ if !ok {
+ return nil, fmt.Errorf(`unregistered key type %q`, kty)
+ }
+ return algs, nil
+}
+
+// Settings allows you to set global settings for this JWS operations.
+//
+// Currently, the only setting available is `jws.WithLegacySigners()`,
+// which for various reason is now a no-op.
+func Settings(options ...GlobalOption) {
+ for _, option := range options {
+ switch option.Ident() {
+ case identLegacySigners{}:
+ }
+ }
+}
+
+// VerifyCompactFast is a fast path verification function for JWS messages
+// in compact serialization format.
+//
+// This function is considered experimental, and may change or be removed
+// in the future.
+//
+// VerifyCompactFast performs signature verification on a JWS compact
+// serialization without fully parsing the message into a jws.Message object.
+// This makes it more efficient for cases where you only need to verify
+// the signature and extract the payload, without needing access to headers
+// or other JWS metadata.
+//
+// Returns the original payload that was signed if verification succeeds.
+//
+// Unlike jws.Verify(), this function requires you to specify the
+// algorithm explicitly rather than extracting it from the JWS headers.
+// This can be useful for performance-critical applications where the
+// algorithm is known in advance.
+//
+// Since this function avoids doing many checks that jws.Verify would perform,
+// you must ensure to perform the necessary checks including ensuring that algorithm is safe to use for your payload yourself.
+func VerifyCompactFast(key any, compact []byte, alg jwa.SignatureAlgorithm) ([]byte, error) {
+ algstr := alg.String()
+
+ // Split the serialized JWT into its components
+ hdr, payload, encodedSig, err := jwsbb.SplitCompact(compact)
+ if err != nil {
+ return nil, fmt.Errorf("jwt.verifyFast: failed to split compact: %w", err)
+ }
+
+ signature, err := base64.Decode(encodedSig)
+ if err != nil {
+ return nil, fmt.Errorf("jwt.verifyFast: failed to decode signature: %w", err)
+ }
+
+ // Instead of appending, copy the data from hdr/payload
+ lvb := len(hdr) + 1 + len(payload)
+ verifyBuf := pool.ByteSlice().GetCapacity(lvb)
+ verifyBuf = verifyBuf[:lvb]
+ copy(verifyBuf, hdr)
+ verifyBuf[len(hdr)] = tokens.Period
+ copy(verifyBuf[len(hdr)+1:], payload)
+ defer pool.ByteSlice().Put(verifyBuf)
+
+ // Verify the signature
+ if verifier2, err := VerifierFor(alg); err == nil {
+ if err := verifier2.Verify(key, verifyBuf, signature); err != nil {
+ return nil, verifyError{verificationError{fmt.Errorf("jwt.VerifyCompact: signature verification failed for %s: %w", algstr, err)}}
+ }
+ } else {
+ legacyVerifier, err := NewVerifier(alg)
+ if err != nil {
+ return nil, verifyerr("jwt.VerifyCompact: failed to create verifier for %s: %w", algstr, err)
+ }
+ if err := legacyVerifier.Verify(verifyBuf, signature, key); err != nil {
+ return nil, verifyError{verificationError{fmt.Errorf("jwt.VerifyCompact: signature verification failed for %s: %w", algstr, err)}}
+ }
+ }
+
+ decoded, err := base64.Decode(payload)
+ if err != nil {
+ return nil, verifyerr("jwt.VerifyCompact: failed to decode payload: %w", err)
+ }
+ return decoded, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/BUILD.bazel
new file mode 100644
index 0000000000..0799e81110
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/BUILD.bazel
@@ -0,0 +1,38 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "jwsbb",
+ srcs = [
+ "crypto_signer.go",
+ "ecdsa.go",
+ "eddsa.go",
+ "format.go",
+ "hmac.go",
+ "jwsbb.go",
+ "rsa.go",
+ "sign.go",
+ "verify.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/jws/jwsbb",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//internal/base64",
+ "//internal/ecutil",
+ "//internal/jwxio",
+ "//internal/keyconv",
+ "//internal/pool",
+ "//internal/tokens",
+ "//jws/internal/keytype",
+ "@com_github_lestrrat_go_dsig//:dsig",
+ ],
+)
+
+go_test(
+ name = "jwsbb_test",
+ srcs = ["jwsbb_test.go"],
+ embed = [":jwsbb"],
+ deps = [
+ "//internal/base64",
+ "@com_github_stretchr_testify//require",
+ ],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/crypto_signer.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/crypto_signer.go
new file mode 100644
index 0000000000..bd6132a4c5
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/crypto_signer.go
@@ -0,0 +1,45 @@
+package jwsbb
+
+import (
+ "crypto"
+ "crypto/rand"
+ "fmt"
+ "io"
+)
+
+// cryptosign is a low-level function that signs a payload using a crypto.Signer.
+// If hash is crypto.Hash(0), the payload is signed directly without hashing.
+// Otherwise, the payload is hashed using the specified hash function before signing.
+//
+// rr is an io.Reader that provides randomness for signing. If rr is nil, it defaults to rand.Reader.
+func cryptosign(signer crypto.Signer, payload []byte, hash crypto.Hash, opts crypto.SignerOpts, rr io.Reader) ([]byte, error) {
+ if rr == nil {
+ rr = rand.Reader
+ }
+
+ var digest []byte
+ if hash == crypto.Hash(0) {
+ digest = payload
+ } else {
+ h := hash.New()
+ if _, err := h.Write(payload); err != nil {
+ return nil, fmt.Errorf(`failed to write payload to hash: %w`, err)
+ }
+ digest = h.Sum(nil)
+ }
+ return signer.Sign(rr, digest, opts)
+}
+
+// SignCryptoSigner generates a signature using a crypto.Signer interface.
+// This function can be used for hardware security modules, smart cards,
+// and other implementations of the crypto.Signer interface.
+//
+// rr is an io.Reader that provides randomness for signing. If rr is nil, it defaults to rand.Reader.
+//
+// Returns the signature bytes or an error if signing fails.
+func SignCryptoSigner(signer crypto.Signer, raw []byte, h crypto.Hash, opts crypto.SignerOpts, rr io.Reader) ([]byte, error) {
+ if signer == nil {
+ return nil, fmt.Errorf("jwsbb.SignCryptoSignerRaw: signer is nil")
+ }
+ return cryptosign(signer, raw, h, opts, rr)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/ecdsa.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/ecdsa.go
new file mode 100644
index 0000000000..1eb492ee7b
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/ecdsa.go
@@ -0,0 +1,179 @@
+package jwsbb
+
+import (
+ "crypto"
+ "crypto/ecdsa"
+ "encoding/asn1"
+ "fmt"
+ "io"
+ "math/big"
+
+ "github.com/lestrrat-go/dsig"
+ "github.com/lestrrat-go/jwx/v3/internal/ecutil"
+)
+
+// ecdsaHashToDsigAlgorithm maps ECDSA hash functions to dsig algorithm constants
+func ecdsaHashToDsigAlgorithm(h crypto.Hash) (string, error) {
+ switch h {
+ case crypto.SHA256:
+ return dsig.ECDSAWithP256AndSHA256, nil
+ case crypto.SHA384:
+ return dsig.ECDSAWithP384AndSHA384, nil
+ case crypto.SHA512:
+ return dsig.ECDSAWithP521AndSHA512, nil
+ default:
+ return "", fmt.Errorf("unsupported ECDSA hash function: %v", h)
+ }
+}
+
+// UnpackASN1ECDSASignature unpacks an ASN.1 encoded ECDSA signature into r and s values.
+// This is typically used when working with crypto.Signer interfaces that return ASN.1 encoded signatures.
+func UnpackASN1ECDSASignature(signed []byte, r, s *big.Int) error {
+ // Okay, this is silly, but hear me out. When we use the
+ // crypto.Signer interface, the PrivateKey is hidden.
+ // But we need some information about the key (its bit size).
+ //
+ // So while silly, we're going to have to make another call
+ // here and fetch the Public key.
+ // (This probably means that this information should be cached somewhere)
+ var p struct {
+ R *big.Int // TODO: get this from a pool?
+ S *big.Int
+ }
+ if _, err := asn1.Unmarshal(signed, &p); err != nil {
+ return fmt.Errorf(`failed to unmarshal ASN1 encoded signature: %w`, err)
+ }
+
+ r.Set(p.R)
+ s.Set(p.S)
+ return nil
+}
+
+// UnpackECDSASignature unpacks a JWS-format ECDSA signature into r and s values.
+// The signature should be in the format specified by RFC 7515 (r||s as fixed-length byte arrays).
+func UnpackECDSASignature(signature []byte, pubkey *ecdsa.PublicKey, r, s *big.Int) error {
+ keySize := ecutil.CalculateKeySize(pubkey.Curve)
+ if len(signature) != keySize*2 {
+ return fmt.Errorf(`invalid signature length for curve %q`, pubkey.Curve.Params().Name)
+ }
+
+ r.SetBytes(signature[:keySize])
+ s.SetBytes(signature[keySize:])
+
+ return nil
+}
+
+// PackECDSASignature packs the r and s values from an ECDSA signature into a JWS-format byte slice.
+// The output format follows RFC 7515: r||s as fixed-length byte arrays.
+func PackECDSASignature(r *big.Int, sbig *big.Int, curveBits int) ([]byte, error) {
+ keyBytes := curveBits / 8
+ if curveBits%8 > 0 {
+ keyBytes++
+ }
+
+ // Serialize r and s into fixed-length bytes
+ rBytes := r.Bytes()
+ rBytesPadded := make([]byte, keyBytes)
+ copy(rBytesPadded[keyBytes-len(rBytes):], rBytes)
+
+ sBytes := sbig.Bytes()
+ sBytesPadded := make([]byte, keyBytes)
+ copy(sBytesPadded[keyBytes-len(sBytes):], sBytes)
+
+ // Output as r||s
+ return append(rBytesPadded, sBytesPadded...), nil
+}
+
+// SignECDSA generates an ECDSA signature for the given payload using the specified private key and hash.
+// The raw parameter should be the pre-computed signing input (typically header.payload).
+//
+// rr is an io.Reader that provides randomness for signing. if rr is nil, it defaults to rand.Reader.
+//
+// This function is now a thin wrapper around dsig.SignECDSA. For new projects, you should
+// consider using dsig instead of this function.
+func SignECDSA(key *ecdsa.PrivateKey, payload []byte, h crypto.Hash, rr io.Reader) ([]byte, error) {
+ dsigAlg, err := ecdsaHashToDsigAlgorithm(h)
+ if err != nil {
+ return nil, fmt.Errorf("jwsbb.SignECDSA: %w", err)
+ }
+
+ return dsig.Sign(key, dsigAlg, payload, rr)
+}
+
+// SignECDSACryptoSigner generates an ECDSA signature using a crypto.Signer interface.
+// This function works with hardware security modules and other crypto.Signer implementations.
+// The signature is converted from ASN.1 format to JWS format (r||s).
+//
+// rr is an io.Reader that provides randomness for signing. If rr is nil, it defaults to rand.Reader.
+func SignECDSACryptoSigner(signer crypto.Signer, raw []byte, h crypto.Hash, rr io.Reader) ([]byte, error) {
+ signed, err := SignCryptoSigner(signer, raw, h, h, rr)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to sign payload using crypto.Signer: %w`, err)
+ }
+
+ return signECDSACryptoSigner(signer, signed)
+}
+
+func signECDSACryptoSigner(signer crypto.Signer, signed []byte) ([]byte, error) {
+ cpub := signer.Public()
+ pubkey, ok := cpub.(*ecdsa.PublicKey)
+ if !ok {
+ return nil, fmt.Errorf(`expected *ecdsa.PublicKey, got %T`, pubkey)
+ }
+ curveBits := pubkey.Curve.Params().BitSize
+
+ var r, s big.Int
+ if err := UnpackASN1ECDSASignature(signed, &r, &s); err != nil {
+ return nil, fmt.Errorf(`failed to unpack ASN1 encoded signature: %w`, err)
+ }
+
+ return PackECDSASignature(&r, &s, curveBits)
+}
+
+func ecdsaVerify(key *ecdsa.PublicKey, buf []byte, h crypto.Hash, r, s *big.Int) error {
+ hasher := h.New()
+ hasher.Write(buf)
+ digest := hasher.Sum(nil)
+ if !ecdsa.Verify(key, digest, r, s) {
+ return fmt.Errorf("jwsbb.ECDSAVerifier: invalid ECDSA signature")
+ }
+ return nil
+}
+
+// VerifyECDSA verifies an ECDSA signature for the given payload.
+// This function verifies the signature using the specified public key and hash algorithm.
+// The payload parameter should be the pre-computed signing input (typically header.payload).
+//
+// This function is now a thin wrapper around dsig.VerifyECDSA. For new projects, you should
+// consider using dsig instead of this function.
+func VerifyECDSA(key *ecdsa.PublicKey, payload, signature []byte, h crypto.Hash) error {
+ dsigAlg, err := ecdsaHashToDsigAlgorithm(h)
+ if err != nil {
+ return fmt.Errorf("jwsbb.VerifyECDSA: %w", err)
+ }
+
+ return dsig.Verify(key, dsigAlg, payload, signature)
+}
+
+// VerifyECDSACryptoSigner verifies an ECDSA signature for crypto.Signer implementations.
+// This function is useful for verifying signatures created by hardware security modules
+// or other implementations of the crypto.Signer interface.
+// The payload parameter should be the pre-computed signing input (typically header.payload).
+func VerifyECDSACryptoSigner(signer crypto.Signer, payload, signature []byte, h crypto.Hash) error {
+ var pubkey *ecdsa.PublicKey
+ switch cpub := signer.Public(); cpub := cpub.(type) {
+ case ecdsa.PublicKey:
+ pubkey = &cpub
+ case *ecdsa.PublicKey:
+ pubkey = cpub
+ default:
+ return fmt.Errorf(`jwsbb.VerifyECDSACryptoSigner: expected *ecdsa.PublicKey, got %T`, cpub)
+ }
+
+ var r, s big.Int
+ if err := UnpackECDSASignature(signature, pubkey, &r, &s); err != nil {
+ return fmt.Errorf("jwsbb.ECDSAVerifier: failed to unpack ASN.1 encoded ECDSA signature: %w", err)
+ }
+
+ return ecdsaVerify(pubkey, payload, h, &r, &s)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/eddsa.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/eddsa.go
new file mode 100644
index 0000000000..960cf97dde
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/eddsa.go
@@ -0,0 +1,30 @@
+package jwsbb
+
+import (
+ "crypto/ed25519"
+
+ "github.com/lestrrat-go/dsig"
+)
+
+// SignEdDSA generates an EdDSA (Ed25519) signature for the given payload.
+// The raw parameter should be the pre-computed signing input (typically header.payload).
+// EdDSA is deterministic and doesn't require additional hashing of the input.
+//
+// This function is now a thin wrapper around dsig.SignEdDSA. For new projects, you should
+// consider using dsig instead of this function.
+func SignEdDSA(key ed25519.PrivateKey, payload []byte) ([]byte, error) {
+ // Use dsig.Sign with EdDSA algorithm constant
+ return dsig.Sign(key, dsig.EdDSA, payload, nil)
+}
+
+// VerifyEdDSA verifies an EdDSA (Ed25519) signature for the given payload.
+// This function verifies the signature using Ed25519 verification algorithm.
+// The payload parameter should be the pre-computed signing input (typically header.payload).
+// EdDSA is deterministic and provides strong security guarantees without requiring hash function selection.
+//
+// This function is now a thin wrapper around dsig.VerifyEdDSA. For new projects, you should
+// consider using dsig instead of this function.
+func VerifyEdDSA(key ed25519.PublicKey, payload, signature []byte) error {
+ // Use dsig.Verify with EdDSA algorithm constant
+ return dsig.Verify(key, dsig.EdDSA, payload, signature)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/es256k.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/es256k.go
new file mode 100644
index 0000000000..a8761ee0fc
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/es256k.go
@@ -0,0 +1,14 @@
+//go:build jwx_es256k
+
+package jwsbb
+
+import (
+ dsigsecp256k1 "github.com/lestrrat-go/dsig-secp256k1"
+)
+
+const es256k = "ES256K"
+
+func init() {
+ // Add ES256K mapping when this build tag is enabled
+ jwsToDsigAlgorithm[es256k] = dsigsecp256k1.ECDSAWithSecp256k1AndSHA256
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/format.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/format.go
new file mode 100644
index 0000000000..430bf625ac
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/format.go
@@ -0,0 +1,235 @@
+package jwsbb
+
+import (
+ "bytes"
+ "errors"
+ "io"
+
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/jwxio"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+)
+
+// SignBuffer combines the base64-encoded header and payload into a single byte slice
+// for signing purposes. This creates the signing input according to JWS specification (RFC 7515).
+// The result should be passed to signature generation functions.
+//
+// Parameters:
+// - buf: Reusable buffer (can be nil for automatic allocation)
+// - hdr: Raw header bytes (will be base64-encoded)
+// - payload: Raw payload bytes (encoded based on encodePayload flag)
+// - encoder: Base64 encoder to use for encoding components
+// - encodePayload: If true, payload is base64-encoded; if false, payload is used as-is
+//
+// Returns the constructed signing input in the format: base64(header).base64(payload) or base64(header).payload
+func SignBuffer(buf, hdr, payload []byte, encoder base64.Encoder, encodePayload bool) []byte {
+ l := encoder.EncodedLen(len(hdr)+len(payload)) + 1
+ if cap(buf) < l {
+ buf = make([]byte, 0, l)
+ }
+ buf = buf[:0]
+ buf = encoder.AppendEncode(buf, hdr)
+ buf = append(buf, tokens.Period)
+ if encodePayload {
+ buf = encoder.AppendEncode(buf, payload)
+ } else {
+ buf = append(buf, payload...)
+ }
+
+ return buf
+}
+
+// AppendSignature appends a base64-encoded signature to a JWS signing input buffer.
+// This completes the compact JWS serialization by adding the final signature component.
+// The input buffer should contain the signing input (header.payload), and this function
+// adds the period separator and base64-encoded signature.
+//
+// Parameters:
+// - buf: Buffer containing the signing input (typically from SignBuffer)
+// - signature: Raw signature bytes (will be base64-encoded)
+// - encoder: Base64 encoder to use for encoding the signature
+//
+// Returns the complete compact JWS in the format: base64(header).base64(payload).base64(signature)
+func AppendSignature(buf, signature []byte, encoder base64.Encoder) []byte {
+ l := len(buf) + len(signature) + 1
+ if cap(buf) < l {
+ buf = make([]byte, 0, l)
+ }
+ buf = append(buf, tokens.Period)
+ buf = encoder.AppendEncode(buf, signature)
+
+ return buf
+}
+
+// JoinCompact creates a complete compact JWS serialization from individual components.
+// This is a one-step function that combines header, payload, and signature into the final JWS format.
+// It includes safety checks to prevent excessive memory allocation.
+//
+// Parameters:
+// - buf: Reusable buffer (can be nil for automatic allocation)
+// - hdr: Raw header bytes (will be base64-encoded)
+// - payload: Raw payload bytes (encoded based on encodePayload flag)
+// - signature: Raw signature bytes (will be base64-encoded)
+// - encoder: Base64 encoder to use for encoding all components
+// - encodePayload: If true, payload is base64-encoded; if false, payload is used as-is
+//
+// Returns the complete compact JWS or an error if the total size exceeds safety limits (1GB).
+func JoinCompact(buf, hdr, payload, signature []byte, encoder base64.Encoder, encodePayload bool) ([]byte, error) {
+ const MaxBufferSize = 1 << 30 // 1 GB
+ totalSize := len(hdr) + len(payload) + len(signature) + 2
+ if totalSize > MaxBufferSize {
+ return nil, errors.New("input sizes exceed maximum allowable buffer size")
+ }
+ if cap(buf) < totalSize {
+ buf = make([]byte, 0, totalSize)
+ }
+ buf = buf[:0]
+ buf = encoder.AppendEncode(buf, hdr)
+ buf = append(buf, tokens.Period)
+ if encodePayload {
+ buf = encoder.AppendEncode(buf, payload)
+ } else {
+ buf = append(buf, payload...)
+ }
+ buf = append(buf, tokens.Period)
+ buf = encoder.AppendEncode(buf, signature)
+
+ return buf, nil
+}
+
+var compactDelim = []byte{tokens.Period}
+
+var errInvalidNumberOfSegments = errors.New(`jwsbb: invalid number of segments`)
+
+// InvalidNumberOfSegmentsError returns the standard error for invalid JWS segment count.
+// A valid compact JWS must have exactly 3 segments separated by periods: header.payload.signature
+func InvalidNumberOfSegmentsError() error {
+ return errInvalidNumberOfSegments
+}
+
+// SplitCompact parses a compact JWS serialization into its three components.
+// This function validates that the input has exactly 3 segments separated by periods
+// and returns the base64-encoded components without decoding them.
+//
+// Parameters:
+// - src: Complete compact JWS string as bytes
+//
+// Returns:
+// - protected: Base64-encoded protected header
+// - payload: Base64-encoded payload (or raw payload if b64=false was used)
+// - signature: Base64-encoded signature
+// - err: Error if the format is invalid or segment count is wrong
+func SplitCompact(src []byte) (protected, payload, signature []byte, err error) {
+ var s []byte
+ var ok bool
+
+ protected, s, ok = bytes.Cut(src, compactDelim)
+ if !ok { // no period found
+ return nil, nil, nil, InvalidNumberOfSegmentsError()
+ }
+ payload, s, ok = bytes.Cut(s, compactDelim)
+ if !ok { // only one period found
+ return nil, nil, nil, InvalidNumberOfSegmentsError()
+ }
+ signature, _, ok = bytes.Cut(s, compactDelim)
+ if ok { // three periods found
+ return nil, nil, nil, InvalidNumberOfSegmentsError()
+ }
+ return protected, payload, signature, nil
+}
+
+// SplitCompactString is a convenience wrapper around SplitCompact for string inputs.
+// It converts the string to bytes and parses the compact JWS serialization.
+//
+// Parameters:
+// - src: Complete compact JWS as a string
+//
+// Returns the same components as SplitCompact: protected header, payload, signature, and error.
+func SplitCompactString(src string) (protected, payload, signature []byte, err error) {
+ return SplitCompact([]byte(src))
+}
+
+// SplitCompactReader parses a compact JWS serialization from an io.Reader.
+// This function handles both finite and streaming sources efficiently.
+// For finite sources, it reads all data at once. For streaming sources,
+// it uses a buffer-based approach to find segment boundaries.
+//
+// Parameters:
+// - rdr: Reader containing the compact JWS data
+//
+// Returns:
+// - protected: Base64-encoded protected header
+// - payload: Base64-encoded payload (or raw payload if b64=false was used)
+// - signature: Base64-encoded signature
+// - err: Error if reading fails or the format is invalid
+//
+// The function validates that exactly 3 segments are present, separated by periods.
+func SplitCompactReader(rdr io.Reader) (protected, payload, signature []byte, err error) {
+ data, err := jwxio.ReadAllFromFiniteSource(rdr)
+ if err == nil {
+ return SplitCompact(data)
+ }
+
+ if !errors.Is(err, jwxio.NonFiniteSourceError()) {
+ return nil, nil, nil, err
+ }
+
+ var periods int
+ var state int
+
+ buf := make([]byte, 4096)
+ var sofar []byte
+
+ for {
+ // read next bytes
+ n, err := rdr.Read(buf)
+ // return on unexpected read error
+ if err != nil && err != io.EOF {
+ return nil, nil, nil, io.ErrUnexpectedEOF
+ }
+
+ // append to current buffer
+ sofar = append(sofar, buf[:n]...)
+ // loop to capture multiple tokens.Period in current buffer
+ for loop := true; loop; {
+ var i = bytes.IndexByte(sofar, tokens.Period)
+ if i == -1 && err != io.EOF {
+ // no tokens.Period found -> exit and read next bytes (outer loop)
+ loop = false
+ continue
+ } else if i == -1 && err == io.EOF {
+ // no tokens.Period found -> process rest and exit
+ i = len(sofar)
+ loop = false
+ } else {
+ // tokens.Period found
+ periods++
+ }
+
+ // Reaching this point means we have found a tokens.Period or EOF and process the rest of the buffer
+ switch state {
+ case 0:
+ protected = sofar[:i]
+ state++
+ case 1:
+ payload = sofar[:i]
+ state++
+ case 2:
+ signature = sofar[:i]
+ }
+ // Shorten current buffer
+ if len(sofar) > i {
+ sofar = sofar[i+1:]
+ }
+ }
+ // Exit on EOF
+ if err == io.EOF {
+ break
+ }
+ }
+ if periods != 2 {
+ return nil, nil, nil, InvalidNumberOfSegmentsError()
+ }
+
+ return protected, payload, signature, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/header.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/header.go
new file mode 100644
index 0000000000..cac3987ea5
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/header.go
@@ -0,0 +1,222 @@
+package jwsbb
+
+import (
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/valyala/fastjson"
+)
+
+type headerNotFoundError struct {
+ key string
+}
+
+func (e headerNotFoundError) Error() string {
+ return fmt.Sprintf(`jwsbb: header "%s" not found`, e.key)
+}
+
+func (e headerNotFoundError) Is(target error) bool {
+ switch target.(type) {
+ case headerNotFoundError, *headerNotFoundError:
+ // If the target is a headerNotFoundError or a pointer to it, we
+ // consider it a match
+ return true
+ default:
+ return false
+ }
+}
+
+// ErrHeaderNotFound returns an error that can be passed to `errors.Is` to check if the error is
+// the result of the field not being found
+func ErrHeaderNotFound() error {
+ return headerNotFoundError{}
+}
+
+// ErrFieldNotFound is an alias for ErrHeaderNotFound, and is deprecated. It was a misnomer.
+// It will be removed in a future release.
+func ErrFieldNotFound() error {
+ return ErrHeaderNotFound()
+}
+
+// Header is an object that allows you to access the JWS header in a quick and
+// dirty way. It does not verify anything, it does not know anything about what
+// each header field means, and it does not care about the JWS specification.
+// But when you need to access the JWS header for that one field that you
+// need, this is the object you want to use.
+//
+// As of this writing, HeaderParser cannot be used from concurrent goroutines.
+// You will need to create a new instance for each goroutine that needs to parse a JWS header.
+// Also, in general values obtained from this object should only be used
+// while the Header object is still in scope.
+//
+// This type is experimental and may change or be removed in the future.
+type Header interface {
+ // I'm hiding this behind an interface so that users won't accidentally
+ // rely on the underlying json handler implementation, nor the concrete
+ // type name that jwsbb provides, as we may choose a different one in the future.
+ jwsbbHeader()
+}
+
+type header struct {
+ v *fastjson.Value
+ err error
+}
+
+func (h *header) jwsbbHeader() {}
+
+// HeaderParseCompact parses a JWS header from a compact serialization format.
+// You will need to call HeaderGet* functions to extract the values from the header.
+//
+// This function is experimental and may change or be removed in the future.
+func HeaderParseCompact(buf []byte) Header {
+ decoded, err := base64.Decode(buf)
+ if err != nil {
+ return &header{err: err}
+ }
+ return HeaderParse(decoded)
+}
+
+// HeaderParse parses a JWS header from a byte slice containing the decoded JSON.
+// You will need to call HeaderGet* functions to extract the values from the header.
+//
+// Unlike HeaderParseCompact, this function does not perform any base64 decoding.
+// This function is experimental and may change or be removed in the future.
+func HeaderParse(decoded []byte) Header {
+ var p fastjson.Parser
+ v, err := p.ParseBytes(decoded)
+ if err != nil {
+ return &header{err: err}
+ }
+ return &header{
+ v: v,
+ }
+}
+
+func headerGet(h Header, key string) (*fastjson.Value, error) {
+ //nolint:forcetypeassert
+ hh := h.(*header) // we _know_ this can't be another type
+ if hh.err != nil {
+ return nil, hh.err
+ }
+
+ v := hh.v.Get(key)
+ if v == nil {
+ return nil, headerNotFoundError{key: key}
+ }
+ return v, nil
+}
+
+// HeaderGetString returns the string value for the given key from the JWS header.
+// An error is returned if the JSON was not valid, if the key does not exist,
+// or if the value is not a string.
+//
+// This function is experimental and may change or be removed in the future.
+func HeaderGetString(h Header, key string) (string, error) {
+ v, err := headerGet(h, key)
+ if err != nil {
+ return "", err
+ }
+
+ sb, err := v.StringBytes()
+ if err != nil {
+ return "", err
+ }
+
+ return string(sb), nil
+}
+
+// HeaderGetBool returns the boolean value for the given key from the JWS header.
+// An error is returned if the JSON was not valid, if the key does not exist,
+// or if the value is not a boolean.
+//
+// This function is experimental and may change or be removed in the future.
+func HeaderGetBool(h Header, key string) (bool, error) {
+ v, err := headerGet(h, key)
+ if err != nil {
+ return false, err
+ }
+ return v.Bool()
+}
+
+// HeaderGetFloat64 returns the float64 value for the given key from the JWS header.
+// An error is returned if the JSON was not valid, if the key does not exist,
+// or if the value is not a float64.
+//
+// This function is experimental and may change or be removed in the future.
+func HeaderGetFloat64(h Header, key string) (float64, error) {
+ v, err := headerGet(h, key)
+ if err != nil {
+ return 0, err
+ }
+ return v.Float64()
+}
+
+// HeaderGetInt returns the int value for the given key from the JWS header.
+// An error is returned if the JSON was not valid, if the key does not exist,
+// or if the value is not an int.
+//
+// This function is experimental and may change or be removed in the future.
+func HeaderGetInt(h Header, key string) (int, error) {
+ v, err := headerGet(h, key)
+ if err != nil {
+ return 0, err
+ }
+ return v.Int()
+}
+
+// HeaderGetInt64 returns the int64 value for the given key from the JWS header.
+// An error is returned if the JSON was not valid, if the key does not exist,
+// or if the value is not an int64.
+//
+// This function is experimental and may change or be removed in the future.
+func HeaderGetInt64(h Header, key string) (int64, error) {
+ v, err := headerGet(h, key)
+ if err != nil {
+ return 0, err
+ }
+ return v.Int64()
+}
+
+// HeaderGetStringBytes returns the byte slice value for the given key from the JWS header.
+// An error is returned if the JSON was not valid, if the key does not exist,
+// or if the value is not a byte slice.
+//
+// Because of limitations of the underlying library, you cannot use the return value
+// of this function after the parser is garbage collected.
+//
+// This function is experimental and may change or be removed in the future.
+func HeaderGetStringBytes(h Header, key string) ([]byte, error) {
+ v, err := headerGet(h, key)
+ if err != nil {
+ return nil, err
+ }
+
+ return v.StringBytes()
+}
+
+// HeaderGetUint returns the uint value for the given key from the JWS header.
+// An error is returned if the JSON was not valid, if the key does not exist,
+// or if the value is not a uint.
+//
+// This function is experimental and may change or be removed in the future.
+func HeaderGetUint(h Header, key string) (uint, error) {
+ v, err := headerGet(h, key)
+ if err != nil {
+ return 0, err
+ }
+ return v.Uint()
+}
+
+// HeaderGetUint64 returns the uint64 value for the given key from the JWS header.
+// An error is returned if the JSON was not valid, if the key does not exist,
+// or if the value is not a uint64.
+//
+// This function is experimental and may change or be removed in the future.
+func HeaderGetUint64(h Header, key string) (uint64, error) {
+ v, err := headerGet(h, key)
+ if err != nil {
+ return 0, err
+ }
+
+ return v.Uint64()
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/hmac.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/hmac.go
new file mode 100644
index 0000000000..8e70eb667d
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/hmac.go
@@ -0,0 +1,52 @@
+package jwsbb
+
+import (
+ "fmt"
+ "hash"
+
+ "github.com/lestrrat-go/dsig"
+)
+
+// hmacHashToDsigAlgorithm maps HMAC hash function sizes to dsig algorithm constants
+func hmacHashToDsigAlgorithm(hfunc func() hash.Hash) (string, error) {
+ h := hfunc()
+ switch h.Size() {
+ case 32: // SHA256
+ return dsig.HMACWithSHA256, nil
+ case 48: // SHA384
+ return dsig.HMACWithSHA384, nil
+ case 64: // SHA512
+ return dsig.HMACWithSHA512, nil
+ default:
+ return "", fmt.Errorf("unsupported HMAC hash function: size=%d", h.Size())
+ }
+}
+
+// SignHMAC generates an HMAC signature for the given payload using the specified hash function and key.
+// The raw parameter should be the pre-computed signing input (typically header.payload).
+//
+// This function is now a thin wrapper around dsig.SignHMAC. For new projects, you should
+// consider using dsig instead of this function.
+func SignHMAC(key, payload []byte, hfunc func() hash.Hash) ([]byte, error) {
+ dsigAlg, err := hmacHashToDsigAlgorithm(hfunc)
+ if err != nil {
+ return nil, fmt.Errorf("jwsbb.SignHMAC: %w", err)
+ }
+
+ return dsig.Sign(key, dsigAlg, payload, nil)
+}
+
+// VerifyHMAC verifies an HMAC signature for the given payload.
+// This function verifies the signature using the specified key and hash function.
+// The payload parameter should be the pre-computed signing input (typically header.payload).
+//
+// This function is now a thin wrapper around dsig.VerifyHMAC. For new projects, you should
+// consider using dsig instead of this function.
+func VerifyHMAC(key, payload, signature []byte, hfunc func() hash.Hash) error {
+ dsigAlg, err := hmacHashToDsigAlgorithm(hfunc)
+ if err != nil {
+ return fmt.Errorf("jwsbb.VerifyHMAC: %w", err)
+ }
+
+ return dsig.Verify(key, dsigAlg, payload, signature)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/jwsbb.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/jwsbb.go
new file mode 100644
index 0000000000..6a67ee8f86
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/jwsbb.go
@@ -0,0 +1,94 @@
+// Package jwsbb provides the building blocks (hence the name "bb") for JWS operations.
+// It should be thought of as a low-level API, almost akin to internal packages
+// that should not be used directly by users of the jwx package. However, these exist
+// to provide a more efficient way to perform JWS operations without the overhead of
+// the higher-level jws package to power-users who know what they are doing.
+//
+// This package is currently considered EXPERIMENTAL, and the API may change
+// without notice. It is not recommended to use this package unless you are
+// fully aware of the implications of using it.
+//
+// All bb packages in jwx follow the same design principles:
+// 1. Does minimal checking of input parameters (for performance); callers need to ensure that the parameters are valid.
+// 2. All exported functions are strongly typed (i.e. they do not take `any` types unless they absolutely have to).
+// 3. Does not rely on other public jwx packages (they are standalone, except for internal packages).
+//
+// This implementation uses github.com/lestrrat-go/dsig as the underlying signature provider.
+package jwsbb
+
+import (
+ "github.com/lestrrat-go/dsig"
+)
+
+// JWS algorithm name constants
+const (
+ // HMAC algorithms
+ hs256 = "HS256"
+ hs384 = "HS384"
+ hs512 = "HS512"
+
+ // RSA PKCS#1 v1.5 algorithms
+ rs256 = "RS256"
+ rs384 = "RS384"
+ rs512 = "RS512"
+
+ // RSA PSS algorithms
+ ps256 = "PS256"
+ ps384 = "PS384"
+ ps512 = "PS512"
+
+ // ECDSA algorithms
+ es256 = "ES256"
+ es384 = "ES384"
+ es512 = "ES512"
+
+ // EdDSA algorithm
+ edDSA = "EdDSA"
+)
+
+// Signer is a generic interface that defines the method for signing payloads.
+// The type parameter K represents the key type (e.g., []byte for HMAC keys,
+// *rsa.PrivateKey for RSA keys, *ecdsa.PrivateKey for ECDSA keys).
+type Signer[K any] interface {
+ Sign(key K, payload []byte) ([]byte, error)
+}
+
+// Verifier is a generic interface that defines the method for verifying signatures.
+// The type parameter K represents the key type (e.g., []byte for HMAC keys,
+// *rsa.PublicKey for RSA keys, *ecdsa.PublicKey for ECDSA keys).
+type Verifier[K any] interface {
+ Verify(key K, buf []byte, signature []byte) error
+}
+
+// JWS to dsig algorithm mapping
+var jwsToDsigAlgorithm = map[string]string{
+ // HMAC algorithms
+ hs256: dsig.HMACWithSHA256,
+ hs384: dsig.HMACWithSHA384,
+ hs512: dsig.HMACWithSHA512,
+
+ // RSA PKCS#1 v1.5 algorithms
+ rs256: dsig.RSAPKCS1v15WithSHA256,
+ rs384: dsig.RSAPKCS1v15WithSHA384,
+ rs512: dsig.RSAPKCS1v15WithSHA512,
+
+ // RSA PSS algorithms
+ ps256: dsig.RSAPSSWithSHA256,
+ ps384: dsig.RSAPSSWithSHA384,
+ ps512: dsig.RSAPSSWithSHA512,
+
+ // ECDSA algorithms
+ es256: dsig.ECDSAWithP256AndSHA256,
+ es384: dsig.ECDSAWithP384AndSHA384,
+ es512: dsig.ECDSAWithP521AndSHA512,
+ // Note: ES256K requires external dependency and is handled separately
+
+ // EdDSA algorithm
+ edDSA: dsig.EdDSA,
+}
+
+// getDsigAlgorithm returns the dsig algorithm name for a JWS algorithm
+func getDsigAlgorithm(jwsAlg string) (string, bool) {
+ dsigAlg, ok := jwsToDsigAlgorithm[jwsAlg]
+ return dsigAlg, ok
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/rsa.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/rsa.go
new file mode 100644
index 0000000000..36997cef7c
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/rsa.go
@@ -0,0 +1,71 @@
+package jwsbb
+
+import (
+ "crypto"
+ "crypto/rsa"
+ "fmt"
+ "io"
+
+ "github.com/lestrrat-go/dsig"
+)
+
+// rsaHashToDsigAlgorithm maps RSA hash functions to dsig algorithm constants
+func rsaHashToDsigAlgorithm(h crypto.Hash, pss bool) (string, error) {
+ if pss {
+ switch h {
+ case crypto.SHA256:
+ return dsig.RSAPSSWithSHA256, nil
+ case crypto.SHA384:
+ return dsig.RSAPSSWithSHA384, nil
+ case crypto.SHA512:
+ return dsig.RSAPSSWithSHA512, nil
+ default:
+ return "", fmt.Errorf("unsupported hash algorithm for RSA-PSS: %v", h)
+ }
+ } else {
+ switch h {
+ case crypto.SHA256:
+ return dsig.RSAPKCS1v15WithSHA256, nil
+ case crypto.SHA384:
+ return dsig.RSAPKCS1v15WithSHA384, nil
+ case crypto.SHA512:
+ return dsig.RSAPKCS1v15WithSHA512, nil
+ default:
+ return "", fmt.Errorf("unsupported hash algorithm for RSA PKCS#1 v1.5: %v", h)
+ }
+ }
+}
+
+// SignRSA generates an RSA signature for the given payload using the specified private key and options.
+// The raw parameter should be the pre-computed signing input (typically header.payload).
+// If pss is true, RSA-PSS is used; otherwise, PKCS#1 v1.5 is used.
+//
+// The rr parameter is an optional io.Reader that can be used to provide randomness for signing.
+// If rr is nil, it defaults to rand.Reader.
+//
+// This function is now a thin wrapper around dsig.SignRSA. For new projects, you should
+// consider using dsig instead of this function.
+func SignRSA(key *rsa.PrivateKey, payload []byte, h crypto.Hash, pss bool, rr io.Reader) ([]byte, error) {
+ dsigAlg, err := rsaHashToDsigAlgorithm(h, pss)
+ if err != nil {
+ return nil, fmt.Errorf("jwsbb.SignRSA: %w", err)
+ }
+
+ return dsig.Sign(key, dsigAlg, payload, rr)
+}
+
+// VerifyRSA verifies an RSA signature for the given payload and header.
+// This function constructs the signing input by encoding the header and payload according to JWS specification,
+// then verifies the signature using the specified public key and hash algorithm.
+// If pss is true, RSA-PSS verification is used; otherwise, PKCS#1 v1.5 verification is used.
+//
+// This function is now a thin wrapper around dsig.VerifyRSA. For new projects, you should
+// consider using dsig instead of this function.
+func VerifyRSA(key *rsa.PublicKey, payload, signature []byte, h crypto.Hash, pss bool) error {
+ dsigAlg, err := rsaHashToDsigAlgorithm(h, pss)
+ if err != nil {
+ return fmt.Errorf("jwsbb.VerifyRSA: %w", err)
+ }
+
+ return dsig.Verify(key, dsigAlg, payload, signature)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/sign.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/sign.go
new file mode 100644
index 0000000000..6f36ab0554
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/sign.go
@@ -0,0 +1,110 @@
+package jwsbb
+
+import (
+ "crypto"
+ "crypto/ecdsa"
+ "crypto/ed25519"
+ "crypto/rsa"
+ "fmt"
+ "io"
+
+ "github.com/lestrrat-go/dsig"
+ "github.com/lestrrat-go/jwx/v3/internal/keyconv"
+)
+
+// Sign generates a JWS signature using the specified key and algorithm.
+//
+// This function loads the signer registered in the jwsbb package _ONLY_.
+// It does not support custom signers that the user might have registered.
+//
+// rr is an io.Reader that provides randomness for signing. If rr is nil, it defaults to rand.Reader.
+// Not all algorithms require this parameter, but it is included for consistency.
+// 99% of the time, you can pass nil for rr, and it will work fine.
+func Sign(key any, alg string, payload []byte, rr io.Reader) ([]byte, error) {
+ dsigAlg, ok := getDsigAlgorithm(alg)
+ if !ok {
+ return nil, fmt.Errorf(`jwsbb.Sign: unsupported signature algorithm %q`, alg)
+ }
+
+ // Get dsig algorithm info to determine key conversion strategy
+ dsigInfo, ok := dsig.GetAlgorithmInfo(dsigAlg)
+ if !ok {
+ return nil, fmt.Errorf(`jwsbb.Sign: dsig algorithm %q not registered`, dsigAlg)
+ }
+
+ switch dsigInfo.Family {
+ case dsig.HMAC:
+ return dispatchHMACSign(key, dsigAlg, payload)
+ case dsig.RSA:
+ return dispatchRSASign(key, dsigAlg, payload, rr)
+ case dsig.ECDSA:
+ return dispatchECDSASign(key, dsigAlg, payload, rr)
+ case dsig.EdDSAFamily:
+ return dispatchEdDSASign(key, dsigAlg, payload, rr)
+ default:
+ return nil, fmt.Errorf(`jwsbb.Sign: unsupported dsig algorithm family %q`, dsigInfo.Family)
+ }
+}
+
+func dispatchHMACSign(key any, dsigAlg string, payload []byte) ([]byte, error) {
+ var hmackey []byte
+ if err := keyconv.ByteSliceKey(&hmackey, key); err != nil {
+ return nil, fmt.Errorf(`jwsbb.Sign: invalid key type %T. []byte is required: %w`, key, err)
+ }
+
+ return dsig.Sign(hmackey, dsigAlg, payload, nil)
+}
+
+func dispatchRSASign(key any, dsigAlg string, payload []byte, rr io.Reader) ([]byte, error) {
+ // Try crypto.Signer first (dsig can handle it directly)
+ if signer, ok := key.(crypto.Signer); ok {
+ // Verify it's an RSA key
+ if _, ok := signer.Public().(*rsa.PublicKey); ok {
+ return dsig.Sign(signer, dsigAlg, payload, rr)
+ }
+ }
+
+ // Fall back to concrete key types
+ var privkey *rsa.PrivateKey
+ if err := keyconv.RSAPrivateKey(&privkey, key); err != nil {
+ return nil, fmt.Errorf(`jwsbb.Sign: invalid key type %T. *rsa.PrivateKey is required: %w`, key, err)
+ }
+
+ return dsig.Sign(privkey, dsigAlg, payload, rr)
+}
+
+func dispatchECDSASign(key any, dsigAlg string, payload []byte, rr io.Reader) ([]byte, error) {
+ // Try crypto.Signer first (dsig can handle it directly)
+ if signer, ok := key.(crypto.Signer); ok {
+ // Verify it's an ECDSA key
+ if _, ok := signer.Public().(*ecdsa.PublicKey); ok {
+ return dsig.Sign(signer, dsigAlg, payload, rr)
+ }
+ }
+
+ // Fall back to concrete key types
+ var privkey *ecdsa.PrivateKey
+ if err := keyconv.ECDSAPrivateKey(&privkey, key); err != nil {
+ return nil, fmt.Errorf(`jwsbb.Sign: invalid key type %T. *ecdsa.PrivateKey is required: %w`, key, err)
+ }
+
+ return dsig.Sign(privkey, dsigAlg, payload, rr)
+}
+
+func dispatchEdDSASign(key any, dsigAlg string, payload []byte, rr io.Reader) ([]byte, error) {
+ // Try crypto.Signer first (dsig can handle it directly)
+ if signer, ok := key.(crypto.Signer); ok {
+ // Verify it's an EdDSA key
+ if _, ok := signer.Public().(ed25519.PublicKey); ok {
+ return dsig.Sign(signer, dsigAlg, payload, rr)
+ }
+ }
+
+ // Fall back to concrete key types
+ var privkey ed25519.PrivateKey
+ if err := keyconv.Ed25519PrivateKey(&privkey, key); err != nil {
+ return nil, fmt.Errorf(`jwsbb.Sign: invalid key type %T. ed25519.PrivateKey is required: %w`, key, err)
+ }
+
+ return dsig.Sign(privkey, dsigAlg, payload, rr)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/verify.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/verify.go
new file mode 100644
index 0000000000..bac3ff487e
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/jwsbb/verify.go
@@ -0,0 +1,105 @@
+package jwsbb
+
+import (
+ "crypto"
+ "crypto/ecdsa"
+ "crypto/ed25519"
+ "crypto/rsa"
+ "fmt"
+
+ "github.com/lestrrat-go/dsig"
+ "github.com/lestrrat-go/jwx/v3/internal/keyconv"
+)
+
+// Verify verifies a JWS signature using the specified key and algorithm.
+//
+// This function loads the verifier registered in the jwsbb package _ONLY_.
+// It does not support custom verifiers that the user might have registered.
+func Verify(key any, alg string, payload, signature []byte) error {
+ dsigAlg, ok := getDsigAlgorithm(alg)
+ if !ok {
+ return fmt.Errorf(`jwsbb.Verify: unsupported signature algorithm %q`, alg)
+ }
+
+ // Get dsig algorithm info to determine key conversion strategy
+ dsigInfo, ok := dsig.GetAlgorithmInfo(dsigAlg)
+ if !ok {
+ return fmt.Errorf(`jwsbb.Verify: dsig algorithm %q not registered`, dsigAlg)
+ }
+
+ switch dsigInfo.Family {
+ case dsig.HMAC:
+ return dispatchHMACVerify(key, dsigAlg, payload, signature)
+ case dsig.RSA:
+ return dispatchRSAVerify(key, dsigAlg, payload, signature)
+ case dsig.ECDSA:
+ return dispatchECDSAVerify(key, dsigAlg, payload, signature)
+ case dsig.EdDSAFamily:
+ return dispatchEdDSAVerify(key, dsigAlg, payload, signature)
+ default:
+ return fmt.Errorf(`jwsbb.Verify: unsupported dsig algorithm family %q`, dsigInfo.Family)
+ }
+}
+
+func dispatchHMACVerify(key any, dsigAlg string, payload, signature []byte) error {
+ var hmackey []byte
+ if err := keyconv.ByteSliceKey(&hmackey, key); err != nil {
+ return fmt.Errorf(`jwsbb.Verify: invalid key type %T. []byte is required: %w`, key, err)
+ }
+
+ return dsig.Verify(hmackey, dsigAlg, payload, signature)
+}
+
+func dispatchRSAVerify(key any, dsigAlg string, payload, signature []byte) error {
+ // Try crypto.Signer first (dsig can handle it directly)
+ if signer, ok := key.(crypto.Signer); ok {
+ // Verify it's an RSA key
+ if _, ok := signer.Public().(*rsa.PublicKey); ok {
+ return dsig.Verify(signer, dsigAlg, payload, signature)
+ }
+ }
+
+ // Fall back to concrete key types
+ var pubkey *rsa.PublicKey
+ if err := keyconv.RSAPublicKey(&pubkey, key); err != nil {
+ return fmt.Errorf(`jwsbb.Verify: invalid key type %T. *rsa.PublicKey is required: %w`, key, err)
+ }
+
+ return dsig.Verify(pubkey, dsigAlg, payload, signature)
+}
+
+func dispatchECDSAVerify(key any, dsigAlg string, payload, signature []byte) error {
+ // Try crypto.Signer first (dsig can handle it directly)
+ if signer, ok := key.(crypto.Signer); ok {
+ // Verify it's an ECDSA key
+ if _, ok := signer.Public().(*ecdsa.PublicKey); ok {
+ return dsig.Verify(signer, dsigAlg, payload, signature)
+ }
+ }
+
+ // Fall back to concrete key types
+ var pubkey *ecdsa.PublicKey
+ if err := keyconv.ECDSAPublicKey(&pubkey, key); err != nil {
+ return fmt.Errorf(`jwsbb.Verify: invalid key type %T. *ecdsa.PublicKey is required: %w`, key, err)
+ }
+
+ return dsig.Verify(pubkey, dsigAlg, payload, signature)
+}
+
+func dispatchEdDSAVerify(key any, dsigAlg string, payload, signature []byte) error {
+ // Try crypto.Signer first (dsig can handle it directly)
+ if signer, ok := key.(crypto.Signer); ok {
+ // Verify it's an EdDSA key
+ if _, ok := signer.Public().(ed25519.PublicKey); ok {
+ return dsig.Verify(signer, dsigAlg, payload, signature)
+ }
+ }
+
+ // Fall back to concrete key types
+ var pubkey ed25519.PublicKey
+ if err := keyconv.Ed25519PublicKey(&pubkey, key); err != nil {
+ return fmt.Errorf(`jwsbb.Verify: invalid key type %T. ed25519.PublicKey is required: %w`, key, err)
+ }
+
+ return dsig.Verify(pubkey, dsigAlg, payload, signature)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/key_provider.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/key_provider.go
new file mode 100644
index 0000000000..84529a1a87
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/key_provider.go
@@ -0,0 +1,291 @@
+package jws
+
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwk"
+)
+
+// KeyProvider is responsible for providing key(s) to sign or verify a payload.
+// Multiple `jws.KeyProvider`s can be passed to `jws.Verify()` or `jws.Sign()`
+//
+// `jws.Sign()` can only accept static key providers via `jws.WithKey()`,
+// while `jws.Verify()` can accept `jws.WithKey()`, `jws.WithKeySet()`,
+// `jws.WithVerifyAuto()`, and `jws.WithKeyProvider()`.
+//
+// Understanding how this works is crucial to learn how this package works.
+//
+// `jws.Sign()` is straightforward: signatures are created for each
+// provided key.
+//
+// `jws.Verify()` is a bit more involved, because there are cases you
+// will want to compute/deduce/guess the keys that you would like to
+// use for verification.
+//
+// The first thing that `jws.Verify()` does is to collect the
+// KeyProviders from the option list that the user provided (presented in pseudocode):
+//
+// keyProviders := filterKeyProviders(options)
+//
+// Then, remember that a JWS message may contain multiple signatures in the
+// message. For each signature, we call on the KeyProviders to give us
+// the key(s) to use on this signature:
+//
+// for sig in msg.Signatures {
+// for kp in keyProviders {
+// kp.FetchKeys(ctx, sink, sig, msg)
+// ...
+// }
+// }
+//
+// The `sink` argument passed to the KeyProvider is a temporary storage
+// for the keys (either a jwk.Key or a "raw" key). The `KeyProvider`
+// is responsible for sending keys into the `sink`.
+//
+// When called, the `KeyProvider` created by `jws.WithKey()` sends the same key,
+// `jws.WithKeySet()` sends keys that matches a particular `kid` and `alg`,
+// `jws.WithVerifyAuto()` fetches a JWK from the `jku` URL,
+// and finally `jws.WithKeyProvider()` allows you to execute arbitrary
+// logic to provide keys. If you are providing a custom `KeyProvider`,
+// you should execute the necessary checks or retrieval of keys, and
+// then send the key(s) to the sink:
+//
+// sink.Key(alg, key)
+//
+// These keys are then retrieved and tried for each signature, until
+// a match is found:
+//
+// keys := sink.Keys()
+// for key in keys {
+// if givenSignature == makeSignature(key, payload, ...)) {
+// return OK
+// }
+// }
+type KeyProvider interface {
+ FetchKeys(context.Context, KeySink, *Signature, *Message) error
+}
+
+// KeySink is a data storage where `jws.KeyProvider` objects should
+// send their keys to.
+type KeySink interface {
+ Key(jwa.SignatureAlgorithm, any)
+}
+
+type algKeyPair struct {
+ alg jwa.KeyAlgorithm
+ key any
+}
+
+type algKeySink struct {
+ mu sync.Mutex
+ list []algKeyPair
+}
+
+func (s *algKeySink) Key(alg jwa.SignatureAlgorithm, key any) {
+ s.mu.Lock()
+ s.list = append(s.list, algKeyPair{alg, key})
+ s.mu.Unlock()
+}
+
+type staticKeyProvider struct {
+ alg jwa.SignatureAlgorithm
+ key any
+}
+
+func (kp *staticKeyProvider) FetchKeys(_ context.Context, sink KeySink, _ *Signature, _ *Message) error {
+ sink.Key(kp.alg, kp.key)
+ return nil
+}
+
+type keySetProvider struct {
+ set jwk.Set
+ requireKid bool // true if `kid` must be specified
+ useDefault bool // true if the first key should be used iff there's exactly one key in set
+ inferAlgorithm bool // true if the algorithm should be inferred from key type
+ multipleKeysPerKeyID bool // true if we should attempt to match multiple keys per key ID. if false we assume that only one key exists for a given key ID
+}
+
+func (kp *keySetProvider) selectKey(sink KeySink, key jwk.Key, sig *Signature, _ *Message) error {
+ if usage, ok := key.KeyUsage(); ok {
+ // it's okay if use: "". we'll assume it's "sig"
+ if usage != "" && usage != jwk.ForSignature.String() {
+ return nil
+ }
+ }
+
+ if v, ok := key.Algorithm(); ok {
+ salg, ok := jwa.LookupSignatureAlgorithm(v.String())
+ if !ok {
+ return fmt.Errorf(`invalid signature algorithm %q`, v)
+ }
+
+ sink.Key(salg, key)
+ return nil
+ }
+
+ if kp.inferAlgorithm {
+ algs, err := AlgorithmsForKey(key)
+ if err != nil {
+ return fmt.Errorf(`failed to get a list of signature methods for key type %s: %w`, key.KeyType(), err)
+ }
+
+ // bail out if the JWT has a `alg` field, and it doesn't match
+ if tokAlg, ok := sig.ProtectedHeaders().Algorithm(); ok {
+ for _, alg := range algs {
+ if tokAlg == alg {
+ sink.Key(alg, key)
+ return nil
+ }
+ }
+ return fmt.Errorf(`algorithm in the message does not match any of the inferred algorithms`)
+ }
+
+ // Yes, you get to try them all!!!!!!!
+ for _, alg := range algs {
+ sink.Key(alg, key)
+ }
+ return nil
+ }
+ return nil
+}
+
+func (kp *keySetProvider) FetchKeys(_ context.Context, sink KeySink, sig *Signature, msg *Message) error {
+ if kp.requireKid {
+ wantedKid, ok := sig.ProtectedHeaders().KeyID()
+ if !ok {
+ // If the kid is NOT specified... kp.useDefault needs to be true, and the
+ // JWKs must have exactly one key in it
+ if !kp.useDefault {
+ return fmt.Errorf(`failed to find matching key: no key ID ("kid") specified in token`)
+ } else if kp.useDefault && kp.set.Len() > 1 {
+ return fmt.Errorf(`failed to find matching key: no key ID ("kid") specified in token but multiple keys available in key set`)
+ }
+
+ // if we got here, then useDefault == true AND there is exactly
+ // one key in the set.
+ key, ok := kp.set.Key(0)
+ if !ok {
+ return fmt.Errorf(`failed to get key at index 0 (empty JWKS?)`)
+ }
+ return kp.selectKey(sink, key, sig, msg)
+ }
+
+ // Otherwise we better be able to look up the key.
+ // <= v2.0.3 backwards compatible case: only match a single key
+ // whose key ID matches `wantedKid`
+ if !kp.multipleKeysPerKeyID {
+ key, ok := kp.set.LookupKeyID(wantedKid)
+ if !ok {
+ return fmt.Errorf(`failed to find key with key ID %q in key set`, wantedKid)
+ }
+ return kp.selectKey(sink, key, sig, msg)
+ }
+
+ // if multipleKeysPerKeyID is true, we attempt all keys whose key ID matches
+ // the wantedKey
+ ok = false
+ for i := range kp.set.Len() {
+ key, _ := kp.set.Key(i)
+ if kid, ok := key.KeyID(); !ok || kid != wantedKid {
+ continue
+ }
+
+ if err := kp.selectKey(sink, key, sig, msg); err != nil {
+ continue
+ }
+ ok = true
+ // continue processing so that we try all keys with the same key ID
+ }
+ if !ok {
+ return fmt.Errorf(`failed to find key with key ID %q in key set`, wantedKid)
+ }
+ return nil
+ }
+
+ // Otherwise just try all keys
+ for i := range kp.set.Len() {
+ key, ok := kp.set.Key(i)
+ if !ok {
+ return fmt.Errorf(`failed to get key at index %d`, i)
+ }
+ if err := kp.selectKey(sink, key, sig, msg); err != nil {
+ continue
+ }
+ }
+ return nil
+}
+
+type jkuProvider struct {
+ fetcher jwk.Fetcher
+ options []jwk.FetchOption
+}
+
+func (kp jkuProvider) FetchKeys(ctx context.Context, sink KeySink, sig *Signature, _ *Message) error {
+ if kp.fetcher == nil {
+ kp.fetcher = jwk.FetchFunc(jwk.Fetch)
+ }
+
+ kid, ok := sig.ProtectedHeaders().KeyID()
+ if !ok {
+ return fmt.Errorf(`use of "jku" requires that the payload contain a "kid" field in the protected header`)
+ }
+
+ // errors here can't be reliably passed to the consumers.
+ // it's unfortunate, but if you need this control, you are
+ // going to have to write your own fetcher
+ u, ok := sig.ProtectedHeaders().JWKSetURL()
+ if !ok || u == "" {
+ return fmt.Errorf(`use of "jku" field specified, but the field is empty`)
+ }
+ uo, err := url.Parse(u)
+ if err != nil {
+ return fmt.Errorf(`failed to parse "jku": %w`, err)
+ }
+ if uo.Scheme != "https" {
+ return fmt.Errorf(`url in "jku" must be HTTPS`)
+ }
+
+ set, err := kp.fetcher.Fetch(ctx, u, kp.options...)
+ if err != nil {
+ return fmt.Errorf(`failed to fetch %q: %w`, u, err)
+ }
+
+ key, ok := set.LookupKeyID(kid)
+ if !ok {
+ // It is not an error if the key with the kid doesn't exist
+ return nil
+ }
+
+ algs, err := AlgorithmsForKey(key)
+ if err != nil {
+ return fmt.Errorf(`failed to get a list of signature methods for key type %s: %w`, key.KeyType(), err)
+ }
+
+ hdrAlg, ok := sig.ProtectedHeaders().Algorithm()
+ if ok {
+ for _, alg := range algs {
+ // if we have an "alg" field in the JWS, we can only proceed if
+ // the inferred algorithm matches
+ if hdrAlg != alg {
+ continue
+ }
+
+ sink.Key(alg, key)
+ break
+ }
+ }
+ return nil
+}
+
+// KeyProviderFunc is a type of KeyProvider that is implemented by
+// a single function. You can use this to create ad-hoc `KeyProvider`
+// instances.
+type KeyProviderFunc func(context.Context, KeySink, *Signature, *Message) error
+
+func (kp KeyProviderFunc) FetchKeys(ctx context.Context, sink KeySink, sig *Signature, msg *Message) error {
+ return kp(ctx, sink, sig, msg)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy.go
new file mode 100644
index 0000000000..767ad723a3
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy.go
@@ -0,0 +1,91 @@
+package jws
+
+import (
+ "fmt"
+ "sync"
+
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jws/legacy"
+)
+
+var enableLegacySignersOnce = &sync.Once{}
+
+func enableLegacySigners() {
+ for _, alg := range []jwa.SignatureAlgorithm{jwa.HS256(), jwa.HS384(), jwa.HS512()} {
+ if err := RegisterSigner(alg, func(alg jwa.SignatureAlgorithm) SignerFactory {
+ return SignerFactoryFn(func() (Signer, error) {
+ return legacy.NewHMACSigner(alg), nil
+ })
+ }(alg)); err != nil {
+ panic(fmt.Sprintf("RegisterSigner failed: %v", err))
+ }
+ if err := RegisterVerifier(alg, func(alg jwa.SignatureAlgorithm) VerifierFactory {
+ return VerifierFactoryFn(func() (Verifier, error) {
+ return legacy.NewHMACVerifier(alg), nil
+ })
+ }(alg)); err != nil {
+ panic(fmt.Sprintf("RegisterVerifier failed: %v", err))
+ }
+ }
+
+ for _, alg := range []jwa.SignatureAlgorithm{jwa.RS256(), jwa.RS384(), jwa.RS512(), jwa.PS256(), jwa.PS384(), jwa.PS512()} {
+ if err := RegisterSigner(alg, func(alg jwa.SignatureAlgorithm) SignerFactory {
+ return SignerFactoryFn(func() (Signer, error) {
+ return legacy.NewRSASigner(alg), nil
+ })
+ }(alg)); err != nil {
+ panic(fmt.Sprintf("RegisterSigner failed: %v", err))
+ }
+ if err := RegisterVerifier(alg, func(alg jwa.SignatureAlgorithm) VerifierFactory {
+ return VerifierFactoryFn(func() (Verifier, error) {
+ return legacy.NewRSAVerifier(alg), nil
+ })
+ }(alg)); err != nil {
+ panic(fmt.Sprintf("RegisterVerifier failed: %v", err))
+ }
+ }
+ for _, alg := range []jwa.SignatureAlgorithm{jwa.ES256(), jwa.ES384(), jwa.ES512(), jwa.ES256K()} {
+ if err := RegisterSigner(alg, func(alg jwa.SignatureAlgorithm) SignerFactory {
+ return SignerFactoryFn(func() (Signer, error) {
+ return legacy.NewECDSASigner(alg), nil
+ })
+ }(alg)); err != nil {
+ panic(fmt.Sprintf("RegisterSigner failed: %v", err))
+ }
+ if err := RegisterVerifier(alg, func(alg jwa.SignatureAlgorithm) VerifierFactory {
+ return VerifierFactoryFn(func() (Verifier, error) {
+ return legacy.NewECDSAVerifier(alg), nil
+ })
+ }(alg)); err != nil {
+ panic(fmt.Sprintf("RegisterVerifier failed: %v", err))
+ }
+ }
+
+ if err := RegisterSigner(jwa.EdDSA(), SignerFactoryFn(func() (Signer, error) {
+ return legacy.NewEdDSASigner(), nil
+ })); err != nil {
+ panic(fmt.Sprintf("RegisterSigner failed: %v", err))
+ }
+ if err := RegisterVerifier(jwa.EdDSA(), VerifierFactoryFn(func() (Verifier, error) {
+ return legacy.NewEdDSAVerifier(), nil
+ })); err != nil {
+ panic(fmt.Sprintf("RegisterVerifier failed: %v", err))
+ }
+}
+
+func legacySignerFor(alg jwa.SignatureAlgorithm) (Signer, error) {
+ muSigner.Lock()
+ s, ok := signers[alg]
+ if !ok {
+ v, err := newLegacySigner(alg)
+ if err != nil {
+ muSigner.Unlock()
+ return nil, fmt.Errorf(`failed to create payload signer: %w`, err)
+ }
+ signers[alg] = v
+ s = v
+ }
+ muSigner.Unlock()
+
+ return s, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/BUILD.bazel
new file mode 100644
index 0000000000..8e77cece46
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/BUILD.bazel
@@ -0,0 +1,21 @@
+load("@rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "legacy",
+ srcs = [
+ "ecdsa.go",
+ "eddsa.go",
+ "hmac.go",
+ "legacy.go",
+ "rsa.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/jws/legacy",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//internal/ecutil",
+ "//internal/keyconv",
+ "//internal/pool",
+ "//jwa",
+ "//jws/internal/keytype",
+ ],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/ecdsa.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/ecdsa.go
new file mode 100644
index 0000000000..0b714a44b8
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/ecdsa.go
@@ -0,0 +1,204 @@
+package legacy
+
+import (
+ "crypto"
+ "crypto/ecdsa"
+ "crypto/rand"
+ "encoding/asn1"
+ "fmt"
+ "math/big"
+
+ "github.com/lestrrat-go/jwx/v3/internal/ecutil"
+ "github.com/lestrrat-go/jwx/v3/internal/keyconv"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jws/internal/keytype"
+)
+
+var ecdsaSigners = make(map[jwa.SignatureAlgorithm]*ecdsaSigner)
+var ecdsaVerifiers = make(map[jwa.SignatureAlgorithm]*ecdsaVerifier)
+
+func init() {
+ algs := map[jwa.SignatureAlgorithm]crypto.Hash{
+ jwa.ES256(): crypto.SHA256,
+ jwa.ES384(): crypto.SHA384,
+ jwa.ES512(): crypto.SHA512,
+ jwa.ES256K(): crypto.SHA256,
+ }
+ for alg, hash := range algs {
+ ecdsaSigners[alg] = &ecdsaSigner{
+ alg: alg,
+ hash: hash,
+ }
+ ecdsaVerifiers[alg] = &ecdsaVerifier{
+ alg: alg,
+ hash: hash,
+ }
+ }
+}
+
+func NewECDSASigner(alg jwa.SignatureAlgorithm) Signer {
+ return ecdsaSigners[alg]
+}
+
+// ecdsaSigners are immutable.
+type ecdsaSigner struct {
+ alg jwa.SignatureAlgorithm
+ hash crypto.Hash
+}
+
+func (es ecdsaSigner) Algorithm() jwa.SignatureAlgorithm {
+ return es.alg
+}
+
+func (es *ecdsaSigner) Sign(payload []byte, key any) ([]byte, error) {
+ if key == nil {
+ return nil, fmt.Errorf(`missing private key while signing payload`)
+ }
+
+ h := es.hash.New()
+ if _, err := h.Write(payload); err != nil {
+ return nil, fmt.Errorf(`failed to write payload using ecdsa: %w`, err)
+ }
+
+ signer, ok := key.(crypto.Signer)
+ if ok {
+ if !keytype.IsValidECDSAKey(key) {
+ return nil, fmt.Errorf(`cannot use key of type %T to generate ECDSA based signatures`, key)
+ }
+ switch key.(type) {
+ case ecdsa.PrivateKey, *ecdsa.PrivateKey:
+ // if it's a ecdsa.PrivateKey, it's more efficient to
+ // go through the non-crypto.Signer route. Set ok to false
+ ok = false
+ }
+ }
+
+ var r, s *big.Int
+ var curveBits int
+ if ok {
+ signed, err := signer.Sign(rand.Reader, h.Sum(nil), es.hash)
+ if err != nil {
+ return nil, err
+ }
+
+ var p struct {
+ R *big.Int
+ S *big.Int
+ }
+ if _, err := asn1.Unmarshal(signed, &p); err != nil {
+ return nil, fmt.Errorf(`failed to unmarshal ASN1 encoded signature: %w`, err)
+ }
+
+ // Okay, this is silly, but hear me out. When we use the
+ // crypto.Signer interface, the PrivateKey is hidden.
+ // But we need some information about the key (its bit size).
+ //
+ // So while silly, we're going to have to make another call
+ // here and fetch the Public key.
+ // This probably means that this should be cached some where.
+ cpub := signer.Public()
+ pubkey, ok := cpub.(*ecdsa.PublicKey)
+ if !ok {
+ return nil, fmt.Errorf(`expected *ecdsa.PublicKey, got %T`, pubkey)
+ }
+ curveBits = pubkey.Curve.Params().BitSize
+
+ r = p.R
+ s = p.S
+ } else {
+ var privkey ecdsa.PrivateKey
+ if err := keyconv.ECDSAPrivateKey(&privkey, key); err != nil {
+ return nil, fmt.Errorf(`failed to retrieve ecdsa.PrivateKey out of %T: %w`, key, err)
+ }
+ curveBits = privkey.Curve.Params().BitSize
+ rtmp, stmp, err := ecdsa.Sign(rand.Reader, &privkey, h.Sum(nil))
+ if err != nil {
+ return nil, fmt.Errorf(`failed to sign payload using ecdsa: %w`, err)
+ }
+ r = rtmp
+ s = stmp
+ }
+
+ keyBytes := curveBits / 8
+ // Curve bits do not need to be a multiple of 8.
+ if curveBits%8 > 0 {
+ keyBytes++
+ }
+
+ rBytes := r.Bytes()
+ rBytesPadded := make([]byte, keyBytes)
+ copy(rBytesPadded[keyBytes-len(rBytes):], rBytes)
+
+ sBytes := s.Bytes()
+ sBytesPadded := make([]byte, keyBytes)
+ copy(sBytesPadded[keyBytes-len(sBytes):], sBytes)
+
+ out := append(rBytesPadded, sBytesPadded...)
+
+ return out, nil
+}
+
+// ecdsaVerifiers are immutable.
+type ecdsaVerifier struct {
+ alg jwa.SignatureAlgorithm
+ hash crypto.Hash
+}
+
+func NewECDSAVerifier(alg jwa.SignatureAlgorithm) Verifier {
+ return ecdsaVerifiers[alg]
+}
+
+func (v ecdsaVerifier) Algorithm() jwa.SignatureAlgorithm {
+ return v.alg
+}
+
+func (v *ecdsaVerifier) Verify(payload []byte, signature []byte, key any) error {
+ if key == nil {
+ return fmt.Errorf(`missing public key while verifying payload`)
+ }
+
+ var pubkey ecdsa.PublicKey
+ if cs, ok := key.(crypto.Signer); ok {
+ cpub := cs.Public()
+ switch cpub := cpub.(type) {
+ case ecdsa.PublicKey:
+ pubkey = cpub
+ case *ecdsa.PublicKey:
+ pubkey = *cpub
+ default:
+ return fmt.Errorf(`failed to retrieve ecdsa.PublicKey out of crypto.Signer %T`, key)
+ }
+ } else {
+ if err := keyconv.ECDSAPublicKey(&pubkey, key); err != nil {
+ return fmt.Errorf(`failed to retrieve ecdsa.PublicKey out of %T: %w`, key, err)
+ }
+ }
+
+ if !pubkey.Curve.IsOnCurve(pubkey.X, pubkey.Y) {
+ return fmt.Errorf(`public key used does not contain a point (X,Y) on the curve`)
+ }
+
+ r := pool.BigInt().Get()
+ s := pool.BigInt().Get()
+ defer pool.BigInt().Put(r)
+ defer pool.BigInt().Put(s)
+
+ keySize := ecutil.CalculateKeySize(pubkey.Curve)
+ if len(signature) != keySize*2 {
+ return fmt.Errorf(`invalid signature length for curve %q`, pubkey.Curve.Params().Name)
+ }
+
+ r.SetBytes(signature[:keySize])
+ s.SetBytes(signature[keySize:])
+
+ h := v.hash.New()
+ if _, err := h.Write(payload); err != nil {
+ return fmt.Errorf(`failed to write payload using ecdsa: %w`, err)
+ }
+
+ if !ecdsa.Verify(&pubkey, h.Sum(nil), r, s) {
+ return fmt.Errorf(`failed to verify signature using ecdsa`)
+ }
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/eddsa.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/eddsa.go
new file mode 100644
index 0000000000..289e48e3b3
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/eddsa.go
@@ -0,0 +1,79 @@
+package legacy
+
+import (
+ "crypto"
+ "crypto/ed25519"
+ "crypto/rand"
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/internal/keyconv"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jws/internal/keytype"
+)
+
+type eddsaSigner struct{}
+
+func NewEdDSASigner() Signer {
+ return &eddsaSigner{}
+}
+
+func (s eddsaSigner) Algorithm() jwa.SignatureAlgorithm {
+ return jwa.EdDSA()
+}
+
+func (s eddsaSigner) Sign(payload []byte, key any) ([]byte, error) {
+ if key == nil {
+ return nil, fmt.Errorf(`missing private key while signing payload`)
+ }
+
+ // The ed25519.PrivateKey object implements crypto.Signer, so we should
+ // simply accept a crypto.Signer here.
+ signer, ok := key.(crypto.Signer)
+ if ok {
+ if !keytype.IsValidEDDSAKey(key) {
+ return nil, fmt.Errorf(`cannot use key of type %T to generate EdDSA based signatures`, key)
+ }
+ } else {
+ // This fallback exists for cases when jwk.Key was passed, or
+ // users gave us a pointer instead of non-pointer, etc.
+ var privkey ed25519.PrivateKey
+ if err := keyconv.Ed25519PrivateKey(&privkey, key); err != nil {
+ return nil, fmt.Errorf(`failed to retrieve ed25519.PrivateKey out of %T: %w`, key, err)
+ }
+ signer = privkey
+ }
+
+ return signer.Sign(rand.Reader, payload, crypto.Hash(0))
+}
+
+type eddsaVerifier struct{}
+
+func NewEdDSAVerifier() Verifier {
+ return &eddsaVerifier{}
+}
+
+func (v eddsaVerifier) Verify(payload, signature []byte, key any) (err error) {
+ if key == nil {
+ return fmt.Errorf(`missing public key while verifying payload`)
+ }
+
+ var pubkey ed25519.PublicKey
+ signer, ok := key.(crypto.Signer)
+ if ok {
+ v := signer.Public()
+ pubkey, ok = v.(ed25519.PublicKey)
+ if !ok {
+ return fmt.Errorf(`expected crypto.Signer.Public() to return ed25519.PublicKey, but got %T`, v)
+ }
+ } else {
+ if err := keyconv.Ed25519PublicKey(&pubkey, key); err != nil {
+ return fmt.Errorf(`failed to retrieve ed25519.PublicKey out of %T: %w`, key, err)
+ }
+ }
+
+ if !ed25519.Verify(pubkey, payload, signature) {
+ return fmt.Errorf(`failed to match EdDSA signature`)
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/hmac.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/hmac.go
new file mode 100644
index 0000000000..7a3c9d1896
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/hmac.go
@@ -0,0 +1,90 @@
+package legacy
+
+import (
+ "crypto/hmac"
+ "crypto/sha256"
+ "crypto/sha512"
+ "fmt"
+ "hash"
+
+ "github.com/lestrrat-go/jwx/v3/internal/keyconv"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+func init() {
+ algs := map[jwa.SignatureAlgorithm]func() hash.Hash{
+ jwa.HS256(): sha256.New,
+ jwa.HS384(): sha512.New384,
+ jwa.HS512(): sha512.New,
+ }
+
+ for alg, h := range algs {
+ hmacSignFuncs[alg] = makeHMACSignFunc(h)
+ }
+}
+
+// HMACSigner uses crypto/hmac to sign the payloads.
+// This is for legacy support only.
+type HMACSigner struct {
+ alg jwa.SignatureAlgorithm
+ sign hmacSignFunc
+}
+
+type HMACVerifier struct {
+ signer Signer
+}
+
+type hmacSignFunc func(payload []byte, key []byte) ([]byte, error)
+
+var hmacSignFuncs = make(map[jwa.SignatureAlgorithm]hmacSignFunc)
+
+func NewHMACSigner(alg jwa.SignatureAlgorithm) Signer {
+ return &HMACSigner{
+ alg: alg,
+ sign: hmacSignFuncs[alg], // we know this will succeed
+ }
+}
+
+func makeHMACSignFunc(hfunc func() hash.Hash) hmacSignFunc {
+ return func(payload []byte, key []byte) ([]byte, error) {
+ h := hmac.New(hfunc, key)
+ if _, err := h.Write(payload); err != nil {
+ return nil, fmt.Errorf(`failed to write payload using hmac: %w`, err)
+ }
+ return h.Sum(nil), nil
+ }
+}
+
+func (s HMACSigner) Algorithm() jwa.SignatureAlgorithm {
+ return s.alg
+}
+
+func (s HMACSigner) Sign(payload []byte, key any) ([]byte, error) {
+ var hmackey []byte
+ if err := keyconv.ByteSliceKey(&hmackey, key); err != nil {
+ return nil, fmt.Errorf(`invalid key type %T. []byte is required: %w`, key, err)
+ }
+
+ if len(hmackey) == 0 {
+ return nil, fmt.Errorf(`missing key while signing payload`)
+ }
+
+ return s.sign(payload, hmackey)
+}
+
+func NewHMACVerifier(alg jwa.SignatureAlgorithm) Verifier {
+ s := NewHMACSigner(alg)
+ return &HMACVerifier{signer: s}
+}
+
+func (v HMACVerifier) Verify(payload, signature []byte, key any) (err error) {
+ expected, err := v.signer.Sign(payload, key)
+ if err != nil {
+ return fmt.Errorf(`failed to generated signature: %w`, err)
+ }
+
+ if !hmac.Equal(signature, expected) {
+ return fmt.Errorf(`failed to match hmac signature`)
+ }
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/legacy.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/legacy.go
new file mode 100644
index 0000000000..fe69b55e05
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/legacy.go
@@ -0,0 +1,36 @@
+// Package legacy provides support for legacy implementation of JWS signing and verification.
+// Types, functions, and variables in this package are exported only for legacy support,
+// and should not be relied upon for new code.
+//
+// This package will be available until v3 is sunset, but it will be removed in v4
+package legacy
+
+import (
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+// Signer generates the signature for a given payload.
+// This is for legacy support only.
+type Signer interface {
+ // Sign creates a signature for the given payload.
+ // The second argument is the key used for signing the payload, and is usually
+ // the private key type associated with the signature method. For example,
+ // for `jwa.RSXXX` and `jwa.PSXXX` types, you need to pass the
+ // `*"crypto/rsa".PrivateKey` type.
+ // Check the documentation for each signer for details
+ Sign([]byte, any) ([]byte, error)
+
+ Algorithm() jwa.SignatureAlgorithm
+}
+
+// Verifier is for legacy support only.
+type Verifier interface {
+ // Verify checks whether the payload and signature are valid for
+ // the given key.
+ // `key` is the key used for verifying the payload, and is usually
+ // the public key associated with the signature method. For example,
+ // for `jwa.RSXXX` and `jwa.PSXXX` types, you need to pass the
+ // `*"crypto/rsa".PublicKey` type.
+ // Check the documentation for each verifier for details
+ Verify(payload []byte, signature []byte, key any) error
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/rsa.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/rsa.go
new file mode 100644
index 0000000000..aef110a5cf
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/legacy/rsa.go
@@ -0,0 +1,145 @@
+package legacy
+
+import (
+ "crypto"
+ "crypto/rand"
+ "crypto/rsa"
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/internal/keyconv"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jws/internal/keytype"
+)
+
+var rsaSigners = make(map[jwa.SignatureAlgorithm]*rsaSigner)
+var rsaVerifiers = make(map[jwa.SignatureAlgorithm]*rsaVerifier)
+
+func init() {
+ data := map[jwa.SignatureAlgorithm]struct {
+ Hash crypto.Hash
+ PSS bool
+ }{
+ jwa.RS256(): {
+ Hash: crypto.SHA256,
+ },
+ jwa.RS384(): {
+ Hash: crypto.SHA384,
+ },
+ jwa.RS512(): {
+ Hash: crypto.SHA512,
+ },
+ jwa.PS256(): {
+ Hash: crypto.SHA256,
+ PSS: true,
+ },
+ jwa.PS384(): {
+ Hash: crypto.SHA384,
+ PSS: true,
+ },
+ jwa.PS512(): {
+ Hash: crypto.SHA512,
+ PSS: true,
+ },
+ }
+
+ for alg, item := range data {
+ rsaSigners[alg] = &rsaSigner{
+ alg: alg,
+ hash: item.Hash,
+ pss: item.PSS,
+ }
+ rsaVerifiers[alg] = &rsaVerifier{
+ alg: alg,
+ hash: item.Hash,
+ pss: item.PSS,
+ }
+ }
+}
+
+type rsaSigner struct {
+ alg jwa.SignatureAlgorithm
+ hash crypto.Hash
+ pss bool
+}
+
+func NewRSASigner(alg jwa.SignatureAlgorithm) Signer {
+ return rsaSigners[alg]
+}
+
+func (rs *rsaSigner) Algorithm() jwa.SignatureAlgorithm {
+ return rs.alg
+}
+
+func (rs *rsaSigner) Sign(payload []byte, key any) ([]byte, error) {
+ if key == nil {
+ return nil, fmt.Errorf(`missing private key while signing payload`)
+ }
+
+ signer, ok := key.(crypto.Signer)
+ if ok {
+ if !keytype.IsValidRSAKey(key) {
+ return nil, fmt.Errorf(`cannot use key of type %T to generate RSA based signatures`, key)
+ }
+ } else {
+ var privkey rsa.PrivateKey
+ if err := keyconv.RSAPrivateKey(&privkey, key); err != nil {
+ return nil, fmt.Errorf(`failed to retrieve rsa.PrivateKey out of %T: %w`, key, err)
+ }
+ signer = &privkey
+ }
+
+ h := rs.hash.New()
+ if _, err := h.Write(payload); err != nil {
+ return nil, fmt.Errorf(`failed to write payload to hash: %w`, err)
+ }
+ if rs.pss {
+ return signer.Sign(rand.Reader, h.Sum(nil), &rsa.PSSOptions{
+ Hash: rs.hash,
+ SaltLength: rsa.PSSSaltLengthEqualsHash,
+ })
+ }
+ return signer.Sign(rand.Reader, h.Sum(nil), rs.hash)
+}
+
+type rsaVerifier struct {
+ alg jwa.SignatureAlgorithm
+ hash crypto.Hash
+ pss bool
+}
+
+func NewRSAVerifier(alg jwa.SignatureAlgorithm) Verifier {
+ return rsaVerifiers[alg]
+}
+
+func (rv *rsaVerifier) Verify(payload, signature []byte, key any) error {
+ if key == nil {
+ return fmt.Errorf(`missing public key while verifying payload`)
+ }
+
+ var pubkey rsa.PublicKey
+ if cs, ok := key.(crypto.Signer); ok {
+ cpub := cs.Public()
+ switch cpub := cpub.(type) {
+ case rsa.PublicKey:
+ pubkey = cpub
+ case *rsa.PublicKey:
+ pubkey = *cpub
+ default:
+ return fmt.Errorf(`failed to retrieve rsa.PublicKey out of crypto.Signer %T`, key)
+ }
+ } else {
+ if err := keyconv.RSAPublicKey(&pubkey, key); err != nil {
+ return fmt.Errorf(`failed to retrieve rsa.PublicKey out of %T: %w`, key, err)
+ }
+ }
+
+ h := rv.hash.New()
+ if _, err := h.Write(payload); err != nil {
+ return fmt.Errorf(`failed to write payload to hash: %w`, err)
+ }
+
+ if rv.pss {
+ return rsa.VerifyPSS(&pubkey, rv.hash, h.Sum(nil), signature, nil)
+ }
+ return rsa.VerifyPKCS1v15(&pubkey, rv.hash, h.Sum(nil), signature)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/message.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/message.go
new file mode 100644
index 0000000000..e113d1438c
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/message.go
@@ -0,0 +1,550 @@
+package jws
+
+import (
+ "bytes"
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+func NewSignature() *Signature {
+ return &Signature{}
+}
+
+func (s *Signature) DecodeCtx() DecodeCtx {
+ return s.dc
+}
+
+func (s *Signature) SetDecodeCtx(dc DecodeCtx) {
+ s.dc = dc
+}
+
+func (s Signature) PublicHeaders() Headers {
+ return s.headers
+}
+
+func (s *Signature) SetPublicHeaders(v Headers) *Signature {
+ s.headers = v
+ return s
+}
+
+func (s Signature) ProtectedHeaders() Headers {
+ return s.protected
+}
+
+func (s *Signature) SetProtectedHeaders(v Headers) *Signature {
+ s.protected = v
+ return s
+}
+
+func (s Signature) Signature() []byte {
+ return s.signature
+}
+
+func (s *Signature) SetSignature(v []byte) *Signature {
+ s.signature = v
+ return s
+}
+
+type signatureUnmarshalProbe struct {
+ Header Headers `json:"header,omitempty"`
+ Protected *string `json:"protected,omitempty"`
+ Signature *string `json:"signature,omitempty"`
+}
+
+func (s *Signature) UnmarshalJSON(data []byte) error {
+ var sup signatureUnmarshalProbe
+ sup.Header = NewHeaders()
+ if err := json.Unmarshal(data, &sup); err != nil {
+ return fmt.Errorf(`failed to unmarshal signature into temporary struct: %w`, err)
+ }
+
+ s.headers = sup.Header
+ if buf := sup.Protected; buf != nil {
+ src := []byte(*buf)
+ if !bytes.HasPrefix(src, []byte{tokens.OpenCurlyBracket}) {
+ decoded, err := base64.Decode(src)
+ if err != nil {
+ return fmt.Errorf(`failed to base64 decode protected headers: %w`, err)
+ }
+ src = decoded
+ }
+
+ prt := NewHeaders()
+ //nolint:forcetypeassert
+ prt.(*stdHeaders).SetDecodeCtx(s.DecodeCtx())
+ if err := json.Unmarshal(src, prt); err != nil {
+ return fmt.Errorf(`failed to unmarshal protected headers: %w`, err)
+ }
+ //nolint:forcetypeassert
+ prt.(*stdHeaders).SetDecodeCtx(nil)
+ s.protected = prt
+ }
+
+ if sup.Signature != nil {
+ decoded, err := base64.DecodeString(*sup.Signature)
+ if err != nil {
+ return fmt.Errorf(`failed to base decode signature: %w`, err)
+ }
+ s.signature = decoded
+ }
+ return nil
+}
+
+// Sign populates the signature field, with a signature generated by
+// given the signer object and payload.
+//
+// The first return value is the raw signature in binary format.
+// The second return value s the full three-segment signature
+// (e.g. "eyXXXX.XXXXX.XXXX")
+//
+// This method is deprecated, and will be remove in a future release.
+// Signature objects in the future will only be used as containers,
+// and signing will be done using the `jws.Sign` function, or alternatively
+// you could use jwsbb package to craft the signature manually.
+func (s *Signature) Sign(payload []byte, signer Signer, key any) ([]byte, []byte, error) {
+ return s.sign2(payload, signer, key)
+}
+
+func (s *Signature) sign2(payload []byte, signer interface{ Algorithm() jwa.SignatureAlgorithm }, key any) ([]byte, []byte, error) {
+ // Create a signatureBuilder to use the shared signing logic
+ sb := signatureBuilderPool.Get()
+ defer signatureBuilderPool.Put(sb)
+
+ sb.alg = signer.Algorithm()
+ sb.key = key
+ sb.protected = s.protected
+ sb.public = s.headers
+
+ // Set up the appropriate signer interface
+ switch typedSigner := signer.(type) {
+ case Signer2:
+ sb.signer2 = typedSigner
+ case Signer:
+ sb.signer = typedSigner
+ default:
+ return nil, nil, fmt.Errorf(`invalid signer type: %T`, signer)
+ }
+
+ // Create a minimal sign context
+ sc := signContextPool.Get()
+ defer signContextPool.Put(sc)
+
+ sc.detached = s.detached
+
+ encoder := s.encoder
+ if encoder == nil {
+ encoder = base64.DefaultEncoder()
+ }
+ sc.encoder = encoder
+
+ // Build the signature using signatureBuilder
+ sig, err := sb.Build(sc, payload)
+ if err != nil {
+ return nil, nil, fmt.Errorf(`failed to build signature: %w`, err)
+ }
+
+ // Copy the signature result back to this signature instance
+ s.signature = sig.signature
+ s.protected = sig.protected
+ s.headers = sig.headers
+
+ // Build the complete JWS token for the return value
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+
+ // Marshal the merged headers for the final output
+ hdrs, err := mergeHeaders(s.headers, s.protected)
+ if err != nil {
+ return nil, nil, fmt.Errorf(`failed to merge headers: %w`, err)
+ }
+
+ hdrbuf, err := json.Marshal(hdrs)
+ if err != nil {
+ return nil, nil, fmt.Errorf(`failed to marshal headers: %w`, err)
+ }
+
+ buf.WriteString(encoder.EncodeToString(hdrbuf))
+ buf.WriteByte(tokens.Period)
+
+ var plen int
+ b64 := getB64Value(hdrs)
+ if b64 {
+ encoded := encoder.EncodeToString(payload)
+ plen = len(encoded)
+ buf.WriteString(encoded)
+ } else {
+ if !s.detached {
+ if bytes.Contains(payload, []byte{tokens.Period}) {
+ return nil, nil, fmt.Errorf(`payload must not contain a "."`)
+ }
+ }
+ plen = len(payload)
+ buf.Write(payload)
+ }
+
+ // Handle detached payload
+ if s.detached {
+ buf.Truncate(buf.Len() - plen)
+ }
+
+ buf.WriteByte(tokens.Period)
+ buf.WriteString(encoder.EncodeToString(s.signature))
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+
+ return s.signature, ret, nil
+}
+
+func NewMessage() *Message {
+ return &Message{}
+}
+
+// Clears the internal raw buffer that was accumulated during
+// the verify phase
+func (m *Message) clearRaw() {
+ for _, sig := range m.signatures {
+ if protected := sig.protected; protected != nil {
+ if cr, ok := protected.(*stdHeaders); ok {
+ cr.raw = nil
+ }
+ }
+ }
+}
+
+func (m *Message) SetDecodeCtx(dc DecodeCtx) {
+ m.dc = dc
+}
+
+func (m *Message) DecodeCtx() DecodeCtx {
+ return m.dc
+}
+
+// Payload returns the decoded payload
+func (m Message) Payload() []byte {
+ return m.payload
+}
+
+func (m *Message) SetPayload(v []byte) *Message {
+ m.payload = v
+ return m
+}
+
+func (m Message) Signatures() []*Signature {
+ return m.signatures
+}
+
+func (m *Message) AppendSignature(v *Signature) *Message {
+ m.signatures = append(m.signatures, v)
+ return m
+}
+
+func (m *Message) ClearSignatures() *Message {
+ m.signatures = nil
+ return m
+}
+
+// LookupSignature looks up a particular signature entry using
+// the `kid` value
+func (m Message) LookupSignature(kid string) []*Signature {
+ var sigs []*Signature
+ for _, sig := range m.signatures {
+ if hdr := sig.PublicHeaders(); hdr != nil {
+ hdrKeyID, ok := hdr.KeyID()
+ if ok && hdrKeyID == kid {
+ sigs = append(sigs, sig)
+ continue
+ }
+ }
+
+ if hdr := sig.ProtectedHeaders(); hdr != nil {
+ hdrKeyID, ok := hdr.KeyID()
+ if ok && hdrKeyID == kid {
+ sigs = append(sigs, sig)
+ continue
+ }
+ }
+ }
+ return sigs
+}
+
+// This struct is used to first probe for the structure of the
+// incoming JSON object. We then decide how to parse it
+// from the fields that are populated.
+type messageUnmarshalProbe struct {
+ Payload *string `json:"payload"`
+ Signatures []json.RawMessage `json:"signatures,omitempty"`
+ Header Headers `json:"header,omitempty"`
+ Protected *string `json:"protected,omitempty"`
+ Signature *string `json:"signature,omitempty"`
+}
+
+func (m *Message) UnmarshalJSON(buf []byte) error {
+ m.payload = nil
+ m.signatures = nil
+ m.b64 = true
+
+ var mup messageUnmarshalProbe
+ mup.Header = NewHeaders()
+ if err := json.Unmarshal(buf, &mup); err != nil {
+ return fmt.Errorf(`failed to unmarshal into temporary structure: %w`, err)
+ }
+
+ b64 := true
+ if mup.Signature == nil { // flattened signature is NOT present
+ if len(mup.Signatures) == 0 {
+ return fmt.Errorf(`required field "signatures" not present`)
+ }
+
+ m.signatures = make([]*Signature, 0, len(mup.Signatures))
+ for i, rawsig := range mup.Signatures {
+ var sig Signature
+ sig.SetDecodeCtx(m.DecodeCtx())
+ if err := json.Unmarshal(rawsig, &sig); err != nil {
+ return fmt.Errorf(`failed to unmarshal signature #%d: %w`, i+1, err)
+ }
+ sig.SetDecodeCtx(nil)
+
+ if sig.protected == nil {
+ // Instead of barfing on a nil protected header, use an empty header
+ sig.protected = NewHeaders()
+ }
+
+ if i == 0 {
+ if !getB64Value(sig.protected) {
+ b64 = false
+ }
+ } else {
+ if b64 != getB64Value(sig.protected) {
+ return fmt.Errorf(`b64 value must be the same for all signatures`)
+ }
+ }
+
+ m.signatures = append(m.signatures, &sig)
+ }
+ } else { // .signature is present, it's a flattened structure
+ if len(mup.Signatures) != 0 {
+ return fmt.Errorf(`invalid format ("signatures" and "signature" keys cannot both be present)`)
+ }
+
+ var sig Signature
+ sig.headers = mup.Header
+ if src := mup.Protected; src != nil {
+ decoded, err := base64.DecodeString(*src)
+ if err != nil {
+ return fmt.Errorf(`failed to base64 decode flattened protected headers: %w`, err)
+ }
+ prt := NewHeaders()
+ //nolint:forcetypeassert
+ prt.(*stdHeaders).SetDecodeCtx(m.DecodeCtx())
+ if err := json.Unmarshal(decoded, prt); err != nil {
+ return fmt.Errorf(`failed to unmarshal flattened protected headers: %w`, err)
+ }
+ //nolint:forcetypeassert
+ prt.(*stdHeaders).SetDecodeCtx(nil)
+ sig.protected = prt
+ }
+
+ if sig.protected == nil {
+ // Instead of barfing on a nil protected header, use an empty header
+ sig.protected = NewHeaders()
+ }
+
+ decoded, err := base64.DecodeString(*mup.Signature)
+ if err != nil {
+ return fmt.Errorf(`failed to base64 decode flattened signature: %w`, err)
+ }
+ sig.signature = decoded
+
+ m.signatures = []*Signature{&sig}
+ b64 = getB64Value(sig.protected)
+ }
+
+ if mup.Payload != nil {
+ if !b64 { // NOT base64 encoded
+ m.payload = []byte(*mup.Payload)
+ } else {
+ decoded, err := base64.DecodeString(*mup.Payload)
+ if err != nil {
+ return fmt.Errorf(`failed to base64 decode payload: %w`, err)
+ }
+ m.payload = decoded
+ }
+ }
+ m.b64 = b64
+ return nil
+}
+
+func (m Message) MarshalJSON() ([]byte, error) {
+ if len(m.signatures) == 1 {
+ return m.marshalFlattened()
+ }
+ return m.marshalFull()
+}
+
+func (m Message) marshalFlattened() ([]byte, error) {
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+
+ sig := m.signatures[0]
+
+ buf.WriteRune(tokens.OpenCurlyBracket)
+ var wrote bool
+
+ if hdr := sig.headers; hdr != nil {
+ hdrjs, err := json.Marshal(hdr)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to marshal "header" (flattened format): %w`, err)
+ }
+ buf.WriteString(`"header":`)
+ buf.Write(hdrjs)
+ wrote = true
+ }
+
+ if wrote {
+ buf.WriteRune(tokens.Comma)
+ }
+ buf.WriteString(`"payload":"`)
+ buf.WriteString(base64.EncodeToString(m.payload))
+ buf.WriteRune('"')
+
+ if protected := sig.protected; protected != nil {
+ protectedbuf, err := json.Marshal(protected)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to marshal "protected" (flattened format): %w`, err)
+ }
+ buf.WriteString(`,"protected":"`)
+ buf.WriteString(base64.EncodeToString(protectedbuf))
+ buf.WriteRune('"')
+ }
+
+ buf.WriteString(`,"signature":"`)
+ buf.WriteString(base64.EncodeToString(sig.signature))
+ buf.WriteRune('"')
+ buf.WriteRune(tokens.CloseCurlyBracket)
+
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ return ret, nil
+}
+
+func (m Message) marshalFull() ([]byte, error) {
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+
+ buf.WriteString(`{"payload":"`)
+ buf.WriteString(base64.EncodeToString(m.payload))
+ buf.WriteString(`","signatures":[`)
+ for i, sig := range m.signatures {
+ if i > 0 {
+ buf.WriteRune(tokens.Comma)
+ }
+
+ buf.WriteRune(tokens.OpenCurlyBracket)
+ var wrote bool
+ if hdr := sig.headers; hdr != nil {
+ hdrbuf, err := json.Marshal(hdr)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to marshal "header" for signature #%d: %w`, i+1, err)
+ }
+ buf.WriteString(`"header":`)
+ buf.Write(hdrbuf)
+ wrote = true
+ }
+
+ if protected := sig.protected; protected != nil {
+ protectedbuf, err := json.Marshal(protected)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to marshal "protected" for signature #%d: %w`, i+1, err)
+ }
+ if wrote {
+ buf.WriteRune(tokens.Comma)
+ }
+ buf.WriteString(`"protected":"`)
+ buf.WriteString(base64.EncodeToString(protectedbuf))
+ buf.WriteRune('"')
+ wrote = true
+ }
+
+ if len(sig.signature) > 0 {
+ // If InsecureNoSignature is enabled, signature may not exist
+ if wrote {
+ buf.WriteRune(tokens.Comma)
+ }
+ buf.WriteString(`"signature":"`)
+ buf.WriteString(base64.EncodeToString(sig.signature))
+ buf.WriteString(`"`)
+ }
+ buf.WriteString(`}`)
+ }
+ buf.WriteString(`]}`)
+
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ return ret, nil
+}
+
+// Compact generates a JWS message in compact serialization format from
+// `*jws.Message` object. The object contain exactly one signature, or
+// an error is returned.
+//
+// If using a detached payload, the payload must already be stored in
+// the `*jws.Message` object, and the `jws.WithDetached()` option
+// must be passed to the function.
+func Compact(msg *Message, options ...CompactOption) ([]byte, error) {
+ if l := len(msg.signatures); l != 1 {
+ return nil, fmt.Errorf(`jws.Compact: cannot serialize message with %d signatures (must be one)`, l)
+ }
+
+ var detached bool
+ var encoder Base64Encoder = base64.DefaultEncoder()
+ for _, option := range options {
+ switch option.Ident() {
+ case identDetached{}:
+ if err := option.Value(&detached); err != nil {
+ return nil, fmt.Errorf(`jws.Compact: failed to retrieve detached option value: %w`, err)
+ }
+ case identBase64Encoder{}:
+ if err := option.Value(&encoder); err != nil {
+ return nil, fmt.Errorf(`jws.Compact: failed to retrieve base64 encoder option value: %w`, err)
+ }
+ }
+ }
+
+ s := msg.signatures[0]
+ // XXX check if this is correct
+ hdrs := s.ProtectedHeaders()
+
+ hdrbuf, err := json.Marshal(hdrs)
+ if err != nil {
+ return nil, fmt.Errorf(`jws.Compress: failed to marshal headers: %w`, err)
+ }
+
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+
+ buf.WriteString(encoder.EncodeToString(hdrbuf))
+ buf.WriteByte(tokens.Period)
+
+ if !detached {
+ if getB64Value(hdrs) {
+ encoded := encoder.EncodeToString(msg.payload)
+ buf.WriteString(encoded)
+ } else {
+ if bytes.Contains(msg.payload, []byte{tokens.Period}) {
+ return nil, fmt.Errorf(`jws.Compress: payload must not contain a "."`)
+ }
+ buf.Write(msg.payload)
+ }
+ }
+
+ buf.WriteByte(tokens.Period)
+ buf.WriteString(encoder.EncodeToString(s.signature))
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ return ret, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/options.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/options.go
new file mode 100644
index 0000000000..4c217c3483
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/options.go
@@ -0,0 +1,259 @@
+package jws
+
+import (
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwk"
+ "github.com/lestrrat-go/option/v2"
+)
+
+type identInsecureNoSignature struct{}
+
+// WithJSON specifies that the result of `jws.Sign()` is serialized in
+// JSON format.
+//
+// If you pass multiple keys to `jws.Sign()`, it will fail unless
+// you also pass this option.
+func WithJSON(options ...WithJSONSuboption) SignVerifyParseOption {
+ var pretty bool
+ for _, option := range options {
+ switch option.Ident() {
+ case identPretty{}:
+ if err := option.Value(&pretty); err != nil {
+ panic(`jws.WithJSON() option must be of type bool`)
+ }
+ }
+ }
+
+ format := fmtJSON
+ if pretty {
+ format = fmtJSONPretty
+ }
+ return &signVerifyParseOption{option.New(identSerialization{}, format)}
+}
+
+type withKey struct {
+ alg jwa.KeyAlgorithm
+ key any
+ protected Headers
+ public Headers
+}
+
+// Protected exists as an escape hatch to modify the header values after the fact
+func (w *withKey) Protected(v Headers) Headers {
+ if w.protected == nil && v != nil {
+ w.protected = v
+ }
+ return w.protected
+}
+
+// WithKey is used to pass a static algorithm/key pair to either `jws.Sign()` or `jws.Verify()`.
+//
+// The `alg` parameter is the identifier for the signature algorithm that should be used.
+// It is of type `jwa.KeyAlgorithm` but in reality you can only pass `jwa.SignatureAlgorithm`
+// types. It is this way so that the value in `(jwk.Key).Algorithm()` can be directly
+// passed to the option. If you specify other algorithm types such as `jwa.KeyEncryptionAlgorithm`,
+// then you will get an error when `jws.Sign()` or `jws.Verify()` is executed.
+//
+// The `alg` parameter cannot be "none" (jwa.NoSignature) for security reasons.
+// You will have to use a separate, more explicit option to allow the use of "none"
+// algorithm (WithInsecureNoSignature).
+//
+// The algorithm specified in the `alg` parameter MUST be able to support
+// the type of key you provided, otherwise an error is returned.
+//
+// Any of the following is accepted for the `key` parameter:
+// * A "raw" key (e.g. rsa.PrivateKey, ecdsa.PrivateKey, etc)
+// * A crypto.Signer
+// * A jwk.Key
+//
+// Note that due to technical reasons, this library is NOT able to differentiate
+// between a valid/invalid key for given algorithm if the key implements crypto.Signer
+// and the key is from an external library. For example, while we can tell that it is
+// invalid to use `jwk.WithKey(jwa.RSA256, ecdsaPrivateKey)` because the key is
+// presumably from `crypto/ecdsa` or this library, if you use a KMS wrapper
+// that implements crypto.Signer that is outside of the go standard library or this
+// library, we will not be able to properly catch the misuse of such keys --
+// the output will happily generate an ECDSA signature even in the presence of
+// `jwa.RSA256`
+//
+// A `crypto.Signer` is used when the private part of a key is
+// kept in an inaccessible location, such as hardware.
+// `crypto.Signer` is currently supported for RSA, ECDSA, and EdDSA
+// family of algorithms. You may consider using `github.com/jwx-go/crypto-signer`
+// if you would like to use keys stored in GCP/AWS KMS services.
+//
+// If the key is a jwk.Key and the key contains a key ID (`kid` field),
+// then it is added to the protected header generated by the signature.
+//
+// `jws.WithKey()` can further accept suboptions to change signing behavior
+// when used with `jws.Sign()`. `jws.WithProtected()` and `jws.WithPublic()`
+// can be passed to specify JWS headers that should be used whe signing.
+//
+// If the protected headers contain "b64" field, then the boolean value for the field
+// is respected when serializing. That is, if you specify a header with
+// `{"b64": false}`, then the payload is not base64 encoded.
+//
+// These suboptions are ignored when the `jws.WithKey()` option is used with `jws.Verify()`.
+func WithKey(alg jwa.KeyAlgorithm, key any, options ...WithKeySuboption) SignVerifyOption {
+ // Implementation note: this option is shared between Sign() and
+ // Verify(). As such we don't create a KeyProvider here because
+ // if used in Sign() we would be doing something else.
+ var protected, public Headers
+ for _, option := range options {
+ switch option.Ident() {
+ case identProtectedHeaders{}:
+ if err := option.Value(&protected); err != nil {
+ panic(`jws.WithKey() option must be of type Headers`)
+ }
+ case identPublicHeaders{}:
+ if err := option.Value(&public); err != nil {
+ panic(`jws.WithKey() option must be of type Headers`)
+ }
+ }
+ }
+
+ return &signVerifyOption{
+ option.New(identKey{}, &withKey{
+ alg: alg,
+ key: key,
+ protected: protected,
+ public: public,
+ }),
+ }
+}
+
+// WithKeySet specifies a JWKS (jwk.Set) to use for verification.
+//
+// Because a JWKS can contain multiple keys and this library cannot tell
+// which one of the keys should be used for verification, we by default
+// require that both `alg` and `kid` fields in the JWS _and_ the
+// key match before a key is considered to be used.
+//
+// There are ways to override this behavior, but they must be explicitly
+// specified by the caller.
+//
+// To work with keys/JWS messages not having a `kid` field, you may specify
+// the suboption `WithKeySetRequired` via `jws.WithKey(key, jws.WithRequireKid(false))`.
+// This will allow the library to proceed without having to match the `kid` field.
+//
+// However, it will still check if the `alg` fields in the JWS message and the key(s)
+// match. If you must work with JWS messages that do not have an `alg` field,
+// you will need to use `jws.WithKeySet(key, jws.WithInferAlgorithm(true))`.
+//
+// See the documentation for `WithInferAlgorithm()` for more details.
+func WithKeySet(set jwk.Set, options ...WithKeySetSuboption) VerifyOption {
+ requireKid := true
+ var useDefault, inferAlgorithm, multipleKeysPerKeyID bool
+ for _, option := range options {
+ switch option.Ident() {
+ case identRequireKid{}:
+ if err := option.Value(&requireKid); err != nil {
+ panic(`jws.WithKeySet() option must be of type bool`)
+ }
+ case identUseDefault{}:
+ if err := option.Value(&useDefault); err != nil {
+ panic(`jws.WithKeySet() option must be of type bool`)
+ }
+ case identMultipleKeysPerKeyID{}:
+ if err := option.Value(&multipleKeysPerKeyID); err != nil {
+ panic(`jws.WithKeySet() option must be of type bool`)
+ }
+ case identInferAlgorithmFromKey{}:
+ if err := option.Value(&inferAlgorithm); err != nil {
+ panic(`jws.WithKeySet() option must be of type bool`)
+ }
+ }
+ }
+
+ return WithKeyProvider(&keySetProvider{
+ set: set,
+ requireKid: requireKid,
+ useDefault: useDefault,
+ multipleKeysPerKeyID: multipleKeysPerKeyID,
+ inferAlgorithm: inferAlgorithm,
+ })
+}
+
+// WithVerifyAuto enables automatic verification of the signature using the JWKS specified in
+// the `jku` header. Note that by default this option will _reject_ any jku
+// provided by the JWS message. Read on for details.
+//
+// The JWKS is retrieved by the `jwk.Fetcher` specified in the first argument.
+// If the fetcher object is nil, the default fetcher, which is the `jwk.Fetch()`
+// function (wrapped in the `jwk.FetchFunc` type) is used.
+//
+// The remaining arguments are passed to the `(jwk.Fetcher).Fetch` method
+// when the JWKS is retrieved.
+//
+// jws.WithVerifyAuto(nil) // uses jwk.Fetch
+// jws.WithVerifyAuto(jwk.NewCachedFetcher(...)) // uses cached fetcher
+// jws.WithVerifyAuto(myFetcher) // use your custom fetcher
+//
+// By default a whitelist that disallows all URLs is added to the options
+// passed to the fetcher. You must explicitly specify a whitelist that allows
+// the URLs you trust. This default behavior is provided because by design
+// of the JWS specification it is the/ caller's responsibility to verify if
+// the URL specified in the `jku` header can be trusted -- thus by default
+// we trust nothing.
+//
+// Users are free to specify an open whitelist if they so choose, but this must
+// be explicitly done:
+//
+// jws.WithVerifyAuto(nil, jwk.WithFetchWhitelist(jwk.InsecureWhitelist()))
+//
+// You can also use `jwk.CachedFetcher` to use cached JWKS objects, but do note
+// that this object is not really designed to accommodate a large set of
+// arbitrary URLs. Use `jwk.CachedFetcher` as the first argument if you only
+// have a small set of URLs that you trust. For anything more complex, you should
+// implement your own `jwk.Fetcher` object.
+func WithVerifyAuto(f jwk.Fetcher, options ...jwk.FetchOption) VerifyOption {
+ // the option MUST start with a "disallow no whitelist" to force
+ // users provide a whitelist
+ options = append(append([]jwk.FetchOption(nil), jwk.WithFetchWhitelist(allowNoneWhitelist)), options...)
+
+ return WithKeyProvider(jkuProvider{
+ fetcher: f,
+ options: options,
+ })
+}
+
+type withInsecureNoSignature struct {
+ protected Headers
+}
+
+// Protected exists as an escape hatch to modify the header values after the fact
+func (w *withInsecureNoSignature) Protected(v Headers) Headers {
+ if w.protected == nil && v != nil {
+ w.protected = v
+ }
+ return w.protected
+}
+
+// WithInsecureNoSignature creates an option that allows the user to use the
+// "none" signature algorithm.
+//
+// Please note that this is insecure, and should never be used in production
+// (this is exactly why specifying "none"/jwa.NoSignature to `jws.WithKey()`
+// results in an error when `jws.Sign()` is called -- we do not allow using
+// "none" by accident)
+//
+// TODO: create specific suboption set for this option
+func WithInsecureNoSignature(options ...WithKeySuboption) SignOption {
+ var protected Headers
+ for _, option := range options {
+ switch option.Ident() {
+ case identProtectedHeaders{}:
+ if err := option.Value(&protected); err != nil {
+ panic(`jws.WithInsecureNoSignature() option must be of type Headers`)
+ }
+ }
+ }
+
+ return &signOption{
+ option.New(identInsecureNoSignature{},
+ &withInsecureNoSignature{
+ protected: protected,
+ },
+ ),
+ }
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/options.yaml b/vendor/github.com/lestrrat-go/jwx/v3/jws/options.yaml
new file mode 100644
index 0000000000..79dbb72500
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/options.yaml
@@ -0,0 +1,230 @@
+package_name: jws
+output: jws/options_gen.go
+interfaces:
+ - name: CompactOption
+ comment: |
+ CompactOption describes options that can be passed to `jws.Compact`
+ - name: VerifyOption
+ comment: |
+ VerifyOption describes options that can be passed to `jws.Verify`
+ methods:
+ - verifyOption
+ - parseOption
+ - name: SignOption
+ comment: |
+ SignOption describes options that can be passed to `jws.Sign`
+ - name: SignVerifyOption
+ methods:
+ - signOption
+ - verifyOption
+ - parseOption
+ comment: |
+ SignVerifyOption describes options that can be passed to either `jws.Verify` or `jws.Sign`
+ - name: SignVerifyCompactOption
+ methods:
+ - signOption
+ - verifyOption
+ - compactOption
+ - parseOption
+ comment: |
+ SignVerifyCompactOption describes options that can be passed to either `jws.Verify`,
+ `jws.Sign`, or `jws.Compact`
+ - name: WithJSONSuboption
+ concrete_type: withJSONSuboption
+ comment: |
+ JSONSuboption describes suboptions that can be passed to the `jws.WithJSON()` option.
+ - name: WithKeySuboption
+ comment: |
+ WithKeySuboption describes option types that can be passed to the `jws.WithKey()`
+ option.
+ - name: WithKeySetSuboption
+ comment: |
+ WithKeySetSuboption is a suboption passed to the `jws.WithKeySet()` option
+ - name: ParseOption
+ methods:
+ - readFileOption
+ comment: |
+ ReadFileOption is a type of `Option` that can be passed to `jwe.Parse`
+ - name: ReadFileOption
+ comment: |
+ ReadFileOption is a type of `Option` that can be passed to `jws.ReadFile`
+ - name: SignVerifyParseOption
+ methods:
+ - signOption
+ - verifyOption
+ - parseOption
+ - readFileOption
+ - name: GlobalOption
+ comment: |
+ GlobalOption can be passed to `jws.Settings()` to set global options for the JWS package.
+options:
+ - ident: Key
+ skip_option: true
+ - ident: Serialization
+ skip_option: true
+ - ident: Serialization
+ option_name: WithCompact
+ interface: SignVerifyParseOption
+ constant_value: fmtCompact
+ comment: |
+ WithCompact specifies that the result of `jws.Sign()` is serialized in
+ compact format.
+
+ By default `jws.Sign()` will opt to use compact format, so you usually
+ do not need to specify this option other than to be explicit about it
+ - ident: Detached
+ interface: CompactOption
+ argument_type: bool
+ comment: |
+ WithDetached specifies that the `jws.Message` should be serialized in
+ JWS compact serialization with detached payload. The resulting octet
+ sequence will not contain the payload section.
+
+ - ident: DetachedPayload
+ interface: SignVerifyOption
+ argument_type: '[]byte'
+ comment: |
+ WithDetachedPayload can be used to both sign or verify a JWS message with a
+ detached payload.
+ Note that this option does NOT populate the `b64` header, which is sometimes
+ required by other JWS implementations.
+
+
+ When this option is used for `jws.Sign()`, the first parameter (normally the payload)
+ must be set to `nil`.
+
+ If you have to verify using this option, you should know exactly how and why this works.
+ - ident: Base64Encoder
+ interface: SignVerifyCompactOption
+ argument_type: Base64Encoder
+ comment: |
+ WithBase64Encoder specifies the base64 encoder to be used while signing or
+ verifying the JWS message. By default, the raw URL base64 encoding (no padding)
+ is used.
+ - ident: Message
+ interface: VerifyOption
+ argument_type: '*Message'
+ comment: |
+ WithMessage can be passed to Verify() to obtain the jws.Message upon
+ a successful verification.
+ - ident: KeyUsed
+ interface: VerifyOption
+ argument_type: 'any'
+ comment: |
+ WithKeyUsed allows you to specify the `jws.Verify()` function to
+ return the key used for verification. This may be useful when
+ you specify multiple key sources or if you pass a `jwk.Set`
+ and you want to know which key was successful at verifying the
+ signature.
+
+ `v` must be a pointer to an empty `any`. Do not use
+ `jwk.Key` here unless you are 100% sure that all keys that you
+ have provided are instances of `jwk.Key` (remember that the
+ jwx API allows users to specify a raw key such as *rsa.PublicKey)
+ - ident: ValidateKey
+ interface: SignVerifyOption
+ argument_type: bool
+ comment: |
+ WithValidateKey specifies whether the key used for signing or verification
+ should be validated before using. Note that this means calling
+ `key.Validate()` on the key, which in turn means that your key
+ must be a `jwk.Key` instance, or a key that can be converted to
+ a `jwk.Key` by calling `jwk.Import()`. This means that your
+ custom hardware-backed keys will probably not work.
+
+ You can directly call `key.Validate()` yourself if you need to
+ mix keys that cannot be converted to `jwk.Key`.
+
+ Please also note that use of this option will also result in
+ one extra conversion of raw keys to a `jwk.Key` instance. If you
+ care about shaving off as much as possible, consider using a
+ pre-validated key instead of using this option to validate
+ the key on-demand each time.
+
+ By default, the key is not validated.
+ - ident: InferAlgorithmFromKey
+ interface: WithKeySetSuboption
+ argument_type: bool
+ comment: |
+ WithInferAlgorithmFromKey specifies whether the JWS signing algorithm name
+ should be inferred by looking at the provided key, in case the JWS
+ message or the key does not have a proper `alg` header.
+
+ When this option is set to true, a list of algorithm(s) that is compatible
+ with the key type will be enumerated, and _ALL_ of them will be tried
+ against the key/message pair. If any of them succeeds, the verification
+ will be considered successful.
+
+ Compared to providing explicit `alg` from the key this is slower, and
+ verification may fail to verify if somehow our heuristics are wrong
+ or outdated.
+
+ Also, automatic detection of signature verification methods are always
+ more vulnerable for potential attack vectors.
+
+ It is highly recommended that you fix your key to contain a proper `alg`
+ header field instead of resorting to using this option, but sometimes
+ it just needs to happen.
+ - ident: UseDefault
+ interface: WithKeySetSuboption
+ argument_type: bool
+ comment: |
+ WithUseDefault specifies that if and only if a jwk.Key contains
+ exactly one jwk.Key, that key should be used.
+ - ident: RequireKid
+ interface: WithKeySetSuboption
+ argument_type: bool
+ comment: |
+ WithRequiredKid specifies whether the keys in the jwk.Set should
+ only be matched if the target JWS message's Key ID and the Key ID
+ in the given key matches.
+ - ident: MultipleKeysPerKeyID
+ interface: WithKeySetSuboption
+ argument_type: bool
+ comment: |
+ WithMultipleKeysPerKeyID specifies if we should expect multiple keys
+ to match against a key ID. By default it is assumed that key IDs are
+ unique, i.e. for a given key ID, the key set only contains a single
+ key that has the matching ID. When this option is set to true,
+ multiple keys that match the same key ID in the set can be tried.
+ - ident: Pretty
+ interface: WithJSONSuboption
+ argument_type: bool
+ comment: |
+ WithPretty specifies whether the JSON output should be formatted and
+ indented
+ - ident: KeyProvider
+ interface: VerifyOption
+ argument_type: KeyProvider
+ - ident: Context
+ interface: VerifyOption
+ argument_type: context.Context
+ - ident: ProtectedHeaders
+ interface: WithKeySuboption
+ argument_type: Headers
+ comment: |
+ WithProtected is used with `jws.WithKey()` option when used with `jws.Sign()`
+ to specify a protected header to be attached to the JWS signature.
+
+ It has no effect if used when `jws.WithKey()` is passed to `jws.Verify()`
+ - ident: PublicHeaders
+ interface: WithKeySuboption
+ argument_type: Headers
+ comment: |
+ WithPublic is used with `jws.WithKey()` option when used with `jws.Sign()`
+ to specify a public header to be attached to the JWS signature.
+
+ It has no effect if used when `jws.WithKey()` is passed to `jws.Verify()`
+
+ `jws.Sign()` will result in an error if `jws.WithPublic()` is used
+ and the serialization format is compact serialization.
+ - ident: FS
+ interface: ReadFileOption
+ argument_type: fs.FS
+ comment: |
+ WithFS specifies the source `fs.FS` object to read the file from.
+ - ident: LegacySigners
+ interface: GlobalOption
+ constant_value: true
+ comment: |
+ WithLegacySigners is a no-op option that exists only for backwards compatibility.
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/options_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/options_gen.go
new file mode 100644
index 0000000000..7013e86bd7
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/options_gen.go
@@ -0,0 +1,445 @@
+// Code generated by tools/cmd/genoptions/main.go. DO NOT EDIT.
+
+package jws
+
+import (
+ "context"
+ "io/fs"
+
+ "github.com/lestrrat-go/option/v2"
+)
+
+type Option = option.Interface
+
+// CompactOption describes options that can be passed to `jws.Compact`
+type CompactOption interface {
+ Option
+ compactOption()
+}
+
+type compactOption struct {
+ Option
+}
+
+func (*compactOption) compactOption() {}
+
+// GlobalOption can be passed to `jws.Settings()` to set global options for the JWS package.
+type GlobalOption interface {
+ Option
+ globalOption()
+}
+
+type globalOption struct {
+ Option
+}
+
+func (*globalOption) globalOption() {}
+
+// ReadFileOption is a type of `Option` that can be passed to `jwe.Parse`
+type ParseOption interface {
+ Option
+ readFileOption()
+}
+
+type parseOption struct {
+ Option
+}
+
+func (*parseOption) readFileOption() {}
+
+// ReadFileOption is a type of `Option` that can be passed to `jws.ReadFile`
+type ReadFileOption interface {
+ Option
+ readFileOption()
+}
+
+type readFileOption struct {
+ Option
+}
+
+func (*readFileOption) readFileOption() {}
+
+// SignOption describes options that can be passed to `jws.Sign`
+type SignOption interface {
+ Option
+ signOption()
+}
+
+type signOption struct {
+ Option
+}
+
+func (*signOption) signOption() {}
+
+// SignVerifyCompactOption describes options that can be passed to either `jws.Verify`,
+// `jws.Sign`, or `jws.Compact`
+type SignVerifyCompactOption interface {
+ Option
+ signOption()
+ verifyOption()
+ compactOption()
+ parseOption()
+}
+
+type signVerifyCompactOption struct {
+ Option
+}
+
+func (*signVerifyCompactOption) signOption() {}
+
+func (*signVerifyCompactOption) verifyOption() {}
+
+func (*signVerifyCompactOption) compactOption() {}
+
+func (*signVerifyCompactOption) parseOption() {}
+
+// SignVerifyOption describes options that can be passed to either `jws.Verify` or `jws.Sign`
+type SignVerifyOption interface {
+ Option
+ signOption()
+ verifyOption()
+ parseOption()
+}
+
+type signVerifyOption struct {
+ Option
+}
+
+func (*signVerifyOption) signOption() {}
+
+func (*signVerifyOption) verifyOption() {}
+
+func (*signVerifyOption) parseOption() {}
+
+type SignVerifyParseOption interface {
+ Option
+ signOption()
+ verifyOption()
+ parseOption()
+ readFileOption()
+}
+
+type signVerifyParseOption struct {
+ Option
+}
+
+func (*signVerifyParseOption) signOption() {}
+
+func (*signVerifyParseOption) verifyOption() {}
+
+func (*signVerifyParseOption) parseOption() {}
+
+func (*signVerifyParseOption) readFileOption() {}
+
+// VerifyOption describes options that can be passed to `jws.Verify`
+type VerifyOption interface {
+ Option
+ verifyOption()
+ parseOption()
+}
+
+type verifyOption struct {
+ Option
+}
+
+func (*verifyOption) verifyOption() {}
+
+func (*verifyOption) parseOption() {}
+
+// JSONSuboption describes suboptions that can be passed to the `jws.WithJSON()` option.
+type WithJSONSuboption interface {
+ Option
+ withJSONSuboption()
+}
+
+type withJSONSuboption struct {
+ Option
+}
+
+func (*withJSONSuboption) withJSONSuboption() {}
+
+// WithKeySetSuboption is a suboption passed to the `jws.WithKeySet()` option
+type WithKeySetSuboption interface {
+ Option
+ withKeySetSuboption()
+}
+
+type withKeySetSuboption struct {
+ Option
+}
+
+func (*withKeySetSuboption) withKeySetSuboption() {}
+
+// WithKeySuboption describes option types that can be passed to the `jws.WithKey()`
+// option.
+type WithKeySuboption interface {
+ Option
+ withKeySuboption()
+}
+
+type withKeySuboption struct {
+ Option
+}
+
+func (*withKeySuboption) withKeySuboption() {}
+
+type identBase64Encoder struct{}
+type identContext struct{}
+type identDetached struct{}
+type identDetachedPayload struct{}
+type identFS struct{}
+type identInferAlgorithmFromKey struct{}
+type identKey struct{}
+type identKeyProvider struct{}
+type identKeyUsed struct{}
+type identLegacySigners struct{}
+type identMessage struct{}
+type identMultipleKeysPerKeyID struct{}
+type identPretty struct{}
+type identProtectedHeaders struct{}
+type identPublicHeaders struct{}
+type identRequireKid struct{}
+type identSerialization struct{}
+type identUseDefault struct{}
+type identValidateKey struct{}
+
+func (identBase64Encoder) String() string {
+ return "WithBase64Encoder"
+}
+
+func (identContext) String() string {
+ return "WithContext"
+}
+
+func (identDetached) String() string {
+ return "WithDetached"
+}
+
+func (identDetachedPayload) String() string {
+ return "WithDetachedPayload"
+}
+
+func (identFS) String() string {
+ return "WithFS"
+}
+
+func (identInferAlgorithmFromKey) String() string {
+ return "WithInferAlgorithmFromKey"
+}
+
+func (identKey) String() string {
+ return "WithKey"
+}
+
+func (identKeyProvider) String() string {
+ return "WithKeyProvider"
+}
+
+func (identKeyUsed) String() string {
+ return "WithKeyUsed"
+}
+
+func (identLegacySigners) String() string {
+ return "WithLegacySigners"
+}
+
+func (identMessage) String() string {
+ return "WithMessage"
+}
+
+func (identMultipleKeysPerKeyID) String() string {
+ return "WithMultipleKeysPerKeyID"
+}
+
+func (identPretty) String() string {
+ return "WithPretty"
+}
+
+func (identProtectedHeaders) String() string {
+ return "WithProtectedHeaders"
+}
+
+func (identPublicHeaders) String() string {
+ return "WithPublicHeaders"
+}
+
+func (identRequireKid) String() string {
+ return "WithRequireKid"
+}
+
+func (identSerialization) String() string {
+ return "WithSerialization"
+}
+
+func (identUseDefault) String() string {
+ return "WithUseDefault"
+}
+
+func (identValidateKey) String() string {
+ return "WithValidateKey"
+}
+
+// WithBase64Encoder specifies the base64 encoder to be used while signing or
+// verifying the JWS message. By default, the raw URL base64 encoding (no padding)
+// is used.
+func WithBase64Encoder(v Base64Encoder) SignVerifyCompactOption {
+ return &signVerifyCompactOption{option.New(identBase64Encoder{}, v)}
+}
+
+func WithContext(v context.Context) VerifyOption {
+ return &verifyOption{option.New(identContext{}, v)}
+}
+
+// WithDetached specifies that the `jws.Message` should be serialized in
+// JWS compact serialization with detached payload. The resulting octet
+// sequence will not contain the payload section.
+func WithDetached(v bool) CompactOption {
+ return &compactOption{option.New(identDetached{}, v)}
+}
+
+// WithDetachedPayload can be used to both sign or verify a JWS message with a
+// detached payload.
+// Note that this option does NOT populate the `b64` header, which is sometimes
+// required by other JWS implementations.
+//
+// When this option is used for `jws.Sign()`, the first parameter (normally the payload)
+// must be set to `nil`.
+//
+// If you have to verify using this option, you should know exactly how and why this works.
+func WithDetachedPayload(v []byte) SignVerifyOption {
+ return &signVerifyOption{option.New(identDetachedPayload{}, v)}
+}
+
+// WithFS specifies the source `fs.FS` object to read the file from.
+func WithFS(v fs.FS) ReadFileOption {
+ return &readFileOption{option.New(identFS{}, v)}
+}
+
+// WithInferAlgorithmFromKey specifies whether the JWS signing algorithm name
+// should be inferred by looking at the provided key, in case the JWS
+// message or the key does not have a proper `alg` header.
+//
+// When this option is set to true, a list of algorithm(s) that is compatible
+// with the key type will be enumerated, and _ALL_ of them will be tried
+// against the key/message pair. If any of them succeeds, the verification
+// will be considered successful.
+//
+// Compared to providing explicit `alg` from the key this is slower, and
+// verification may fail to verify if somehow our heuristics are wrong
+// or outdated.
+//
+// Also, automatic detection of signature verification methods are always
+// more vulnerable for potential attack vectors.
+//
+// It is highly recommended that you fix your key to contain a proper `alg`
+// header field instead of resorting to using this option, but sometimes
+// it just needs to happen.
+func WithInferAlgorithmFromKey(v bool) WithKeySetSuboption {
+ return &withKeySetSuboption{option.New(identInferAlgorithmFromKey{}, v)}
+}
+
+func WithKeyProvider(v KeyProvider) VerifyOption {
+ return &verifyOption{option.New(identKeyProvider{}, v)}
+}
+
+// WithKeyUsed allows you to specify the `jws.Verify()` function to
+// return the key used for verification. This may be useful when
+// you specify multiple key sources or if you pass a `jwk.Set`
+// and you want to know which key was successful at verifying the
+// signature.
+//
+// `v` must be a pointer to an empty `any`. Do not use
+// `jwk.Key` here unless you are 100% sure that all keys that you
+// have provided are instances of `jwk.Key` (remember that the
+// jwx API allows users to specify a raw key such as *rsa.PublicKey)
+func WithKeyUsed(v any) VerifyOption {
+ return &verifyOption{option.New(identKeyUsed{}, v)}
+}
+
+// WithLegacySigners is a no-op option that exists only for backwards compatibility.
+func WithLegacySigners() GlobalOption {
+ return &globalOption{option.New(identLegacySigners{}, true)}
+}
+
+// WithMessage can be passed to Verify() to obtain the jws.Message upon
+// a successful verification.
+func WithMessage(v *Message) VerifyOption {
+ return &verifyOption{option.New(identMessage{}, v)}
+}
+
+// WithMultipleKeysPerKeyID specifies if we should expect multiple keys
+// to match against a key ID. By default it is assumed that key IDs are
+// unique, i.e. for a given key ID, the key set only contains a single
+// key that has the matching ID. When this option is set to true,
+// multiple keys that match the same key ID in the set can be tried.
+func WithMultipleKeysPerKeyID(v bool) WithKeySetSuboption {
+ return &withKeySetSuboption{option.New(identMultipleKeysPerKeyID{}, v)}
+}
+
+// WithPretty specifies whether the JSON output should be formatted and
+// indented
+func WithPretty(v bool) WithJSONSuboption {
+ return &withJSONSuboption{option.New(identPretty{}, v)}
+}
+
+// WithProtected is used with `jws.WithKey()` option when used with `jws.Sign()`
+// to specify a protected header to be attached to the JWS signature.
+//
+// It has no effect if used when `jws.WithKey()` is passed to `jws.Verify()`
+func WithProtectedHeaders(v Headers) WithKeySuboption {
+ return &withKeySuboption{option.New(identProtectedHeaders{}, v)}
+}
+
+// WithPublic is used with `jws.WithKey()` option when used with `jws.Sign()`
+// to specify a public header to be attached to the JWS signature.
+//
+// It has no effect if used when `jws.WithKey()` is passed to `jws.Verify()`
+//
+// `jws.Sign()` will result in an error if `jws.WithPublic()` is used
+// and the serialization format is compact serialization.
+func WithPublicHeaders(v Headers) WithKeySuboption {
+ return &withKeySuboption{option.New(identPublicHeaders{}, v)}
+}
+
+// WithRequiredKid specifies whether the keys in the jwk.Set should
+// only be matched if the target JWS message's Key ID and the Key ID
+// in the given key matches.
+func WithRequireKid(v bool) WithKeySetSuboption {
+ return &withKeySetSuboption{option.New(identRequireKid{}, v)}
+}
+
+// WithCompact specifies that the result of `jws.Sign()` is serialized in
+// compact format.
+//
+// By default `jws.Sign()` will opt to use compact format, so you usually
+// do not need to specify this option other than to be explicit about it
+func WithCompact() SignVerifyParseOption {
+ return &signVerifyParseOption{option.New(identSerialization{}, fmtCompact)}
+}
+
+// WithUseDefault specifies that if and only if a jwk.Key contains
+// exactly one jwk.Key, that key should be used.
+func WithUseDefault(v bool) WithKeySetSuboption {
+ return &withKeySetSuboption{option.New(identUseDefault{}, v)}
+}
+
+// WithValidateKey specifies whether the key used for signing or verification
+// should be validated before using. Note that this means calling
+// `key.Validate()` on the key, which in turn means that your key
+// must be a `jwk.Key` instance, or a key that can be converted to
+// a `jwk.Key` by calling `jwk.Import()`. This means that your
+// custom hardware-backed keys will probably not work.
+//
+// You can directly call `key.Validate()` yourself if you need to
+// mix keys that cannot be converted to `jwk.Key`.
+//
+// Please also note that use of this option will also result in
+// one extra conversion of raw keys to a `jwk.Key` instance. If you
+// care about shaving off as much as possible, consider using a
+// pre-validated key instead of using this option to validate
+// the key on-demand each time.
+//
+// By default, the key is not validated.
+func WithValidateKey(v bool) SignVerifyOption {
+ return &signVerifyOption{option.New(identValidateKey{}, v)}
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/sign_context.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/sign_context.go
new file mode 100644
index 0000000000..49abe0abca
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/sign_context.go
@@ -0,0 +1,141 @@
+package jws
+
+import (
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+type signContext struct {
+ format int
+ detached bool
+ validateKey bool
+ payload []byte
+ encoder Base64Encoder
+ none *signatureBuilder // special signature builder
+ sigbuilders []*signatureBuilder
+}
+
+var signContextPool = pool.New[*signContext](allocSignContext, freeSignContext)
+
+func allocSignContext() *signContext {
+ return &signContext{
+ format: fmtCompact,
+ sigbuilders: make([]*signatureBuilder, 0, 1),
+ encoder: base64.DefaultEncoder(),
+ }
+}
+
+func freeSignContext(ctx *signContext) *signContext {
+ ctx.format = fmtCompact
+ for _, sb := range ctx.sigbuilders {
+ signatureBuilderPool.Put(sb)
+ }
+ ctx.sigbuilders = ctx.sigbuilders[:0]
+ ctx.detached = false
+ ctx.validateKey = false
+ ctx.encoder = base64.DefaultEncoder()
+ ctx.none = nil
+ ctx.payload = nil
+
+ return ctx
+}
+
+func (sc *signContext) ProcessOptions(options []SignOption) error {
+ for _, option := range options {
+ switch option.Ident() {
+ case identSerialization{}:
+ if err := option.Value(&sc.format); err != nil {
+ return signerr(`failed to retrieve serialization option value: %w`, err)
+ }
+ case identInsecureNoSignature{}:
+ var data withInsecureNoSignature
+ if err := option.Value(&data); err != nil {
+ return signerr(`failed to retrieve insecure-no-signature option value: %w`, err)
+ }
+ sb := signatureBuilderPool.Get()
+ sb.alg = jwa.NoSignature()
+ sb.protected = data.protected
+ sb.signer = noneSigner{}
+ sc.none = sb
+ sc.sigbuilders = append(sc.sigbuilders, sb)
+ case identKey{}:
+ var data *withKey
+ if err := option.Value(&data); err != nil {
+ return signerr(`jws.Sign: invalid value for WithKey option: %w`, err)
+ }
+
+ alg, ok := data.alg.(jwa.SignatureAlgorithm)
+ if !ok {
+ return signerr(`expected algorithm to be of type jwa.SignatureAlgorithm but got (%[1]q, %[1]T)`, data.alg)
+ }
+
+ // No, we don't accept "none" here.
+ if alg == jwa.NoSignature() {
+ return signerr(`"none" (jwa.NoSignature) cannot be used with jws.WithKey`)
+ }
+
+ sb := signatureBuilderPool.Get()
+ sb.alg = alg
+ sb.protected = data.protected
+ sb.key = data.key
+ sb.public = data.public
+
+ s2, err := SignerFor(alg)
+ if err == nil {
+ sb.signer2 = s2
+ } else {
+ s1, err := legacySignerFor(alg)
+ if err != nil {
+ sb.signer2 = defaultSigner{alg: alg}
+ } else {
+ sb.signer = s1
+ }
+ }
+
+ sc.sigbuilders = append(sc.sigbuilders, sb)
+ case identDetachedPayload{}:
+ if sc.payload != nil {
+ return signerr(`payload must be nil when jws.WithDetachedPayload() is specified`)
+ }
+ if err := option.Value(&sc.payload); err != nil {
+ return signerr(`failed to retrieve detached payload option value: %w`, err)
+ }
+ sc.detached = true
+ case identValidateKey{}:
+ if err := option.Value(&sc.validateKey); err != nil {
+ return signerr(`failed to retrieve validate-key option value: %w`, err)
+ }
+ case identBase64Encoder{}:
+ if err := option.Value(&sc.encoder); err != nil {
+ return signerr(`failed to retrieve base64-encoder option value: %w`, err)
+ }
+ }
+ }
+ return nil
+}
+
+func (sc *signContext) PopulateMessage(m *Message) error {
+ m.payload = sc.payload
+ m.signatures = make([]*Signature, 0, len(sc.sigbuilders))
+
+ for i, sb := range sc.sigbuilders {
+ // Create signature for each builders
+ if sc.validateKey {
+ if err := validateKeyBeforeUse(sb.key); err != nil {
+ return fmt.Errorf(`failed to validate key for signature %d: %w`, i, err)
+ }
+ }
+
+ sig, err := sb.Build(sc, m.payload)
+ if err != nil {
+ return fmt.Errorf(`failed to build signature %d: %w`, i, err)
+ }
+
+ m.signatures = append(m.signatures, sig)
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/signature_builder.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/signature_builder.go
new file mode 100644
index 0000000000..fc09a69367
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/signature_builder.go
@@ -0,0 +1,118 @@
+package jws
+
+import (
+ "bytes"
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwk"
+ "github.com/lestrrat-go/jwx/v3/jws/jwsbb"
+)
+
+var signatureBuilderPool = pool.New[*signatureBuilder](allocSignatureBuilder, freeSignatureBuilder)
+
+// signatureBuilder is a transient object that is used to build
+// a single JWS signature.
+//
+// In a multi-signature JWS message, each message is paired with
+// the following:
+// - a signer (the object that takes a buffer and key and generates a signature)
+// - a key (the key that is used to sign the payload)
+// - protected headers (the headers that are protected by the signature)
+// - public headers (the headers that are not protected by the signature)
+//
+// This object stores all of this information in one place.
+//
+// This object does NOT take care of any synchronization, because it is
+// meant to be used in a single-threaded context.
+type signatureBuilder struct {
+ alg jwa.SignatureAlgorithm
+ signer Signer
+ signer2 Signer2
+ key any
+ protected Headers
+ public Headers
+}
+
+func allocSignatureBuilder() *signatureBuilder {
+ return &signatureBuilder{}
+}
+
+func freeSignatureBuilder(sb *signatureBuilder) *signatureBuilder {
+ sb.alg = jwa.EmptySignatureAlgorithm()
+ sb.signer = nil
+ sb.signer2 = nil
+ sb.key = nil
+ sb.protected = nil
+ sb.public = nil
+ return sb
+}
+
+func (sb *signatureBuilder) Build(sc *signContext, payload []byte) (*Signature, error) {
+ protected := sb.protected
+ if protected == nil {
+ protected = NewHeaders()
+ }
+
+ if err := protected.Set(AlgorithmKey, sb.alg); err != nil {
+ return nil, signerr(`failed to set "alg" header: %w`, err)
+ }
+
+ if key, ok := sb.key.(jwk.Key); ok {
+ if kid, ok := key.KeyID(); ok && kid != "" {
+ if err := protected.Set(KeyIDKey, kid); err != nil {
+ return nil, signerr(`failed to set "kid" header: %w`, err)
+ }
+ }
+ }
+
+ hdrs, err := mergeHeaders(sb.public, protected)
+ if err != nil {
+ return nil, signerr(`failed to merge headers: %w`, err)
+ }
+
+ // raw, json format headers
+ hdrbuf, err := json.Marshal(hdrs)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to marshal headers: %w`, err)
+ }
+
+ // check if we need to base64 encode the payload
+ b64 := getB64Value(hdrs)
+ if !b64 && !sc.detached {
+ if bytes.IndexByte(payload, tokens.Period) != -1 {
+ return nil, fmt.Errorf(`payload must not contain a "."`)
+ }
+ }
+
+ combined := jwsbb.SignBuffer(nil, hdrbuf, payload, sc.encoder, b64)
+
+ var sig Signature
+ sig.protected = protected
+ sig.headers = sb.public
+
+ if sb.signer2 != nil {
+ signature, err := sb.signer2.Sign(sb.key, combined)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to sign payload: %w`, err)
+ }
+ sig.signature = signature
+ return &sig, nil
+ }
+
+ if sb.signer == nil {
+ panic("can't get here")
+ }
+
+ signature, err := sb.signer.Sign(combined, sb.key)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to sign payload: %w`, err)
+ }
+
+ sig.signature = signature
+
+ return &sig, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/signer.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/signer.go
new file mode 100644
index 0000000000..99005e859a
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/signer.go
@@ -0,0 +1,185 @@
+package jws
+
+import (
+ "fmt"
+ "strings"
+ "sync"
+
+ "github.com/lestrrat-go/jwx/v3/jwa"
+)
+
+// Signer2 is an interface that represents a per-signature algorithm signing
+// operation.
+type Signer2 interface {
+ Algorithm() jwa.SignatureAlgorithm
+
+ // Sign takes a key and a payload, and returns the signature for the payload.
+ // The key type is restricted by the signature algorithm that this
+ // signer is associated with.
+ //
+ // (Note to users of legacy Signer interface: the method signature
+ // is different from the legacy Signer interface)
+ Sign(key any, payload []byte) ([]byte, error)
+}
+
+var muSigner2DB sync.RWMutex
+var signer2DB = make(map[jwa.SignatureAlgorithm]Signer2)
+
+type SignerFactory interface {
+ Create() (Signer, error)
+}
+type SignerFactoryFn func() (Signer, error)
+
+func (fn SignerFactoryFn) Create() (Signer, error) {
+ return fn()
+}
+
+func init() {
+ // register the signers using jwsbb. These will be used by default.
+ for _, alg := range jwa.SignatureAlgorithms() {
+ if alg == jwa.NoSignature() {
+ continue
+ }
+
+ if err := RegisterSigner(alg, defaultSigner{alg: alg}); err != nil {
+ panic(fmt.Sprintf("RegisterSigner failed: %v", err))
+ }
+ }
+}
+
+// SignerFor returns a Signer2 for the given signature algorithm.
+//
+// Currently, this function will never fail. It will always return a
+// valid Signer2 object. The heuristic is as follows:
+// 1. If a Signer2 is registered for the given algorithm, it will return that.
+// 2. If a legacy Signer(Factory) is registered for the given algorithm, it will
+// return a Signer2 that wraps the legacy Signer.
+// 3. If no Signer2 or legacy Signer(Factory) is registered, it will return a
+// default signer that uses jwsbb.Sign.
+//
+// 1 and 2 will take care of 99% of the cases. The only time 3 will happen is
+// when you are using a custom algorithm that is not supported out of the box.
+//
+// jwsbb.Sign knows how to handle a static set of algorithms, so if the
+// algorithm is not supported, it will return an error when you call
+// `Sign` on the default signer.
+func SignerFor(alg jwa.SignatureAlgorithm) (Signer2, error) {
+ muSigner2DB.RLock()
+ defer muSigner2DB.RUnlock()
+
+ signer, ok := signer2DB[alg]
+ if ok {
+ return signer, nil
+ }
+
+ s1, err := legacySignerFor(alg)
+ if err == nil {
+ return signerAdapter{signer: s1}, nil
+ }
+
+ return defaultSigner{alg: alg}, nil
+}
+
+var muSignerDB sync.RWMutex
+var signerDB = make(map[jwa.SignatureAlgorithm]SignerFactory)
+
+// RegisterSigner is used to register a signer for the given
+// algorithm.
+//
+// Please note that this function is intended to be passed a
+// signer object as its second argument, but due to historical
+// reasons the function signature is defined as taking `any` type.
+//
+// You should create a signer object that implements the `Signer2`
+// interface to register a signer, unless you have legacy code that
+// plugged into the `SignerFactory` interface.
+//
+// Unlike the `UnregisterSigner` function, this function automatically
+// calls `jwa.RegisterSignatureAlgorithm` to register the algorithm
+// in this module's algorithm database.
+//
+// For backwards compatibility, this function also accepts
+// `SignerFactory` implementations, but this usage is deprecated.
+// You should use `Signer2` implementations instead.
+//
+// If you want to completely remove an algorithm, you must call
+// `jwa.UnregisterSignatureAlgorithm` yourself after calling
+// `UnregisterSigner`.
+func RegisterSigner(alg jwa.SignatureAlgorithm, f any) error {
+ jwa.RegisterSignatureAlgorithm(alg)
+ switch s := f.(type) {
+ case Signer2:
+ muSigner2DB.Lock()
+ signer2DB[alg] = s
+ muSigner2DB.Unlock()
+ case SignerFactory:
+ muSignerDB.Lock()
+ signerDB[alg] = s
+ muSignerDB.Unlock()
+ default:
+ return fmt.Errorf(`jws.RegisterSigner: unsupported type %T for algorithm %q`, f, alg)
+ }
+ return nil
+}
+
+// UnregisterSigner removes the signer factory associated with
+// the given algorithm, as well as the signer instance created
+// by the factory.
+//
+// Note that when you call this function, the algorithm itself is
+// not automatically unregistered from this module's algorithm database.
+// This is because the algorithm may still be required for verification or
+// some other operation (however unlikely, it is still possible).
+// Therefore, in order to completely remove the algorithm, you must
+// call `jwa.UnregisterSignatureAlgorithm` yourself.
+func UnregisterSigner(alg jwa.SignatureAlgorithm) {
+ muSigner2DB.Lock()
+ delete(signer2DB, alg)
+ muSigner2DB.Unlock()
+
+ muSignerDB.Lock()
+ delete(signerDB, alg)
+ muSignerDB.Unlock()
+ // Remove previous signer
+ removeSigner(alg)
+}
+
+// NewSigner creates a signer that signs payloads using the given signature algorithm.
+// This function is deprecated, and will either be removed to re-purposed using
+// a different signature.
+//
+// When you want to load a Signer object, you should use `SignerFor()` instead.
+func NewSigner(alg jwa.SignatureAlgorithm) (Signer, error) {
+ s, err := newLegacySigner(alg)
+ if err == nil {
+ return s, nil
+ }
+
+ if strings.HasPrefix(err.Error(), `jws.NewSigner: unsupported signature algorithm`) {
+ // When newLegacySigner fails, automatically trigger to enable signers
+ enableLegacySignersOnce.Do(enableLegacySigners)
+ return newLegacySigner(alg)
+ }
+ return nil, err
+}
+
+func newLegacySigner(alg jwa.SignatureAlgorithm) (Signer, error) {
+ muSignerDB.RLock()
+ f, ok := signerDB[alg]
+ muSignerDB.RUnlock()
+
+ if ok {
+ return f.Create()
+ }
+ return nil, fmt.Errorf(`jws.NewSigner: unsupported signature algorithm "%s"`, alg)
+}
+
+type noneSigner struct{}
+
+func (noneSigner) Algorithm() jwa.SignatureAlgorithm {
+ return jwa.NoSignature()
+}
+
+func (noneSigner) Sign([]byte, any) ([]byte, error) {
+ return nil, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/verifier.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/verifier.go
new file mode 100644
index 0000000000..70b91c2938
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/verifier.go
@@ -0,0 +1,154 @@
+package jws
+
+import (
+ "fmt"
+ "sync"
+
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jws/jwsbb"
+)
+
+type defaultVerifier struct {
+ alg jwa.SignatureAlgorithm
+}
+
+func (v defaultVerifier) Algorithm() jwa.SignatureAlgorithm {
+ return v.alg
+}
+
+func (v defaultVerifier) Verify(key any, payload, signature []byte) error {
+ if err := jwsbb.Verify(key, v.alg.String(), payload, signature); err != nil {
+ return verifyError{verificationError{err}}
+ }
+ return nil
+}
+
+type Verifier2 interface {
+ Verify(key any, payload, signature []byte) error
+}
+
+var muVerifier2DB sync.RWMutex
+var verifier2DB = make(map[jwa.SignatureAlgorithm]Verifier2)
+
+type verifierAdapter struct {
+ v Verifier
+}
+
+func (v verifierAdapter) Verify(key any, payload, signature []byte) error {
+ if err := v.v.Verify(payload, signature, key); err != nil {
+ return verifyError{verificationError{err}}
+ }
+ return nil
+}
+
+// VerifierFor returns a Verifier2 for the given signature algorithm.
+//
+// Currently, this function will never fail. It will always return a
+// valid Verifier2 object. The heuristic is as follows:
+// 1. If a Verifier2 is registered for the given algorithm, it will return that.
+// 2. If a legacy Verifier(Factory) is registered for the given algorithm, it will
+// return a Verifier2 that wraps the legacy Verifier.
+// 3. If no Verifier2 or legacy Verifier(Factory) is registered, it will return a
+// default verifier that uses jwsbb.Verify.
+//
+// jwsbb.Verify knows how to handle a static set of algorithms, so if the
+// algorithm is not supported, it will return an error when you call
+// `Verify` on the default verifier.
+func VerifierFor(alg jwa.SignatureAlgorithm) (Verifier2, error) {
+ muVerifier2DB.RLock()
+ defer muVerifier2DB.RUnlock()
+
+ v2, ok := verifier2DB[alg]
+ if ok {
+ return v2, nil
+ }
+
+ v1, err := NewVerifier(alg)
+ if err == nil {
+ return verifierAdapter{v: v1}, nil
+ }
+
+ return defaultVerifier{alg: alg}, nil
+}
+
+type VerifierFactory interface {
+ Create() (Verifier, error)
+}
+type VerifierFactoryFn func() (Verifier, error)
+
+func (fn VerifierFactoryFn) Create() (Verifier, error) {
+ return fn()
+}
+
+var muVerifierDB sync.RWMutex
+var verifierDB = make(map[jwa.SignatureAlgorithm]VerifierFactory)
+
+// RegisterVerifier is used to register a verifier for the given
+// algorithm.
+//
+// Please note that this function is intended to be passed a
+// verifier object as its second argument, but due to historical
+// reasons the function signature is defined as taking `any` type.
+//
+// You should create a signer object that implements the `Verifier2`
+// interface to register a signer, unless you have legacy code that
+// plugged into the `SignerFactory` interface.
+//
+// Unlike the `UnregisterVerifier` function, this function automatically
+// calls `jwa.RegisterSignatureAlgorithm` to register the algorithm
+// in this module's algorithm database.
+func RegisterVerifier(alg jwa.SignatureAlgorithm, f any) error {
+ jwa.RegisterSignatureAlgorithm(alg)
+ switch v := f.(type) {
+ case Verifier2:
+ muVerifier2DB.Lock()
+ verifier2DB[alg] = v
+ muVerifier2DB.Unlock()
+
+ muVerifierDB.Lock()
+ delete(verifierDB, alg)
+ muVerifierDB.Unlock()
+ case VerifierFactory:
+ muVerifierDB.Lock()
+ verifierDB[alg] = v
+ muVerifierDB.Unlock()
+
+ muVerifier2DB.Lock()
+ delete(verifier2DB, alg)
+ muVerifier2DB.Unlock()
+ default:
+ return fmt.Errorf(`jws.RegisterVerifier: unsupported type %T for algorithm %q`, f, alg)
+ }
+ return nil
+}
+
+// UnregisterVerifier removes the signer factory associated with
+// the given algorithm.
+//
+// Note that when you call this function, the algorithm itself is
+// not automatically unregistered from this module's algorithm database.
+// This is because the algorithm may still be required for signing or
+// some other operation (however unlikely, it is still possible).
+// Therefore, in order to completely remove the algorithm, you must
+// call `jwa.UnregisterSignatureAlgorithm` yourself.
+func UnregisterVerifier(alg jwa.SignatureAlgorithm) {
+ muVerifier2DB.Lock()
+ delete(verifier2DB, alg)
+ muVerifier2DB.Unlock()
+
+ muVerifierDB.Lock()
+ delete(verifierDB, alg)
+ muVerifierDB.Unlock()
+}
+
+// NewVerifier creates a verifier that signs payloads using the given signature algorithm.
+func NewVerifier(alg jwa.SignatureAlgorithm) (Verifier, error) {
+ muVerifierDB.RLock()
+ f, ok := verifierDB[alg]
+ muVerifierDB.RUnlock()
+
+ if ok {
+ return f.Create()
+ }
+ return nil, fmt.Errorf(`jws.NewVerifier: unsupported signature algorithm "%s"`, alg)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jws/verify_context.go b/vendor/github.com/lestrrat-go/jwx/v3/jws/verify_context.go
new file mode 100644
index 0000000000..b4807d569c
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jws/verify_context.go
@@ -0,0 +1,211 @@
+package jws
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "strings"
+
+ "github.com/lestrrat-go/blackmagic"
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jws/jwsbb"
+)
+
+// verifyContext holds the state during JWS verification
+type verifyContext struct {
+ parseOptions []ParseOption
+ dst *Message
+ detachedPayload []byte
+ keyProviders []KeyProvider
+ keyUsed any
+ validateKey bool
+ encoder Base64Encoder
+ //nolint:containedctx
+ ctx context.Context
+}
+
+var verifyContextPool = pool.New[*verifyContext](allocVerifyContext, freeVerifyContext)
+
+func allocVerifyContext() *verifyContext {
+ return &verifyContext{
+ encoder: base64.DefaultEncoder(),
+ ctx: context.Background(),
+ }
+}
+
+func freeVerifyContext(vc *verifyContext) *verifyContext {
+ vc.parseOptions = vc.parseOptions[:0]
+ vc.dst = nil
+ vc.detachedPayload = nil
+ vc.keyProviders = vc.keyProviders[:0]
+ vc.keyUsed = nil
+ vc.validateKey = false
+ vc.encoder = base64.DefaultEncoder()
+ vc.ctx = context.Background()
+ return vc
+}
+
+func (vc *verifyContext) ProcessOptions(options []VerifyOption) error {
+ //nolint:forcetypeassert
+ for _, option := range options {
+ switch option.Ident() {
+ case identMessage{}:
+ if err := option.Value(&vc.dst); err != nil {
+ return verifyerr(`invalid value for option WithMessage: %w`, err)
+ }
+ case identDetachedPayload{}:
+ if err := option.Value(&vc.detachedPayload); err != nil {
+ return verifyerr(`invalid value for option WithDetachedPayload: %w`, err)
+ }
+ case identKey{}:
+ var pair *withKey
+ if err := option.Value(&pair); err != nil {
+ return verifyerr(`invalid value for option WithKey: %w`, err)
+ }
+ vc.keyProviders = append(vc.keyProviders, &staticKeyProvider{
+ alg: pair.alg.(jwa.SignatureAlgorithm),
+ key: pair.key,
+ })
+ case identKeyProvider{}:
+ var kp KeyProvider
+ if err := option.Value(&kp); err != nil {
+ return verifyerr(`failed to retrieve key-provider option value: %w`, err)
+ }
+ vc.keyProviders = append(vc.keyProviders, kp)
+ case identKeyUsed{}:
+ if err := option.Value(&vc.keyUsed); err != nil {
+ return verifyerr(`failed to retrieve key-used option value: %w`, err)
+ }
+ case identContext{}:
+ if err := option.Value(&vc.ctx); err != nil {
+ return verifyerr(`failed to retrieve context option value: %w`, err)
+ }
+ case identValidateKey{}:
+ if err := option.Value(&vc.validateKey); err != nil {
+ return verifyerr(`failed to retrieve validate-key option value: %w`, err)
+ }
+ case identSerialization{}:
+ vc.parseOptions = append(vc.parseOptions, option.(ParseOption))
+ case identBase64Encoder{}:
+ if err := option.Value(&vc.encoder); err != nil {
+ return verifyerr(`failed to retrieve base64-encoder option value: %w`, err)
+ }
+ default:
+ return verifyerr(`invalid jws.VerifyOption %q passed`, `With`+strings.TrimPrefix(fmt.Sprintf(`%T`, option.Ident()), `jws.ident`))
+ }
+ }
+
+ if len(vc.keyProviders) < 1 {
+ return verifyerr(`no key providers have been provided (see jws.WithKey(), jws.WithKeySet(), jws.WithVerifyAuto(), and jws.WithKeyProvider()`)
+ }
+
+ return nil
+}
+
+func (vc *verifyContext) VerifyMessage(buf []byte) ([]byte, error) {
+ msg, err := Parse(buf, vc.parseOptions...)
+ if err != nil {
+ return nil, verifyerr(`failed to parse jws: %w`, err)
+ }
+ defer msg.clearRaw()
+
+ if vc.detachedPayload != nil {
+ if len(msg.payload) != 0 {
+ return nil, verifyerr(`can't specify detached payload for JWS with payload`)
+ }
+
+ msg.payload = vc.detachedPayload
+ }
+
+ verifyBuf := pool.ByteSlice().Get()
+
+ // Because deferred functions bind to the current value of the variable,
+ // we can't just use `defer pool.ByteSlice().Put(verifyBuf)` here.
+ // Instead, we use a closure to reference the _variable_.
+ // it would be better if we could call it directly, but there are
+ // too many place we may return from this function
+ defer func() {
+ pool.ByteSlice().Put(verifyBuf)
+ }()
+
+ errs := pool.ErrorSlice().Get()
+ defer func() {
+ pool.ErrorSlice().Put(errs)
+ }()
+ for idx, sig := range msg.signatures {
+ var rawHeaders []byte
+ if rbp, ok := sig.protected.(interface{ rawBuffer() []byte }); ok {
+ if raw := rbp.rawBuffer(); raw != nil {
+ rawHeaders = raw
+ }
+ }
+
+ if rawHeaders == nil {
+ protected, err := json.Marshal(sig.protected)
+ if err != nil {
+ return nil, verifyerr(`failed to marshal "protected" for signature #%d: %w`, idx+1, err)
+ }
+ rawHeaders = protected
+ }
+
+ verifyBuf = verifyBuf[:0]
+ verifyBuf = jwsbb.SignBuffer(verifyBuf, rawHeaders, msg.payload, vc.encoder, msg.b64)
+ for i, kp := range vc.keyProviders {
+ var sink algKeySink
+ if err := kp.FetchKeys(vc.ctx, &sink, sig, msg); err != nil {
+ return nil, verifyerr(`key provider %d failed: %w`, i, err)
+ }
+
+ for _, pair := range sink.list {
+ // alg is converted here because pair.alg is of type jwa.KeyAlgorithm.
+ // this may seem ugly, but we're trying to avoid declaring separate
+ // structs for `alg jwa.KeyEncryptionAlgorithm` and `alg jwa.SignatureAlgorithm`
+ //nolint:forcetypeassert
+ alg := pair.alg.(jwa.SignatureAlgorithm)
+ key := pair.key
+
+ if err := vc.tryKey(verifyBuf, alg, key, msg, sig); err != nil {
+ errs = append(errs, verifyerr(`failed to verify signature #%d with key %T: %w`, idx+1, key, err))
+ continue
+ }
+
+ return msg.payload, nil
+ }
+ }
+ errs = append(errs, verifyerr(`signature #%d could not be verified with any of the keys`, idx+1))
+ }
+ return nil, verifyerr(`could not verify message using any of the signatures or keys: %w`, errors.Join(errs...))
+}
+
+func (vc *verifyContext) tryKey(verifyBuf []byte, alg jwa.SignatureAlgorithm, key any, msg *Message, sig *Signature) error {
+ if vc.validateKey {
+ if err := validateKeyBeforeUse(key); err != nil {
+ return fmt.Errorf(`failed to validate key before signing: %w`, err)
+ }
+ }
+
+ verifier, err := VerifierFor(alg)
+ if err != nil {
+ return fmt.Errorf(`failed to get verifier for algorithm %q: %w`, alg, err)
+ }
+
+ if err := verifier.Verify(key, verifyBuf, sig.signature); err != nil {
+ return verificationError{err}
+ }
+
+ // Verification succeeded
+ if vc.keyUsed != nil {
+ if err := blackmagic.AssignIfCompatible(vc.keyUsed, key); err != nil {
+ return fmt.Errorf(`failed to assign used key (%T) to %T: %w`, key, vc.keyUsed, err)
+ }
+ }
+
+ if vc.dst != nil {
+ *(vc.dst) = *msg
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jwt/BUILD.bazel
new file mode 100644
index 0000000000..86197d348a
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/BUILD.bazel
@@ -0,0 +1,72 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "jwt",
+ srcs = [
+ "builder_gen.go",
+ "errors.go",
+ "filter.go",
+ "fastpath.go",
+ "http.go",
+ "interface.go",
+ "io.go",
+ "jwt.go",
+ "options.go",
+ "options_gen.go",
+ "serialize.go",
+ "token_gen.go",
+ "token_options.go",
+ "token_options_gen.go",
+ "validate.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/jwt",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//:jwx",
+ "//internal/base64",
+ "//transform",
+ "//internal/json",
+ "//internal/tokens",
+ "//internal/pool",
+ "//jwa",
+ "//jwe",
+ "//jwk",
+ "//jws",
+ "//jws/jwsbb",
+ "//jwt/internal/types",
+ "//jwt/internal/errors",
+ "@com_github_lestrrat_go_blackmagic//:blackmagic",
+ "@com_github_lestrrat_go_option_v2//:option",
+ ],
+)
+
+go_test(
+ name = "jwt_test",
+ srcs = [
+ "jwt_test.go",
+ "options_gen_test.go",
+ "token_options_test.go",
+ "token_test.go",
+ "validate_test.go",
+ "verify_test.go",
+ ],
+ embed = [":jwt"],
+ deps = [
+ "//internal/json",
+ "//internal/jwxtest",
+ "//jwa",
+ "//jwe",
+ "//jwk",
+ "//jwk/ecdsa",
+ "//jws",
+ "//jwt/internal/types",
+ "@com_github_lestrrat_go_httprc_v3//:httprc",
+ "@com_github_stretchr_testify//require",
+ ],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":jwt",
+ visibility = ["//visibility:public"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/README.md b/vendor/github.com/lestrrat-go/jwx/v3/jwt/README.md
new file mode 100644
index 0000000000..a6b5664c94
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/README.md
@@ -0,0 +1,224 @@
+# JWT [](https://pkg.go.dev/github.com/lestrrat-go/jwx/v3/jwt)
+
+Package jwt implements JSON Web Tokens as described in [RFC7519](https://tools.ietf.org/html/rfc7519).
+
+* Convenience methods for oft-used keys ("aud", "sub", "iss", etc)
+* Convenience functions to extract/parse from http.Request, http.Header, url.Values
+* Ability to Get/Set arbitrary keys
+* Conversion to and from JSON
+* Generate signed tokens
+* Verify signed tokens
+* Extra support for OpenID tokens via [github.com/lestrrat-go/jwx/v3/jwt/openid](./jwt/openid)
+
+How-to style documentation can be found in the [docs directory](../docs).
+
+More examples are located in the examples directory ([jwt_example_test.go](../examples/jwt_example_test.go))
+
+# SYNOPSIS
+
+## Verify a signed JWT
+
+```go
+ token, err := jwt.Parse(payload, jwt.WithKey(alg, key))
+ if err != nil {
+ fmt.Printf("failed to parse payload: %s\n", err)
+ }
+```
+
+## Token Usage
+
+```go
+func ExampleJWT() {
+ const aLongLongTimeAgo = 233431200
+
+ t := jwt.New()
+ t.Set(jwt.SubjectKey, `https://github.com/lestrrat-go/jwx/v3/jwt`)
+ t.Set(jwt.AudienceKey, `Golang Users`)
+ t.Set(jwt.IssuedAtKey, time.Unix(aLongLongTimeAgo, 0))
+ t.Set(`privateClaimKey`, `Hello, World!`)
+
+ buf, err := json.MarshalIndent(t, "", " ")
+ if err != nil {
+ fmt.Printf("failed to generate JSON: %s\n", err)
+ return
+ }
+
+ fmt.Printf("%s\n", buf)
+ fmt.Printf("aud -> '%s'\n", t.Audience())
+ fmt.Printf("iat -> '%s'\n", t.IssuedAt().Format(time.RFC3339))
+ if v, ok := t.Get(`privateClaimKey`); ok {
+ fmt.Printf("privateClaimKey -> '%s'\n", v)
+ }
+ fmt.Printf("sub -> '%s'\n", t.Subject())
+
+ key, err := rsa.GenerateKey(rand.Reader, 2048)
+ if err != nil {
+ log.Printf("failed to generate private key: %s", err)
+ return
+ }
+
+ {
+ // Signing a token (using raw rsa.PrivateKey)
+ signed, err := jwt.Sign(t, jwt.WithKey(jwa.RS256, key))
+ if err != nil {
+ log.Printf("failed to sign token: %s", err)
+ return
+ }
+ _ = signed
+ }
+
+ {
+ // Signing a token (using JWK)
+ jwkKey, err := jwk.New(key)
+ if err != nil {
+ log.Printf("failed to create JWK key: %s", err)
+ return
+ }
+
+ signed, err := jwt.Sign(t, jwt.WithKey(jwa.RS256, jwkKey))
+ if err != nil {
+ log.Printf("failed to sign token: %s", err)
+ return
+ }
+ _ = signed
+ }
+}
+```
+
+## OpenID Claims
+
+`jwt` package can work with token types other than the default one.
+For OpenID claims, use the token created by `openid.New()`, or
+use the `jwt.WithToken(openid.New())`. If you need to use other specialized
+claims, use `jwt.WithToken()` to specify the exact token type
+
+```go
+func Example_openid() {
+ const aLongLongTimeAgo = 233431200
+
+ t := openid.New()
+ t.Set(jwt.SubjectKey, `https://github.com/lestrrat-go/jwx/v3/jwt`)
+ t.Set(jwt.AudienceKey, `Golang Users`)
+ t.Set(jwt.IssuedAtKey, time.Unix(aLongLongTimeAgo, 0))
+ t.Set(`privateClaimKey`, `Hello, World!`)
+
+ addr := openid.NewAddress()
+ addr.Set(openid.AddressPostalCodeKey, `105-0011`)
+ addr.Set(openid.AddressCountryKey, `日本`)
+ addr.Set(openid.AddressRegionKey, `東京都`)
+ addr.Set(openid.AddressLocalityKey, `港区`)
+ addr.Set(openid.AddressStreetAddressKey, `芝公園 4-2-8`)
+ t.Set(openid.AddressKey, addr)
+
+ buf, err := json.MarshalIndent(t, "", " ")
+ if err != nil {
+ fmt.Printf("failed to generate JSON: %s\n", err)
+ return
+ }
+ fmt.Printf("%s\n", buf)
+
+ t2, err := jwt.Parse(buf, jwt.WithToken(openid.New()))
+ if err != nil {
+ fmt.Printf("failed to parse JSON: %s\n", err)
+ return
+ }
+ if _, ok := t2.(openid.Token); !ok {
+ fmt.Printf("using jwt.WithToken(openid.New()) creates an openid.Token instance")
+ return
+ }
+}
+```
+
+# FAQ
+
+## Why is `jwt.Token` an interface?
+
+In this package, `jwt.Token` is an interface. This is not an arbitrary choice: there are actual reason for the type being an interface.
+
+We understand that if you are migrating from another library this may be a deal breaker, but we hope you can at least appreciate the fact that this was not done arbitrarily, and that there were real technical trade offs that were evaluated.
+
+### No uninitialized tokens
+
+First and foremost, by making it an interface, you cannot use an uninitialized token:
+
+```go
+var token1 jwt.Token // this is nil, you can't just start using this
+if err := json.Unmarshal(data, &token1); err != nil { // so you can't do this
+ ...
+}
+
+// But you _can_ do this, and we _want_ you to do this so the object is properly initialized
+token2 = jwt.New()
+if err := json.Unmarshal(data, &token2); err != nil { // actually, in practice you should use jwt.Parse()
+ ....
+}
+```
+
+### But why does it need to be initialized?
+
+There are several reasons, but one of the reasons is that I'm using a sync.Mutex to avoid races. We want this to be properly initialized.
+
+The other reason is that we support custom claims out of the box. The `map[string]interface{}` container is initialized during new. This is important when checking for equality using reflect-y methods (akin to `reflect.DeepEqual`), because if you allowed zero values, you could end up with "empty" tokens, that actually differ. Consider the following:
+
+```go
+// assume jwt.Token was s struct, not an interface
+token1 := jwt.Token{ privateClaims: make(map[string]interface{}) }
+token2 := jwt.Token{ privateClaims: nil }
+```
+
+These are semantically equivalent, but users would need to be aware of this difference when comparing values. By forcing the user to use a constructor, we can force a uniform empty state.
+
+### Standard way to store values
+
+Unlike some other libraries, this library allows you to store standard claims and non-standard claims in the same token.
+
+You _want_ to store standard claims in a properly typed field, which we do for fields like "iss", "nbf", etc.
+But for non-standard claims, there is just no way of doing this, so we _have_ to use a container like `map[string]interface{}`
+
+This means that if you allow direct access to these fields via a struct, you will have two different ways to access the claims, which is confusing:
+
+```go
+tok.Issuer = ...
+tok.PrivateClaims["foo"] = ...
+```
+
+So we want to hide where this data is stored, and use a standard method like `Set()` and `Get()` to store all the values.
+At this point you are effectively going to hide the implementation detail from the user, so you end up with a struct like below, which is fundamentally not so different from providing just an interface{}:
+
+```go
+type Token struct {
+ // unexported fields
+}
+
+func (tok *Token) Set(...) { ... }
+```
+
+### Use of pointers to store values
+
+We wanted to differentiate the state between a claim being uninitialized, and a claim being initialized to empty.
+
+So we use pointers to store values:
+
+```go
+type stdToken struct {
+ ....
+ issuer *string // if nil, uninitialized. if &(""), initialized to empty
+}
+```
+
+This is fine for us, but we doubt that this would be something users would want to do.
+This is a subtle difference, but cluttering up the API with slight variations of the same type (i.e. pointers vs non-pointers) seemed like a bad idea to us.
+
+```go
+token.Issuer = &issuer // want to avoid this
+
+token.Set(jwt.IssuerKey, "foobar") // so this is what we picked
+```
+
+This way users no longer need to care how the data is internally stored.
+
+### Allow more than one type of token through the same interface
+
+`dgrijalva/jwt-go` does this in a different way, but we felt that it would be more intuitive for all tokens to follow a single interface so there is fewer type conversions required.
+
+See the `openid` token for an example.
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/builder_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/builder_gen.go
new file mode 100644
index 0000000000..48d0375a28
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/builder_gen.go
@@ -0,0 +1,88 @@
+// Code generated by tools/cmd/genjwt/main.go. DO NOT EDIT.
+
+package jwt
+
+import (
+ "fmt"
+ "sync"
+ "time"
+)
+
+// Builder is a convenience wrapper around the New() constructor
+// and the Set() methods to assign values to Token claims.
+// Users can successively call Claim() on the Builder, and have it
+// construct the Token when Build() is called. This alleviates the
+// need for the user to check for the return value of every single
+// Set() method call.
+// Note that each call to Claim() overwrites the value set from the
+// previous call.
+type Builder struct {
+ mu sync.Mutex
+ claims map[string]any
+}
+
+func NewBuilder() *Builder {
+ return &Builder{}
+}
+
+func (b *Builder) init() {
+ if b.claims == nil {
+ b.claims = make(map[string]any)
+ }
+}
+
+func (b *Builder) Claim(name string, value any) *Builder {
+ b.mu.Lock()
+ defer b.mu.Unlock()
+ b.init()
+ b.claims[name] = value
+ return b
+}
+
+func (b *Builder) Audience(v []string) *Builder {
+ return b.Claim(AudienceKey, v)
+}
+
+func (b *Builder) Expiration(v time.Time) *Builder {
+ return b.Claim(ExpirationKey, v)
+}
+
+func (b *Builder) IssuedAt(v time.Time) *Builder {
+ return b.Claim(IssuedAtKey, v)
+}
+
+func (b *Builder) Issuer(v string) *Builder {
+ return b.Claim(IssuerKey, v)
+}
+
+func (b *Builder) JwtID(v string) *Builder {
+ return b.Claim(JwtIDKey, v)
+}
+
+func (b *Builder) NotBefore(v time.Time) *Builder {
+ return b.Claim(NotBeforeKey, v)
+}
+
+func (b *Builder) Subject(v string) *Builder {
+ return b.Claim(SubjectKey, v)
+}
+
+// Build creates a new token based on the claims that the builder has received
+// so far. If a claim cannot be set, then the method returns a nil Token with
+// a en error as a second return value
+//
+// Once `Build()` is called, all claims are cleared from the Builder, and the
+// Builder can be reused to build another token
+func (b *Builder) Build() (Token, error) {
+ b.mu.Lock()
+ claims := b.claims
+ b.claims = nil
+ b.mu.Unlock()
+ tok := New()
+ for k, v := range claims {
+ if err := tok.Set(k, v); err != nil {
+ return nil, fmt.Errorf(`failed to set claim %q: %w`, k, err)
+ }
+ }
+ return tok, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/errors.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/errors.go
new file mode 100644
index 0000000000..c5b529c1ae
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/errors.go
@@ -0,0 +1,95 @@
+package jwt
+
+import (
+ jwterrs "github.com/lestrrat-go/jwx/v3/jwt/internal/errors"
+)
+
+// ClaimNotFoundError returns the opaque error value that is returned when
+// `jwt.Get` fails to find the requested claim.
+//
+// This value should only be used for comparison using `errors.Is()`.
+func ClaimNotFoundError() error {
+ return jwterrs.ErrClaimNotFound
+}
+
+// ClaimAssignmentFailedError returns the opaque error value that is returned
+// when `jwt.Get` fails to assign the value to the destination. For example,
+// this can happen when the value is a string, but you passed a &int as the
+// destination.
+//
+// This value should only be used for comparison using `errors.Is()`.
+func ClaimAssignmentFailedError() error {
+ return jwterrs.ErrClaimAssignmentFailed
+}
+
+// UnknownPayloadTypeError returns the opaque error value that is returned when
+// `jwt.Parse` fails due to not being able to deduce the format of
+// the incoming buffer.
+//
+// This value should only be used for comparison using `errors.Is()`.
+func UnknownPayloadTypeError() error {
+ return jwterrs.ErrUnknownPayloadType
+}
+
+// ParseError returns the opaque error that is returned from jwt.Parse when
+// the input is not a valid JWT.
+//
+// This value should only be used for comparison using `errors.Is()`.
+func ParseError() error {
+ return jwterrs.ErrParse
+}
+
+// ValidateError returns the immutable error used for validation errors
+//
+// This value should only be used for comparison using `errors.Is()`.
+func ValidateError() error {
+ return jwterrs.ErrValidateDefault
+}
+
+// InvalidIssuerError returns the immutable error used when `iss` claim
+// is not satisfied
+//
+// This value should only be used for comparison using `errors.Is()`.
+func InvalidIssuerError() error {
+ return jwterrs.ErrInvalidIssuerDefault
+}
+
+// TokenExpiredError returns the immutable error used when `exp` claim
+// is not satisfied.
+//
+// This value should only be used for comparison using `errors.Is()`.
+func TokenExpiredError() error {
+ return jwterrs.ErrTokenExpiredDefault
+}
+
+// InvalidIssuedAtError returns the immutable error used when `iat` claim
+// is not satisfied
+//
+// This value should only be used for comparison using `errors.Is()`.
+func InvalidIssuedAtError() error {
+ return jwterrs.ErrInvalidIssuedAtDefault
+}
+
+// TokenNotYetValidError returns the immutable error used when `nbf` claim
+// is not satisfied
+//
+// This value should only be used for comparison using `errors.Is()`.
+func TokenNotYetValidError() error {
+ return jwterrs.ErrTokenNotYetValidDefault
+}
+
+// InvalidAudienceError returns the immutable error used when `aud` claim
+// is not satisfied
+//
+// This value should only be used for comparison using `errors.Is()`.
+func InvalidAudienceError() error {
+ return jwterrs.ErrInvalidAudienceDefault
+}
+
+// MissingRequiredClaimError returns the immutable error used when the claim
+// specified by `jwt.IsRequired()` is not present.
+//
+// This value should only be used for comparison using `errors.Is()`.
+func MissingRequiredClaimError() error {
+ return jwterrs.ErrMissingRequiredClaimDefault
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/fastpath.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/fastpath.go
new file mode 100644
index 0000000000..43f7c966da
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/fastpath.go
@@ -0,0 +1,71 @@
+package jwt
+
+import (
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/internal/base64"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwk"
+ "github.com/lestrrat-go/jwx/v3/jws"
+ "github.com/lestrrat-go/jwx/v3/jws/jwsbb"
+)
+
+// signFast reinvents the wheel a bit to avoid the overhead of
+// going through the entire jws.Sign() machinery.
+func signFast(t Token, alg jwa.SignatureAlgorithm, key any) ([]byte, error) {
+ algstr := alg.String()
+
+ var kid string
+ if jwkKey, ok := key.(jwk.Key); ok {
+ if v, ok := jwkKey.KeyID(); ok && v != "" {
+ kid = v
+ }
+ }
+
+ // Setup headers
+ // {"alg":"","typ":"JWT"}
+ // 1234567890123456789012
+ want := len(algstr) + 22
+ // also, if kid != "", we need to add "kid":"$kid"
+ if kid != "" {
+ // "kid":""
+ // 12345689
+ want += len(kid) + 9
+ }
+ hdr := pool.ByteSlice().GetCapacity(want)
+ hdr = append(hdr, '{', '"', 'a', 'l', 'g', '"', ':', '"')
+ hdr = append(hdr, algstr...)
+ hdr = append(hdr, '"')
+ if kid != "" {
+ hdr = append(hdr, ',', '"', 'k', 'i', 'd', '"', ':', '"')
+ hdr = append(hdr, kid...)
+ hdr = append(hdr, '"')
+ }
+ hdr = append(hdr, ',', '"', 't', 'y', 'p', '"', ':', '"', 'J', 'W', 'T', '"', '}')
+ defer pool.ByteSlice().Put(hdr)
+
+ // setup the buffer to sign with
+ payload, err := json.Marshal(t)
+ if err != nil {
+ return nil, fmt.Errorf(`jwt.signFast: failed to marshal token payload: %w`, err)
+ }
+
+ combined := jwsbb.SignBuffer(nil, hdr, payload, base64.DefaultEncoder(), true)
+ signer, err := jws.SignerFor(alg)
+ if err != nil {
+ return nil, fmt.Errorf(`jwt.signFast: failed to get signer for %s: %w`, alg, err)
+ }
+
+ signature, err := signer.Sign(key, combined)
+ if err != nil {
+ return nil, fmt.Errorf(`jwt.signFast: failed to sign payload with %s: %w`, alg, err)
+ }
+
+ serialized, err := jwsbb.JoinCompact(nil, hdr, payload, signature, base64.DefaultEncoder(), true)
+ if err != nil {
+ return nil, fmt.Errorf("jwt.signFast: failed to join compact: %w", err)
+ }
+ return serialized, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/filter.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/filter.go
new file mode 100644
index 0000000000..31471dbdfb
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/filter.go
@@ -0,0 +1,34 @@
+package jwt
+
+import (
+ "github.com/lestrrat-go/jwx/v3/transform"
+)
+
+// TokenFilter is an interface that allows users to filter JWT claims.
+// It provides two methods: Filter and Reject; Filter returns a new token with only
+// the claims that match the filter criteria, while Reject returns a new token with
+// only the claims that DO NOT match the filter.
+//
+// EXPERIMENTAL: This API is experimental and its interface and behavior is
+// subject to change in future releases. This API is not subject to semver
+// compatibility guarantees.
+type TokenFilter interface {
+ Filter(token Token) (Token, error)
+ Reject(token Token) (Token, error)
+}
+
+// StandardClaimsFilter returns a TokenFilter that filters out standard JWT claims.
+//
+// You can use this filter to create tokens that either only has standard claims
+// or only custom claims. If you need to configure the filter more precisely, consider
+// using the ClaimNameFilter directly.
+func StandardClaimsFilter() TokenFilter {
+ return stdClaimsFilter
+}
+
+var stdClaimsFilter = NewClaimNameFilter(stdClaimNames...)
+
+// NewClaimNameFilter creates a new ClaimNameFilter with the specified claim names.
+func NewClaimNameFilter(names ...string) TokenFilter {
+ return transform.NewNameBasedFilter[Token](names...)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/http.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/http.go
new file mode 100644
index 0000000000..691c5a0df4
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/http.go
@@ -0,0 +1,295 @@
+package jwt
+
+import (
+ "fmt"
+ "net/http"
+ "net/url"
+ "strconv"
+ "strings"
+
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+)
+
+// ParseCookie parses a JWT stored in a http.Cookie with the given name.
+// If the specified cookie is not found, http.ErrNoCookie is returned.
+func ParseCookie(req *http.Request, name string, options ...ParseOption) (Token, error) {
+ var dst **http.Cookie
+ for _, option := range options {
+ switch option.Ident() {
+ case identCookie{}:
+ if err := option.Value(&dst); err != nil {
+ return nil, fmt.Errorf(`jws.ParseCookie: value to option WithCookie must be **http.Cookie: %w`, err)
+ }
+ }
+ }
+
+ cookie, err := req.Cookie(name)
+ if err != nil {
+ return nil, err
+ }
+ tok, err := ParseString(cookie.Value, options...)
+ if err != nil {
+ return nil, fmt.Errorf(`jws.ParseCookie: failed to parse token stored in cookie: %w`, err)
+ }
+
+ if dst != nil {
+ *dst = cookie
+ }
+ return tok, nil
+}
+
+// ParseHeader parses a JWT stored in a http.Header.
+//
+// For the header "Authorization", it will strip the prefix "Bearer " and will
+// treat the remaining value as a JWT.
+func ParseHeader(hdr http.Header, name string, options ...ParseOption) (Token, error) {
+ key := http.CanonicalHeaderKey(name)
+ v := strings.TrimSpace(hdr.Get(key))
+ if v == "" {
+ return nil, fmt.Errorf(`empty header (%s)`, key)
+ }
+
+ if key == "Authorization" {
+ // Authorization header is an exception. We strip the "Bearer " from
+ // the prefix
+ v = strings.TrimSpace(strings.TrimPrefix(v, "Bearer"))
+ }
+
+ tok, err := ParseString(v, options...)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to parse token stored in header (%s): %w`, key, err)
+ }
+ return tok, nil
+}
+
+// ParseForm parses a JWT stored in a url.Value.
+func ParseForm(values url.Values, name string, options ...ParseOption) (Token, error) {
+ v := strings.TrimSpace(values.Get(name))
+ if v == "" {
+ return nil, fmt.Errorf(`empty value (%s)`, name)
+ }
+
+ return ParseString(v, options...)
+}
+
+// ParseRequest searches a http.Request object for a JWT token.
+//
+// Specifying WithHeaderKey() will tell it to search under a specific
+// header key. Specifying WithFormKey() will tell it to search under
+// a specific form field.
+//
+// If none of jwt.WithHeaderKey()/jwt.WithCookieKey()/jwt.WithFormKey() is
+// used, "Authorization" header will be searched. If any of these options
+// are specified, you must explicitly re-enable searching for "Authorization" header
+// if you also want to search for it.
+//
+// # searches for "Authorization"
+// jwt.ParseRequest(req)
+//
+// # searches for "x-my-token" ONLY.
+// jwt.ParseRequest(req, jwt.WithHeaderKey("x-my-token"))
+//
+// # searches for "Authorization" AND "x-my-token"
+// jwt.ParseRequest(req, jwt.WithHeaderKey("Authorization"), jwt.WithHeaderKey("x-my-token"))
+//
+// Cookies are searched using (http.Request).Cookie(). If you have multiple
+// cookies with the same name, and you want to search for a specific one that
+// (http.Request).Cookie() would not return, you will need to implement your
+// own logic to extract the cookie and use jwt.ParseString().
+func ParseRequest(req *http.Request, options ...ParseOption) (Token, error) {
+ var hdrkeys []string
+ var formkeys []string
+ var cookiekeys []string
+ var parseOptions []ParseOption
+ for _, option := range options {
+ switch option.Ident() {
+ case identHeaderKey{}:
+ var v string
+ if err := option.Value(&v); err != nil {
+ return nil, fmt.Errorf(`jws.ParseRequest: value to option WithHeaderKey must be string: %w`, err)
+ }
+ hdrkeys = append(hdrkeys, v)
+ case identFormKey{}:
+ var v string
+ if err := option.Value(&v); err != nil {
+ return nil, fmt.Errorf(`jws.ParseRequest: value to option WithFormKey must be string: %w`, err)
+ }
+ formkeys = append(formkeys, v)
+ case identCookieKey{}:
+ var v string
+ if err := option.Value(&v); err != nil {
+ return nil, fmt.Errorf(`jws.ParseRequest: value to option WithCookieKey must be string: %w`, err)
+ }
+ cookiekeys = append(cookiekeys, v)
+ default:
+ parseOptions = append(parseOptions, option)
+ }
+ }
+
+ if len(hdrkeys) == 0 && len(formkeys) == 0 && len(cookiekeys) == 0 {
+ hdrkeys = append(hdrkeys, "Authorization")
+ }
+
+ mhdrs := pool.KeyToErrorMap().Get()
+ defer pool.KeyToErrorMap().Put(mhdrs)
+ mfrms := pool.KeyToErrorMap().Get()
+ defer pool.KeyToErrorMap().Put(mfrms)
+ mcookies := pool.KeyToErrorMap().Get()
+ defer pool.KeyToErrorMap().Put(mcookies)
+
+ for _, hdrkey := range hdrkeys {
+ // Check presence via a direct map lookup
+ if _, ok := req.Header[http.CanonicalHeaderKey(hdrkey)]; !ok {
+ // if non-existent, not error
+ continue
+ }
+
+ tok, err := ParseHeader(req.Header, hdrkey, parseOptions...)
+ if err != nil {
+ mhdrs[hdrkey] = err
+ continue
+ }
+ return tok, nil
+ }
+
+ for _, name := range cookiekeys {
+ tok, err := ParseCookie(req, name, parseOptions...)
+ if err != nil {
+ if err == http.ErrNoCookie {
+ // not fatal
+ mcookies[name] = err
+ }
+ continue
+ }
+ return tok, nil
+ }
+
+ if cl := req.ContentLength; cl > 0 {
+ if err := req.ParseForm(); err != nil {
+ return nil, fmt.Errorf(`failed to parse form: %w`, err)
+ }
+ }
+
+ for _, formkey := range formkeys {
+ // Check presence via a direct map lookup
+ if _, ok := req.Form[formkey]; !ok {
+ // if non-existent, not error
+ continue
+ }
+
+ tok, err := ParseForm(req.Form, formkey, parseOptions...)
+ if err != nil {
+ mfrms[formkey] = err
+ continue
+ }
+ return tok, nil
+ }
+
+ // Everything below is a prelude to error reporting.
+ var triedHdrs strings.Builder
+ for i, hdrkey := range hdrkeys {
+ if i > 0 {
+ triedHdrs.WriteString(", ")
+ }
+ triedHdrs.WriteString(strconv.Quote(hdrkey))
+ }
+
+ var triedForms strings.Builder
+ for i, formkey := range formkeys {
+ if i > 0 {
+ triedForms.WriteString(", ")
+ }
+ triedForms.WriteString(strconv.Quote(formkey))
+ }
+
+ var triedCookies strings.Builder
+ for i, cookiekey := range cookiekeys {
+ if i > 0 {
+ triedCookies.WriteString(", ")
+ }
+ triedCookies.WriteString(strconv.Quote(cookiekey))
+ }
+
+ var b strings.Builder
+ b.WriteString(`failed to find a valid token in any location of the request (tried: `)
+ olen := b.Len()
+ if triedHdrs.Len() > 0 {
+ b.WriteString(`header keys: [`)
+ b.WriteString(triedHdrs.String())
+ b.WriteByte(tokens.CloseSquareBracket)
+ }
+ if triedForms.Len() > 0 {
+ if b.Len() > olen {
+ b.WriteString(", ")
+ }
+ b.WriteString("form keys: [")
+ b.WriteString(triedForms.String())
+ b.WriteByte(tokens.CloseSquareBracket)
+ }
+
+ if triedCookies.Len() > 0 {
+ if b.Len() > olen {
+ b.WriteString(", ")
+ }
+ b.WriteString("cookie keys: [")
+ b.WriteString(triedCookies.String())
+ b.WriteByte(tokens.CloseSquareBracket)
+ }
+ b.WriteByte(')')
+
+ lmhdrs := len(mhdrs)
+ lmfrms := len(mfrms)
+ lmcookies := len(mcookies)
+ var errors []any
+ if lmhdrs > 0 || lmfrms > 0 || lmcookies > 0 {
+ b.WriteString(". Additionally, errors were encountered during attempts to verify using:")
+
+ if lmhdrs > 0 {
+ b.WriteString(" headers: (")
+ count := 0
+ for hdrkey, err := range mhdrs {
+ if count > 0 {
+ b.WriteString(", ")
+ }
+ b.WriteString("[header key: ")
+ b.WriteString(strconv.Quote(hdrkey))
+ b.WriteString(", error: %w]")
+ errors = append(errors, err)
+ count++
+ }
+ b.WriteString(")")
+ }
+
+ if lmcookies > 0 {
+ count := 0
+ b.WriteString(" cookies: (")
+ for cookiekey, err := range mcookies {
+ if count > 0 {
+ b.WriteString(", ")
+ }
+ b.WriteString("[cookie key: ")
+ b.WriteString(strconv.Quote(cookiekey))
+ b.WriteString(", error: %w]")
+ errors = append(errors, err)
+ count++
+ }
+ }
+
+ if lmfrms > 0 {
+ count := 0
+ b.WriteString(" forms: (")
+ for formkey, err := range mfrms {
+ if count > 0 {
+ b.WriteString(", ")
+ }
+ b.WriteString("[form key: ")
+ b.WriteString(strconv.Quote(formkey))
+ b.WriteString(", error: %w]")
+ errors = append(errors, err)
+ count++
+ }
+ }
+ }
+ return nil, fmt.Errorf(b.String(), errors...)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/interface.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/interface.go
new file mode 100644
index 0000000000..f9a9d971ef
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/interface.go
@@ -0,0 +1,8 @@
+package jwt
+
+import (
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+)
+
+type DecodeCtx = json.DecodeCtx
+type TokenWithDecodeCtx = json.DecodeCtxContainer
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/internal/errors/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jwt/internal/errors/BUILD.bazel
new file mode 100644
index 0000000000..a053e8c0aa
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/internal/errors/BUILD.bazel
@@ -0,0 +1,16 @@
+load("@rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "errors",
+ srcs = [
+ "errors.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/jwt/internal/errors",
+ visibility = ["//jwt:__subpackages__"],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":errors",
+ visibility = ["//jwt:__subpackages__"],
+)
\ No newline at end of file
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/internal/errors/errors.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/internal/errors/errors.go
new file mode 100644
index 0000000000..179763a50d
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/internal/errors/errors.go
@@ -0,0 +1,185 @@
+// Package errors exist to store errors for jwt and openid packages.
+//
+// It's internal because we don't want to expose _anything_ about these errors
+// so users absolutely cannot do anything other than use them as opaque errors.
+//
+//nolint:revive
+package errors
+
+import (
+ "errors"
+ "fmt"
+)
+
+var (
+ ErrClaimNotFound = ClaimNotFoundError{}
+ ErrClaimAssignmentFailed = ClaimAssignmentFailedError{Err: errors.New(`claim assignment failed`)}
+ ErrUnknownPayloadType = errors.New(`unknown payload type (payload is not JWT?)`)
+ ErrParse = ParseError{error: errors.New(`jwt.Parse: unknown error`)}
+ ErrValidateDefault = ValidationError{errors.New(`unknown error`)}
+ ErrInvalidIssuerDefault = InvalidIssuerError{errors.New(`"iss" not satisfied`)}
+ ErrTokenExpiredDefault = TokenExpiredError{errors.New(`"exp" not satisfied: token is expired`)}
+ ErrInvalidIssuedAtDefault = InvalidIssuedAtError{errors.New(`"iat" not satisfied`)}
+ ErrTokenNotYetValidDefault = TokenNotYetValidError{errors.New(`"nbf" not satisfied: token is not yet valid`)}
+ ErrInvalidAudienceDefault = InvalidAudienceError{errors.New(`"aud" not satisfied`)}
+ ErrMissingRequiredClaimDefault = &MissingRequiredClaimError{error: errors.New(`required claim is missing`)}
+)
+
+type ClaimNotFoundError struct {
+ Name string
+}
+
+func (e ClaimNotFoundError) Error() string {
+ // This error message uses "field" instead of "claim" for backwards compatibility,
+ // but it shuold really be "claim" since it refers to a JWT claim.
+ return fmt.Sprintf(`field "%s" not found`, e.Name)
+}
+
+func (e ClaimNotFoundError) Is(target error) bool {
+ _, ok := target.(ClaimNotFoundError)
+ return ok
+}
+
+type ClaimAssignmentFailedError struct {
+ Err error
+}
+
+func (e ClaimAssignmentFailedError) Error() string {
+ // This error message probably should be tweaked, but it is this way
+ // for backwards compatibility.
+ return fmt.Sprintf(`failed to assign value to dst: %s`, e.Err.Error())
+}
+
+func (e ClaimAssignmentFailedError) Unwrap() error {
+ return e.Err
+}
+
+func (e ClaimAssignmentFailedError) Is(target error) bool {
+ _, ok := target.(ClaimAssignmentFailedError)
+ return ok
+}
+
+type ParseError struct {
+ error
+}
+
+func (e ParseError) Unwrap() error {
+ return e.error
+}
+
+func (ParseError) Is(err error) bool {
+ _, ok := err.(ParseError)
+ return ok
+}
+
+func ParseErrorf(prefix, f string, args ...any) error {
+ return ParseError{fmt.Errorf(prefix+": "+f, args...)}
+}
+
+type ValidationError struct {
+ error
+}
+
+func (ValidationError) Is(err error) bool {
+ _, ok := err.(ValidationError)
+ return ok
+}
+
+func (err ValidationError) Unwrap() error {
+ return err.error
+}
+
+func ValidateErrorf(f string, args ...any) error {
+ return ValidationError{fmt.Errorf(`jwt.Validate: `+f, args...)}
+}
+
+type InvalidIssuerError struct {
+ error
+}
+
+func (err InvalidIssuerError) Is(target error) bool {
+ _, ok := target.(InvalidIssuerError)
+ return ok
+}
+
+func (err InvalidIssuerError) Unwrap() error {
+ return err.error
+}
+
+func IssuerErrorf(f string, args ...any) error {
+ return InvalidIssuerError{fmt.Errorf(`"iss" not satisfied: `+f, args...)}
+}
+
+type TokenExpiredError struct {
+ error
+}
+
+func (err TokenExpiredError) Is(target error) bool {
+ _, ok := target.(TokenExpiredError)
+ return ok
+}
+
+func (err TokenExpiredError) Unwrap() error {
+ return err.error
+}
+
+type InvalidIssuedAtError struct {
+ error
+}
+
+func (err InvalidIssuedAtError) Is(target error) bool {
+ _, ok := target.(InvalidIssuedAtError)
+ return ok
+}
+
+func (err InvalidIssuedAtError) Unwrap() error {
+ return err.error
+}
+
+type TokenNotYetValidError struct {
+ error
+}
+
+func (err TokenNotYetValidError) Is(target error) bool {
+ _, ok := target.(TokenNotYetValidError)
+ return ok
+}
+
+func (err TokenNotYetValidError) Unwrap() error {
+ return err.error
+}
+
+type InvalidAudienceError struct {
+ error
+}
+
+func (err InvalidAudienceError) Is(target error) bool {
+ _, ok := target.(InvalidAudienceError)
+ return ok
+}
+
+func (err InvalidAudienceError) Unwrap() error {
+ return err.error
+}
+
+func AudienceErrorf(f string, args ...any) error {
+ return InvalidAudienceError{fmt.Errorf(`"aud" not satisfied: `+f, args...)}
+}
+
+type MissingRequiredClaimError struct {
+ error
+
+ claim string
+}
+
+func (err *MissingRequiredClaimError) Is(target error) bool {
+ err1, ok := target.(*MissingRequiredClaimError)
+ if !ok {
+ return false
+ }
+ return err1 == ErrMissingRequiredClaimDefault || err1.claim == err.claim
+}
+
+func MissingRequiredClaimErrorf(name string) error {
+ return &MissingRequiredClaimError{claim: name, error: fmt.Errorf(`required claim "%s" is missing`, name)}
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/internal/types/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/jwt/internal/types/BUILD.bazel
new file mode 100644
index 0000000000..1d046a3ecc
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/internal/types/BUILD.bazel
@@ -0,0 +1,35 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "types",
+ srcs = [
+ "date.go",
+ "string.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/jwt/internal/types",
+ visibility = ["//jwt:__subpackages__"],
+ deps = [
+ "//internal/json",
+ "//internal/tokens",
+ ],
+)
+
+go_test(
+ name = "types_test",
+ srcs = [
+ "date_test.go",
+ "string_test.go",
+ ],
+ deps = [
+ ":types",
+ "//internal/json",
+ "//jwt",
+ "@com_github_stretchr_testify//require",
+ ],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":types",
+ visibility = ["//jwt:__subpackages__"],
+)
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/internal/types/date.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/internal/types/date.go
new file mode 100644
index 0000000000..3d40a9ed97
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/internal/types/date.go
@@ -0,0 +1,192 @@
+package types
+
+import (
+ "fmt"
+ "strconv"
+ "strings"
+ "time"
+
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+)
+
+const (
+ DefaultPrecision uint32 = 0 // second level
+ MaxPrecision uint32 = 9 // nanosecond level
+)
+
+var Pedantic uint32
+var ParsePrecision = DefaultPrecision
+var FormatPrecision = DefaultPrecision
+
+// NumericDate represents the date format used in the 'nbf' claim
+type NumericDate struct {
+ time.Time
+}
+
+func (n *NumericDate) Get() time.Time {
+ if n == nil {
+ return (time.Time{}).UTC()
+ }
+ return n.Time
+}
+
+func intToTime(v any, t *time.Time) bool {
+ var n int64
+ switch x := v.(type) {
+ case int64:
+ n = x
+ case int32:
+ n = int64(x)
+ case int16:
+ n = int64(x)
+ case int8:
+ n = int64(x)
+ case int:
+ n = int64(x)
+ default:
+ return false
+ }
+
+ *t = time.Unix(n, 0)
+ return true
+}
+
+func parseNumericString(x string) (time.Time, error) {
+ var t time.Time // empty time for empty return value
+
+ // Only check for the escape hatch if it's the pedantic
+ // flag is off
+ if Pedantic != 1 {
+ // This is an escape hatch for non-conformant providers
+ // that gives us RFC3339 instead of epoch time
+ for _, r := range x {
+ // 0x30 = '0', 0x39 = '9', 0x2E = tokens.Period
+ if (r >= 0x30 && r <= 0x39) || r == 0x2E {
+ continue
+ }
+
+ // if it got here, then it probably isn't epoch time
+ tv, err := time.Parse(time.RFC3339, x)
+ if err != nil {
+ return t, fmt.Errorf(`value is not number of seconds since the epoch, and attempt to parse it as RFC3339 timestamp failed: %w`, err)
+ }
+ return tv, nil
+ }
+ }
+
+ var fractional string
+ whole := x
+ if i := strings.IndexRune(x, tokens.Period); i > 0 {
+ if ParsePrecision > 0 && len(x) > i+1 {
+ fractional = x[i+1:] // everything after the tokens.Period
+ if int(ParsePrecision) < len(fractional) {
+ // Remove insignificant digits
+ fractional = fractional[:int(ParsePrecision)]
+ }
+ // Replace missing fractional diits with zeros
+ for len(fractional) < int(MaxPrecision) {
+ fractional = fractional + "0"
+ }
+ }
+ whole = x[:i]
+ }
+ n, err := strconv.ParseInt(whole, 10, 64)
+ if err != nil {
+ return t, fmt.Errorf(`failed to parse whole value %q: %w`, whole, err)
+ }
+ var nsecs int64
+ if fractional != "" {
+ v, err := strconv.ParseInt(fractional, 10, 64)
+ if err != nil {
+ return t, fmt.Errorf(`failed to parse fractional value %q: %w`, fractional, err)
+ }
+ nsecs = v
+ }
+
+ return time.Unix(n, nsecs).UTC(), nil
+}
+
+func (n *NumericDate) Accept(v any) error {
+ var t time.Time
+ switch x := v.(type) {
+ case float32:
+ tv, err := parseNumericString(fmt.Sprintf(`%.9f`, x))
+ if err != nil {
+ return fmt.Errorf(`failed to accept float32 %.9f: %w`, x, err)
+ }
+ t = tv
+ case float64:
+ tv, err := parseNumericString(fmt.Sprintf(`%.9f`, x))
+ if err != nil {
+ return fmt.Errorf(`failed to accept float32 %.9f: %w`, x, err)
+ }
+ t = tv
+ case json.Number:
+ tv, err := parseNumericString(x.String())
+ if err != nil {
+ return fmt.Errorf(`failed to accept json.Number %q: %w`, x.String(), err)
+ }
+ t = tv
+ case string:
+ tv, err := parseNumericString(x)
+ if err != nil {
+ return fmt.Errorf(`failed to accept string %q: %w`, x, err)
+ }
+ t = tv
+ case time.Time:
+ t = x
+ default:
+ if !intToTime(v, &t) {
+ return fmt.Errorf(`invalid type %T`, v)
+ }
+ }
+ n.Time = t.UTC()
+ return nil
+}
+
+func (n NumericDate) String() string {
+ if FormatPrecision == 0 {
+ return strconv.FormatInt(n.Unix(), 10)
+ }
+
+ // This is cheating, but it's better (easier) than doing floating point math
+ // We basically munge with strings after formatting an integer value
+ // for nanoseconds since epoch
+ s := strconv.FormatInt(n.UnixNano(), 10)
+ for len(s) < int(MaxPrecision) {
+ s = "0" + s
+ }
+
+ slwhole := len(s) - int(MaxPrecision)
+ s = s[:slwhole] + "." + s[slwhole:slwhole+int(FormatPrecision)]
+ if s[0] == tokens.Period {
+ s = "0" + s
+ }
+
+ return s
+}
+
+// MarshalJSON translates from internal representation to JSON NumericDate
+// See https://tools.ietf.org/html/rfc7519#page-6
+func (n *NumericDate) MarshalJSON() ([]byte, error) {
+ if n.IsZero() {
+ return json.Marshal(nil)
+ }
+
+ return json.Marshal(n.String())
+}
+
+func (n *NumericDate) UnmarshalJSON(data []byte) error {
+ var v any
+ if err := json.Unmarshal(data, &v); err != nil {
+ return fmt.Errorf(`failed to unmarshal date: %w`, err)
+ }
+
+ var n2 NumericDate
+ if err := n2.Accept(v); err != nil {
+ return fmt.Errorf(`invalid value for NumericDate: %w`, err)
+ }
+ *n = n2
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/internal/types/string.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/internal/types/string.go
new file mode 100644
index 0000000000..8117bea358
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/internal/types/string.go
@@ -0,0 +1,43 @@
+package types
+
+import (
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+)
+
+type StringList []string
+
+func (l StringList) Get() []string {
+ return []string(l)
+}
+
+func (l *StringList) Accept(v any) error {
+ switch x := v.(type) {
+ case string:
+ *l = StringList([]string{x})
+ case []string:
+ *l = StringList(x)
+ case []any:
+ list := make(StringList, len(x))
+ for i, e := range x {
+ if s, ok := e.(string); ok {
+ list[i] = s
+ continue
+ }
+ return fmt.Errorf(`invalid list element type %T`, e)
+ }
+ *l = list
+ default:
+ return fmt.Errorf(`invalid type: %T`, v)
+ }
+ return nil
+}
+
+func (l *StringList) UnmarshalJSON(data []byte) error {
+ var v any
+ if err := json.Unmarshal(data, &v); err != nil {
+ return fmt.Errorf(`failed to unmarshal data: %w`, err)
+ }
+ return l.Accept(v)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/io.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/io.go
new file mode 100644
index 0000000000..812cda775e
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/io.go
@@ -0,0 +1,42 @@
+// Code generated by tools/cmd/genreadfile/main.go. DO NOT EDIT.
+
+package jwt
+
+import (
+ "fmt"
+ "io/fs"
+ "os"
+)
+
+type sysFS struct{}
+
+func (sysFS) Open(path string) (fs.File, error) {
+ return os.Open(path)
+}
+
+func ReadFile(path string, options ...ReadFileOption) (Token, error) {
+ var parseOptions []ParseOption
+ for _, option := range options {
+ if po, ok := option.(ParseOption); ok {
+ parseOptions = append(parseOptions, po)
+ }
+ }
+
+ var srcFS fs.FS = sysFS{}
+ for _, option := range options {
+ switch option.Ident() {
+ case identFS{}:
+ if err := option.Value(&srcFS); err != nil {
+ return nil, fmt.Errorf("failed to set fs.FS: %w", err)
+ }
+ }
+ }
+
+ f, err := srcFS.Open(path)
+ if err != nil {
+ return nil, err
+ }
+
+ defer f.Close()
+ return ParseReader(f, parseOptions...)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/jwt.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/jwt.go
new file mode 100644
index 0000000000..99b5ef37a6
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/jwt.go
@@ -0,0 +1,597 @@
+//go:generate ../tools/cmd/genjwt.sh
+//go:generate stringer -type=TokenOption -output=token_options_gen.go
+
+// Package jwt implements JSON Web Tokens as described in https://tools.ietf.org/html/rfc7519
+package jwt
+
+import (
+ "bytes"
+ "fmt"
+ "io"
+ "sync/atomic"
+ "time"
+
+ "github.com/lestrrat-go/jwx/v3"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jws"
+ jwterrs "github.com/lestrrat-go/jwx/v3/jwt/internal/errors"
+ "github.com/lestrrat-go/jwx/v3/jwt/internal/types"
+)
+
+var defaultTruncation atomic.Int64
+
+// Settings controls global settings that are specific to JWTs.
+func Settings(options ...GlobalOption) {
+ var flattenAudience bool
+ var parsePedantic bool
+ var parsePrecision = types.MaxPrecision + 1 // illegal value, so we can detect nothing was set
+ var formatPrecision = types.MaxPrecision + 1 // illegal value, so we can detect nothing was set
+ truncation := time.Duration(-1)
+ for _, option := range options {
+ switch option.Ident() {
+ case identTruncation{}:
+ if err := option.Value(&truncation); err != nil {
+ panic(fmt.Sprintf("jwt.Settings: value for WithTruncation must be time.Duration: %s", err))
+ }
+ case identFlattenAudience{}:
+ if err := option.Value(&flattenAudience); err != nil {
+ panic(fmt.Sprintf("jwt.Settings: value for WithFlattenAudience must be bool: %s", err))
+ }
+ case identNumericDateParsePedantic{}:
+ if err := option.Value(&parsePedantic); err != nil {
+ panic(fmt.Sprintf("jwt.Settings: value for WithNumericDateParsePedantic must be bool: %s", err))
+ }
+ case identNumericDateParsePrecision{}:
+ var v int
+ if err := option.Value(&v); err != nil {
+ panic(fmt.Sprintf("jwt.Settings: value for WithNumericDateParsePrecision must be int: %s", err))
+ }
+ // only accept this value if it's in our desired range
+ if v >= 0 && v <= int(types.MaxPrecision) {
+ parsePrecision = uint32(v)
+ }
+ case identNumericDateFormatPrecision{}:
+ var v int
+ if err := option.Value(&v); err != nil {
+ panic(fmt.Sprintf("jwt.Settings: value for WithNumericDateFormatPrecision must be int: %s", err))
+ }
+ // only accept this value if it's in our desired range
+ if v >= 0 && v <= int(types.MaxPrecision) {
+ formatPrecision = uint32(v)
+ }
+ }
+ }
+
+ if parsePrecision <= types.MaxPrecision { // remember we set default to max + 1
+ v := atomic.LoadUint32(&types.ParsePrecision)
+ if v != parsePrecision {
+ atomic.CompareAndSwapUint32(&types.ParsePrecision, v, parsePrecision)
+ }
+ }
+
+ if formatPrecision <= types.MaxPrecision { // remember we set default to max + 1
+ v := atomic.LoadUint32(&types.FormatPrecision)
+ if v != formatPrecision {
+ atomic.CompareAndSwapUint32(&types.FormatPrecision, v, formatPrecision)
+ }
+ }
+
+ {
+ v := atomic.LoadUint32(&types.Pedantic)
+ if (v == 1) != parsePedantic {
+ var newVal uint32
+ if parsePedantic {
+ newVal = 1
+ }
+ atomic.CompareAndSwapUint32(&types.Pedantic, v, newVal)
+ }
+ }
+
+ {
+ defaultOptionsMu.Lock()
+ if flattenAudience {
+ defaultOptions.Enable(FlattenAudience)
+ } else {
+ defaultOptions.Disable(FlattenAudience)
+ }
+ defaultOptionsMu.Unlock()
+ }
+
+ if truncation >= 0 {
+ defaultTruncation.Store(int64(truncation))
+ }
+}
+
+var registry = json.NewRegistry()
+
+// ParseString calls Parse against a string
+func ParseString(s string, options ...ParseOption) (Token, error) {
+ tok, err := parseBytes([]byte(s), options...)
+ if err != nil {
+ return nil, jwterrs.ParseErrorf(`jwt.ParseString`, `failed to parse string: %w`, err)
+ }
+ return tok, nil
+}
+
+// Parse parses the JWT token payload and creates a new `jwt.Token` object.
+// The token must be encoded in JWS compact format, or a raw JSON form of JWT
+// without any signatures.
+//
+// If you need JWE support on top of JWS, you will need to rollout your
+// own workaround.
+//
+// If the token is signed, and you want to verify the payload matches the signature,
+// you must pass the jwt.WithKey(alg, key) or jwt.WithKeySet(jwk.Set) option.
+// If you do not specify these parameters, no verification will be performed.
+//
+// During verification, if the JWS headers specify a key ID (`kid`), the
+// key used for verification must match the specified ID. If you are somehow
+// using a key without a `kid` (which is highly unlikely if you are working
+// with a JWT from a well-know provider), you can work around this by modifying
+// the `jwk.Key` and setting the `kid` header.
+//
+// If you also want to assert the validity of the JWT itself (i.e. expiration
+// and such), use the `Validate()` function on the returned token, or pass the
+// `WithValidate(true)` option. Validate options can also be passed to
+// `Parse`
+//
+// This function takes both ParseOption and ValidateOption types:
+// ParseOptions control the parsing behavior, and ValidateOptions are
+// passed to `Validate()` when `jwt.WithValidate` is specified.
+func Parse(s []byte, options ...ParseOption) (Token, error) {
+ tok, err := parseBytes(s, options...)
+ if err != nil {
+ return nil, jwterrs.ParseErrorf(`jwt.Parse`, `failed to parse token: %w`, err)
+ }
+ return tok, nil
+}
+
+// ParseInsecure is exactly the same as Parse(), but it disables
+// signature verification and token validation.
+//
+// You cannot override `jwt.WithVerify()` or `jwt.WithValidate()`
+// using this function. Providing these options would result in
+// an error
+func ParseInsecure(s []byte, options ...ParseOption) (Token, error) {
+ for _, option := range options {
+ switch option.Ident() {
+ case identVerify{}, identValidate{}:
+ return nil, jwterrs.ParseErrorf(`jwt.ParseInsecure`, `jwt.WithVerify() and jwt.WithValidate() may not be specified`)
+ }
+ }
+
+ options = append(options, WithVerify(false), WithValidate(false))
+ tok, err := Parse(s, options...)
+ if err != nil {
+ return nil, jwterrs.ParseErrorf(`jwt.ParseInsecure`, `failed to parse token: %w`, err)
+ }
+ return tok, nil
+}
+
+// ParseReader calls Parse against an io.Reader
+func ParseReader(src io.Reader, options ...ParseOption) (Token, error) {
+ // We're going to need the raw bytes regardless. Read it.
+ data, err := io.ReadAll(src)
+ if err != nil {
+ return nil, jwterrs.ParseErrorf(`jwt.ParseReader`, `failed to read from token data source: %w`, err)
+ }
+ tok, err := parseBytes(data, options...)
+ if err != nil {
+ return nil, jwterrs.ParseErrorf(`jwt.ParseReader`, `failed to parse token: %w`, err)
+ }
+ return tok, nil
+}
+
+type parseCtx struct {
+ token Token
+ validateOpts []ValidateOption
+ verifyOpts []jws.VerifyOption
+ localReg *json.Registry
+ pedantic bool
+ skipVerification bool
+ validate bool
+ withKeyCount int
+ withKey *withKey // this is used to detect if we have a WithKey option
+}
+
+func parseBytes(data []byte, options ...ParseOption) (Token, error) {
+ var ctx parseCtx
+
+ // Validation is turned on by default. You need to specify
+ // jwt.WithValidate(false) if you want to disable it
+ ctx.validate = true
+
+ // Verification is required (i.e., it is assumed that the incoming
+ // data is in JWS format) unless the user explicitly asks for
+ // it to be skipped.
+ verification := true
+
+ var verifyOpts []Option
+ for _, o := range options {
+ if v, ok := o.(ValidateOption); ok {
+ ctx.validateOpts = append(ctx.validateOpts, v)
+ // context is used for both verification and validation, so we can't just continue
+ switch o.Ident() {
+ case identContext{}:
+ default:
+ continue
+ }
+ }
+
+ switch o.Ident() {
+ case identKey{}:
+ // it would be nice to be able to detect if ctx.verifyOpts[0]
+ // is a WithKey option, but unfortunately at that point we have
+ // already converted the options to a jws option, which means
+ // we can no longer compare its Ident() to jwt.identKey{}.
+ // So let's just count this here
+ ctx.withKeyCount++
+ if ctx.withKeyCount == 1 {
+ if err := o.Value(&ctx.withKey); err != nil {
+ return nil, fmt.Errorf("jws.parseBytes: value for WithKey option must be a *jwt.withKey: %w", err)
+ }
+ }
+ verifyOpts = append(verifyOpts, o)
+ case identKeySet{}, identVerifyAuto{}, identKeyProvider{}, identBase64Encoder{}, identContext{}:
+ verifyOpts = append(verifyOpts, o)
+ case identToken{}:
+ var token Token
+ if err := o.Value(&token); err != nil {
+ return nil, fmt.Errorf("jws.parseBytes: value for WithToken option must be a jwt.Token: %w", err)
+ }
+ ctx.token = token
+ case identPedantic{}:
+ if err := o.Value(&ctx.pedantic); err != nil {
+ return nil, fmt.Errorf("jws.parseBytes: value for WithPedantic option must be a bool: %w", err)
+ }
+ case identValidate{}:
+ if err := o.Value(&ctx.validate); err != nil {
+ return nil, fmt.Errorf("jws.parseBytes: value for WithValidate option must be a bool: %w", err)
+ }
+ case identVerify{}:
+ if err := o.Value(&verification); err != nil {
+ return nil, fmt.Errorf("jws.parseBytes: value for WithVerify option must be a bool: %w", err)
+ }
+ case identTypedClaim{}:
+ var pair claimPair
+ if err := o.Value(&pair); err != nil {
+ return nil, fmt.Errorf("jws.parseBytes: value for WithTypedClaim option must be claimPair: %w", err)
+ }
+ if ctx.localReg == nil {
+ ctx.localReg = json.NewRegistry()
+ }
+ ctx.localReg.Register(pair.Name, pair.Value)
+ }
+ }
+
+ if !verification {
+ ctx.skipVerification = true
+ }
+
+ lvo := len(verifyOpts)
+ if lvo == 0 && verification {
+ return nil, fmt.Errorf(`jwt.Parse: no keys for verification are provided (use jwt.WithVerify(false) to explicitly skip)`)
+ }
+
+ if lvo > 0 {
+ converted, err := toVerifyOptions(verifyOpts...)
+ if err != nil {
+ return nil, fmt.Errorf(`jwt.Parse: failed to convert options into jws.VerifyOption: %w`, err)
+ }
+ ctx.verifyOpts = converted
+ }
+
+ data = bytes.TrimSpace(data)
+ return parse(&ctx, data)
+}
+
+const (
+ _JwsVerifyInvalid = iota
+ _JwsVerifyDone
+ _JwsVerifyExpectNested
+ _JwsVerifySkipped
+)
+
+var _ = _JwsVerifyInvalid
+
+func verifyJWS(ctx *parseCtx, payload []byte) ([]byte, int, error) {
+ lvo := len(ctx.verifyOpts)
+ if lvo == 0 {
+ return nil, _JwsVerifySkipped, nil
+ }
+
+ if lvo == 1 && ctx.withKeyCount == 1 {
+ wk := ctx.withKey
+ alg, ok := wk.alg.(jwa.SignatureAlgorithm)
+ if ok && len(wk.options) == 0 {
+ verified, err := jws.VerifyCompactFast(wk.key, payload, alg)
+ if err != nil {
+ return nil, _JwsVerifyDone, err
+ }
+ return verified, _JwsVerifyDone, nil
+ }
+ }
+
+ verifyOpts := append(ctx.verifyOpts, jws.WithCompact())
+ verified, err := jws.Verify(payload, verifyOpts...)
+ return verified, _JwsVerifyDone, err
+}
+
+// verify parameter exists to make sure that we don't accidentally skip
+// over verification just because alg == "" or key == nil or something.
+func parse(ctx *parseCtx, data []byte) (Token, error) {
+ payload := data
+ const maxDecodeLevels = 2
+
+ // If cty = `JWT`, we expect this to be a nested structure
+ var expectNested bool
+
+OUTER:
+ for i := range maxDecodeLevels {
+ switch kind := jwx.GuessFormat(payload); kind {
+ case jwx.JWT:
+ if ctx.pedantic {
+ if expectNested {
+ return nil, fmt.Errorf(`expected nested encrypted/signed payload, got raw JWT`)
+ }
+ }
+
+ if i == 0 {
+ // We were NOT enveloped in other formats
+ if !ctx.skipVerification {
+ if _, _, err := verifyJWS(ctx, payload); err != nil {
+ return nil, err
+ }
+ }
+ }
+
+ break OUTER
+ case jwx.InvalidFormat:
+ return nil, UnknownPayloadTypeError()
+ case jwx.UnknownFormat:
+ // "Unknown" may include invalid JWTs, for example, those who lack "aud"
+ // claim. We could be pedantic and reject these
+ if ctx.pedantic {
+ return nil, fmt.Errorf(`unknown JWT format (pedantic)`)
+ }
+
+ if i == 0 {
+ // We were NOT enveloped in other formats
+ if !ctx.skipVerification {
+ if _, _, err := verifyJWS(ctx, payload); err != nil {
+ return nil, err
+ }
+ }
+ }
+ break OUTER
+ case jwx.JWS:
+ // Food for thought: This is going to break if you have multiple layers of
+ // JWS enveloping using different keys. It is highly unlikely use case,
+ // but it might happen.
+
+ // skipVerification should only be set to true by us. It's used
+ // when we just want to parse the JWT out of a payload
+ if !ctx.skipVerification {
+ // nested return value means:
+ // false (next envelope _may_ need to be processed)
+ // true (next envelope MUST be processed)
+ v, state, err := verifyJWS(ctx, payload)
+ if err != nil {
+ return nil, err
+ }
+
+ if state != _JwsVerifySkipped {
+ payload = v
+
+ // We only check for cty and typ if the pedantic flag is enabled
+ if !ctx.pedantic {
+ continue
+ }
+
+ if state == _JwsVerifyExpectNested {
+ expectNested = true
+ continue OUTER
+ }
+
+ // if we're not nested, we found our target. bail out of this loop
+ break OUTER
+ }
+ }
+
+ // No verification.
+ m, err := jws.Parse(data, jws.WithCompact())
+ if err != nil {
+ return nil, fmt.Errorf(`invalid jws message: %w`, err)
+ }
+ payload = m.Payload()
+ default:
+ return nil, fmt.Errorf(`unsupported format (layer: #%d)`, i+1)
+ }
+ expectNested = false
+ }
+
+ if ctx.token == nil {
+ ctx.token = New()
+ }
+
+ if ctx.localReg != nil {
+ dcToken, ok := ctx.token.(TokenWithDecodeCtx)
+ if !ok {
+ return nil, fmt.Errorf(`typed claim was requested, but the token (%T) does not support DecodeCtx`, ctx.token)
+ }
+ dc := json.NewDecodeCtx(ctx.localReg)
+ dcToken.SetDecodeCtx(dc)
+ defer func() { dcToken.SetDecodeCtx(nil) }()
+ }
+
+ if err := json.Unmarshal(payload, ctx.token); err != nil {
+ return nil, fmt.Errorf(`failed to parse token: %w`, err)
+ }
+
+ if ctx.validate {
+ if err := Validate(ctx.token, ctx.validateOpts...); err != nil {
+ return nil, err
+ }
+ }
+ return ctx.token, nil
+}
+
+// Sign is a convenience function to create a signed JWT token serialized in
+// compact form.
+//
+// It accepts either a raw key (e.g. rsa.PrivateKey, ecdsa.PrivateKey, etc)
+// or a jwk.Key, and the name of the algorithm that should be used to sign
+// the token.
+//
+// For well-known algorithms with no special considerations (e.g. detached
+// payloads, extra protected heders, etc), this function will automatically
+// take the fast path and bypass the jws.Sign() machinery, which improves
+// performance significantly.
+//
+// If the key is a jwk.Key and the key contains a key ID (`kid` field),
+// then it is added to the protected header generated by the signature
+//
+// The algorithm specified in the `alg` parameter must be able to support
+// the type of key you provided, otherwise an error is returned.
+// For convenience `alg` is of type jwa.KeyAlgorithm so you can pass
+// the return value of `(jwk.Key).Algorithm()` directly, but in practice
+// it must be an instance of jwa.SignatureAlgorithm, otherwise an error
+// is returned.
+//
+// The protected header will also automatically have the `typ` field set
+// to the literal value `JWT`, unless you provide a custom value for it
+// by jws.WithProtectedHeaders option, that can be passed to `jwt.WithKey“.
+func Sign(t Token, options ...SignOption) ([]byte, error) {
+ // fast path; can only happen if there is exactly one option
+ if len(options) == 1 && (options[0].Ident() == identKey{}) {
+ // The option must be a withKey option.
+ var wk *withKey
+ if err := options[0].Value(&wk); err == nil {
+ alg, ok := wk.alg.(jwa.SignatureAlgorithm)
+ if !ok {
+ return nil, fmt.Errorf(`jwt.Sign: invalid algorithm type %T. jwa.SignatureAlgorithm is required`, wk.alg)
+ }
+
+ // Check if option contains anything other than alg/key
+ if len(wk.options) == 0 {
+ // yay, we have something we can put in the FAST PATH!
+ return signFast(t, alg, wk.key)
+ }
+ // fallthrough
+ }
+ // fallthrough
+ }
+
+ var soptions []jws.SignOption
+ if l := len(options); l > 0 {
+ // we need to from SignOption to Option because ... reasons
+ // (todo: when go1.18 prevails, use type parameters
+ rawoptions := make([]Option, l)
+ for i, option := range options {
+ rawoptions[i] = option
+ }
+
+ converted, err := toSignOptions(rawoptions...)
+ if err != nil {
+ return nil, fmt.Errorf(`jwt.Sign: failed to convert options into jws.SignOption: %w`, err)
+ }
+ soptions = converted
+ }
+ return NewSerializer().sign(soptions...).Serialize(t)
+}
+
+// Equal compares two JWT tokens. Do not use `reflect.Equal` or the like
+// to compare tokens as they will also compare extra detail such as
+// sync.Mutex objects used to control concurrent access.
+//
+// The comparison for values is currently done using a simple equality ("=="),
+// except for time.Time, which uses time.Equal after dropping the monotonic
+// clock and truncating the values to 1 second accuracy.
+//
+// if both t1 and t2 are nil, returns true
+func Equal(t1, t2 Token) bool {
+ if t1 == nil && t2 == nil {
+ return true
+ }
+
+ // we already checked for t1 == t2 == nil, so safe to do this
+ if t1 == nil || t2 == nil {
+ return false
+ }
+
+ j1, err := json.Marshal(t1)
+ if err != nil {
+ return false
+ }
+
+ j2, err := json.Marshal(t2)
+ if err != nil {
+ return false
+ }
+
+ return bytes.Equal(j1, j2)
+}
+
+func (t *stdToken) Clone() (Token, error) {
+ dst := New()
+
+ dst.Options().Set(*(t.Options()))
+ for _, k := range t.Keys() {
+ var v any
+ if err := t.Get(k, &v); err != nil {
+ return nil, fmt.Errorf(`jwt.Clone: failed to get %s: %w`, k, err)
+ }
+ if err := dst.Set(k, v); err != nil {
+ return nil, fmt.Errorf(`jwt.Clone failed to set %s: %w`, k, err)
+ }
+ }
+ return dst, nil
+}
+
+type CustomDecoder = json.CustomDecoder
+type CustomDecodeFunc = json.CustomDecodeFunc
+
+// RegisterCustomField allows users to specify that a private field
+// be decoded as an instance of the specified type. This option has
+// a global effect.
+//
+// For example, suppose you have a custom field `x-birthday`, which
+// you want to represent as a string formatted in RFC3339 in JSON,
+// but want it back as `time.Time`.
+//
+// In such case you would register a custom field as follows
+//
+// jwt.RegisterCustomField(`x-birthday`, time.Time{})
+//
+// Then you can use a `time.Time` variable to extract the value
+// of `x-birthday` field, instead of having to use `any`
+// and later convert it to `time.Time`
+//
+// var bday time.Time
+// _ = token.Get(`x-birthday`, &bday)
+//
+// If you need a more fine-tuned control over the decoding process,
+// you can register a `CustomDecoder`. For example, below shows
+// how to register a decoder that can parse RFC822 format string:
+//
+// jwt.RegisterCustomField(`x-birthday`, jwt.CustomDecodeFunc(func(data []byte) (any, error) {
+// return time.Parse(time.RFC822, string(data))
+// }))
+//
+// Please note that use of custom fields can be problematic if you
+// are using a library that does not implement MarshalJSON/UnmarshalJSON
+// and you try to roundtrip from an object to JSON, and then back to an object.
+// For example, in the above example, you can _parse_ time values formatted
+// in the format specified in RFC822, but when you convert an object into
+// JSON, it will be formatted in RFC3339, because that's what `time.Time`
+// likes to do. To avoid this, it's always better to use a custom type
+// that wraps your desired type (in this case `time.Time`) and implement
+// MarshalJSON and UnmashalJSON.
+func RegisterCustomField(name string, object any) {
+ registry.Register(name, object)
+}
+
+func getDefaultTruncation() time.Duration {
+ return time.Duration(defaultTruncation.Load())
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/options.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/options.go
new file mode 100644
index 0000000000..4a7cfd3e5d
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/options.go
@@ -0,0 +1,332 @@
+package jwt
+
+import (
+ "context"
+ "fmt"
+ "strings"
+ "time"
+
+ "github.com/lestrrat-go/jwx/v3/jwa"
+ "github.com/lestrrat-go/jwx/v3/jwe"
+ "github.com/lestrrat-go/jwx/v3/jwk"
+ "github.com/lestrrat-go/jwx/v3/jws"
+ "github.com/lestrrat-go/option/v2"
+)
+
+type identInsecureNoSignature struct{}
+type identKey struct{}
+type identKeySet struct{}
+type identTypedClaim struct{}
+type identVerifyAuto struct{}
+
+func toSignOptions(options ...Option) ([]jws.SignOption, error) {
+ soptions := make([]jws.SignOption, 0, len(options))
+ for _, option := range options {
+ switch option.Ident() {
+ case identInsecureNoSignature{}:
+ soptions = append(soptions, jws.WithInsecureNoSignature())
+ case identKey{}:
+ var wk withKey
+ if err := option.Value(&wk); err != nil {
+ return nil, fmt.Errorf(`toSignOtpions: failed to convert option value to withKey: %w`, err)
+ }
+ var wksoptions []jws.WithKeySuboption
+ for _, subopt := range wk.options {
+ wksopt, ok := subopt.(jws.WithKeySuboption)
+ if !ok {
+ return nil, fmt.Errorf(`expected optional arguments in jwt.WithKey to be jws.WithKeySuboption, but got %T`, subopt)
+ }
+ wksoptions = append(wksoptions, wksopt)
+ }
+
+ soptions = append(soptions, jws.WithKey(wk.alg, wk.key, wksoptions...))
+ case identSignOption{}:
+ var sigOpt jws.SignOption
+ if err := option.Value(&sigOpt); err != nil {
+ return nil, fmt.Errorf(`failed to decode SignOption: %w`, err)
+ }
+ soptions = append(soptions, sigOpt)
+ case identBase64Encoder{}:
+ var enc jws.Base64Encoder
+ if err := option.Value(&enc); err != nil {
+ return nil, fmt.Errorf(`failed to decode Base64Encoder: %w`, err)
+ }
+ soptions = append(soptions, jws.WithBase64Encoder(enc))
+ }
+ }
+ return soptions, nil
+}
+
+func toEncryptOptions(options ...Option) ([]jwe.EncryptOption, error) {
+ soptions := make([]jwe.EncryptOption, 0, len(options))
+ for _, option := range options {
+ switch option.Ident() {
+ case identKey{}:
+ var wk withKey
+ if err := option.Value(&wk); err != nil {
+ return nil, fmt.Errorf(`toEncryptOptions: failed to convert option value to withKey: %w`, err)
+ }
+ var wksoptions []jwe.WithKeySuboption
+ for _, subopt := range wk.options {
+ wksopt, ok := subopt.(jwe.WithKeySuboption)
+ if !ok {
+ return nil, fmt.Errorf(`expected optional arguments in jwt.WithKey to be jwe.WithKeySuboption, but got %T`, subopt)
+ }
+ wksoptions = append(wksoptions, wksopt)
+ }
+
+ soptions = append(soptions, jwe.WithKey(wk.alg, wk.key, wksoptions...))
+ case identEncryptOption{}:
+ var encOpt jwe.EncryptOption
+ if err := option.Value(&encOpt); err != nil {
+ return nil, fmt.Errorf(`failed to decode EncryptOption: %w`, err)
+ }
+ soptions = append(soptions, encOpt)
+ }
+ }
+ return soptions, nil
+}
+
+func toVerifyOptions(options ...Option) ([]jws.VerifyOption, error) {
+ voptions := make([]jws.VerifyOption, 0, len(options))
+ for _, option := range options {
+ switch option.Ident() {
+ case identKey{}:
+ var wk withKey
+ if err := option.Value(&wk); err != nil {
+ return nil, fmt.Errorf(`toVerifyOptions: failed to convert option value to withKey: %w`, err)
+ }
+ var wksoptions []jws.WithKeySuboption
+ for _, subopt := range wk.options {
+ wksopt, ok := subopt.(jws.WithKeySuboption)
+ if !ok {
+ return nil, fmt.Errorf(`expected optional arguments in jwt.WithKey to be jws.WithKeySuboption, but got %T`, subopt)
+ }
+ wksoptions = append(wksoptions, wksopt)
+ }
+
+ voptions = append(voptions, jws.WithKey(wk.alg, wk.key, wksoptions...))
+ case identKeySet{}:
+ var wks withKeySet
+ if err := option.Value(&wks); err != nil {
+ return nil, fmt.Errorf(`failed to convert option value to withKeySet: %w`, err)
+ }
+ var wkssoptions []jws.WithKeySetSuboption
+ for _, subopt := range wks.options {
+ wkssopt, ok := subopt.(jws.WithKeySetSuboption)
+ if !ok {
+ return nil, fmt.Errorf(`expected optional arguments in jwt.WithKey to be jws.WithKeySetSuboption, but got %T`, subopt)
+ }
+ wkssoptions = append(wkssoptions, wkssopt)
+ }
+
+ voptions = append(voptions, jws.WithKeySet(wks.set, wkssoptions...))
+ case identVerifyAuto{}:
+ var vo jws.VerifyOption
+ if err := option.Value(&vo); err != nil {
+ return nil, fmt.Errorf(`failed to decode VerifyOption: %w`, err)
+ }
+ voptions = append(voptions, vo)
+ case identKeyProvider{}:
+ var kp jws.KeyProvider
+ if err := option.Value(&kp); err != nil {
+ return nil, fmt.Errorf(`failed to decode KeyProvider: %w`, err)
+ }
+ voptions = append(voptions, jws.WithKeyProvider(kp))
+ case identBase64Encoder{}:
+ var enc jws.Base64Encoder
+ if err := option.Value(&enc); err != nil {
+ return nil, fmt.Errorf(`failed to decode Base64Encoder: %w`, err)
+ }
+ voptions = append(voptions, jws.WithBase64Encoder(enc))
+ case identContext{}:
+ var ctx context.Context
+ if err := option.Value(&ctx); err != nil {
+ return nil, fmt.Errorf(`failed to decode Context: %w`, err)
+ }
+ voptions = append(voptions, jws.WithContext(ctx))
+ default:
+ return nil, fmt.Errorf(`invalid jws.VerifyOption %q passed`, `With`+strings.TrimPrefix(fmt.Sprintf(`%T`, option.Ident()), `jws.ident`))
+ }
+ }
+ return voptions, nil
+}
+
+type withKey struct {
+ alg jwa.KeyAlgorithm
+ key any
+ options []Option
+}
+
+// WithKey is a multipurpose option. It can be used for either jwt.Sign, jwt.Parse (and
+// its siblings), and jwt.Serializer methods. For signatures, please see the documentation
+// for `jws.WithKey` for more details. For encryption, please see the documentation
+// for `jwe.WithKey`.
+//
+// It is the caller's responsibility to match the suboptions to the operation that they
+// are performing. For example, you are not allowed to do this, because the operation
+// is to generate a signature, and yet you are passing options for jwe:
+//
+// jwt.Sign(token, jwt.WithKey(alg, key, jweOptions...))
+//
+// In the above example, the creation of the option via `jwt.WithKey()` will work, but
+// when `jwt.Sign()` is called, the fact that you passed JWE suboptions will be
+// detected, and an error will occur.
+func WithKey(alg jwa.KeyAlgorithm, key any, suboptions ...Option) SignEncryptParseOption {
+ return &signEncryptParseOption{option.New(identKey{}, &withKey{
+ alg: alg,
+ key: key,
+ options: suboptions,
+ })}
+}
+
+type withKeySet struct {
+ set jwk.Set
+ options []any
+}
+
+// WithKeySet forces the Parse method to verify the JWT message
+// using one of the keys in the given key set.
+//
+// Key IDs (`kid`) in the JWS message and the JWK in the given `jwk.Set`
+// must match in order for the key to be a candidate to be used for
+// verification.
+//
+// This is for security reasons. If you must disable it, you can do so by
+// specifying `jws.WithRequireKid(false)` in the suboptions. But we don't
+// recommend it unless you know exactly what the security implications are
+//
+// When using this option, keys MUST have a proper 'alg' field
+// set. This is because we need to know the exact algorithm that
+// you (the user) wants to use to verify the token. We do NOT
+// trust the token's headers, because they can easily be tampered with.
+//
+// However, there _is_ a workaround if you do understand the risks
+// of allowing a library to automatically choose a signature verification strategy,
+// and you do not mind the verification process having to possibly
+// attempt using multiple times before succeeding to verify. See
+// `jws.InferAlgorithmFromKey` option
+//
+// If you have only one key in the set, and are sure you want to
+// use that key, you can use the `jwt.WithDefaultKey` option.
+func WithKeySet(set jwk.Set, options ...any) ParseOption {
+ return &parseOption{option.New(identKeySet{}, &withKeySet{
+ set: set,
+ options: options,
+ })}
+}
+
+// WithIssuer specifies that expected issuer value. If not specified,
+// the value of issuer is not verified at all.
+func WithIssuer(s string) ValidateOption {
+ return WithValidator(issuerClaimValueIs(s))
+}
+
+// WithSubject specifies that expected subject value. If not specified,
+// the value of subject is not verified at all.
+func WithSubject(s string) ValidateOption {
+ return WithValidator(ClaimValueIs(SubjectKey, s))
+}
+
+// WithJwtID specifies that expected jti value. If not specified,
+// the value of jti is not verified at all.
+func WithJwtID(s string) ValidateOption {
+ return WithValidator(ClaimValueIs(JwtIDKey, s))
+}
+
+// WithAudience specifies that expected audience value.
+// `Validate()` will return true if one of the values in the `aud` element
+// matches this value. If not specified, the value of `aud` is not
+// verified at all.
+func WithAudience(s string) ValidateOption {
+ return WithValidator(audienceClaimContainsString(s))
+}
+
+// WithClaimValue specifies the expected value for a given claim
+func WithClaimValue(name string, v any) ValidateOption {
+ return WithValidator(ClaimValueIs(name, v))
+}
+
+// WithTypedClaim allows a private claim to be parsed into the object type of
+// your choice. It works much like the RegisterCustomField, but the effect
+// is only applicable to the jwt.Parse function call which receives this option.
+//
+// While this can be extremely useful, this option should be used with caution:
+// There are many caveats that your entire team/user-base needs to be aware of,
+// and therefore in general its use is discouraged. Only use it when you know
+// what you are doing, and you document its use clearly for others.
+//
+// First and foremost, this is a "per-object" option. Meaning that given the same
+// serialized format, it is possible to generate two objects whose internal
+// representations may differ. That is, if you parse one _WITH_ the option,
+// and the other _WITHOUT_, their internal representation may completely differ.
+// This could potentially lead to problems.
+//
+// Second, specifying this option will slightly slow down the decoding process
+// as it needs to consult multiple definitions sources (global and local), so
+// be careful if you are decoding a large number of tokens, as the effects will stack up.
+//
+// Finally, this option will also NOT work unless the tokens themselves support such
+// parsing mechanism. For example, while tokens obtained from `jwt.New()` and
+// `openid.New()` will respect this option, if you provide your own custom
+// token type, it will need to implement the TokenWithDecodeCtx interface.
+func WithTypedClaim(name string, object any) ParseOption {
+ return &parseOption{option.New(identTypedClaim{}, claimPair{Name: name, Value: object})}
+}
+
+// WithRequiredClaim specifies that the claim identified the given name
+// must exist in the token. Only the existence of the claim is checked:
+// the actual value associated with that field is not checked.
+func WithRequiredClaim(name string) ValidateOption {
+ return WithValidator(IsRequired(name))
+}
+
+// WithMaxDelta specifies that given two claims `c1` and `c2` that represent time, the difference in
+// time.Duration must be less than equal to the value specified by `d`. If `c1` or `c2` is the
+// empty string, the current time (as computed by `time.Now` or the object passed via
+// `WithClock()`) is used for the comparison.
+//
+// `c1` and `c2` are also assumed to be required, therefore not providing either claim in the
+// token will result in an error.
+//
+// Because there is no way of reliably knowing how to parse private claims, we currently only
+// support `iat`, `exp`, and `nbf` claims.
+//
+// If the empty string is passed to c1 or c2, then the current time (as calculated by time.Now() or
+// the clock object provided via WithClock()) is used.
+//
+// For example, in order to specify that `exp` - `iat` should be less than 10*time.Second, you would write
+//
+// jwt.Validate(token, jwt.WithMaxDelta(10*time.Second, jwt.ExpirationKey, jwt.IssuedAtKey))
+//
+// If AcceptableSkew of 2 second is specified, the above will return valid for any value of
+// `exp` - `iat` between 8 (10-2) and 12 (10+2).
+func WithMaxDelta(dur time.Duration, c1, c2 string) ValidateOption {
+ return WithValidator(MaxDeltaIs(c1, c2, dur))
+}
+
+// WithMinDelta is almost exactly the same as WithMaxDelta, but force validation to fail if
+// the difference between time claims are less than dur.
+//
+// For example, in order to specify that `exp` - `iat` should be greater than 10*time.Second, you would write
+//
+// jwt.Validate(token, jwt.WithMinDelta(10*time.Second, jwt.ExpirationKey, jwt.IssuedAtKey))
+//
+// The validation would fail if the difference is less than 10 seconds.
+func WithMinDelta(dur time.Duration, c1, c2 string) ValidateOption {
+ return WithValidator(MinDeltaIs(c1, c2, dur))
+}
+
+// WithVerifyAuto specifies that the JWS verification should be attempted
+// by using the data available in the JWS message. Currently only verification
+// method available is to use the keys available in the JWKS URL pointed
+// in the `jku` field.
+//
+// Please read the documentation for `jws.VerifyAuto` for more details.
+func WithVerifyAuto(f jwk.Fetcher, options ...jwk.FetchOption) ParseOption {
+ return &parseOption{option.New(identVerifyAuto{}, jws.WithVerifyAuto(f, options...))}
+}
+
+func WithInsecureNoSignature() SignOption {
+ return &signEncryptParseOption{option.New(identInsecureNoSignature{}, (any)(nil))}
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/options.yaml b/vendor/github.com/lestrrat-go/jwx/v3/jwt/options.yaml
new file mode 100644
index 0000000000..bfcadfac25
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/options.yaml
@@ -0,0 +1,274 @@
+package_name: jwt
+output: jwt/options_gen.go
+interfaces:
+ - name: GlobalOption
+ comment: |
+ GlobalOption describes an Option that can be passed to `Settings()`.
+ - name: EncryptOption
+ comment: |
+ EncryptOption describes an Option that can be passed to (jwt.Serializer).Encrypt
+ - name: ParseOption
+ methods:
+ - parseOption
+ - readFileOption
+ comment: |
+ ParseOption describes an Option that can be passed to `jwt.Parse()`.
+ ParseOption also implements ReadFileOption, therefore it may be
+ safely pass them to `jwt.ReadFile()`
+ - name: SignOption
+ comment: |
+ SignOption describes an Option that can be passed to `jwt.Sign()` or
+ (jwt.Serializer).Sign
+ - name: SignParseOption
+ methods:
+ - signOption
+ - parseOption
+ - readFileOption
+ comment: |
+ SignParseOption describes an Option that can be passed to both `jwt.Sign()` or
+ `jwt.Parse()`
+ - name: SignEncryptParseOption
+ methods:
+ - parseOption
+ - encryptOption
+ - readFileOption
+ - signOption
+ comment: |
+ SignEncryptParseOption describes an Option that can be passed to both `jwt.Sign()` or
+ `jwt.Parse()`
+ - name: ValidateOption
+ methods:
+ - parseOption
+ - readFileOption
+ - validateOption
+ comment: |
+ ValidateOption describes an Option that can be passed to Validate().
+ ValidateOption also implements ParseOption, therefore it may be
+ safely passed to `Parse()` (and thus `jwt.ReadFile()`)
+ - name: ReadFileOption
+ comment: |
+ ReadFileOption is a type of `Option` that can be passed to `jws.ReadFile`
+ - name: GlobalValidateOption
+ methods:
+ - globalOption
+ - parseOption
+ - readFileOption
+ - validateOption
+ comment: |
+ GlobalValidateOption describes an Option that can be passed to `jwt.Settings()` and `jwt.Validate()`
+options:
+ - ident: AcceptableSkew
+ interface: ValidateOption
+ argument_type: time.Duration
+ comment: |
+ WithAcceptableSkew specifies the duration in which exp, iat and nbf
+ claims may differ by. This value should be positive
+ - ident: Truncation
+ interface: GlobalValidateOption
+ argument_type: time.Duration
+ comment: |
+ WithTruncation specifies the amount that should be used when
+ truncating time values used during time-based validation routines,
+ and by default this is disabled.
+
+ In v2 of this library, time values were truncated down to second accuracy, i.e.
+ 1.0000001 seconds is truncated to 1 second. To restore this behavior, set
+ this value to `time.Second`
+
+ Since v3, this option can be passed to `jwt.Settings()` to set the truncation
+ value globally, as well as per invocation of `jwt.Validate()`
+ - ident: Clock
+ interface: ValidateOption
+ argument_type: Clock
+ comment: |
+ WithClock specifies the `Clock` to be used when verifying
+ exp, iat and nbf claims.
+ - ident: Context
+ interface: ValidateOption
+ argument_type: context.Context
+ comment: |
+ WithContext allows you to specify a context.Context object to be used
+ with `jwt.Validate()` option.
+
+ Please be aware that in the next major release of this library,
+ `jwt.Validate()`'s signature will change to include an explicit
+ `context.Context` object.
+ - ident: ResetValidators
+ interface: ValidateOption
+ argument_type: bool
+ comment: |
+ WithResetValidators specifies that the default validators should be
+ reset before applying the custom validators. By default `jwt.Validate()`
+ checks for the validity of JWT by checking `exp`, `nbf`, and `iat`, even
+ when you specify more validators through other options.
+
+ You SHOULD NOT use this option unless you know exactly what you are doing,
+ as this will pose significant security issues when used incorrectly.
+
+ Using this option with the value `true` will remove all default checks,
+ and will expect you to specify validators as options. This is useful when you
+ want to skip the default validators and only use specific validators, such as
+ for https://openid.net/specs/openid-connect-rpinitiated-1_0.html, where
+ the token could be accepted even if the token is expired.
+
+ If you set this option to true and you do not specify any validators,
+ `jwt.Validate()` will return an error.
+
+ The default value is `false` (`iat`, `exp`, and `nbf` are automatically checked).
+ - ident: FlattenAudience
+ interface: GlobalOption
+ argument_type: bool
+ comment: |
+ WithFlattenAudience specifies the the `jwt.FlattenAudience` option on
+ every token defaults to enabled. You can still disable this on a per-object
+ basis using the `jwt.Options().Disable(jwt.FlattenAudience)` method call.
+
+ See the documentation for `jwt.TokenOptionSet`, `(jwt.Token).Options`, and
+ `jwt.FlattenAudience` for more details
+ - ident: FormKey
+ interface: ParseOption
+ argument_type: string
+ comment: |
+ WithFormKey is used to specify header keys to search for tokens.
+
+ While the type system allows this option to be passed to jwt.Parse() directly,
+ doing so will have no effect. Only use it for HTTP request parsing functions
+ - ident: HeaderKey
+ interface: ParseOption
+ argument_type: string
+ comment: |
+ WithHeaderKey is used to specify header keys to search for tokens.
+
+ While the type system allows this option to be passed to `jwt.Parse()` directly,
+ doing so will have no effect. Only use it for HTTP request parsing functions
+ - ident: Cookie
+ interface: ParseOption
+ argument_type: '**http.Cookie'
+ comment: |
+ WithCookie is used to specify a variable to store the cookie used when `jwt.ParseCookie()`
+ is called. This allows you to inspect the cookie for additional information after a successful
+ parsing of the JWT token stored in the cookie.
+
+ While the type system allows this option to be passed to `jwt.Parse()` directly,
+ doing so will have no effect. Only use it for HTTP request parsing functions
+ - ident: CookieKey
+ interface: ParseOption
+ argument_type: string
+ comment: |
+ WithCookieKey is used to specify cookie keys to search for tokens.
+
+ While the type system allows this option to be passed to `jwt.Parse()` directly,
+ doing so will have no effect. Only use it for HTTP request parsing functions
+ - ident: Token
+ interface: ParseOption
+ argument_type: Token
+ comment: |
+ WithToken specifies the token instance in which the resulting JWT is stored
+ when parsing JWT tokens
+ - ident: Validate
+ interface: ParseOption
+ argument_type: bool
+ comment: |
+ WithValidate is passed to `Parse()` method to denote that the
+ validation of the JWT token should be performed (or not) after
+ a successful parsing of the incoming payload.
+
+ This option is enabled by default.
+
+ If you would like disable validation,
+ you must use `jwt.WithValidate(false)` or use `jwt.ParseInsecure()`
+ - ident: Verify
+ interface: ParseOption
+ argument_type: bool
+ comment: |
+ WithVerify is passed to `Parse()` method to denote that the
+ signature verification should be performed after a successful
+ deserialization of the incoming payload.
+
+ This option is enabled by default.
+
+ If you do not provide any verification key sources, `jwt.Parse()`
+ would return an error.
+
+ If you would like to only parse the JWT payload and not verify it,
+ you must use `jwt.WithVerify(false)` or use `jwt.ParseInsecure()`
+ - ident: KeyProvider
+ interface: ParseOption
+ argument_type: jws.KeyProvider
+ comment: |
+ WithKeyProvider allows users to specify an object to provide keys to
+ sign/verify tokens using arbitrary code. Please read the documentation
+ for `jws.KeyProvider` in the `jws` package for details on how this works.
+ - ident: Pedantic
+ interface: ParseOption
+ argument_type: bool
+ comment: |
+ WithPedantic enables pedantic mode for parsing JWTs. Currently this only
+ applies to checking for the correct `typ` and/or `cty` when necessary.
+ - ident: EncryptOption
+ interface: EncryptOption
+ argument_type: jwe.EncryptOption
+ comment: |
+ WithEncryptOption provides an escape hatch for cases where extra options to
+ `(jws.Serializer).Encrypt()` must be specified when using `jwt.Sign()`. Normally you do not
+ need to use this.
+ - ident: SignOption
+ interface: SignOption
+ argument_type: jws.SignOption
+ comment: |
+ WithSignOption provides an escape hatch for cases where extra options to
+ `jws.Sign()` must be specified when using `jwt.Sign()`. Normally you do not
+ need to use this.
+ - ident: Validator
+ interface: ValidateOption
+ argument_type: Validator
+ comment: |
+ WithValidator validates the token with the given Validator.
+
+ For example, in order to validate tokens that are only valid during August, you would write
+
+ validator := jwt.ValidatorFunc(func(_ context.Context, t jwt.Token) error {
+ if time.Now().Month() != 8 {
+ return fmt.Errorf(`tokens are only valid during August!`)
+ }
+ return nil
+ })
+ err := jwt.Validate(token, jwt.WithValidator(validator))
+ - ident: FS
+ interface: ReadFileOption
+ argument_type: fs.FS
+ comment: |
+ WithFS specifies the source `fs.FS` object to read the file from.
+ - ident: NumericDateParsePrecision
+ interface: GlobalOption
+ argument_type: int
+ comment: |
+ WithNumericDateParsePrecision sets the precision up to which the
+ library uses to parse fractional dates found in the numeric date
+ fields. Default is 0 (second, no fractions), max is 9 (nanosecond)
+ - ident: NumericDateFormatPrecision
+ interface: GlobalOption
+ argument_type: int
+ comment: |
+ WithNumericDateFormatPrecision sets the precision up to which the
+ library uses to format fractional dates found in the numeric date
+ fields. Default is 0 (second, no fractions), max is 9 (nanosecond)
+ - ident: NumericDateParsePedantic
+ interface: GlobalOption
+ argument_type: bool
+ comment: |
+ WithNumericDateParsePedantic specifies if the parser should behave
+ in a pedantic manner when parsing numeric dates. Normally this library
+ attempts to interpret timestamps as a numeric value representing
+ number of seconds (with an optional fractional part), but if that fails
+ it tries to parse using a RFC3339 parser. This allows us to parse
+ payloads from non-conforming servers.
+
+ However, when you set WithNumericDateParePedantic to `true`, the
+ RFC3339 parser is not tried, and we expect a numeric value strictly
+ - ident: Base64Encoder
+ interface: SignParseOption
+ argument_type: jws.Base64Encoder
+ comment: |
+ WithBase64Encoder specifies the base64 encoder to use for signing
+ tokens and verifying JWS signatures.
\ No newline at end of file
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/options_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/options_gen.go
new file mode 100644
index 0000000000..3a644a6e4c
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/options_gen.go
@@ -0,0 +1,495 @@
+// Code generated by tools/cmd/genoptions/main.go. DO NOT EDIT.
+
+package jwt
+
+import (
+ "context"
+ "io/fs"
+ "net/http"
+ "time"
+
+ "github.com/lestrrat-go/jwx/v3/jwe"
+ "github.com/lestrrat-go/jwx/v3/jws"
+ "github.com/lestrrat-go/option/v2"
+)
+
+type Option = option.Interface
+
+// EncryptOption describes an Option that can be passed to (jwt.Serializer).Encrypt
+type EncryptOption interface {
+ Option
+ encryptOption()
+}
+
+type encryptOption struct {
+ Option
+}
+
+func (*encryptOption) encryptOption() {}
+
+// GlobalOption describes an Option that can be passed to `Settings()`.
+type GlobalOption interface {
+ Option
+ globalOption()
+}
+
+type globalOption struct {
+ Option
+}
+
+func (*globalOption) globalOption() {}
+
+// GlobalValidateOption describes an Option that can be passed to `jwt.Settings()` and `jwt.Validate()`
+type GlobalValidateOption interface {
+ Option
+ globalOption()
+ parseOption()
+ readFileOption()
+ validateOption()
+}
+
+type globalValidateOption struct {
+ Option
+}
+
+func (*globalValidateOption) globalOption() {}
+
+func (*globalValidateOption) parseOption() {}
+
+func (*globalValidateOption) readFileOption() {}
+
+func (*globalValidateOption) validateOption() {}
+
+// ParseOption describes an Option that can be passed to `jwt.Parse()`.
+// ParseOption also implements ReadFileOption, therefore it may be
+// safely pass them to `jwt.ReadFile()`
+type ParseOption interface {
+ Option
+ parseOption()
+ readFileOption()
+}
+
+type parseOption struct {
+ Option
+}
+
+func (*parseOption) parseOption() {}
+
+func (*parseOption) readFileOption() {}
+
+// ReadFileOption is a type of `Option` that can be passed to `jws.ReadFile`
+type ReadFileOption interface {
+ Option
+ readFileOption()
+}
+
+type readFileOption struct {
+ Option
+}
+
+func (*readFileOption) readFileOption() {}
+
+// SignEncryptParseOption describes an Option that can be passed to both `jwt.Sign()` or
+// `jwt.Parse()`
+type SignEncryptParseOption interface {
+ Option
+ parseOption()
+ encryptOption()
+ readFileOption()
+ signOption()
+}
+
+type signEncryptParseOption struct {
+ Option
+}
+
+func (*signEncryptParseOption) parseOption() {}
+
+func (*signEncryptParseOption) encryptOption() {}
+
+func (*signEncryptParseOption) readFileOption() {}
+
+func (*signEncryptParseOption) signOption() {}
+
+// SignOption describes an Option that can be passed to `jwt.Sign()` or
+// (jwt.Serializer).Sign
+type SignOption interface {
+ Option
+ signOption()
+}
+
+type signOption struct {
+ Option
+}
+
+func (*signOption) signOption() {}
+
+// SignParseOption describes an Option that can be passed to both `jwt.Sign()` or
+// `jwt.Parse()`
+type SignParseOption interface {
+ Option
+ signOption()
+ parseOption()
+ readFileOption()
+}
+
+type signParseOption struct {
+ Option
+}
+
+func (*signParseOption) signOption() {}
+
+func (*signParseOption) parseOption() {}
+
+func (*signParseOption) readFileOption() {}
+
+// ValidateOption describes an Option that can be passed to Validate().
+// ValidateOption also implements ParseOption, therefore it may be
+// safely passed to `Parse()` (and thus `jwt.ReadFile()`)
+type ValidateOption interface {
+ Option
+ parseOption()
+ readFileOption()
+ validateOption()
+}
+
+type validateOption struct {
+ Option
+}
+
+func (*validateOption) parseOption() {}
+
+func (*validateOption) readFileOption() {}
+
+func (*validateOption) validateOption() {}
+
+type identAcceptableSkew struct{}
+type identBase64Encoder struct{}
+type identClock struct{}
+type identContext struct{}
+type identCookie struct{}
+type identCookieKey struct{}
+type identEncryptOption struct{}
+type identFS struct{}
+type identFlattenAudience struct{}
+type identFormKey struct{}
+type identHeaderKey struct{}
+type identKeyProvider struct{}
+type identNumericDateFormatPrecision struct{}
+type identNumericDateParsePedantic struct{}
+type identNumericDateParsePrecision struct{}
+type identPedantic struct{}
+type identResetValidators struct{}
+type identSignOption struct{}
+type identToken struct{}
+type identTruncation struct{}
+type identValidate struct{}
+type identValidator struct{}
+type identVerify struct{}
+
+func (identAcceptableSkew) String() string {
+ return "WithAcceptableSkew"
+}
+
+func (identBase64Encoder) String() string {
+ return "WithBase64Encoder"
+}
+
+func (identClock) String() string {
+ return "WithClock"
+}
+
+func (identContext) String() string {
+ return "WithContext"
+}
+
+func (identCookie) String() string {
+ return "WithCookie"
+}
+
+func (identCookieKey) String() string {
+ return "WithCookieKey"
+}
+
+func (identEncryptOption) String() string {
+ return "WithEncryptOption"
+}
+
+func (identFS) String() string {
+ return "WithFS"
+}
+
+func (identFlattenAudience) String() string {
+ return "WithFlattenAudience"
+}
+
+func (identFormKey) String() string {
+ return "WithFormKey"
+}
+
+func (identHeaderKey) String() string {
+ return "WithHeaderKey"
+}
+
+func (identKeyProvider) String() string {
+ return "WithKeyProvider"
+}
+
+func (identNumericDateFormatPrecision) String() string {
+ return "WithNumericDateFormatPrecision"
+}
+
+func (identNumericDateParsePedantic) String() string {
+ return "WithNumericDateParsePedantic"
+}
+
+func (identNumericDateParsePrecision) String() string {
+ return "WithNumericDateParsePrecision"
+}
+
+func (identPedantic) String() string {
+ return "WithPedantic"
+}
+
+func (identResetValidators) String() string {
+ return "WithResetValidators"
+}
+
+func (identSignOption) String() string {
+ return "WithSignOption"
+}
+
+func (identToken) String() string {
+ return "WithToken"
+}
+
+func (identTruncation) String() string {
+ return "WithTruncation"
+}
+
+func (identValidate) String() string {
+ return "WithValidate"
+}
+
+func (identValidator) String() string {
+ return "WithValidator"
+}
+
+func (identVerify) String() string {
+ return "WithVerify"
+}
+
+// WithAcceptableSkew specifies the duration in which exp, iat and nbf
+// claims may differ by. This value should be positive
+func WithAcceptableSkew(v time.Duration) ValidateOption {
+ return &validateOption{option.New(identAcceptableSkew{}, v)}
+}
+
+// WithBase64Encoder specifies the base64 encoder to use for signing
+// tokens and verifying JWS signatures.
+func WithBase64Encoder(v jws.Base64Encoder) SignParseOption {
+ return &signParseOption{option.New(identBase64Encoder{}, v)}
+}
+
+// WithClock specifies the `Clock` to be used when verifying
+// exp, iat and nbf claims.
+func WithClock(v Clock) ValidateOption {
+ return &validateOption{option.New(identClock{}, v)}
+}
+
+// WithContext allows you to specify a context.Context object to be used
+// with `jwt.Validate()` option.
+//
+// Please be aware that in the next major release of this library,
+// `jwt.Validate()`'s signature will change to include an explicit
+// `context.Context` object.
+func WithContext(v context.Context) ValidateOption {
+ return &validateOption{option.New(identContext{}, v)}
+}
+
+// WithCookie is used to specify a variable to store the cookie used when `jwt.ParseCookie()`
+// is called. This allows you to inspect the cookie for additional information after a successful
+// parsing of the JWT token stored in the cookie.
+//
+// While the type system allows this option to be passed to `jwt.Parse()` directly,
+// doing so will have no effect. Only use it for HTTP request parsing functions
+func WithCookie(v **http.Cookie) ParseOption {
+ return &parseOption{option.New(identCookie{}, v)}
+}
+
+// WithCookieKey is used to specify cookie keys to search for tokens.
+//
+// While the type system allows this option to be passed to `jwt.Parse()` directly,
+// doing so will have no effect. Only use it for HTTP request parsing functions
+func WithCookieKey(v string) ParseOption {
+ return &parseOption{option.New(identCookieKey{}, v)}
+}
+
+// WithEncryptOption provides an escape hatch for cases where extra options to
+// `(jws.Serializer).Encrypt()` must be specified when using `jwt.Sign()`. Normally you do not
+// need to use this.
+func WithEncryptOption(v jwe.EncryptOption) EncryptOption {
+ return &encryptOption{option.New(identEncryptOption{}, v)}
+}
+
+// WithFS specifies the source `fs.FS` object to read the file from.
+func WithFS(v fs.FS) ReadFileOption {
+ return &readFileOption{option.New(identFS{}, v)}
+}
+
+// WithFlattenAudience specifies the the `jwt.FlattenAudience` option on
+// every token defaults to enabled. You can still disable this on a per-object
+// basis using the `jwt.Options().Disable(jwt.FlattenAudience)` method call.
+//
+// See the documentation for `jwt.TokenOptionSet`, `(jwt.Token).Options`, and
+// `jwt.FlattenAudience` for more details
+func WithFlattenAudience(v bool) GlobalOption {
+ return &globalOption{option.New(identFlattenAudience{}, v)}
+}
+
+// WithFormKey is used to specify header keys to search for tokens.
+//
+// While the type system allows this option to be passed to jwt.Parse() directly,
+// doing so will have no effect. Only use it for HTTP request parsing functions
+func WithFormKey(v string) ParseOption {
+ return &parseOption{option.New(identFormKey{}, v)}
+}
+
+// WithHeaderKey is used to specify header keys to search for tokens.
+//
+// While the type system allows this option to be passed to `jwt.Parse()` directly,
+// doing so will have no effect. Only use it for HTTP request parsing functions
+func WithHeaderKey(v string) ParseOption {
+ return &parseOption{option.New(identHeaderKey{}, v)}
+}
+
+// WithKeyProvider allows users to specify an object to provide keys to
+// sign/verify tokens using arbitrary code. Please read the documentation
+// for `jws.KeyProvider` in the `jws` package for details on how this works.
+func WithKeyProvider(v jws.KeyProvider) ParseOption {
+ return &parseOption{option.New(identKeyProvider{}, v)}
+}
+
+// WithNumericDateFormatPrecision sets the precision up to which the
+// library uses to format fractional dates found in the numeric date
+// fields. Default is 0 (second, no fractions), max is 9 (nanosecond)
+func WithNumericDateFormatPrecision(v int) GlobalOption {
+ return &globalOption{option.New(identNumericDateFormatPrecision{}, v)}
+}
+
+// WithNumericDateParsePedantic specifies if the parser should behave
+// in a pedantic manner when parsing numeric dates. Normally this library
+// attempts to interpret timestamps as a numeric value representing
+// number of seconds (with an optional fractional part), but if that fails
+// it tries to parse using a RFC3339 parser. This allows us to parse
+// payloads from non-conforming servers.
+//
+// However, when you set WithNumericDateParePedantic to `true`, the
+// RFC3339 parser is not tried, and we expect a numeric value strictly
+func WithNumericDateParsePedantic(v bool) GlobalOption {
+ return &globalOption{option.New(identNumericDateParsePedantic{}, v)}
+}
+
+// WithNumericDateParsePrecision sets the precision up to which the
+// library uses to parse fractional dates found in the numeric date
+// fields. Default is 0 (second, no fractions), max is 9 (nanosecond)
+func WithNumericDateParsePrecision(v int) GlobalOption {
+ return &globalOption{option.New(identNumericDateParsePrecision{}, v)}
+}
+
+// WithPedantic enables pedantic mode for parsing JWTs. Currently this only
+// applies to checking for the correct `typ` and/or `cty` when necessary.
+func WithPedantic(v bool) ParseOption {
+ return &parseOption{option.New(identPedantic{}, v)}
+}
+
+// WithResetValidators specifies that the default validators should be
+// reset before applying the custom validators. By default `jwt.Validate()`
+// checks for the validity of JWT by checking `exp`, `nbf`, and `iat`, even
+// when you specify more validators through other options.
+//
+// You SHOULD NOT use this option unless you know exactly what you are doing,
+// as this will pose significant security issues when used incorrectly.
+//
+// Using this option with the value `true` will remove all default checks,
+// and will expect you to specify validators as options. This is useful when you
+// want to skip the default validators and only use specific validators, such as
+// for https://openid.net/specs/openid-connect-rpinitiated-1_0.html, where
+// the token could be accepted even if the token is expired.
+//
+// If you set this option to true and you do not specify any validators,
+// `jwt.Validate()` will return an error.
+//
+// The default value is `false` (`iat`, `exp`, and `nbf` are automatically checked).
+func WithResetValidators(v bool) ValidateOption {
+ return &validateOption{option.New(identResetValidators{}, v)}
+}
+
+// WithSignOption provides an escape hatch for cases where extra options to
+// `jws.Sign()` must be specified when using `jwt.Sign()`. Normally you do not
+// need to use this.
+func WithSignOption(v jws.SignOption) SignOption {
+ return &signOption{option.New(identSignOption{}, v)}
+}
+
+// WithToken specifies the token instance in which the resulting JWT is stored
+// when parsing JWT tokens
+func WithToken(v Token) ParseOption {
+ return &parseOption{option.New(identToken{}, v)}
+}
+
+// WithTruncation specifies the amount that should be used when
+// truncating time values used during time-based validation routines,
+// and by default this is disabled.
+//
+// In v2 of this library, time values were truncated down to second accuracy, i.e.
+// 1.0000001 seconds is truncated to 1 second. To restore this behavior, set
+// this value to `time.Second`
+//
+// Since v3, this option can be passed to `jwt.Settings()` to set the truncation
+// value globally, as well as per invocation of `jwt.Validate()`
+func WithTruncation(v time.Duration) GlobalValidateOption {
+ return &globalValidateOption{option.New(identTruncation{}, v)}
+}
+
+// WithValidate is passed to `Parse()` method to denote that the
+// validation of the JWT token should be performed (or not) after
+// a successful parsing of the incoming payload.
+//
+// This option is enabled by default.
+//
+// If you would like disable validation,
+// you must use `jwt.WithValidate(false)` or use `jwt.ParseInsecure()`
+func WithValidate(v bool) ParseOption {
+ return &parseOption{option.New(identValidate{}, v)}
+}
+
+// WithValidator validates the token with the given Validator.
+//
+// For example, in order to validate tokens that are only valid during August, you would write
+//
+// validator := jwt.ValidatorFunc(func(_ context.Context, t jwt.Token) error {
+// if time.Now().Month() != 8 {
+// return fmt.Errorf(`tokens are only valid during August!`)
+// }
+// return nil
+// })
+// err := jwt.Validate(token, jwt.WithValidator(validator))
+func WithValidator(v Validator) ValidateOption {
+ return &validateOption{option.New(identValidator{}, v)}
+}
+
+// WithVerify is passed to `Parse()` method to denote that the
+// signature verification should be performed after a successful
+// deserialization of the incoming payload.
+//
+// This option is enabled by default.
+//
+// If you do not provide any verification key sources, `jwt.Parse()`
+// would return an error.
+//
+// If you would like to only parse the JWT payload and not verify it,
+// you must use `jwt.WithVerify(false)` or use `jwt.ParseInsecure()`
+func WithVerify(v bool) ParseOption {
+ return &parseOption{option.New(identVerify{}, v)}
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/serialize.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/serialize.go
new file mode 100644
index 0000000000..9d3bdac94a
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/serialize.go
@@ -0,0 +1,264 @@
+package jwt
+
+import (
+ "fmt"
+
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/jwe"
+ "github.com/lestrrat-go/jwx/v3/jws"
+)
+
+type SerializeCtx interface {
+ Step() int
+ Nested() bool
+}
+
+type serializeCtx struct {
+ step int
+ nested bool
+}
+
+func (ctx *serializeCtx) Step() int {
+ return ctx.step
+}
+
+func (ctx *serializeCtx) Nested() bool {
+ return ctx.nested
+}
+
+type SerializeStep interface {
+ Serialize(SerializeCtx, any) (any, error)
+}
+
+// errStep is always an error. used to indicate that a method like
+// serializer.Sign or Encrypt already errored out on configuration
+type errStep struct {
+ err error
+}
+
+func (e errStep) Serialize(_ SerializeCtx, _ any) (any, error) {
+ return nil, e.err
+}
+
+// Serializer is a generic serializer for JWTs. Whereas other convenience
+// functions can only do one thing (such as generate a JWS signed JWT),
+// Using this construct you can serialize the token however you want.
+//
+// By default, the serializer only marshals the token into a JSON payload.
+// You must set up the rest of the steps that should be taken by the
+// serializer.
+//
+// For example, to marshal the token into JSON, then apply JWS and JWE
+// in that order, you would do:
+//
+// serialized, err := jwt.NewSerializer().
+// Sign(jwa.RS256, key).
+// Encrypt(jwe.WithEncryptOption(jwe.WithKey(jwa.RSA_OAEP(), publicKey))).
+// Serialize(token)
+//
+// The `jwt.Sign()` function is equivalent to
+//
+// serialized, err := jwt.NewSerializer().
+// Sign(...args...).
+// Serialize(token)
+type Serializer struct {
+ steps []SerializeStep
+}
+
+// NewSerializer creates a new empty serializer.
+func NewSerializer() *Serializer {
+ return &Serializer{}
+}
+
+// Reset clears all of the registered steps.
+func (s *Serializer) Reset() *Serializer {
+ s.steps = nil
+ return s
+}
+
+// Step adds a new Step to the serialization process
+func (s *Serializer) Step(step SerializeStep) *Serializer {
+ s.steps = append(s.steps, step)
+ return s
+}
+
+type jsonSerializer struct{}
+
+func (jsonSerializer) Serialize(_ SerializeCtx, v any) (any, error) {
+ token, ok := v.(Token)
+ if !ok {
+ return nil, fmt.Errorf(`invalid input: expected jwt.Token`)
+ }
+
+ buf, err := json.Marshal(token)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to serialize as JSON: %w`, err)
+ }
+ return buf, nil
+}
+
+type genericHeader interface {
+ Get(string, any) error
+ Set(string, any) error
+ Has(string) bool
+}
+
+func setTypeOrCty(ctx SerializeCtx, hdrs genericHeader) error {
+ // cty and typ are common between JWE/JWS, so we don't use
+ // the constants in jws/jwe package here
+ const typKey = `typ`
+ const ctyKey = `cty`
+
+ if ctx.Step() == 1 {
+ // We are executed immediately after json marshaling
+ if !hdrs.Has(typKey) {
+ if err := hdrs.Set(typKey, `JWT`); err != nil {
+ return fmt.Errorf(`failed to set %s key to "JWT": %w`, typKey, err)
+ }
+ }
+ } else {
+ if ctx.Nested() {
+ // If this is part of a nested sequence, we should set cty = 'JWT'
+ // https://datatracker.ietf.org/doc/html/rfc7519#section-5.2
+ if err := hdrs.Set(ctyKey, `JWT`); err != nil {
+ return fmt.Errorf(`failed to set %s key to "JWT": %w`, ctyKey, err)
+ }
+ }
+ }
+ return nil
+}
+
+type jwsSerializer struct {
+ options []jws.SignOption
+}
+
+func (s *jwsSerializer) Serialize(ctx SerializeCtx, v any) (any, error) {
+ payload, ok := v.([]byte)
+ if !ok {
+ return nil, fmt.Errorf(`expected []byte as input`)
+ }
+
+ for _, option := range s.options {
+ var pc interface{ Protected(jws.Headers) jws.Headers }
+ if err := option.Value(&pc); err != nil {
+ continue
+ }
+ hdrs := pc.Protected(jws.NewHeaders())
+ if err := setTypeOrCty(ctx, hdrs); err != nil {
+ return nil, err // this is already wrapped
+ }
+
+ // JWTs MUST NOT use b64 = false
+ // https://datatracker.ietf.org/doc/html/rfc7797#section-7
+ var b64 bool
+ if err := hdrs.Get("b64", &b64); err == nil {
+ if !b64 { // b64 = false
+ return nil, fmt.Errorf(`b64 cannot be false for JWTs`)
+ }
+ }
+ }
+ return jws.Sign(payload, s.options...)
+}
+
+func (s *Serializer) Sign(options ...SignOption) *Serializer {
+ var soptions []jws.SignOption
+ if l := len(options); l > 0 {
+ // we need to from SignOption to Option because ... reasons
+ // (todo: when go1.18 prevails, use type parameters
+ rawoptions := make([]Option, l)
+ for i, option := range options {
+ rawoptions[i] = option
+ }
+
+ converted, err := toSignOptions(rawoptions...)
+ if err != nil {
+ return s.Step(errStep{fmt.Errorf(`(jwt.Serializer).Sign: failed to convert options into jws.SignOption: %w`, err)})
+ }
+ soptions = converted
+ }
+ return s.sign(soptions...)
+}
+
+func (s *Serializer) sign(options ...jws.SignOption) *Serializer {
+ return s.Step(&jwsSerializer{
+ options: options,
+ })
+}
+
+type jweSerializer struct {
+ options []jwe.EncryptOption
+}
+
+func (s *jweSerializer) Serialize(ctx SerializeCtx, v any) (any, error) {
+ payload, ok := v.([]byte)
+ if !ok {
+ return nil, fmt.Errorf(`expected []byte as input`)
+ }
+
+ hdrs := jwe.NewHeaders()
+ if err := setTypeOrCty(ctx, hdrs); err != nil {
+ return nil, err // this is already wrapped
+ }
+
+ options := append([]jwe.EncryptOption{jwe.WithMergeProtectedHeaders(true), jwe.WithProtectedHeaders(hdrs)}, s.options...)
+ return jwe.Encrypt(payload, options...)
+}
+
+// Encrypt specifies the JWT to be serialized as an encrypted payload.
+//
+// One notable difference between this method and `jwe.Encrypt()` is that
+// while `jwe.Encrypt()` OVERWRITES the previous headers when `jwe.WithProtectedHeaders()`
+// is provided, this method MERGES them. This is due to the fact that we
+// MUST add some extra headers to construct a proper JWE message.
+// Be careful when you pass multiple `jwe.EncryptOption`s.
+func (s *Serializer) Encrypt(options ...EncryptOption) *Serializer {
+ var eoptions []jwe.EncryptOption
+ if l := len(options); l > 0 {
+ // we need to from SignOption to Option because ... reasons
+ // (todo: when go1.18 prevails, use type parameters
+ rawoptions := make([]Option, l)
+ for i, option := range options {
+ rawoptions[i] = option
+ }
+
+ converted, err := toEncryptOptions(rawoptions...)
+ if err != nil {
+ return s.Step(errStep{fmt.Errorf(`(jwt.Serializer).Encrypt: failed to convert options into jwe.EncryptOption: %w`, err)})
+ }
+ eoptions = converted
+ }
+ return s.encrypt(eoptions...)
+}
+
+func (s *Serializer) encrypt(options ...jwe.EncryptOption) *Serializer {
+ return s.Step(&jweSerializer{
+ options: options,
+ })
+}
+
+func (s *Serializer) Serialize(t Token) ([]byte, error) {
+ steps := make([]SerializeStep, len(s.steps)+1)
+ steps[0] = jsonSerializer{}
+ for i, step := range s.steps {
+ steps[i+1] = step
+ }
+
+ var ctx serializeCtx
+ ctx.nested = len(s.steps) > 1
+ var payload any = t
+ for i, step := range steps {
+ ctx.step = i
+ v, err := step.Serialize(&ctx, payload)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to serialize token at step #%d: %w`, i+1, err)
+ }
+ payload = v
+ }
+
+ res, ok := payload.([]byte)
+ if !ok {
+ return nil, fmt.Errorf(`invalid serialization produced`)
+ }
+
+ return res, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/token_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/token_gen.go
new file mode 100644
index 0000000000..2361ff5621
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/token_gen.go
@@ -0,0 +1,635 @@
+// Code generated by tools/cmd/genjwt/main.go. DO NOT EDIT.
+
+package jwt
+
+import (
+ "bytes"
+ "fmt"
+ "sort"
+ "sync"
+ "time"
+
+ "github.com/lestrrat-go/blackmagic"
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+ "github.com/lestrrat-go/jwx/v3/internal/pool"
+ "github.com/lestrrat-go/jwx/v3/internal/tokens"
+ jwterrs "github.com/lestrrat-go/jwx/v3/jwt/internal/errors"
+ "github.com/lestrrat-go/jwx/v3/jwt/internal/types"
+)
+
+const (
+ AudienceKey = "aud"
+ ExpirationKey = "exp"
+ IssuedAtKey = "iat"
+ IssuerKey = "iss"
+ JwtIDKey = "jti"
+ NotBeforeKey = "nbf"
+ SubjectKey = "sub"
+)
+
+// stdClaimNames is a list of all standard claim names defined in the JWT specification.
+var stdClaimNames = []string{AudienceKey, ExpirationKey, IssuedAtKey, IssuerKey, JwtIDKey, NotBeforeKey, SubjectKey}
+
+// Token represents a generic JWT token.
+// which are type-aware (to an extent). Other claims may be accessed via the `Get`/`Set`
+// methods but their types are not taken into consideration at all. If you have non-standard
+// claims that you must frequently access, consider creating accessors functions
+// like the following
+//
+// func SetFoo(tok jwt.Token) error
+// func GetFoo(tok jwt.Token) (*Customtyp, error)
+//
+// Embedding jwt.Token into another struct is not recommended, because
+// jwt.Token needs to handle private claims, and this really does not
+// work well when it is embedded in other structure
+type Token interface {
+ // Audience returns the value for "aud" field of the token
+ Audience() ([]string, bool)
+
+ // Expiration returns the value for "exp" field of the token
+ Expiration() (time.Time, bool)
+
+ // IssuedAt returns the value for "iat" field of the token
+ IssuedAt() (time.Time, bool)
+
+ // Issuer returns the value for "iss" field of the token
+ Issuer() (string, bool)
+
+ // JwtID returns the value for "jti" field of the token
+ JwtID() (string, bool)
+
+ // NotBefore returns the value for "nbf" field of the token
+ NotBefore() (time.Time, bool)
+
+ // Subject returns the value for "sub" field of the token
+ Subject() (string, bool)
+
+ // Get is used to extract the value of any claim, including non-standard claims, out of the token.
+ //
+ // The first argument is the name of the claim. The second argument is a pointer
+ // to a variable that will receive the value of the claim. The method returns
+ // an error if the claim does not exist, or if the value cannot be assigned to
+ // the destination variable. Note that a field is considered to "exist" even if
+ // the value is empty-ish (e.g. 0, false, ""), as long as it is explicitly set.
+ //
+ // For standard claims, you can use the corresponding getter method, such as
+ // `Issuer()`, `Subject()`, `Audience()`, `IssuedAt()`, `NotBefore()`, `ExpiresAt()`
+ //
+ // Note that fields of JWS/JWE are NOT accessible through this method. You need
+ // to use `jws.Parse` and `jwe.Parse` to obtain the JWS/JWE message (and NOT
+ // the payload, which presumably is the JWT), and then use their `Get` methods in their respective packages
+ Get(string, any) error
+
+ // Set assigns a value to the corresponding field in the token. Some
+ // pre-defined fields such as `nbf`, `iat`, `iss` need their values to
+ // be of a specific type. See the other getter methods in this interface
+ // for the types of each of these fields
+ Set(string, any) error
+
+ // Has returns true if the specified claim has a value, even if
+ // the value is empty-ish (e.g. 0, false, "") as long as it has been
+ // explicitly set.
+ Has(string) bool
+ Remove(string) error
+
+ // Options returns the per-token options associated with this token.
+ // The options set value will be copied when the token is cloned via `Clone()`
+ // but it will not survive when the token goes through marshaling/unmarshaling
+ // such as `json.Marshal` and `json.Unmarshal`
+ Options() *TokenOptionSet
+ Clone() (Token, error)
+ Keys() []string
+}
+type stdToken struct {
+ mu *sync.RWMutex
+ dc DecodeCtx // per-object context for decoding
+ options TokenOptionSet // per-object option
+ audience types.StringList // https://tools.ietf.org/html/rfc7519#section-4.1.3
+ expiration *types.NumericDate // https://tools.ietf.org/html/rfc7519#section-4.1.4
+ issuedAt *types.NumericDate // https://tools.ietf.org/html/rfc7519#section-4.1.6
+ issuer *string // https://tools.ietf.org/html/rfc7519#section-4.1.1
+ jwtID *string // https://tools.ietf.org/html/rfc7519#section-4.1.7
+ notBefore *types.NumericDate // https://tools.ietf.org/html/rfc7519#section-4.1.5
+ subject *string // https://tools.ietf.org/html/rfc7519#section-4.1.2
+ privateClaims map[string]any
+}
+
+// New creates a standard token, with minimal knowledge of
+// possible claims. Standard claims include"aud", "exp", "iat", "iss", "jti", "nbf" and "sub".
+// Convenience accessors are provided for these standard claims
+func New() Token {
+ return &stdToken{
+ mu: &sync.RWMutex{},
+ privateClaims: make(map[string]any),
+ options: DefaultOptionSet(),
+ }
+}
+
+func (t *stdToken) Options() *TokenOptionSet {
+ return &t.options
+}
+
+func (t *stdToken) Has(name string) bool {
+ t.mu.RLock()
+ defer t.mu.RUnlock()
+ switch name {
+ case AudienceKey:
+ return t.audience != nil
+ case ExpirationKey:
+ return t.expiration != nil
+ case IssuedAtKey:
+ return t.issuedAt != nil
+ case IssuerKey:
+ return t.issuer != nil
+ case JwtIDKey:
+ return t.jwtID != nil
+ case NotBeforeKey:
+ return t.notBefore != nil
+ case SubjectKey:
+ return t.subject != nil
+ default:
+ _, ok := t.privateClaims[name]
+ return ok
+ }
+}
+
+func (t *stdToken) Get(name string, dst any) error {
+ t.mu.RLock()
+ defer t.mu.RUnlock()
+ switch name {
+ case AudienceKey:
+ if t.audience == nil {
+ return jwterrs.ClaimNotFoundError{Name: name}
+ }
+ if err := blackmagic.AssignIfCompatible(dst, t.audience.Get()); err != nil {
+ return jwterrs.ClaimAssignmentFailedError{Err: err}
+ }
+ return nil
+ case ExpirationKey:
+ if t.expiration == nil {
+ return jwterrs.ClaimNotFoundError{Name: name}
+ }
+ if err := blackmagic.AssignIfCompatible(dst, t.expiration.Get()); err != nil {
+ return jwterrs.ClaimAssignmentFailedError{Err: err}
+ }
+ return nil
+ case IssuedAtKey:
+ if t.issuedAt == nil {
+ return jwterrs.ClaimNotFoundError{Name: name}
+ }
+ if err := blackmagic.AssignIfCompatible(dst, t.issuedAt.Get()); err != nil {
+ return jwterrs.ClaimAssignmentFailedError{Err: err}
+ }
+ return nil
+ case IssuerKey:
+ if t.issuer == nil {
+ return jwterrs.ClaimNotFoundError{Name: name}
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(t.issuer)); err != nil {
+ return jwterrs.ClaimAssignmentFailedError{Err: err}
+ }
+ return nil
+ case JwtIDKey:
+ if t.jwtID == nil {
+ return jwterrs.ClaimNotFoundError{Name: name}
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(t.jwtID)); err != nil {
+ return jwterrs.ClaimAssignmentFailedError{Err: err}
+ }
+ return nil
+ case NotBeforeKey:
+ if t.notBefore == nil {
+ return jwterrs.ClaimNotFoundError{Name: name}
+ }
+ if err := blackmagic.AssignIfCompatible(dst, t.notBefore.Get()); err != nil {
+ return jwterrs.ClaimAssignmentFailedError{Err: err}
+ }
+ return nil
+ case SubjectKey:
+ if t.subject == nil {
+ return jwterrs.ClaimNotFoundError{Name: name}
+ }
+ if err := blackmagic.AssignIfCompatible(dst, *(t.subject)); err != nil {
+ return jwterrs.ClaimAssignmentFailedError{Err: err}
+ }
+ return nil
+ default:
+ v, ok := t.privateClaims[name]
+ if !ok {
+ return jwterrs.ClaimNotFoundError{Name: name}
+ }
+ if err := blackmagic.AssignIfCompatible(dst, v); err != nil {
+ return jwterrs.ClaimAssignmentFailedError{Err: err}
+ }
+ return nil
+ }
+}
+
+func (t *stdToken) Remove(key string) error {
+ t.mu.Lock()
+ defer t.mu.Unlock()
+ switch key {
+ case AudienceKey:
+ t.audience = nil
+ case ExpirationKey:
+ t.expiration = nil
+ case IssuedAtKey:
+ t.issuedAt = nil
+ case IssuerKey:
+ t.issuer = nil
+ case JwtIDKey:
+ t.jwtID = nil
+ case NotBeforeKey:
+ t.notBefore = nil
+ case SubjectKey:
+ t.subject = nil
+ default:
+ delete(t.privateClaims, key)
+ }
+ return nil
+}
+
+func (t *stdToken) Set(name string, value any) error {
+ t.mu.Lock()
+ defer t.mu.Unlock()
+ return t.setNoLock(name, value)
+}
+
+func (t *stdToken) DecodeCtx() DecodeCtx {
+ t.mu.RLock()
+ defer t.mu.RUnlock()
+ return t.dc
+}
+
+func (t *stdToken) SetDecodeCtx(v DecodeCtx) {
+ t.mu.Lock()
+ defer t.mu.Unlock()
+ t.dc = v
+}
+
+func (t *stdToken) setNoLock(name string, value any) error {
+ switch name {
+ case AudienceKey:
+ var acceptor types.StringList
+ if err := acceptor.Accept(value); err != nil {
+ return fmt.Errorf(`invalid value for %s key: %w`, AudienceKey, err)
+ }
+ t.audience = acceptor
+ return nil
+ case ExpirationKey:
+ var acceptor types.NumericDate
+ if err := acceptor.Accept(value); err != nil {
+ return fmt.Errorf(`invalid value for %s key: %w`, ExpirationKey, err)
+ }
+ t.expiration = &acceptor
+ return nil
+ case IssuedAtKey:
+ var acceptor types.NumericDate
+ if err := acceptor.Accept(value); err != nil {
+ return fmt.Errorf(`invalid value for %s key: %w`, IssuedAtKey, err)
+ }
+ t.issuedAt = &acceptor
+ return nil
+ case IssuerKey:
+ if v, ok := value.(string); ok {
+ t.issuer = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, IssuerKey, value)
+ case JwtIDKey:
+ if v, ok := value.(string); ok {
+ t.jwtID = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, JwtIDKey, value)
+ case NotBeforeKey:
+ var acceptor types.NumericDate
+ if err := acceptor.Accept(value); err != nil {
+ return fmt.Errorf(`invalid value for %s key: %w`, NotBeforeKey, err)
+ }
+ t.notBefore = &acceptor
+ return nil
+ case SubjectKey:
+ if v, ok := value.(string); ok {
+ t.subject = &v
+ return nil
+ }
+ return fmt.Errorf(`invalid value for %s key: %T`, SubjectKey, value)
+ default:
+ if t.privateClaims == nil {
+ t.privateClaims = map[string]any{}
+ }
+ t.privateClaims[name] = value
+ }
+ return nil
+}
+
+func (t *stdToken) Audience() ([]string, bool) {
+ t.mu.RLock()
+ defer t.mu.RUnlock()
+ if t.audience != nil {
+ return t.audience.Get(), true
+ }
+ return nil, false
+}
+
+func (t *stdToken) Expiration() (time.Time, bool) {
+ t.mu.RLock()
+ defer t.mu.RUnlock()
+ if t.expiration != nil {
+ return t.expiration.Get(), true
+ }
+ return time.Time{}, false
+}
+
+func (t *stdToken) IssuedAt() (time.Time, bool) {
+ t.mu.RLock()
+ defer t.mu.RUnlock()
+ if t.issuedAt != nil {
+ return t.issuedAt.Get(), true
+ }
+ return time.Time{}, false
+}
+
+func (t *stdToken) Issuer() (string, bool) {
+ t.mu.RLock()
+ defer t.mu.RUnlock()
+ if t.issuer != nil {
+ return *(t.issuer), true
+ }
+ return "", false
+}
+
+func (t *stdToken) JwtID() (string, bool) {
+ t.mu.RLock()
+ defer t.mu.RUnlock()
+ if t.jwtID != nil {
+ return *(t.jwtID), true
+ }
+ return "", false
+}
+
+func (t *stdToken) NotBefore() (time.Time, bool) {
+ t.mu.RLock()
+ defer t.mu.RUnlock()
+ if t.notBefore != nil {
+ return t.notBefore.Get(), true
+ }
+ return time.Time{}, false
+}
+
+func (t *stdToken) Subject() (string, bool) {
+ t.mu.RLock()
+ defer t.mu.RUnlock()
+ if t.subject != nil {
+ return *(t.subject), true
+ }
+ return "", false
+}
+
+func (t *stdToken) PrivateClaims() map[string]any {
+ t.mu.RLock()
+ defer t.mu.RUnlock()
+ return t.privateClaims
+}
+
+func (t *stdToken) UnmarshalJSON(buf []byte) error {
+ t.mu.Lock()
+ defer t.mu.Unlock()
+ t.audience = nil
+ t.expiration = nil
+ t.issuedAt = nil
+ t.issuer = nil
+ t.jwtID = nil
+ t.notBefore = nil
+ t.subject = nil
+ dec := json.NewDecoder(bytes.NewReader(buf))
+LOOP:
+ for {
+ tok, err := dec.Token()
+ if err != nil {
+ return fmt.Errorf(`error reading token: %w`, err)
+ }
+ switch tok := tok.(type) {
+ case json.Delim:
+ // Assuming we're doing everything correctly, we should ONLY
+ // get either tokens.OpenCurlyBracket or tokens.CloseCurlyBracket here.
+ if tok == tokens.CloseCurlyBracket { // End of object
+ break LOOP
+ } else if tok != tokens.OpenCurlyBracket {
+ return fmt.Errorf(`expected '%c', but got '%c'`, tokens.OpenCurlyBracket, tok)
+ }
+ case string: // Objects can only have string keys
+ switch tok {
+ case AudienceKey:
+ var decoded types.StringList
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, AudienceKey, err)
+ }
+ t.audience = decoded
+ case ExpirationKey:
+ var decoded types.NumericDate
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, ExpirationKey, err)
+ }
+ t.expiration = &decoded
+ case IssuedAtKey:
+ var decoded types.NumericDate
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, IssuedAtKey, err)
+ }
+ t.issuedAt = &decoded
+ case IssuerKey:
+ if err := json.AssignNextStringToken(&t.issuer, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, IssuerKey, err)
+ }
+ case JwtIDKey:
+ if err := json.AssignNextStringToken(&t.jwtID, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, JwtIDKey, err)
+ }
+ case NotBeforeKey:
+ var decoded types.NumericDate
+ if err := dec.Decode(&decoded); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, NotBeforeKey, err)
+ }
+ t.notBefore = &decoded
+ case SubjectKey:
+ if err := json.AssignNextStringToken(&t.subject, dec); err != nil {
+ return fmt.Errorf(`failed to decode value for key %s: %w`, SubjectKey, err)
+ }
+ default:
+ if dc := t.dc; dc != nil {
+ if localReg := dc.Registry(); localReg != nil {
+ decoded, err := localReg.Decode(dec, tok)
+ if err == nil {
+ t.setNoLock(tok, decoded)
+ continue
+ }
+ }
+ }
+ decoded, err := registry.Decode(dec, tok)
+ if err == nil {
+ t.setNoLock(tok, decoded)
+ continue
+ }
+ return fmt.Errorf(`could not decode field %s: %w`, tok, err)
+ }
+ default:
+ return fmt.Errorf(`invalid token %T`, tok)
+ }
+ }
+ return nil
+}
+
+func (t *stdToken) Keys() []string {
+ t.mu.RLock()
+ defer t.mu.RUnlock()
+ keys := make([]string, 0, 7+len(t.privateClaims))
+ if t.audience != nil {
+ keys = append(keys, AudienceKey)
+ }
+ if t.expiration != nil {
+ keys = append(keys, ExpirationKey)
+ }
+ if t.issuedAt != nil {
+ keys = append(keys, IssuedAtKey)
+ }
+ if t.issuer != nil {
+ keys = append(keys, IssuerKey)
+ }
+ if t.jwtID != nil {
+ keys = append(keys, JwtIDKey)
+ }
+ if t.notBefore != nil {
+ keys = append(keys, NotBeforeKey)
+ }
+ if t.subject != nil {
+ keys = append(keys, SubjectKey)
+ }
+ for k := range t.privateClaims {
+ keys = append(keys, k)
+ }
+ return keys
+}
+
+type claimPair struct {
+ Name string
+ Value any
+}
+
+var claimPairPool = sync.Pool{
+ New: func() any {
+ return make([]claimPair, 0, 7)
+ },
+}
+
+func getClaimPairList() []claimPair {
+ return claimPairPool.Get().([]claimPair)
+}
+
+func putClaimPairList(list []claimPair) {
+ list = list[:0]
+ claimPairPool.Put(list)
+}
+
+// makePairs creates a list of claimPair objects that are sorted by
+// their key names. The key names are always their JSON names, and
+// the values are already JSON encoded.
+// Because makePairs needs to allocate a slice, it _slows_ down
+// marshaling of the token to JSON. The upside is that it allows us to
+// marshal the token keys in a deterministic order.
+// Do we really need it...? Well, technically we don't, but it's so
+// much nicer to have this to make the example tests actually work
+// deterministically. Also if for whatever reason this becomes a
+// performance issue, we can always/ add a flag to use a more _optimized_ code path.
+//
+// The caller is responsible to call putClaimPairList() to return the
+// allocated slice back to the pool.
+
+func (t *stdToken) makePairs() ([]claimPair, error) {
+ pairs := getClaimPairList()
+ if t.audience != nil {
+ buf, err := json.MarshalAudience(t.audience, t.options.IsEnabled(FlattenAudience))
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encode "aud": %w`, err)
+ }
+ pairs = append(pairs, claimPair{Name: AudienceKey, Value: buf})
+ }
+ if t.expiration != nil {
+ buf, err := json.Marshal(t.expiration.Unix())
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encode "exp": %w`, err)
+ }
+ pairs = append(pairs, claimPair{Name: ExpirationKey, Value: buf})
+ }
+ if t.issuedAt != nil {
+ buf, err := json.Marshal(t.issuedAt.Unix())
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encode "iat": %w`, err)
+ }
+ pairs = append(pairs, claimPair{Name: IssuedAtKey, Value: buf})
+ }
+ if t.issuer != nil {
+ buf, err := json.Marshal(*(t.issuer))
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encode field "iss": %w`, err)
+ }
+ pairs = append(pairs, claimPair{Name: IssuerKey, Value: buf})
+ }
+ if t.jwtID != nil {
+ buf, err := json.Marshal(*(t.jwtID))
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encode field "jti": %w`, err)
+ }
+ pairs = append(pairs, claimPair{Name: JwtIDKey, Value: buf})
+ }
+ if t.notBefore != nil {
+ buf, err := json.Marshal(t.notBefore.Unix())
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encode "nbf": %w`, err)
+ }
+ pairs = append(pairs, claimPair{Name: NotBeforeKey, Value: buf})
+ }
+ if t.subject != nil {
+ buf, err := json.Marshal(*(t.subject))
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encode field "sub": %w`, err)
+ }
+ pairs = append(pairs, claimPair{Name: SubjectKey, Value: buf})
+ }
+ for k, v := range t.privateClaims {
+ buf, err := json.Marshal(v)
+ if err != nil {
+ return nil, fmt.Errorf(`failed to encode field %q: %w`, k, err)
+ }
+ pairs = append(pairs, claimPair{Name: k, Value: buf})
+ }
+
+ sort.Slice(pairs, func(i, j int) bool {
+ return pairs[i].Name < pairs[j].Name
+ })
+
+ return pairs, nil
+}
+
+func (t stdToken) MarshalJSON() ([]byte, error) {
+ buf := pool.BytesBuffer().Get()
+ defer pool.BytesBuffer().Put(buf)
+ pairs, err := t.makePairs()
+ if err != nil {
+ return nil, fmt.Errorf(`failed to make pairs: %w`, err)
+ }
+ buf.WriteByte(tokens.OpenCurlyBracket)
+
+ for i, pair := range pairs {
+ if i > 0 {
+ buf.WriteByte(tokens.Comma)
+ }
+ fmt.Fprintf(buf, "%q: %s", pair.Name, pair.Value)
+ }
+ buf.WriteByte(tokens.CloseCurlyBracket)
+ ret := make([]byte, buf.Len())
+ copy(ret, buf.Bytes())
+ putClaimPairList(pairs)
+ return ret, nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/token_options.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/token_options.go
new file mode 100644
index 0000000000..088c4263be
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/token_options.go
@@ -0,0 +1,78 @@
+package jwt
+
+import "sync"
+
+// TokenOptionSet is a bit flag containing per-token options.
+type TokenOptionSet uint64
+
+var defaultOptions TokenOptionSet
+var defaultOptionsMu sync.RWMutex
+
+// TokenOption describes a single token option that can be set on
+// the per-token option set (TokenOptionSet)
+type TokenOption uint64
+
+const (
+ // FlattenAudience option controls whether the "aud" claim should be flattened
+ // to a single string upon the token being serialized to JSON.
+ //
+ // This is sometimes important when a JWT consumer does not understand that
+ // the "aud" claim can actually take the form of an array of strings.
+ // (We have been notified by users that AWS Cognito has manifested this behavior
+ // at some point)
+ //
+ // Unless the global option is set using `jwt.Settings()`, the default value is
+ // `disabled`, which means that "aud" claims are always rendered as a arrays of
+ // strings when serialized to JSON.
+ FlattenAudience TokenOption = 1 << iota
+
+ // MaxPerTokenOption is a marker to denote the last value that an option can take.
+ // This value has no meaning other than to be used as a marker.
+ MaxPerTokenOption
+)
+
+// Value returns the uint64 value of a single option
+func (o TokenOption) Value() uint64 {
+ return uint64(o)
+}
+
+// Value returns the uint64 bit flag value of an option set
+func (o TokenOptionSet) Value() uint64 {
+ return uint64(o)
+}
+
+// DefaultOptionSet creates a new TokenOptionSet using the default
+// option set. This may differ depending on if/when functions that
+// change the global state has been called, such as `jwt.Settings`
+func DefaultOptionSet() TokenOptionSet {
+ return TokenOptionSet(defaultOptions.Value())
+}
+
+// Clear sets all bits to zero, effectively disabling all options
+func (o *TokenOptionSet) Clear() {
+ *o = TokenOptionSet(uint64(0))
+}
+
+// Set sets the value of this option set, effectively *replacing*
+// the entire option set with the new value. This is NOT the same
+// as Enable/Disable.
+func (o *TokenOptionSet) Set(s TokenOptionSet) {
+ *o = s
+}
+
+// Enable sets the appropriate value to enable the option in the
+// option set
+func (o *TokenOptionSet) Enable(flag TokenOption) {
+ *o = TokenOptionSet(o.Value() | uint64(flag))
+}
+
+// Disable sets the appropriate value to disable the option in the
+// option set
+func (o *TokenOptionSet) Disable(flag TokenOption) {
+ *o = TokenOptionSet(o.Value() & ^uint64(flag))
+}
+
+// IsEnabled returns true if the given bit on the option set is enabled.
+func (o TokenOptionSet) IsEnabled(flag TokenOption) bool {
+ return (uint64(o)&uint64(flag) == uint64(flag))
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/token_options_gen.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/token_options_gen.go
new file mode 100644
index 0000000000..c1f333d13b
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/token_options_gen.go
@@ -0,0 +1,25 @@
+// Code generated by "stringer -type=TokenOption -output=token_options_gen.go"; DO NOT EDIT.
+
+package jwt
+
+import "strconv"
+
+func _() {
+ // An "invalid array index" compiler error signifies that the constant values have changed.
+ // Re-run the stringer command to generate them again.
+ var x [1]struct{}
+ _ = x[FlattenAudience-1]
+ _ = x[MaxPerTokenOption-2]
+}
+
+const _TokenOption_name = "FlattenAudienceMaxPerTokenOption"
+
+var _TokenOption_index = [...]uint8{0, 15, 32}
+
+func (i TokenOption) String() string {
+ idx := int(i) - 1
+ if i < 1 || idx >= len(_TokenOption_index)-1 {
+ return "TokenOption(" + strconv.FormatInt(int64(i), 10) + ")"
+ }
+ return _TokenOption_name[_TokenOption_index[idx]:_TokenOption_index[idx+1]]
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwt/validate.go b/vendor/github.com/lestrrat-go/jwx/v3/jwt/validate.go
new file mode 100644
index 0000000000..af46868d8b
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwt/validate.go
@@ -0,0 +1,417 @@
+package jwt
+
+import (
+ "context"
+ "fmt"
+ "slices"
+ "strconv"
+ "time"
+
+ jwterrs "github.com/lestrrat-go/jwx/v3/jwt/internal/errors"
+)
+
+type Clock interface {
+ Now() time.Time
+}
+type ClockFunc func() time.Time
+
+func (f ClockFunc) Now() time.Time {
+ return f()
+}
+
+func isSupportedTimeClaim(c string) error {
+ switch c {
+ case ExpirationKey, IssuedAtKey, NotBeforeKey:
+ return nil
+ }
+ return fmt.Errorf(`unsupported time claim %s`, strconv.Quote(c))
+}
+
+func timeClaim(t Token, clock Clock, c string) time.Time {
+ // We don't check if the claims already exist. It should have been done
+ // by piggybacking on `required` check.
+ switch c {
+ case ExpirationKey:
+ tv, _ := t.Expiration()
+ return tv
+ case IssuedAtKey:
+ tv, _ := t.IssuedAt()
+ return tv
+ case NotBeforeKey:
+ tv, _ := t.NotBefore()
+ return tv
+ case "":
+ return clock.Now()
+ }
+ return time.Time{} // should *NEVER* reach here, but...
+}
+
+// Validate makes sure that the essential claims stand.
+//
+// See the various `WithXXX` functions for optional parameters
+// that can control the behavior of this method.
+func Validate(t Token, options ...ValidateOption) error {
+ ctx := context.Background()
+ trunc := getDefaultTruncation()
+
+ var clock Clock = ClockFunc(time.Now)
+ var skew time.Duration
+ var baseValidators = []Validator{
+ IsIssuedAtValid(),
+ IsExpirationValid(),
+ IsNbfValid(),
+ }
+ var extraValidators []Validator
+ var resetValidators bool
+ for _, o := range options {
+ switch o.Ident() {
+ case identClock{}:
+ if err := o.Value(&clock); err != nil {
+ return fmt.Errorf(`jwt.Validate: value for WithClock() option must be jwt.Clock: %w`, err)
+ }
+ case identAcceptableSkew{}:
+ if err := o.Value(&skew); err != nil {
+ return fmt.Errorf(`jwt.Validate: value for WithAcceptableSkew() option must be time.Duration: %w`, err)
+ }
+ case identTruncation{}:
+ if err := o.Value(&trunc); err != nil {
+ return fmt.Errorf(`jwt.Validate: value for WithTruncation() option must be time.Duration: %w`, err)
+ }
+ case identContext{}:
+ if err := o.Value(&ctx); err != nil {
+ return fmt.Errorf(`jwt.Validate: value for WithContext() option must be context.Context: %w`, err)
+ }
+ case identResetValidators{}:
+ if err := o.Value(&resetValidators); err != nil {
+ return fmt.Errorf(`jwt.Validate: value for WithResetValidators() option must be bool: %w`, err)
+ }
+ case identValidator{}:
+ var v Validator
+ if err := o.Value(&v); err != nil {
+ return fmt.Errorf(`jwt.Validate: value for WithValidator() option must be jwt.Validator: %w`, err)
+ }
+ switch v := v.(type) {
+ case *isInTimeRange:
+ if v.c1 != "" {
+ if err := isSupportedTimeClaim(v.c1); err != nil {
+ return err
+ }
+ extraValidators = append(extraValidators, IsRequired(v.c1))
+ }
+ if v.c2 != "" {
+ if err := isSupportedTimeClaim(v.c2); err != nil {
+ return err
+ }
+ extraValidators = append(extraValidators, IsRequired(v.c2))
+ }
+ }
+ extraValidators = append(extraValidators, v)
+ }
+ }
+
+ ctx = SetValidationCtxSkew(ctx, skew)
+ ctx = SetValidationCtxClock(ctx, clock)
+ ctx = SetValidationCtxTruncation(ctx, trunc)
+
+ var validators []Validator
+ if !resetValidators {
+ validators = append(baseValidators, extraValidators...)
+ } else {
+ if len(extraValidators) == 0 {
+ return jwterrs.ValidateErrorf(`no validators specified: jwt.WithResetValidators(true) and no jwt.WithValidator() specified`)
+ }
+ validators = extraValidators
+ }
+
+ for _, v := range validators {
+ if err := v.Validate(ctx, t); err != nil {
+ return jwterrs.ValidateErrorf(`validation failed: %w`, err)
+ }
+ }
+
+ return nil
+}
+
+type isInTimeRange struct {
+ c1 string
+ c2 string
+ dur time.Duration
+ less bool // if true, d =< c1 - c2. otherwise d >= c1 - c2
+}
+
+// MaxDeltaIs implements the logic behind `WithMaxDelta()` option
+func MaxDeltaIs(c1, c2 string, dur time.Duration) Validator {
+ return &isInTimeRange{
+ c1: c1,
+ c2: c2,
+ dur: dur,
+ less: true,
+ }
+}
+
+// MinDeltaIs implements the logic behind `WithMinDelta()` option
+func MinDeltaIs(c1, c2 string, dur time.Duration) Validator {
+ return &isInTimeRange{
+ c1: c1,
+ c2: c2,
+ dur: dur,
+ less: false,
+ }
+}
+
+func (iitr *isInTimeRange) Validate(ctx context.Context, t Token) error {
+ clock := ValidationCtxClock(ctx) // MUST be populated
+ skew := ValidationCtxSkew(ctx) // MUST be populated
+ // We don't check if the claims already exist, because we already did that
+ // by piggybacking on `required` check.
+ t1 := timeClaim(t, clock, iitr.c1)
+ t2 := timeClaim(t, clock, iitr.c2)
+ if iitr.less { // t1 - t2 <= iitr.dur
+ // t1 - t2 < iitr.dur + skew
+ if t1.Sub(t2) > iitr.dur+skew {
+ return fmt.Errorf(`iitr between %s and %s exceeds %s (skew %s)`, iitr.c1, iitr.c2, iitr.dur, skew)
+ }
+ } else {
+ if t1.Sub(t2) < iitr.dur-skew {
+ return fmt.Errorf(`iitr between %s and %s is less than %s (skew %s)`, iitr.c1, iitr.c2, iitr.dur, skew)
+ }
+ }
+ return nil
+}
+
+// Validator describes interface to validate a Token.
+type Validator interface {
+ // Validate should return an error if a required conditions is not met.
+ Validate(context.Context, Token) error
+}
+
+// ValidatorFunc is a type of Validator that does not have any
+// state, that is implemented as a function
+type ValidatorFunc func(context.Context, Token) error
+
+func (vf ValidatorFunc) Validate(ctx context.Context, tok Token) error {
+ return vf(ctx, tok)
+}
+
+type identValidationCtxClock struct{}
+type identValidationCtxSkew struct{}
+type identValidationCtxTruncation struct{}
+
+func SetValidationCtxClock(ctx context.Context, cl Clock) context.Context {
+ return context.WithValue(ctx, identValidationCtxClock{}, cl)
+}
+
+func SetValidationCtxTruncation(ctx context.Context, dur time.Duration) context.Context {
+ return context.WithValue(ctx, identValidationCtxTruncation{}, dur)
+}
+
+func SetValidationCtxSkew(ctx context.Context, dur time.Duration) context.Context {
+ return context.WithValue(ctx, identValidationCtxSkew{}, dur)
+}
+
+// ValidationCtxClock returns the Clock object associated with
+// the current validation context. This value will always be available
+// during validation of tokens.
+func ValidationCtxClock(ctx context.Context) Clock {
+ //nolint:forcetypeassert
+ return ctx.Value(identValidationCtxClock{}).(Clock)
+}
+
+func ValidationCtxSkew(ctx context.Context) time.Duration {
+ //nolint:forcetypeassert
+ return ctx.Value(identValidationCtxSkew{}).(time.Duration)
+}
+
+func ValidationCtxTruncation(ctx context.Context) time.Duration {
+ //nolint:forcetypeassert
+ return ctx.Value(identValidationCtxTruncation{}).(time.Duration)
+}
+
+// IsExpirationValid is one of the default validators that will be executed.
+// It does not need to be specified by users, but it exists as an
+// exported field so that you can check what it does.
+//
+// The supplied context.Context object must have the "clock" and "skew"
+// populated with appropriate values using SetValidationCtxClock() and
+// SetValidationCtxSkew()
+func IsExpirationValid() Validator {
+ return ValidatorFunc(isExpirationValid)
+}
+
+func isExpirationValid(ctx context.Context, t Token) error {
+ tv, ok := t.Expiration()
+ if !ok {
+ return nil
+ }
+
+ clock := ValidationCtxClock(ctx) // MUST be populated
+ skew := ValidationCtxSkew(ctx) // MUST be populated
+ trunc := ValidationCtxTruncation(ctx) // MUST be populated
+
+ now := clock.Now().Truncate(trunc)
+ ttv := tv.Truncate(trunc)
+
+ // expiration date must be after NOW
+ if !now.Before(ttv.Add(skew)) {
+ return TokenExpiredError()
+ }
+ return nil
+}
+
+// IsIssuedAtValid is one of the default validators that will be executed.
+// It does not need to be specified by users, but it exists as an
+// exported field so that you can check what it does.
+//
+// The supplied context.Context object must have the "clock" and "skew"
+// populated with appropriate values using SetValidationCtxClock() and
+// SetValidationCtxSkew()
+func IsIssuedAtValid() Validator {
+ return ValidatorFunc(isIssuedAtValid)
+}
+
+func isIssuedAtValid(ctx context.Context, t Token) error {
+ tv, ok := t.IssuedAt()
+ if !ok {
+ return nil
+ }
+
+ clock := ValidationCtxClock(ctx) // MUST be populated
+ skew := ValidationCtxSkew(ctx) // MUST be populated
+ trunc := ValidationCtxTruncation(ctx) // MUST be populated
+
+ now := clock.Now().Truncate(trunc)
+ ttv := tv.Truncate(trunc)
+
+ if now.Before(ttv.Add(-1 * skew)) {
+ return InvalidIssuedAtError()
+ }
+ return nil
+}
+
+// IsNbfValid is one of the default validators that will be executed.
+// It does not need to be specified by users, but it exists as an
+// exported field so that you can check what it does.
+//
+// The supplied context.Context object must have the "clock" and "skew"
+// populated with appropriate values using SetValidationCtxClock() and
+// SetValidationCtxSkew()
+func IsNbfValid() Validator {
+ return ValidatorFunc(isNbfValid)
+}
+
+func isNbfValid(ctx context.Context, t Token) error {
+ tv, ok := t.NotBefore()
+ if !ok {
+ return nil
+ }
+
+ clock := ValidationCtxClock(ctx) // MUST be populated
+ skew := ValidationCtxSkew(ctx) // MUST be populated
+ trunc := ValidationCtxTruncation(ctx) // MUST be populated
+
+ // Truncation always happens even for trunc = 0 because
+ // we also use this to strip monotonic clocks
+ now := clock.Now().Truncate(trunc)
+ ttv := tv.Truncate(trunc)
+
+ // "now" cannot be before t - skew, so we check for now > t - skew
+ ttv = ttv.Add(-1 * skew)
+ if now.Before(ttv) {
+ return TokenNotYetValidError()
+ }
+ return nil
+}
+
+type claimContainsString struct {
+ name string
+ value string
+ makeErr func(string, ...any) error
+}
+
+// ClaimContainsString can be used to check if the claim called `name`, which is
+// expected to be a list of strings, contains `value`. Currently, because of the
+// implementation, this will probably only work for `aud` fields.
+func ClaimContainsString(name, value string) Validator {
+ return claimContainsString{
+ name: name,
+ value: value,
+ makeErr: fmt.Errorf,
+ }
+}
+
+func (ccs claimContainsString) Validate(_ context.Context, t Token) error {
+ var list []string
+ if err := t.Get(ccs.name, &list); err != nil {
+ return ccs.makeErr(`claim %q does not exist or is not a []string: %w`, ccs.name, err)
+ }
+
+ if !slices.Contains(list, ccs.value) {
+ return ccs.makeErr(`%q not satisfied`, ccs.name)
+ }
+ return nil
+}
+
+// audienceClaimContainsString can be used to check if the audience claim, which is
+// expected to be a list of strings, contains `value`.
+func audienceClaimContainsString(value string) Validator {
+ return claimContainsString{
+ name: AudienceKey,
+ value: value,
+ makeErr: jwterrs.AudienceErrorf,
+ }
+}
+
+type claimValueIs struct {
+ name string
+ value any
+ makeErr func(string, ...any) error
+}
+
+// ClaimValueIs creates a Validator that checks if the value of claim `name`
+// matches `value`. The comparison is done using a simple `==` comparison,
+// and therefore complex comparisons may fail using this code. If you
+// need to do more, use a custom Validator.
+func ClaimValueIs(name string, value any) Validator {
+ return &claimValueIs{
+ name: name,
+ value: value,
+ makeErr: fmt.Errorf,
+ }
+}
+
+func (cv *claimValueIs) Validate(_ context.Context, t Token) error {
+ var v any
+ if err := t.Get(cv.name, &v); err != nil {
+ return cv.makeErr(`claim %[1]q does not exist or is not a []string: %[2]w`, cv.name, err)
+ }
+ if v != cv.value {
+ return cv.makeErr(`claim %[1]q does not have the expected value`, cv.name)
+ }
+ return nil
+}
+
+// issuerClaimValueIs creates a Validator that checks if the issuer claim
+// matches `value`.
+func issuerClaimValueIs(value string) Validator {
+ return &claimValueIs{
+ name: IssuerKey,
+ value: value,
+ makeErr: jwterrs.IssuerErrorf,
+ }
+}
+
+// IsRequired creates a Validator that checks if the required claim `name`
+// exists in the token
+func IsRequired(name string) Validator {
+ return isRequired(name)
+}
+
+type isRequired string
+
+func (ir isRequired) Validate(_ context.Context, t Token) error {
+ name := string(ir)
+ if !t.Has(name) {
+ return jwterrs.MissingRequiredClaimErrorf(name)
+ }
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/jwx.go b/vendor/github.com/lestrrat-go/jwx/v3/jwx.go
new file mode 100644
index 0000000000..fc394e5137
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/jwx.go
@@ -0,0 +1,45 @@
+//go:generate ./tools/cmd/genreadfile.sh
+//go:generate ./tools/cmd/genoptions.sh
+//go:generate stringer -type=FormatKind
+//go:generate mv formatkind_string.go formatkind_string_gen.go
+
+// Package jwx contains tools that deal with the various JWx (JOSE)
+// technologies such as JWT, JWS, JWE, etc in Go.
+//
+// JWS (https://tools.ietf.org/html/rfc7515)
+// JWE (https://tools.ietf.org/html/rfc7516)
+// JWK (https://tools.ietf.org/html/rfc7517)
+// JWA (https://tools.ietf.org/html/rfc7518)
+// JWT (https://tools.ietf.org/html/rfc7519)
+//
+// Examples are stored in a separate Go module (to avoid adding
+// dependencies to this module), and thus does not appear in the
+// online documentation for this module.
+// You can find the examples in Github at https://github.com/lestrrat-go/jwx/tree/v3/examples
+//
+// You can find more high level documentation at Github (https://github.com/lestrrat-go/jwx/tree/v2)
+//
+// FAQ style documentation can be found in the repository (https://github.com/lestrrat-go/jwx/tree/develop/v3/docs)
+package jwx
+
+import (
+ "github.com/lestrrat-go/jwx/v3/internal/json"
+)
+
+// DecoderSettings gives you a access to configure the "encoding/json".Decoder
+// used to decode JSON objects within the jwx framework.
+func DecoderSettings(options ...JSONOption) {
+ // XXX We're using this format instead of just passing a single boolean
+ // in case a new option is to be added some time later
+ var useNumber bool
+ for _, option := range options {
+ switch option.Ident() {
+ case identUseNumber{}:
+ if err := option.Value(&useNumber); err != nil {
+ panic("jwx.DecoderSettings: useNumber option must be a boolean")
+ }
+ }
+ }
+
+ json.DecoderSettings(useNumber)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/options.go b/vendor/github.com/lestrrat-go/jwx/v3/options.go
new file mode 100644
index 0000000000..b642a199d8
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/options.go
@@ -0,0 +1,30 @@
+package jwx
+
+import "github.com/lestrrat-go/option/v2"
+
+type identUseNumber struct{}
+
+type Option = option.Interface
+
+type JSONOption interface {
+ Option
+ isJSONOption()
+}
+
+type jsonOption struct {
+ Option
+}
+
+func (o *jsonOption) isJSONOption() {}
+
+func newJSONOption(n any, v any) JSONOption {
+ return &jsonOption{option.New(n, v)}
+}
+
+// WithUseNumber controls whether the jwx package should unmarshal
+// JSON objects with the "encoding/json".Decoder.UseNumber feature on.
+//
+// Default is false.
+func WithUseNumber(b bool) JSONOption {
+ return newJSONOption(identUseNumber{}, b)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/transform/BUILD.bazel b/vendor/github.com/lestrrat-go/jwx/v3/transform/BUILD.bazel
new file mode 100644
index 0000000000..3333c6607c
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/transform/BUILD.bazel
@@ -0,0 +1,32 @@
+load("@rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "transform",
+ srcs = [
+ "filter.go",
+ "map.go",
+ ],
+ importpath = "github.com/lestrrat-go/jwx/v3/transform",
+ visibility = ["//visibility:public"],
+ deps = [
+ "@com_github_lestrrat_go_blackmagic//:blackmagic",
+ ],
+)
+
+go_test(
+ name = "transform_test",
+ srcs = [
+ "map_test.go",
+ ],
+ deps = [
+ ":transform",
+ "//jwt",
+ "@com_github_stretchr_testify//require",
+ ],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":transform",
+ visibility = ["//visibility:public"],
+)
\ No newline at end of file
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/transform/filter.go b/vendor/github.com/lestrrat-go/jwx/v3/transform/filter.go
new file mode 100644
index 0000000000..da2972db6a
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/transform/filter.go
@@ -0,0 +1,115 @@
+package transform
+
+import "sync"
+
+// FilterLogic is an interface that defines the logic for filtering objects.
+type FilterLogic interface {
+ Apply(key string, object any) bool
+}
+
+// FilterLogicFunc is a function type that implements the FilterLogic interface.
+type FilterLogicFunc func(key string, object any) bool
+
+func (f FilterLogicFunc) Apply(key string, object any) bool {
+ return f(key, object)
+}
+
+// Filterable is an interface that must be implemented by objects that can be filtered.
+type Filterable[T any] interface {
+ // Keys returns the names of all fields in the object.
+ Keys() []string
+
+ // Clone returns a deep copy of the object.
+ Clone() (T, error)
+
+ // Remove removes a field from the object.
+ Remove(string) error
+}
+
+// Apply is a standalone function that provides type-safe filtering based on
+// specified filter logic.
+//
+// It returns a new object with only the fields that match the result of `logic.Apply`.
+func Apply[T Filterable[T]](object T, logic FilterLogic) (T, error) {
+ return filterWith(object, logic, true)
+}
+
+// Reject is a standalone function that provides type-safe filtering based on
+// specified filter logic.
+//
+// It returns a new object with only the fields that DO NOT match the result
+// of `logic.Apply`.
+func Reject[T Filterable[T]](object T, logic FilterLogic) (T, error) {
+ return filterWith(object, logic, false)
+}
+
+// filterWith is an internal function used by both Apply and Reject functions
+// to apply the filtering logic to an object. If include is true, only fields
+// matching the logic are included. If include is false, fields matching
+// the logic are excluded.
+func filterWith[T Filterable[T]](object T, logic FilterLogic, include bool) (T, error) {
+ var zero T
+
+ result, err := object.Clone()
+ if err != nil {
+ return zero, err
+ }
+
+ for _, k := range result.Keys() {
+ if ok := logic.Apply(k, object); (include && ok) || (!include && !ok) {
+ continue
+ }
+
+ if err := result.Remove(k); err != nil {
+ return zero, err
+ }
+ }
+
+ return result, nil
+}
+
+// NameBasedFilter is a filter that filters fields based on their field names.
+type NameBasedFilter[T Filterable[T]] struct {
+ names map[string]struct{}
+ mu sync.RWMutex
+ logic FilterLogic
+}
+
+// NewNameBasedFilter creates a new NameBasedFilter with the specified field names.
+//
+// NameBasedFilter is the underlying implementation of the
+// various filters in jwe, jwk, jws, and jwt packages. You normally do not
+// need to use this directly.
+func NewNameBasedFilter[T Filterable[T]](names ...string) *NameBasedFilter[T] {
+ nameMap := make(map[string]struct{}, len(names))
+ for _, name := range names {
+ nameMap[name] = struct{}{}
+ }
+
+ nf := &NameBasedFilter[T]{
+ names: nameMap,
+ }
+
+ nf.logic = FilterLogicFunc(nf.filter)
+ return nf
+}
+
+func (nf *NameBasedFilter[T]) filter(k string, _ any) bool {
+ _, ok := nf.names[k]
+ return ok
+}
+
+// Filter returns a new object with only the fields that match the specified names.
+func (nf *NameBasedFilter[T]) Filter(object T) (T, error) {
+ nf.mu.RLock()
+ defer nf.mu.RUnlock()
+
+ return Apply(object, nf.logic)
+}
+
+// Reject returns a new object with only the fields that DO NOT match the specified names.
+func (nf *NameBasedFilter[T]) Reject(object T) (T, error) {
+ nf.mu.RLock()
+ defer nf.mu.RUnlock()
+ return Reject(object, nf.logic)
+}
diff --git a/vendor/github.com/lestrrat-go/jwx/v3/transform/map.go b/vendor/github.com/lestrrat-go/jwx/v3/transform/map.go
new file mode 100644
index 0000000000..4eb80cb99f
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/jwx/v3/transform/map.go
@@ -0,0 +1,46 @@
+package transform
+
+import (
+ "errors"
+ "fmt"
+
+ "github.com/lestrrat-go/blackmagic"
+)
+
+// Mappable is an interface that defines methods required when converting
+// a jwx structure into a map[string]any.
+//
+// EXPERIMENTAL: This API is experimental and its interface and behavior is
+// subject to change in future releases. This API is not subject to semver
+// compatibility guarantees.
+type Mappable interface {
+ Get(key string, dst any) error
+ Keys() []string
+}
+
+// AsMap takes the specified Mappable object and populates the map
+// `dst` with the key-value pairs from the Mappable object.
+// Many objects in jwe, jwk, jws, and jwt packages including
+// `jwt.Token`, `jwk.Key`, `jws.Header`, etc.
+//
+// EXPERIMENTAL: This API is experimental and its interface and behavior is
+// subject to change in future releases. This API is not subject to semver
+// compatibility guarantees.
+func AsMap(m Mappable, dst map[string]any) error {
+ if dst == nil {
+ return fmt.Errorf("transform.AsMap: destination map cannot be nil")
+ }
+
+ for _, k := range m.Keys() {
+ var val any
+ if err := m.Get(k, &val); err != nil {
+ // Allow invalid value errors. Assume they are just nil values.
+ if !errors.Is(err, blackmagic.InvalidValueError()) {
+ return fmt.Errorf(`transform.AsMap: failed to get key %q: %w`, k, err)
+ }
+ }
+ dst[k] = val
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/lestrrat-go/option/v2/.gitignore b/vendor/github.com/lestrrat-go/option/v2/.gitignore
new file mode 100644
index 0000000000..66fd13c903
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/option/v2/.gitignore
@@ -0,0 +1,15 @@
+# Binaries for programs and plugins
+*.exe
+*.exe~
+*.dll
+*.so
+*.dylib
+
+# Test binary, built with `go test -c`
+*.test
+
+# Output of the go coverage tool, specifically when used with LiteIDE
+*.out
+
+# Dependency directories (remove the comment below to include it)
+# vendor/
diff --git a/vendor/github.com/lestrrat-go/option/v2/LICENSE b/vendor/github.com/lestrrat-go/option/v2/LICENSE
new file mode 100644
index 0000000000..188ea7685c
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/option/v2/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2021 lestrrat-go
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/github.com/lestrrat-go/option/v2/README.md b/vendor/github.com/lestrrat-go/option/v2/README.md
new file mode 100644
index 0000000000..cab0044ed3
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/option/v2/README.md
@@ -0,0 +1,245 @@
+# option
+
+Base object for the "Optional Parameters Pattern".
+
+# DESCRIPTION
+
+The beauty of this pattern is that you can achieve a method that can
+take the following simple calling style
+
+```go
+obj.Method(mandatory1, mandatory2)
+```
+
+or the following, if you want to modify its behavior with optional parameters
+
+```go
+obj.Method(mandatory1, mandatory2, optional1, optional2, optional3)
+```
+
+Instead of the more clunky zero value for optionals style
+
+```go
+obj.Method(mandatory1, mandatory2, nil, "", 0)
+```
+
+or the equally clunky config object style, which requires you to create a
+struct with `NamesThatLookReallyLongBecauseItNeedsToIncludeMethodNamesConfig
+
+```go
+cfg := &ConfigForMethod{
+ Optional1: ...,
+ Optional2: ...,
+ Optional3: ...,
+}
+obj.Method(mandatory1, mandatory2, &cfg)
+```
+
+# SYNOPSIS
+
+Create an "identifier" for the option. We recommend using an unexported empty struct,
+because
+
+1. It is uniquely identifiable globally
+1. Takes minimal space
+1. Since it's unexported, you do not have to worry about it leaking elsewhere or having it changed by consumers
+
+```go
+// an unexported empty struct
+type identFeatureX struct{}
+```
+
+Then define a method to create an option using this identifier. Here we assume
+that the option will be a boolean option.
+
+```go
+// this is optional, but for readability we usually use a wrapper
+// around option.Interface, or a type alias.
+type Option
+func WithFeatureX(v bool) Option {
+ // use the constructor to create a new option
+ return option.New(identFeatureX{}, v)
+}
+```
+
+Now you can create an option, which essentially a two element tuple consisting
+of an identifier and its associated value.
+
+To consume this, you will need to create a function with variadic parameters,
+and iterate over the list looking for a particular identifier:
+
+```go
+func MyAwesomeFunc( /* mandatory parameters omitted */, options ...[]Option) {
+ var enableFeatureX bool
+ // The nolint directive is recommended if you are using linters such
+ // as golangci-lint
+ //nolint:forcetypeassert
+ for _, option := range options {
+ switch option.Ident() {
+ case identFeatureX{}:
+ enableFeatureX = option.Value().(bool)
+ // other cases omitted
+ }
+ }
+ if enableFeatureX {
+ ....
+ }
+}
+```
+
+# Option objects
+
+Option objects take two arguments, its identifier and the value it contains.
+
+The identifier can be anything, but it's usually better to use a an unexported
+empty struct so that only you have the ability to generate said option:
+
+```go
+type identOptionalParamOne struct{}
+type identOptionalParamTwo struct{}
+type identOptionalParamThree struct{}
+
+func WithOptionOne(v ...) Option {
+ return option.New(identOptionalParamOne{}, v)
+}
+```
+
+Then you can call the method we described above as
+
+```go
+obj.Method(m1, m2, WithOptionOne(...), WithOptionTwo(...), WithOptionThree(...))
+```
+
+Options should be parsed in a code that looks somewhat like this
+
+```go
+func (obj *Object) Method(m1 Type1, m2 Type2, options ...Option) {
+ paramOne := defaultValueParamOne
+ for _, option := range options {
+ switch option.Ident() {
+ case identOptionalParamOne{}:
+ paramOne = option.Value().(...)
+ }
+ }
+ ...
+}
+```
+
+The loop requires a bit of boilerplate, and admittedly, this is the main downside
+of this module. However, if you think you want use the Option as a Function pattern,
+please check the FAQ below for rationale.
+
+# Simple usage
+
+Most of the times all you need to do is to declare the Option type as an alias
+in your code:
+
+```go
+package myawesomepkg
+
+import "github.com/lestrrat-go/option"
+
+type Option = option.Interface
+```
+
+Then you can start defining options like they are described in the SYNOPSIS section.
+
+# Differentiating Options
+
+When you have multiple methods and options, and those options can only be passed to
+each one the methods, it's hard to see which options should be passed to which method.
+
+```go
+func WithX() Option { ... }
+func WithY() Option { ... }
+
+// Now, which of WithX/WithY go to which method?
+func (*Obj) Method1(options ...Option) {}
+func (*Obj) Method2(options ...Option) {}
+```
+
+In this case the easiest way to make it obvious is to put an extra layer around
+the options so that they have different types
+
+```go
+type Method1Option interface {
+ Option
+ method1Option()
+}
+
+type method1Option struct { Option }
+func (*method1Option) method1Option() {}
+
+func WithX() Method1Option {
+ return &methodOption{option.New(...)}
+}
+
+func (*Obj) Method1(options ...Method1Option) {}
+```
+
+This way the compiler knows if an option can be passed to a given method.
+
+# FAQ
+
+## Why aren't these function-based?
+
+Using a base option type like `type Option func(ctx interface{})` is certainly one way to achieve the same goal. In this case, you are giving the option itself the ability to "configure" the main object. For example:
+
+```go
+type Foo struct {
+ optionaValue bool
+}
+
+type Option func(*Foo) error
+
+func WithOptionalValue(v bool) Option {
+ return Option(func(f *Foo) error {
+ f.optionalValue = v
+ return nil
+ })
+}
+
+func NewFoo(options ...Option) (*Foo, error) {
+ var f Foo
+ for _, o := range options {
+ if err := o(&f); err != nil {
+ return nil, err
+ }
+ }
+ return &f
+}
+```
+
+This in itself is fine, but we think there are a few problems:
+
+### 1. It's hard to create a reusable "Option" type
+
+We create many libraries using this optional pattern. We would like to provide a default base object. However, this function based approach is not reusuable because each "Option" type requires that it has a context-specific input type. For example, if the "Option" type in the previous example was `func(interface{}) error`, then its usability will significantly decrease because of the type conversion.
+
+This is not to say that this library's approach is better as it also requires type conversion to convert the _value_ of the option. However, part of the beauty of the original function based approach was the ease of its use, and we claim that this significantly decreases the merits of the function based approach.
+
+### 2. The receiver requires exported fields
+
+Part of the appeal for a function-based option pattern is by giving the option itself the ability to do what it wants, you open up the possibility of allowing third-parties to create options that do things that the library authors did not think about.
+
+```go
+package thirdparty
+, but when I read drum sheet music, I kind of get thrown off b/c many times it says to hit the bass drum where I feel like it's a snare hit.
+func WithMyAwesomeOption( ... ) mypkg.Option {
+ return mypkg.Option(func(f *mypkg) error {
+ f.X = ...
+ f.Y = ...
+ f.Z = ...
+ return nil
+ })
+}
+```
+
+However, for any third party code to access and set field values, these fields (`X`, `Y`, `Z`) must be exported. Basically you will need an "open" struct.
+
+Exported fields are absolutely no problem when you have a struct that represents data alone (i.e., API calls that refer or change state information) happen, but we think that casually expose fields for a library struct is a sure way to maintenance hell in the future. What happens when you want to change the API? What happens when you realize that you want to use the field as state (i.e. use it for more than configuration)? What if they kept referring to that field, and then you have concurrent code accessing it?
+
+Giving third parties complete access to exported fields is like handing out a loaded weapon to the users, and you are at their mercy.
+
+Of course, providing public APIs for everything so you can validate and control concurrency is an option, but then ... it's a lot of work, and you may have to provide APIs _only_ so that users can refer it in the option-configuration phase. That sounds like a lot of extra work.
+
diff --git a/vendor/github.com/lestrrat-go/option/v2/option.go b/vendor/github.com/lestrrat-go/option/v2/option.go
new file mode 100644
index 0000000000..f4fcca3b58
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/option/v2/option.go
@@ -0,0 +1,47 @@
+package option
+
+import (
+ "fmt"
+
+ "github.com/lestrrat-go/blackmagic"
+)
+
+// Interface defines the minimum interface that an option must fulfill
+type Interface interface {
+ // Ident returns the "identity" of this option, a unique identifier that
+ // can be used to differentiate between options
+ Ident() any
+
+ // Value assigns the stored value into the dst argument, which must be
+ // a pointer to a variable that can store the value. If the assignment
+ // is successful, it return nil, otherwise it returns an error.
+ Value(dst any) error
+}
+
+type pair[T any] struct {
+ ident any
+ value T
+}
+
+// New creates a new Option
+func New[T any](ident any, value T) Interface {
+ return &pair[T]{
+ ident: ident,
+ value: value,
+ }
+}
+
+func (p *pair[T]) Ident() any {
+ return p.ident
+}
+
+func (p *pair[T]) Value(dst any) error {
+ if err := blackmagic.AssignIfCompatible(dst, p.value); err != nil {
+ return fmt.Errorf("failed to assign value %T to %T: %s", p.value, dst, err)
+ }
+ return nil
+}
+
+func (p *pair[T]) String() string {
+ return fmt.Sprintf(`%v(%v)`, p.ident, p.value)
+}
diff --git a/vendor/github.com/lestrrat-go/option/v2/set.go b/vendor/github.com/lestrrat-go/option/v2/set.go
new file mode 100644
index 0000000000..def943407a
--- /dev/null
+++ b/vendor/github.com/lestrrat-go/option/v2/set.go
@@ -0,0 +1,92 @@
+package option
+
+import (
+ "sync"
+)
+
+// Set is a container to store multiple options. Because options are
+// usually used all over the place to configure various aspects of
+// a system, it is often useful to be able to collect multiple options
+// together and pass them around as a single entity.
+//
+// Note that Set is meant to be add-only; You usually do not remove
+// options from a Set.
+//
+// The intention is to create a set using a sync.Pool; we would like
+// to provide a centralized pool of Sets so that you don't need to
+// instantiate a new pool for every type of option you want to
+// store, but that is not quite possible because of the limitations
+// of parameterized types in Go. Instead create a `*option.SetPool`
+// with an appropriate type parameter and allocator.
+type Set[T Interface] struct {
+ mu sync.RWMutex
+ options []T
+}
+
+func NewSet[T Interface]() *Set[T] {
+ return &Set[T]{
+ options: make([]T, 0, 1),
+ }
+}
+
+func (s *Set[T]) Add(opt T) {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+ s.options = append(s.options, opt)
+}
+
+func (s *Set[T]) Reset() {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+ s.options = s.options[:0] // Reset the options slice to avoid memory leaks
+}
+
+func (s *Set[T]) Len() int {
+ s.mu.RLock()
+ defer s.mu.RUnlock()
+ return len(s.options)
+}
+
+func (s *Set[T]) Option(i int) T {
+ var zero T
+ s.mu.RLock()
+ defer s.mu.RUnlock()
+ if i < 0 || i >= len(s.options) {
+ return zero
+ }
+ return s.options[i]
+}
+
+// List returns a slice of all options stored in the Set.
+// Note that the slice is the same slice that is used internally, so
+// you should not modify the contents of the slice directly.
+// This to avoid unnecessary allocations and copying of the slice for
+// performance reasons.
+func (s *Set[T]) List() []T {
+ s.mu.RLock()
+ defer s.mu.RUnlock()
+ return s.options
+}
+
+// SetPool is a pool of Sets that can be used to efficiently manage
+// the lifecycle of Sets. It uses a sync.Pool to store and retrieve
+// Sets, allowing for efficient reuse of memory and reducing the
+// number of allocations required when creating new Sets.
+type SetPool[T Interface] struct {
+ pool *sync.Pool // sync.Pool that contains *Set[T]
+}
+
+func NewSetPool[T Interface](pool *sync.Pool) *SetPool[T] {
+ return &SetPool[T]{
+ pool: pool,
+ }
+}
+
+func (p *SetPool[T]) Get() *Set[T] {
+ return p.pool.Get().(*Set[T])
+}
+
+func (p *SetPool[T]) Put(s *Set[T]) {
+ s.Reset()
+ p.pool.Put(s)
+}
diff --git a/vendor/github.com/munnerz/goautoneg/LICENSE b/vendor/github.com/munnerz/goautoneg/LICENSE
deleted file mode 100644
index bbc7b897cb..0000000000
--- a/vendor/github.com/munnerz/goautoneg/LICENSE
+++ /dev/null
@@ -1,31 +0,0 @@
-Copyright (c) 2011, Open Knowledge Foundation Ltd.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Open Knowledge Foundation Ltd. nor the
- names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/munnerz/goautoneg/Makefile b/vendor/github.com/munnerz/goautoneg/Makefile
deleted file mode 100644
index e33ee17303..0000000000
--- a/vendor/github.com/munnerz/goautoneg/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-include $(GOROOT)/src/Make.inc
-
-TARG=bitbucket.org/ww/goautoneg
-GOFILES=autoneg.go
-
-include $(GOROOT)/src/Make.pkg
-
-format:
- gofmt -w *.go
-
-docs:
- gomake clean
- godoc ${TARG} > README.txt
diff --git a/vendor/github.com/munnerz/goautoneg/README.txt b/vendor/github.com/munnerz/goautoneg/README.txt
deleted file mode 100644
index 7723656d58..0000000000
--- a/vendor/github.com/munnerz/goautoneg/README.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-PACKAGE
-
-package goautoneg
-import "bitbucket.org/ww/goautoneg"
-
-HTTP Content-Type Autonegotiation.
-
-The functions in this package implement the behaviour specified in
-http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
-
-Copyright (c) 2011, Open Knowledge Foundation Ltd.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Open Knowledge Foundation Ltd. nor the
- names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-FUNCTIONS
-
-func Negotiate(header string, alternatives []string) (content_type string)
-Negotiate the most appropriate content_type given the accept header
-and a list of alternatives.
-
-func ParseAccept(header string) (accept []Accept)
-Parse an Accept Header string returning a sorted list
-of clauses
-
-
-TYPES
-
-type Accept struct {
- Type, SubType string
- Q float32
- Params map[string]string
-}
-Structure to represent a clause in an HTTP Accept Header
-
-
-SUBDIRECTORIES
-
- .hg
diff --git a/vendor/github.com/munnerz/goautoneg/autoneg.go b/vendor/github.com/munnerz/goautoneg/autoneg.go
deleted file mode 100644
index 1dd1cad646..0000000000
--- a/vendor/github.com/munnerz/goautoneg/autoneg.go
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
-HTTP Content-Type Autonegotiation.
-
-The functions in this package implement the behaviour specified in
-http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
-
-Copyright (c) 2011, Open Knowledge Foundation Ltd.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Open Knowledge Foundation Ltd. nor the
- names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-package goautoneg
-
-import (
- "sort"
- "strconv"
- "strings"
-)
-
-// Structure to represent a clause in an HTTP Accept Header
-type Accept struct {
- Type, SubType string
- Q float64
- Params map[string]string
-}
-
-// acceptSlice is defined to implement sort interface.
-type acceptSlice []Accept
-
-func (slice acceptSlice) Len() int {
- return len(slice)
-}
-
-func (slice acceptSlice) Less(i, j int) bool {
- ai, aj := slice[i], slice[j]
- if ai.Q > aj.Q {
- return true
- }
- if ai.Type != "*" && aj.Type == "*" {
- return true
- }
- if ai.SubType != "*" && aj.SubType == "*" {
- return true
- }
- return false
-}
-
-func (slice acceptSlice) Swap(i, j int) {
- slice[i], slice[j] = slice[j], slice[i]
-}
-
-func stringTrimSpaceCutset(r rune) bool {
- return r == ' '
-}
-
-func nextSplitElement(s, sep string) (item string, remaining string) {
- if index := strings.Index(s, sep); index != -1 {
- return s[:index], s[index+1:]
- }
- return s, ""
-}
-
-// Parse an Accept Header string returning a sorted list
-// of clauses
-func ParseAccept(header string) acceptSlice {
- partsCount := 0
- remaining := header
- for len(remaining) > 0 {
- partsCount++
- _, remaining = nextSplitElement(remaining, ",")
- }
- accept := make(acceptSlice, 0, partsCount)
-
- remaining = header
- var part string
- for len(remaining) > 0 {
- part, remaining = nextSplitElement(remaining, ",")
- part = strings.TrimFunc(part, stringTrimSpaceCutset)
-
- a := Accept{
- Q: 1.0,
- }
-
- sp, remainingPart := nextSplitElement(part, ";")
-
- sp0, spRemaining := nextSplitElement(sp, "/")
- a.Type = strings.TrimFunc(sp0, stringTrimSpaceCutset)
-
- switch {
- case len(spRemaining) == 0:
- if a.Type == "*" {
- a.SubType = "*"
- } else {
- continue
- }
- default:
- var sp1 string
- sp1, spRemaining = nextSplitElement(spRemaining, "/")
- if len(spRemaining) > 0 {
- continue
- }
- a.SubType = strings.TrimFunc(sp1, stringTrimSpaceCutset)
- }
-
- if len(remainingPart) == 0 {
- accept = append(accept, a)
- continue
- }
-
- a.Params = make(map[string]string)
- for len(remainingPart) > 0 {
- sp, remainingPart = nextSplitElement(remainingPart, ";")
- sp0, spRemaining = nextSplitElement(sp, "=")
- if len(spRemaining) == 0 {
- continue
- }
- var sp1 string
- sp1, spRemaining = nextSplitElement(spRemaining, "=")
- if len(spRemaining) != 0 {
- continue
- }
- token := strings.TrimFunc(sp0, stringTrimSpaceCutset)
- if token == "q" {
- a.Q, _ = strconv.ParseFloat(sp1, 32)
- } else {
- a.Params[token] = strings.TrimFunc(sp1, stringTrimSpaceCutset)
- }
- }
-
- accept = append(accept, a)
- }
-
- sort.Sort(accept)
- return accept
-}
-
-// Negotiate the most appropriate content_type given the accept header
-// and a list of alternatives.
-func Negotiate(header string, alternatives []string) (content_type string) {
- asp := make([][]string, 0, len(alternatives))
- for _, ctype := range alternatives {
- asp = append(asp, strings.SplitN(ctype, "/", 2))
- }
- for _, clause := range ParseAccept(header) {
- for i, ctsp := range asp {
- if clause.Type == ctsp[0] && clause.SubType == ctsp[1] {
- content_type = alternatives[i]
- return
- }
- if clause.Type == ctsp[0] && clause.SubType == "*" {
- content_type = alternatives[i]
- return
- }
- if clause.Type == "*" && clause.SubType == "*" {
- content_type = alternatives[i]
- return
- }
- }
- }
- return
-}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/annotations.go b/vendor/github.com/open-policy-agent/opa/ast/annotations.go
index d6267a0e64..3bc5fb36a5 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/annotations.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/annotations.go
@@ -5,973 +5,33 @@
package ast
import (
- "encoding/json"
- "fmt"
- "net/url"
- "sort"
- "strings"
-
- astJSON "github.com/open-policy-agent/opa/ast/json"
- "github.com/open-policy-agent/opa/internal/deepcopy"
- "github.com/open-policy-agent/opa/util"
-)
-
-const (
- annotationScopePackage = "package"
- annotationScopeImport = "import"
- annotationScopeRule = "rule"
- annotationScopeDocument = "document"
- annotationScopeSubpackages = "subpackages"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
type (
// Annotations represents metadata attached to other AST nodes such as rules.
- Annotations struct {
- Scope string `json:"scope"`
- Title string `json:"title,omitempty"`
- Entrypoint bool `json:"entrypoint,omitempty"`
- Description string `json:"description,omitempty"`
- Organizations []string `json:"organizations,omitempty"`
- RelatedResources []*RelatedResourceAnnotation `json:"related_resources,omitempty"`
- Authors []*AuthorAnnotation `json:"authors,omitempty"`
- Schemas []*SchemaAnnotation `json:"schemas,omitempty"`
- Custom map[string]interface{} `json:"custom,omitempty"`
- Location *Location `json:"location,omitempty"`
-
- comments []*Comment
- node Node
- jsonOptions astJSON.Options
- }
+ Annotations = v1.Annotations
// SchemaAnnotation contains a schema declaration for the document identified by the path.
- SchemaAnnotation struct {
- Path Ref `json:"path"`
- Schema Ref `json:"schema,omitempty"`
- Definition *interface{} `json:"definition,omitempty"`
- }
-
- AuthorAnnotation struct {
- Name string `json:"name"`
- Email string `json:"email,omitempty"`
- }
-
- RelatedResourceAnnotation struct {
- Ref url.URL `json:"ref"`
- Description string `json:"description,omitempty"`
- }
-
- AnnotationSet struct {
- byRule map[*Rule][]*Annotations
- byPackage map[int]*Annotations
- byPath *annotationTreeNode
- modules []*Module // Modules this set was constructed from
- }
+ SchemaAnnotation = v1.SchemaAnnotation
- annotationTreeNode struct {
- Value *Annotations
- Children map[Value]*annotationTreeNode // we assume key elements are hashable (vars and strings only!)
- }
+ AuthorAnnotation = v1.AuthorAnnotation
- AnnotationsRef struct {
- Path Ref `json:"path"` // The path of the node the annotations are applied to
- Annotations *Annotations `json:"annotations,omitempty"`
- Location *Location `json:"location,omitempty"` // The location of the node the annotations are applied to
+ RelatedResourceAnnotation = v1.RelatedResourceAnnotation
- jsonOptions astJSON.Options
+ AnnotationSet = v1.AnnotationSet
- node Node // The node the annotations are applied to
- }
+ AnnotationsRef = v1.AnnotationsRef
- AnnotationsRefSet []*AnnotationsRef
+ AnnotationsRefSet = v1.AnnotationsRefSet
- FlatAnnotationsRefSet AnnotationsRefSet
+ FlatAnnotationsRefSet = v1.FlatAnnotationsRefSet
)
-func (a *Annotations) String() string {
- bs, _ := a.MarshalJSON()
- return string(bs)
-}
-
-// Loc returns the location of this annotation.
-func (a *Annotations) Loc() *Location {
- return a.Location
-}
-
-// SetLoc updates the location of this annotation.
-func (a *Annotations) SetLoc(l *Location) {
- a.Location = l
-}
-
-// EndLoc returns the location of this annotation's last comment line.
-func (a *Annotations) EndLoc() *Location {
- count := len(a.comments)
- if count == 0 {
- return a.Location
- }
- return a.comments[count-1].Location
-}
-
-// Compare returns an integer indicating if a is less than, equal to, or greater
-// than other.
-func (a *Annotations) Compare(other *Annotations) int {
-
- if a == nil && other == nil {
- return 0
- }
-
- if a == nil {
- return -1
- }
-
- if other == nil {
- return 1
- }
-
- if cmp := scopeCompare(a.Scope, other.Scope); cmp != 0 {
- return cmp
- }
-
- if cmp := strings.Compare(a.Title, other.Title); cmp != 0 {
- return cmp
- }
-
- if cmp := strings.Compare(a.Description, other.Description); cmp != 0 {
- return cmp
- }
-
- if cmp := compareStringLists(a.Organizations, other.Organizations); cmp != 0 {
- return cmp
- }
-
- if cmp := compareRelatedResources(a.RelatedResources, other.RelatedResources); cmp != 0 {
- return cmp
- }
-
- if cmp := compareAuthors(a.Authors, other.Authors); cmp != 0 {
- return cmp
- }
-
- if cmp := compareSchemas(a.Schemas, other.Schemas); cmp != 0 {
- return cmp
- }
-
- if a.Entrypoint != other.Entrypoint {
- if a.Entrypoint {
- return 1
- }
- return -1
- }
-
- if cmp := util.Compare(a.Custom, other.Custom); cmp != 0 {
- return cmp
- }
-
- return 0
-}
-
-// GetTargetPath returns the path of the node these Annotations are applied to (the target)
-func (a *Annotations) GetTargetPath() Ref {
- switch n := a.node.(type) {
- case *Package:
- return n.Path
- case *Rule:
- return n.Ref().GroundPrefix()
- default:
- return nil
- }
-}
-
-func (a *Annotations) setJSONOptions(opts astJSON.Options) {
- a.jsonOptions = opts
- if a.Location != nil {
- a.Location.JSONOptions = opts
- }
-}
-
-func (a *Annotations) MarshalJSON() ([]byte, error) {
- if a == nil {
- return []byte(`{"scope":""}`), nil
- }
-
- data := map[string]interface{}{
- "scope": a.Scope,
- }
-
- if a.Title != "" {
- data["title"] = a.Title
- }
-
- if a.Description != "" {
- data["description"] = a.Description
- }
-
- if a.Entrypoint {
- data["entrypoint"] = a.Entrypoint
- }
-
- if len(a.Organizations) > 0 {
- data["organizations"] = a.Organizations
- }
-
- if len(a.RelatedResources) > 0 {
- data["related_resources"] = a.RelatedResources
- }
-
- if len(a.Authors) > 0 {
- data["authors"] = a.Authors
- }
-
- if len(a.Schemas) > 0 {
- data["schemas"] = a.Schemas
- }
-
- if len(a.Custom) > 0 {
- data["custom"] = a.Custom
- }
-
- if a.jsonOptions.MarshalOptions.IncludeLocation.Annotations {
- if a.Location != nil {
- data["location"] = a.Location
- }
- }
-
- return json.Marshal(data)
-}
-
func NewAnnotationsRef(a *Annotations) *AnnotationsRef {
- var loc *Location
- if a.node != nil {
- loc = a.node.Loc()
- }
-
- return &AnnotationsRef{
- Location: loc,
- Path: a.GetTargetPath(),
- Annotations: a,
- node: a.node,
- jsonOptions: a.jsonOptions,
- }
-}
-
-func (ar *AnnotationsRef) GetPackage() *Package {
- switch n := ar.node.(type) {
- case *Package:
- return n
- case *Rule:
- return n.Module.Package
- default:
- return nil
- }
-}
-
-func (ar *AnnotationsRef) GetRule() *Rule {
- switch n := ar.node.(type) {
- case *Rule:
- return n
- default:
- return nil
- }
-}
-
-func (ar *AnnotationsRef) MarshalJSON() ([]byte, error) {
- data := map[string]interface{}{
- "path": ar.Path,
- }
-
- if ar.Annotations != nil {
- data["annotations"] = ar.Annotations
- }
-
- if ar.jsonOptions.MarshalOptions.IncludeLocation.AnnotationsRef {
- if ar.Location != nil {
- data["location"] = ar.Location
- }
- }
-
- return json.Marshal(data)
-}
-
-func scopeCompare(s1, s2 string) int {
-
- o1 := scopeOrder(s1)
- o2 := scopeOrder(s2)
-
- if o2 < o1 {
- return 1
- } else if o2 > o1 {
- return -1
- }
-
- if s1 < s2 {
- return -1
- } else if s2 < s1 {
- return 1
- }
-
- return 0
-}
-
-func scopeOrder(s string) int {
- switch s {
- case annotationScopeRule:
- return 1
- }
- return 0
-}
-
-func compareAuthors(a, b []*AuthorAnnotation) int {
- if len(a) > len(b) {
- return 1
- } else if len(a) < len(b) {
- return -1
- }
-
- for i := 0; i < len(a); i++ {
- if cmp := a[i].Compare(b[i]); cmp != 0 {
- return cmp
- }
- }
-
- return 0
-}
-
-func compareRelatedResources(a, b []*RelatedResourceAnnotation) int {
- if len(a) > len(b) {
- return 1
- } else if len(a) < len(b) {
- return -1
- }
-
- for i := 0; i < len(a); i++ {
- if cmp := strings.Compare(a[i].String(), b[i].String()); cmp != 0 {
- return cmp
- }
- }
-
- return 0
-}
-
-func compareSchemas(a, b []*SchemaAnnotation) int {
- maxLen := len(a)
- if len(b) < maxLen {
- maxLen = len(b)
- }
-
- for i := 0; i < maxLen; i++ {
- if cmp := a[i].Compare(b[i]); cmp != 0 {
- return cmp
- }
- }
-
- if len(a) > len(b) {
- return 1
- } else if len(a) < len(b) {
- return -1
- }
-
- return 0
-}
-
-func compareStringLists(a, b []string) int {
- if len(a) > len(b) {
- return 1
- } else if len(a) < len(b) {
- return -1
- }
-
- for i := 0; i < len(a); i++ {
- if cmp := strings.Compare(a[i], b[i]); cmp != 0 {
- return cmp
- }
- }
-
- return 0
-}
-
-// Copy returns a deep copy of s.
-func (a *Annotations) Copy(node Node) *Annotations {
- cpy := *a
-
- cpy.Organizations = make([]string, len(a.Organizations))
- copy(cpy.Organizations, a.Organizations)
-
- cpy.RelatedResources = make([]*RelatedResourceAnnotation, len(a.RelatedResources))
- for i := range a.RelatedResources {
- cpy.RelatedResources[i] = a.RelatedResources[i].Copy()
- }
-
- cpy.Authors = make([]*AuthorAnnotation, len(a.Authors))
- for i := range a.Authors {
- cpy.Authors[i] = a.Authors[i].Copy()
- }
-
- cpy.Schemas = make([]*SchemaAnnotation, len(a.Schemas))
- for i := range a.Schemas {
- cpy.Schemas[i] = a.Schemas[i].Copy()
- }
-
- cpy.Custom = deepcopy.Map(a.Custom)
-
- cpy.node = node
-
- return &cpy
-}
-
-// toObject constructs an AST Object from the annotation.
-func (a *Annotations) toObject() (*Object, *Error) {
- obj := NewObject()
-
- if a == nil {
- return &obj, nil
- }
-
- if len(a.Scope) > 0 {
- obj.Insert(StringTerm("scope"), StringTerm(a.Scope))
- }
-
- if len(a.Title) > 0 {
- obj.Insert(StringTerm("title"), StringTerm(a.Title))
- }
-
- if a.Entrypoint {
- obj.Insert(StringTerm("entrypoint"), BooleanTerm(true))
- }
-
- if len(a.Description) > 0 {
- obj.Insert(StringTerm("description"), StringTerm(a.Description))
- }
-
- if len(a.Organizations) > 0 {
- orgs := make([]*Term, 0, len(a.Organizations))
- for _, org := range a.Organizations {
- orgs = append(orgs, StringTerm(org))
- }
- obj.Insert(StringTerm("organizations"), ArrayTerm(orgs...))
- }
-
- if len(a.RelatedResources) > 0 {
- rrs := make([]*Term, 0, len(a.RelatedResources))
- for _, rr := range a.RelatedResources {
- rrObj := NewObject(Item(StringTerm("ref"), StringTerm(rr.Ref.String())))
- if len(rr.Description) > 0 {
- rrObj.Insert(StringTerm("description"), StringTerm(rr.Description))
- }
- rrs = append(rrs, NewTerm(rrObj))
- }
- obj.Insert(StringTerm("related_resources"), ArrayTerm(rrs...))
- }
-
- if len(a.Authors) > 0 {
- as := make([]*Term, 0, len(a.Authors))
- for _, author := range a.Authors {
- aObj := NewObject()
- if len(author.Name) > 0 {
- aObj.Insert(StringTerm("name"), StringTerm(author.Name))
- }
- if len(author.Email) > 0 {
- aObj.Insert(StringTerm("email"), StringTerm(author.Email))
- }
- as = append(as, NewTerm(aObj))
- }
- obj.Insert(StringTerm("authors"), ArrayTerm(as...))
- }
-
- if len(a.Schemas) > 0 {
- ss := make([]*Term, 0, len(a.Schemas))
- for _, s := range a.Schemas {
- sObj := NewObject()
- if len(s.Path) > 0 {
- sObj.Insert(StringTerm("path"), NewTerm(s.Path.toArray()))
- }
- if len(s.Schema) > 0 {
- sObj.Insert(StringTerm("schema"), NewTerm(s.Schema.toArray()))
- }
- if s.Definition != nil {
- def, err := InterfaceToValue(s.Definition)
- if err != nil {
- return nil, NewError(CompileErr, a.Location, "invalid definition in schema annotation: %s", err.Error())
- }
- sObj.Insert(StringTerm("definition"), NewTerm(def))
- }
- ss = append(ss, NewTerm(sObj))
- }
- obj.Insert(StringTerm("schemas"), ArrayTerm(ss...))
- }
-
- if len(a.Custom) > 0 {
- c, err := InterfaceToValue(a.Custom)
- if err != nil {
- return nil, NewError(CompileErr, a.Location, "invalid custom annotation %s", err.Error())
- }
- obj.Insert(StringTerm("custom"), NewTerm(c))
- }
-
- return &obj, nil
-}
-
-func attachRuleAnnotations(mod *Module) {
- // make a copy of the annotations
- cpy := make([]*Annotations, len(mod.Annotations))
- for i, a := range mod.Annotations {
- cpy[i] = a.Copy(a.node)
- }
-
- for _, rule := range mod.Rules {
- var j int
- var found bool
- for i, a := range cpy {
- if rule.Ref().GroundPrefix().Equal(a.GetTargetPath()) {
- if a.Scope == annotationScopeDocument {
- rule.Annotations = append(rule.Annotations, a)
- } else if a.Scope == annotationScopeRule && rule.Loc().Row > a.Location.Row {
- j = i
- found = true
- rule.Annotations = append(rule.Annotations, a)
- }
- }
- }
-
- if found && j < len(cpy) {
- cpy = append(cpy[:j], cpy[j+1:]...)
- }
- }
-}
-
-func attachAnnotationsNodes(mod *Module) Errors {
- var errs Errors
-
- // Find first non-annotation statement following each annotation and attach
- // the annotation to that statement.
- for _, a := range mod.Annotations {
- for _, stmt := range mod.stmts {
- _, ok := stmt.(*Annotations)
- if !ok {
- if stmt.Loc().Row > a.Location.Row {
- a.node = stmt
- break
- }
- }
- }
-
- if a.Scope == "" {
- switch a.node.(type) {
- case *Rule:
- if a.Entrypoint {
- a.Scope = annotationScopeDocument
- } else {
- a.Scope = annotationScopeRule
- }
- case *Package:
- a.Scope = annotationScopePackage
- case *Import:
- a.Scope = annotationScopeImport
- }
- }
-
- if err := validateAnnotationScopeAttachment(a); err != nil {
- errs = append(errs, err)
- }
-
- if err := validateAnnotationEntrypointAttachment(a); err != nil {
- errs = append(errs, err)
- }
- }
-
- return errs
-}
-
-func validateAnnotationScopeAttachment(a *Annotations) *Error {
-
- switch a.Scope {
- case annotationScopeRule, annotationScopeDocument:
- if _, ok := a.node.(*Rule); ok {
- return nil
- }
- return newScopeAttachmentErr(a, "rule")
- case annotationScopePackage, annotationScopeSubpackages:
- if _, ok := a.node.(*Package); ok {
- return nil
- }
- return newScopeAttachmentErr(a, "package")
- }
-
- return NewError(ParseErr, a.Loc(), "invalid annotation scope '%v'. Use one of '%s', '%s', '%s', or '%s'",
- a.Scope, annotationScopeRule, annotationScopeDocument, annotationScopePackage, annotationScopeSubpackages)
-}
-
-func validateAnnotationEntrypointAttachment(a *Annotations) *Error {
- if a.Entrypoint && !(a.Scope == annotationScopeDocument || a.Scope == annotationScopePackage) {
- return NewError(
- ParseErr, a.Loc(), "annotation entrypoint applied to non-document or package scope '%v'", a.Scope)
- }
- return nil
-}
-
-// Copy returns a deep copy of a.
-func (a *AuthorAnnotation) Copy() *AuthorAnnotation {
- cpy := *a
- return &cpy
-}
-
-// Compare returns an integer indicating if s is less than, equal to, or greater
-// than other.
-func (a *AuthorAnnotation) Compare(other *AuthorAnnotation) int {
- if cmp := strings.Compare(a.Name, other.Name); cmp != 0 {
- return cmp
- }
-
- if cmp := strings.Compare(a.Email, other.Email); cmp != 0 {
- return cmp
- }
-
- return 0
-}
-
-func (a *AuthorAnnotation) String() string {
- if len(a.Email) == 0 {
- return a.Name
- } else if len(a.Name) == 0 {
- return fmt.Sprintf("<%s>", a.Email)
- }
- return fmt.Sprintf("%s <%s>", a.Name, a.Email)
-}
-
-// Copy returns a deep copy of rr.
-func (rr *RelatedResourceAnnotation) Copy() *RelatedResourceAnnotation {
- cpy := *rr
- return &cpy
-}
-
-// Compare returns an integer indicating if s is less than, equal to, or greater
-// than other.
-func (rr *RelatedResourceAnnotation) Compare(other *RelatedResourceAnnotation) int {
- if cmp := strings.Compare(rr.Description, other.Description); cmp != 0 {
- return cmp
- }
-
- if cmp := strings.Compare(rr.Ref.String(), other.Ref.String()); cmp != 0 {
- return cmp
- }
-
- return 0
-}
-
-func (rr *RelatedResourceAnnotation) String() string {
- bs, _ := json.Marshal(rr)
- return string(bs)
-}
-
-func (rr *RelatedResourceAnnotation) MarshalJSON() ([]byte, error) {
- d := map[string]interface{}{
- "ref": rr.Ref.String(),
- }
-
- if len(rr.Description) > 0 {
- d["description"] = rr.Description
- }
-
- return json.Marshal(d)
-}
-
-// Copy returns a deep copy of s.
-func (s *SchemaAnnotation) Copy() *SchemaAnnotation {
- cpy := *s
- return &cpy
-}
-
-// Compare returns an integer indicating if s is less than, equal to, or greater
-// than other.
-func (s *SchemaAnnotation) Compare(other *SchemaAnnotation) int {
-
- if cmp := s.Path.Compare(other.Path); cmp != 0 {
- return cmp
- }
-
- if cmp := s.Schema.Compare(other.Schema); cmp != 0 {
- return cmp
- }
-
- if s.Definition != nil && other.Definition == nil {
- return -1
- } else if s.Definition == nil && other.Definition != nil {
- return 1
- } else if s.Definition != nil && other.Definition != nil {
- return util.Compare(*s.Definition, *other.Definition)
- }
-
- return 0
-}
-
-func (s *SchemaAnnotation) String() string {
- bs, _ := json.Marshal(s)
- return string(bs)
-}
-
-func newAnnotationSet() *AnnotationSet {
- return &AnnotationSet{
- byRule: map[*Rule][]*Annotations{},
- byPackage: map[int]*Annotations{},
- byPath: newAnnotationTree(),
- }
+ return v1.NewAnnotationsRef(a)
}
func BuildAnnotationSet(modules []*Module) (*AnnotationSet, Errors) {
- as := newAnnotationSet()
- var errs Errors
- for _, m := range modules {
- for _, a := range m.Annotations {
- if err := as.add(a); err != nil {
- errs = append(errs, err)
- }
- }
- }
- if len(errs) > 0 {
- return nil, errs
- }
- as.modules = modules
- return as, nil
-}
-
-// NOTE(philipc): During copy propagation, the underlying Nodes can be
-// stripped away from the annotations, leading to nil deref panics. We
-// silently ignore these cases for now, as a workaround.
-func (as *AnnotationSet) add(a *Annotations) *Error {
- switch a.Scope {
- case annotationScopeRule:
- if rule, ok := a.node.(*Rule); ok {
- as.byRule[rule] = append(as.byRule[rule], a)
- }
- case annotationScopePackage:
- if pkg, ok := a.node.(*Package); ok {
- hash := pkg.Path.Hash()
- if exist, ok := as.byPackage[hash]; ok {
- return errAnnotationRedeclared(a, exist.Location)
- }
- as.byPackage[hash] = a
- }
- case annotationScopeDocument:
- if rule, ok := a.node.(*Rule); ok {
- path := rule.Ref().GroundPrefix()
- x := as.byPath.get(path)
- if x != nil {
- return errAnnotationRedeclared(a, x.Value.Location)
- }
- as.byPath.insert(path, a)
- }
- case annotationScopeSubpackages:
- if pkg, ok := a.node.(*Package); ok {
- x := as.byPath.get(pkg.Path)
- if x != nil && x.Value != nil {
- return errAnnotationRedeclared(a, x.Value.Location)
- }
- as.byPath.insert(pkg.Path, a)
- }
- }
- return nil
-}
-
-func (as *AnnotationSet) GetRuleScope(r *Rule) []*Annotations {
- if as == nil {
- return nil
- }
- return as.byRule[r]
-}
-
-func (as *AnnotationSet) GetSubpackagesScope(path Ref) []*Annotations {
- if as == nil {
- return nil
- }
- return as.byPath.ancestors(path)
-}
-
-func (as *AnnotationSet) GetDocumentScope(path Ref) *Annotations {
- if as == nil {
- return nil
- }
- if node := as.byPath.get(path); node != nil {
- return node.Value
- }
- return nil
-}
-
-func (as *AnnotationSet) GetPackageScope(pkg *Package) *Annotations {
- if as == nil {
- return nil
- }
- return as.byPackage[pkg.Path.Hash()]
-}
-
-// Flatten returns a flattened list view of this AnnotationSet.
-// The returned slice is sorted, first by the annotations' target path, then by their target location
-func (as *AnnotationSet) Flatten() FlatAnnotationsRefSet {
- // This preallocation often won't be optimal, but it's superior to starting with a nil slice.
- refs := make([]*AnnotationsRef, 0, len(as.byPath.Children)+len(as.byRule)+len(as.byPackage))
-
- refs = as.byPath.flatten(refs)
-
- for _, a := range as.byPackage {
- refs = append(refs, NewAnnotationsRef(a))
- }
-
- for _, as := range as.byRule {
- for _, a := range as {
- refs = append(refs, NewAnnotationsRef(a))
- }
- }
-
- // Sort by path, then annotation location, for stable output
- sort.SliceStable(refs, func(i, j int) bool {
- return refs[i].Compare(refs[j]) < 0
- })
-
- return refs
-}
-
-// Chain returns the chain of annotations leading up to the given rule.
-// The returned slice is ordered as follows
-// 0. Entries for the given rule, ordered from the METADATA block declared immediately above the rule, to the block declared farthest away (always at least one entry)
-// 1. The 'document' scope entry, if any
-// 2. The 'package' scope entry, if any
-// 3. Entries for the 'subpackages' scope, if any; ordered from the closest package path to the fartest. E.g.: 'do.re.mi', 'do.re', 'do'
-// The returned slice is guaranteed to always contain at least one entry, corresponding to the given rule.
-func (as *AnnotationSet) Chain(rule *Rule) AnnotationsRefSet {
- var refs []*AnnotationsRef
-
- ruleAnnots := as.GetRuleScope(rule)
-
- if len(ruleAnnots) >= 1 {
- for _, a := range ruleAnnots {
- refs = append(refs, NewAnnotationsRef(a))
- }
- } else {
- // Make sure there is always a leading entry representing the passed rule, even if it has no annotations
- refs = append(refs, &AnnotationsRef{
- Location: rule.Location,
- Path: rule.Ref().GroundPrefix(),
- node: rule,
- })
- }
-
- if len(refs) > 1 {
- // Sort by annotation location; chain must start with annotations declared closest to rule, then going outward
- sort.SliceStable(refs, func(i, j int) bool {
- return refs[i].Annotations.Location.Compare(refs[j].Annotations.Location) > 0
- })
- }
-
- docAnnots := as.GetDocumentScope(rule.Ref().GroundPrefix())
- if docAnnots != nil {
- refs = append(refs, NewAnnotationsRef(docAnnots))
- }
-
- pkg := rule.Module.Package
- pkgAnnots := as.GetPackageScope(pkg)
- if pkgAnnots != nil {
- refs = append(refs, NewAnnotationsRef(pkgAnnots))
- }
-
- subPkgAnnots := as.GetSubpackagesScope(pkg.Path)
- // We need to reverse the order, as subPkgAnnots ordering will start at the root,
- // whereas we want to end at the root.
- for i := len(subPkgAnnots) - 1; i >= 0; i-- {
- refs = append(refs, NewAnnotationsRef(subPkgAnnots[i]))
- }
-
- return refs
-}
-
-func (ars FlatAnnotationsRefSet) Insert(ar *AnnotationsRef) FlatAnnotationsRefSet {
- result := make(FlatAnnotationsRefSet, 0, len(ars)+1)
-
- // insertion sort, first by path, then location
- for i, current := range ars {
- if ar.Compare(current) < 0 {
- result = append(result, ar)
- result = append(result, ars[i:]...)
- break
- }
- result = append(result, current)
- }
-
- if len(result) < len(ars)+1 {
- result = append(result, ar)
- }
-
- return result
-}
-
-func newAnnotationTree() *annotationTreeNode {
- return &annotationTreeNode{
- Value: nil,
- Children: map[Value]*annotationTreeNode{},
- }
-}
-
-func (t *annotationTreeNode) insert(path Ref, value *Annotations) {
- node := t
- for _, k := range path {
- child, ok := node.Children[k.Value]
- if !ok {
- child = newAnnotationTree()
- node.Children[k.Value] = child
- }
- node = child
- }
- node.Value = value
-}
-
-func (t *annotationTreeNode) get(path Ref) *annotationTreeNode {
- node := t
- for _, k := range path {
- if node == nil {
- return nil
- }
- child, ok := node.Children[k.Value]
- if !ok {
- return nil
- }
- node = child
- }
- return node
-}
-
-// ancestors returns a slice of annotations in ascending order, starting with the root of ref; e.g.: 'root', 'root.foo', 'root.foo.bar'.
-func (t *annotationTreeNode) ancestors(path Ref) (result []*Annotations) {
- node := t
- for _, k := range path {
- if node == nil {
- return result
- }
- child, ok := node.Children[k.Value]
- if !ok {
- return result
- }
- if child.Value != nil {
- result = append(result, child.Value)
- }
- node = child
- }
- return result
-}
-
-func (t *annotationTreeNode) flatten(refs []*AnnotationsRef) []*AnnotationsRef {
- if a := t.Value; a != nil {
- refs = append(refs, NewAnnotationsRef(a))
- }
- for _, c := range t.Children {
- refs = c.flatten(refs)
- }
- return refs
-}
-
-func (ar *AnnotationsRef) Compare(other *AnnotationsRef) int {
- if c := ar.Path.Compare(other.Path); c != 0 {
- return c
- }
-
- if c := ar.Annotations.Location.Compare(other.Annotations.Location); c != 0 {
- return c
- }
-
- return ar.Annotations.Compare(other.Annotations)
+ return v1.BuildAnnotationSet(modules)
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/builtins.go b/vendor/github.com/open-policy-agent/opa/ast/builtins.go
index f54d91d317..65de5abef2 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/builtins.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/builtins.go
@@ -5,1348 +5,230 @@
package ast
import (
- "strings"
-
- "github.com/open-policy-agent/opa/types"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
// Builtins is the registry of built-in functions supported by OPA.
// Call RegisterBuiltin to add a new built-in.
-var Builtins []*Builtin
+var Builtins = v1.Builtins
// RegisterBuiltin adds a new built-in function to the registry.
func RegisterBuiltin(b *Builtin) {
- Builtins = append(Builtins, b)
- BuiltinMap[b.Name] = b
- if len(b.Infix) > 0 {
- BuiltinMap[b.Infix] = b
- }
+ v1.RegisterBuiltin(b)
}
// DefaultBuiltins is the registry of built-in functions supported in OPA
// by default. When adding a new built-in function to OPA, update this
// list.
-var DefaultBuiltins = [...]*Builtin{
- // Unification/equality ("=")
- Equality,
-
- // Assignment (":=")
- Assign,
-
- // Membership, infix "in": `x in xs`
- Member,
- MemberWithKey,
-
- // Comparisons
- GreaterThan,
- GreaterThanEq,
- LessThan,
- LessThanEq,
- NotEqual,
- Equal,
-
- // Arithmetic
- Plus,
- Minus,
- Multiply,
- Divide,
- Ceil,
- Floor,
- Round,
- Abs,
- Rem,
-
- // Bitwise Arithmetic
- BitsOr,
- BitsAnd,
- BitsNegate,
- BitsXOr,
- BitsShiftLeft,
- BitsShiftRight,
-
- // Binary
- And,
- Or,
-
- // Aggregates
- Count,
- Sum,
- Product,
- Max,
- Min,
- Any,
- All,
-
- // Arrays
- ArrayConcat,
- ArraySlice,
- ArrayReverse,
-
- // Conversions
- ToNumber,
-
- // Casts (DEPRECATED)
- CastObject,
- CastNull,
- CastBoolean,
- CastString,
- CastSet,
- CastArray,
-
- // Regular Expressions
- RegexIsValid,
- RegexMatch,
- RegexMatchDeprecated,
- RegexSplit,
- GlobsMatch,
- RegexTemplateMatch,
- RegexFind,
- RegexFindAllStringSubmatch,
- RegexReplace,
-
- // Sets
- SetDiff,
- Intersection,
- Union,
-
- // Strings
- AnyPrefixMatch,
- AnySuffixMatch,
- Concat,
- FormatInt,
- IndexOf,
- IndexOfN,
- Substring,
- Lower,
- Upper,
- Contains,
- StringCount,
- StartsWith,
- EndsWith,
- Split,
- Replace,
- ReplaceN,
- Trim,
- TrimLeft,
- TrimPrefix,
- TrimRight,
- TrimSuffix,
- TrimSpace,
- Sprintf,
- StringReverse,
- RenderTemplate,
-
- // Numbers
- NumbersRange,
- NumbersRangeStep,
- RandIntn,
-
- // Encoding
- JSONMarshal,
- JSONMarshalWithOptions,
- JSONUnmarshal,
- JSONIsValid,
- Base64Encode,
- Base64Decode,
- Base64IsValid,
- Base64UrlEncode,
- Base64UrlEncodeNoPad,
- Base64UrlDecode,
- URLQueryDecode,
- URLQueryEncode,
- URLQueryEncodeObject,
- URLQueryDecodeObject,
- YAMLMarshal,
- YAMLUnmarshal,
- YAMLIsValid,
- HexEncode,
- HexDecode,
-
- // Object Manipulation
- ObjectUnion,
- ObjectUnionN,
- ObjectRemove,
- ObjectFilter,
- ObjectGet,
- ObjectKeys,
- ObjectSubset,
-
- // JSON Object Manipulation
- JSONFilter,
- JSONRemove,
- JSONPatch,
-
- // Tokens
- JWTDecode,
- JWTVerifyRS256,
- JWTVerifyRS384,
- JWTVerifyRS512,
- JWTVerifyPS256,
- JWTVerifyPS384,
- JWTVerifyPS512,
- JWTVerifyES256,
- JWTVerifyES384,
- JWTVerifyES512,
- JWTVerifyHS256,
- JWTVerifyHS384,
- JWTVerifyHS512,
- JWTDecodeVerify,
- JWTEncodeSignRaw,
- JWTEncodeSign,
-
- // Time
- NowNanos,
- ParseNanos,
- ParseRFC3339Nanos,
- ParseDurationNanos,
- Format,
- Date,
- Clock,
- Weekday,
- AddDate,
- Diff,
-
- // Crypto
- CryptoX509ParseCertificates,
- CryptoX509ParseAndVerifyCertificates,
- CryptoX509ParseAndVerifyCertificatesWithOptions,
- CryptoMd5,
- CryptoSha1,
- CryptoSha256,
- CryptoX509ParseCertificateRequest,
- CryptoX509ParseRSAPrivateKey,
- CryptoX509ParseKeyPair,
- CryptoParsePrivateKeys,
- CryptoHmacMd5,
- CryptoHmacSha1,
- CryptoHmacSha256,
- CryptoHmacSha512,
- CryptoHmacEqual,
-
- // Graphs
- WalkBuiltin,
- ReachableBuiltin,
- ReachablePathsBuiltin,
-
- // Sort
- Sort,
-
- // Types
- IsNumber,
- IsString,
- IsBoolean,
- IsArray,
- IsSet,
- IsObject,
- IsNull,
- TypeNameBuiltin,
-
- // HTTP
- HTTPSend,
-
- // GraphQL
- GraphQLParse,
- GraphQLParseAndVerify,
- GraphQLParseQuery,
- GraphQLParseSchema,
- GraphQLIsValid,
- GraphQLSchemaIsValid,
-
- // JSON Schema
- JSONSchemaVerify,
- JSONMatchSchema,
-
- // Cloud Provider Helpers
- ProvidersAWSSignReqObj,
-
- // Rego
- RegoParseModule,
- RegoMetadataChain,
- RegoMetadataRule,
-
- // OPA
- OPARuntime,
-
- // Tracing
- Trace,
-
- // Networking
- NetCIDROverlap,
- NetCIDRIntersects,
- NetCIDRContains,
- NetCIDRContainsMatches,
- NetCIDRExpand,
- NetCIDRMerge,
- NetLookupIPAddr,
- NetCIDRIsValid,
-
- // Glob
- GlobMatch,
- GlobQuoteMeta,
-
- // Units
- UnitsParse,
- UnitsParseBytes,
-
- // UUIDs
- UUIDRFC4122,
- UUIDParse,
-
- // SemVers
- SemVerIsValid,
- SemVerCompare,
-
- // Printing
- Print,
- InternalPrint,
-}
+var DefaultBuiltins = v1.DefaultBuiltins
// BuiltinMap provides a convenient mapping of built-in names to
// built-in definitions.
-var BuiltinMap map[string]*Builtin
+var BuiltinMap = v1.BuiltinMap
// Deprecated: Builtins can now be directly annotated with the
// Nondeterministic property, and when set to true, will be ignored
// for partial evaluation.
-var IgnoreDuringPartialEval = []*Builtin{
- RandIntn,
- UUIDRFC4122,
- JWTDecodeVerify,
- JWTEncodeSignRaw,
- JWTEncodeSign,
- NowNanos,
- HTTPSend,
- OPARuntime,
- NetLookupIPAddr,
-}
+var IgnoreDuringPartialEval = v1.IgnoreDuringPartialEval //nolint:staticcheck
/**
* Unification
*/
// Equality represents the "=" operator.
-var Equality = &Builtin{
- Name: "eq",
- Infix: "=",
- Decl: types.NewFunction(
- types.Args(types.A, types.A),
- types.B,
- ),
-}
+var Equality = v1.Equality
/**
* Assignment
*/
// Assign represents the assignment (":=") operator.
-var Assign = &Builtin{
- Name: "assign",
- Infix: ":=",
- Decl: types.NewFunction(
- types.Args(types.A, types.A),
- types.B,
- ),
-}
+var Assign = v1.Assign
// Member represents the `in` (infix) operator.
-var Member = &Builtin{
- Name: "internal.member_2",
- Infix: "in",
- Decl: types.NewFunction(
- types.Args(
- types.A,
- types.A,
- ),
- types.B,
- ),
-}
+var Member = v1.Member
// MemberWithKey represents the `in` (infix) operator when used
// with two terms on the lhs, i.e., `k, v in obj`.
-var MemberWithKey = &Builtin{
- Name: "internal.member_3",
- Infix: "in",
- Decl: types.NewFunction(
- types.Args(
- types.A,
- types.A,
- types.A,
- ),
- types.B,
- ),
-}
+var MemberWithKey = v1.MemberWithKey
-/**
- * Comparisons
- */
-var comparison = category("comparison")
-
-var GreaterThan = &Builtin{
- Name: "gt",
- Infix: ">",
- Categories: comparison,
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A),
- types.Named("y", types.A),
- ),
- types.Named("result", types.B).Description("true if `x` is greater than `y`; false otherwise"),
- ),
-}
+var GreaterThan = v1.GreaterThan
-var GreaterThanEq = &Builtin{
- Name: "gte",
- Infix: ">=",
- Categories: comparison,
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A),
- types.Named("y", types.A),
- ),
- types.Named("result", types.B).Description("true if `x` is greater or equal to `y`; false otherwise"),
- ),
-}
+var GreaterThanEq = v1.GreaterThanEq
// LessThan represents the "<" comparison operator.
-var LessThan = &Builtin{
- Name: "lt",
- Infix: "<",
- Categories: comparison,
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A),
- types.Named("y", types.A),
- ),
- types.Named("result", types.B).Description("true if `x` is less than `y`; false otherwise"),
- ),
-}
+var LessThan = v1.LessThan
-var LessThanEq = &Builtin{
- Name: "lte",
- Infix: "<=",
- Categories: comparison,
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A),
- types.Named("y", types.A),
- ),
- types.Named("result", types.B).Description("true if `x` is less than or equal to `y`; false otherwise"),
- ),
-}
+var LessThanEq = v1.LessThanEq
-var NotEqual = &Builtin{
- Name: "neq",
- Infix: "!=",
- Categories: comparison,
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A),
- types.Named("y", types.A),
- ),
- types.Named("result", types.B).Description("true if `x` is not equal to `y`; false otherwise"),
- ),
-}
+var NotEqual = v1.NotEqual
// Equal represents the "==" comparison operator.
-var Equal = &Builtin{
- Name: "equal",
- Infix: "==",
- Categories: comparison,
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A),
- types.Named("y", types.A),
- ),
- types.Named("result", types.B).Description("true if `x` is equal to `y`; false otherwise"),
- ),
-}
+var Equal = v1.Equal
-/**
- * Arithmetic
- */
-var number = category("numbers")
-
-var Plus = &Builtin{
- Name: "plus",
- Infix: "+",
- Description: "Plus adds two numbers together.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.N),
- types.Named("y", types.N),
- ),
- types.Named("z", types.N).Description("the sum of `x` and `y`"),
- ),
- Categories: number,
-}
+var Plus = v1.Plus
-var Minus = &Builtin{
- Name: "minus",
- Infix: "-",
- Description: "Minus subtracts the second number from the first number or computes the difference between two sets.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.NewAny(types.N, types.NewSet(types.A))),
- types.Named("y", types.NewAny(types.N, types.NewSet(types.A))),
- ),
- types.Named("z", types.NewAny(types.N, types.NewSet(types.A))).Description("the difference of `x` and `y`"),
- ),
- Categories: category("sets", "numbers"),
-}
+var Minus = v1.Minus
-var Multiply = &Builtin{
- Name: "mul",
- Infix: "*",
- Description: "Multiplies two numbers.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.N),
- types.Named("y", types.N),
- ),
- types.Named("z", types.N).Description("the product of `x` and `y`"),
- ),
- Categories: number,
-}
+var Multiply = v1.Multiply
-var Divide = &Builtin{
- Name: "div",
- Infix: "/",
- Description: "Divides the first number by the second number.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.N).Description("the dividend"),
- types.Named("y", types.N).Description("the divisor"),
- ),
- types.Named("z", types.N).Description("the result of `x` divided by `y`"),
- ),
- Categories: number,
-}
+var Divide = v1.Divide
-var Round = &Builtin{
- Name: "round",
- Description: "Rounds the number to the nearest integer.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.N).Description("the number to round"),
- ),
- types.Named("y", types.N).Description("the result of rounding `x`"),
- ),
- Categories: number,
-}
+var Round = v1.Round
-var Ceil = &Builtin{
- Name: "ceil",
- Description: "Rounds the number _up_ to the nearest integer.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.N).Description("the number to round"),
- ),
- types.Named("y", types.N).Description("the result of rounding `x` _up_"),
- ),
- Categories: number,
-}
+var Ceil = v1.Ceil
-var Floor = &Builtin{
- Name: "floor",
- Description: "Rounds the number _down_ to the nearest integer.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.N).Description("the number to round"),
- ),
- types.Named("y", types.N).Description("the result of rounding `x` _down_"),
- ),
- Categories: number,
-}
+var Floor = v1.Floor
-var Abs = &Builtin{
- Name: "abs",
- Description: "Returns the number without its sign.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.N),
- ),
- types.Named("y", types.N).Description("the absolute value of `x`"),
- ),
- Categories: number,
-}
+var Abs = v1.Abs
-var Rem = &Builtin{
- Name: "rem",
- Infix: "%",
- Description: "Returns the remainder for of `x` divided by `y`, for `y != 0`.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.N),
- types.Named("y", types.N),
- ),
- types.Named("z", types.N).Description("the remainder"),
- ),
- Categories: number,
-}
+var Rem = v1.Rem
/**
* Bitwise
*/
-var BitsOr = &Builtin{
- Name: "bits.or",
- Description: "Returns the bitwise \"OR\" of two integers.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.N),
- types.Named("y", types.N),
- ),
- types.Named("z", types.N),
- ),
-}
+var BitsOr = v1.BitsOr
-var BitsAnd = &Builtin{
- Name: "bits.and",
- Description: "Returns the bitwise \"AND\" of two integers.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.N),
- types.Named("y", types.N),
- ),
- types.Named("z", types.N),
- ),
-}
+var BitsAnd = v1.BitsAnd
-var BitsNegate = &Builtin{
- Name: "bits.negate",
- Description: "Returns the bitwise negation (flip) of an integer.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.N),
- ),
- types.Named("z", types.N),
- ),
-}
+var BitsNegate = v1.BitsNegate
-var BitsXOr = &Builtin{
- Name: "bits.xor",
- Description: "Returns the bitwise \"XOR\" (exclusive-or) of two integers.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.N),
- types.Named("y", types.N),
- ),
- types.Named("z", types.N),
- ),
-}
+var BitsXOr = v1.BitsXOr
-var BitsShiftLeft = &Builtin{
- Name: "bits.lsh",
- Description: "Returns a new integer with its bits shifted `s` bits to the left.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.N),
- types.Named("s", types.N),
- ),
- types.Named("z", types.N),
- ),
-}
+var BitsShiftLeft = v1.BitsShiftLeft
-var BitsShiftRight = &Builtin{
- Name: "bits.rsh",
- Description: "Returns a new integer with its bits shifted `s` bits to the right.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.N),
- types.Named("s", types.N),
- ),
- types.Named("z", types.N),
- ),
-}
+var BitsShiftRight = v1.BitsShiftRight
/**
* Sets
*/
-var sets = category("sets")
-
-var And = &Builtin{
- Name: "and",
- Infix: "&",
- Description: "Returns the intersection of two sets.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.NewSet(types.A)),
- types.Named("y", types.NewSet(types.A)),
- ),
- types.Named("z", types.NewSet(types.A)).Description("the intersection of `x` and `y`"),
- ),
- Categories: sets,
-}
+var And = v1.And
// Or performs a union operation on sets.
-var Or = &Builtin{
- Name: "or",
- Infix: "|",
- Description: "Returns the union of two sets.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.NewSet(types.A)),
- types.Named("y", types.NewSet(types.A)),
- ),
- types.Named("z", types.NewSet(types.A)).Description("the union of `x` and `y`"),
- ),
- Categories: sets,
-}
+var Or = v1.Or
-var Intersection = &Builtin{
- Name: "intersection",
- Description: "Returns the intersection of the given input sets.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("xs", types.NewSet(types.NewSet(types.A))).Description("set of sets to intersect"),
- ),
- types.Named("y", types.NewSet(types.A)).Description("the intersection of all `xs` sets"),
- ),
- Categories: sets,
-}
+var Intersection = v1.Intersection
-var Union = &Builtin{
- Name: "union",
- Description: "Returns the union of the given input sets.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("xs", types.NewSet(types.NewSet(types.A))).Description("set of sets to merge"),
- ),
- types.Named("y", types.NewSet(types.A)).Description("the union of all `xs` sets"),
- ),
- Categories: sets,
-}
+var Union = v1.Union
/**
* Aggregates
*/
-var aggregates = category("aggregates")
-
-var Count = &Builtin{
- Name: "count",
- Description: " Count takes a collection or string and returns the number of elements (or characters) in it.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("collection", types.NewAny(
- types.NewSet(types.A),
- types.NewArray(nil, types.A),
- types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)),
- types.S,
- )).Description("the set/array/object/string to be counted"),
- ),
- types.Named("n", types.N).Description("the count of elements, key/val pairs, or characters, respectively."),
- ),
- Categories: aggregates,
-}
+var Count = v1.Count
-var Sum = &Builtin{
- Name: "sum",
- Description: "Sums elements of an array or set of numbers.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("collection", types.NewAny(
- types.NewSet(types.N),
- types.NewArray(nil, types.N),
- )),
- ),
- types.Named("n", types.N).Description("the sum of all elements"),
- ),
- Categories: aggregates,
-}
+var Sum = v1.Sum
-var Product = &Builtin{
- Name: "product",
- Description: "Muliplies elements of an array or set of numbers",
- Decl: types.NewFunction(
- types.Args(
- types.Named("collection", types.NewAny(
- types.NewSet(types.N),
- types.NewArray(nil, types.N),
- )),
- ),
- types.Named("n", types.N).Description("the product of all elements"),
- ),
- Categories: aggregates,
-}
+var Product = v1.Product
-var Max = &Builtin{
- Name: "max",
- Description: "Returns the maximum value in a collection.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("collection", types.NewAny(
- types.NewSet(types.A),
- types.NewArray(nil, types.A),
- )),
- ),
- types.Named("n", types.A).Description("the maximum of all elements"),
- ),
- Categories: aggregates,
-}
+var Max = v1.Max
-var Min = &Builtin{
- Name: "min",
- Description: "Returns the minimum value in a collection.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("collection", types.NewAny(
- types.NewSet(types.A),
- types.NewArray(nil, types.A),
- )),
- ),
- types.Named("n", types.A).Description("the minimum of all elements"),
- ),
- Categories: aggregates,
-}
+var Min = v1.Min
/**
* Sorting
*/
-var Sort = &Builtin{
- Name: "sort",
- Description: "Returns a sorted array.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("collection", types.NewAny(
- types.NewArray(nil, types.A),
- types.NewSet(types.A),
- )).Description("the array or set to be sorted"),
- ),
- types.Named("n", types.NewArray(nil, types.A)).Description("the sorted array"),
- ),
- Categories: aggregates,
-}
+var Sort = v1.Sort
/**
* Arrays
*/
-var ArrayConcat = &Builtin{
- Name: "array.concat",
- Description: "Concatenates two arrays.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.NewArray(nil, types.A)),
- types.Named("y", types.NewArray(nil, types.A)),
- ),
- types.Named("z", types.NewArray(nil, types.A)).Description("the concatenation of `x` and `y`"),
- ),
-}
+var ArrayConcat = v1.ArrayConcat
-var ArraySlice = &Builtin{
- Name: "array.slice",
- Description: "Returns a slice of a given array. If `start` is greater or equal than `stop`, `slice` is `[]`.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("arr", types.NewArray(nil, types.A)).Description("the array to be sliced"),
- types.Named("start", types.NewNumber()).Description("the start index of the returned slice; if less than zero, it's clamped to 0"),
- types.Named("stop", types.NewNumber()).Description("the stop index of the returned slice; if larger than `count(arr)`, it's clamped to `count(arr)`"),
- ),
- types.Named("slice", types.NewArray(nil, types.A)).Description("the subslice of `array`, from `start` to `end`, including `arr[start]`, but excluding `arr[end]`"),
- ),
-} // NOTE(sr): this function really needs examples
-
-var ArrayReverse = &Builtin{
- Name: "array.reverse",
- Description: "Returns the reverse of a given array.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("arr", types.NewArray(nil, types.A)).Description("the array to be reversed"),
- ),
- types.Named("rev", types.NewArray(nil, types.A)).Description("an array containing the elements of `arr` in reverse order"),
- ),
-}
+var ArraySlice = v1.ArraySlice
+
+var ArrayReverse = v1.ArrayReverse
/**
* Conversions
*/
-var conversions = category("conversions")
-
-var ToNumber = &Builtin{
- Name: "to_number",
- Description: "Converts a string, bool, or number value to a number: Strings are converted to numbers using `strconv.Atoi`, Boolean `false` is converted to 0 and `true` is converted to 1.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.NewAny(
- types.N,
- types.S,
- types.B,
- types.NewNull(),
- )),
- ),
- types.Named("num", types.N),
- ),
- Categories: conversions,
-}
+
+var ToNumber = v1.ToNumber
/**
* Regular Expressions
*/
-var RegexMatch = &Builtin{
- Name: "regex.match",
- Description: "Matches a string against a regular expression.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("pattern", types.S).Description("regular expression"),
- types.Named("value", types.S).Description("value to match against `pattern`"),
- ),
- types.Named("result", types.B),
- ),
-}
+var RegexMatch = v1.RegexMatch
-var RegexIsValid = &Builtin{
- Name: "regex.is_valid",
- Description: "Checks if a string is a valid regular expression: the detailed syntax for patterns is defined by https://github.com/google/re2/wiki/Syntax.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("pattern", types.S).Description("regular expression"),
- ),
- types.Named("result", types.B),
- ),
-}
+var RegexIsValid = v1.RegexIsValid
-var RegexFindAllStringSubmatch = &Builtin{
- Name: "regex.find_all_string_submatch_n",
- Description: "Returns all successive matches of the expression.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("pattern", types.S).Description("regular expression"),
- types.Named("value", types.S).Description("string to match"),
- types.Named("number", types.N).Description("number of matches to return; `-1` means all matches"),
- ),
- types.Named("output", types.NewArray(nil, types.NewArray(nil, types.S))),
- ),
-}
+var RegexFindAllStringSubmatch = v1.RegexFindAllStringSubmatch
-var RegexTemplateMatch = &Builtin{
- Name: "regex.template_match",
- Description: "Matches a string against a pattern, where there pattern may be glob-like",
- Decl: types.NewFunction(
- types.Args(
- types.Named("template", types.S).Description("template expression containing `0..n` regular expressions"),
- types.Named("value", types.S).Description("string to match"),
- types.Named("delimiter_start", types.S).Description("start delimiter of the regular expression in `template`"),
- types.Named("delimiter_end", types.S).Description("end delimiter of the regular expression in `template`"),
- ),
- types.Named("result", types.B),
- ),
-} // TODO(sr): example:`regex.template_match("urn:foo:{.*}", "urn:foo:bar:baz", "{", "}")`` returns ``true``.
-
-var RegexSplit = &Builtin{
- Name: "regex.split",
- Description: "Splits the input string by the occurrences of the given pattern.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("pattern", types.S).Description("regular expression"),
- types.Named("value", types.S).Description("string to match"),
- ),
- types.Named("output", types.NewArray(nil, types.S)).Description("the parts obtained by splitting `value`"),
- ),
-}
+var RegexTemplateMatch = v1.RegexTemplateMatch
+
+var RegexSplit = v1.RegexSplit
// RegexFind takes two strings and a number, the pattern, the value and number of match values to
// return, -1 means all match values.
-var RegexFind = &Builtin{
- Name: "regex.find_n",
- Description: "Returns the specified number of matches when matching the input against the pattern.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("pattern", types.S).Description("regular expression"),
- types.Named("value", types.S).Description("string to match"),
- types.Named("number", types.N).Description("number of matches to return, if `-1`, returns all matches"),
- ),
- types.Named("output", types.NewArray(nil, types.S)).Description("collected matches"),
- ),
-}
+var RegexFind = v1.RegexFind
// GlobsMatch takes two strings regexp-style strings and evaluates to true if their
// intersection matches a non-empty set of non-empty strings.
// Examples:
// - "a.a." and ".b.b" -> true.
// - "[a-z]*" and [0-9]+" -> not true.
-var GlobsMatch = &Builtin{
- Name: "regex.globs_match",
- Description: `Checks if the intersection of two glob-style regular expressions matches a non-empty set of non-empty strings.
-The set of regex symbols is limited for this builtin: only ` + "`.`, `*`, `+`, `[`, `-`, `]` and `\\` are treated as special symbols.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("glob1", types.S),
- types.Named("glob2", types.S),
- ),
- types.Named("result", types.B),
- ),
-}
+var GlobsMatch = v1.GlobsMatch
/**
* Strings
*/
-var stringsCat = category("strings")
-
-var AnyPrefixMatch = &Builtin{
- Name: "strings.any_prefix_match",
- Description: "Returns true if any of the search strings begins with any of the base strings.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("search", types.NewAny(
- types.S,
- types.NewSet(types.S),
- types.NewArray(nil, types.S),
- )).Description("search string(s)"),
- types.Named("base", types.NewAny(
- types.S,
- types.NewSet(types.S),
- types.NewArray(nil, types.S),
- )).Description("base string(s)"),
- ),
- types.Named("result", types.B).Description("result of the prefix check"),
- ),
- Categories: stringsCat,
-}
-var AnySuffixMatch = &Builtin{
- Name: "strings.any_suffix_match",
- Description: "Returns true if any of the search strings ends with any of the base strings.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("search", types.NewAny(
- types.S,
- types.NewSet(types.S),
- types.NewArray(nil, types.S),
- )).Description("search string(s)"),
- types.Named("base", types.NewAny(
- types.S,
- types.NewSet(types.S),
- types.NewArray(nil, types.S),
- )).Description("base string(s)"),
- ),
- types.Named("result", types.B).Description("result of the suffix check"),
- ),
- Categories: stringsCat,
-}
+var AnyPrefixMatch = v1.AnyPrefixMatch
-var Concat = &Builtin{
- Name: "concat",
- Description: "Joins a set or array of strings with a delimiter.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("delimiter", types.S),
- types.Named("collection", types.NewAny(
- types.NewSet(types.S),
- types.NewArray(nil, types.S),
- )).Description("strings to join"),
- ),
- types.Named("output", types.S),
- ),
- Categories: stringsCat,
-}
+var AnySuffixMatch = v1.AnySuffixMatch
-var FormatInt = &Builtin{
- Name: "format_int",
- Description: "Returns the string representation of the number in the given base after rounding it down to an integer value.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("number", types.N).Description("number to format"),
- types.Named("base", types.N).Description("base of number representation to use"),
- ),
- types.Named("output", types.S).Description("formatted number"),
- ),
- Categories: stringsCat,
-}
+var Concat = v1.Concat
-var IndexOf = &Builtin{
- Name: "indexof",
- Description: "Returns the index of a substring contained inside a string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("haystack", types.S).Description("string to search in"),
- types.Named("needle", types.S).Description("substring to look for"),
- ),
- types.Named("output", types.N).Description("index of first occurrence, `-1` if not found"),
- ),
- Categories: stringsCat,
-}
+var FormatInt = v1.FormatInt
-var IndexOfN = &Builtin{
- Name: "indexof_n",
- Description: "Returns a list of all the indexes of a substring contained inside a string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("haystack", types.S).Description("string to search in"),
- types.Named("needle", types.S).Description("substring to look for"),
- ),
- types.Named("output", types.NewArray(nil, types.N)).Description("all indices at which `needle` occurs in `haystack`, may be empty"),
- ),
- Categories: stringsCat,
-}
+var IndexOf = v1.IndexOf
-var Substring = &Builtin{
- Name: "substring",
- Description: "Returns the portion of a string for a given `offset` and a `length`. If `length < 0`, `output` is the remainder of the string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("value", types.S),
- types.Named("offset", types.N).Description("offset, must be positive"),
- types.Named("length", types.N).Description("length of the substring starting from `offset`"),
- ),
- types.Named("output", types.S).Description("substring of `value` from `offset`, of length `length`"),
- ),
- Categories: stringsCat,
-}
+var IndexOfN = v1.IndexOfN
-var Contains = &Builtin{
- Name: "contains",
- Description: "Returns `true` if the search string is included in the base string",
- Decl: types.NewFunction(
- types.Args(
- types.Named("haystack", types.S).Description("string to search in"),
- types.Named("needle", types.S).Description("substring to look for"),
- ),
- types.Named("result", types.B).Description("result of the containment check"),
- ),
- Categories: stringsCat,
-}
+var Substring = v1.Substring
-var StringCount = &Builtin{
- Name: "strings.count",
- Description: "Returns the number of non-overlapping instances of a substring in a string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("search", types.S).Description("string to search in"),
- types.Named("substring", types.S).Description("substring to look for"),
- ),
- types.Named("output", types.N).Description("count of occurrences, `0` if not found"),
- ),
- Categories: stringsCat,
-}
+var Contains = v1.Contains
-var StartsWith = &Builtin{
- Name: "startswith",
- Description: "Returns true if the search string begins with the base string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("search", types.S).Description("search string"),
- types.Named("base", types.S).Description("base string"),
- ),
- types.Named("result", types.B).Description("result of the prefix check"),
- ),
- Categories: stringsCat,
-}
+var StringCount = v1.StringCount
-var EndsWith = &Builtin{
- Name: "endswith",
- Description: "Returns true if the search string ends with the base string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("search", types.S).Description("search string"),
- types.Named("base", types.S).Description("base string"),
- ),
- types.Named("result", types.B).Description("result of the suffix check"),
- ),
- Categories: stringsCat,
-}
+var StartsWith = v1.StartsWith
-var Lower = &Builtin{
- Name: "lower",
- Description: "Returns the input string but with all characters in lower-case.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S).Description("string that is converted to lower-case"),
- ),
- types.Named("y", types.S).Description("lower-case of x"),
- ),
- Categories: stringsCat,
-}
+var EndsWith = v1.EndsWith
-var Upper = &Builtin{
- Name: "upper",
- Description: "Returns the input string but with all characters in upper-case.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S).Description("string that is converted to upper-case"),
- ),
- types.Named("y", types.S).Description("upper-case of x"),
- ),
- Categories: stringsCat,
-}
+var Lower = v1.Lower
-var Split = &Builtin{
- Name: "split",
- Description: "Split returns an array containing elements of the input string split on a delimiter.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S).Description("string that is split"),
- types.Named("delimiter", types.S).Description("delimiter used for splitting"),
- ),
- types.Named("ys", types.NewArray(nil, types.S)).Description("split parts"),
- ),
- Categories: stringsCat,
-}
+var Upper = v1.Upper
-var Replace = &Builtin{
- Name: "replace",
- Description: "Replace replaces all instances of a sub-string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S).Description("string being processed"),
- types.Named("old", types.S).Description("substring to replace"),
- types.Named("new", types.S).Description("string to replace `old` with"),
- ),
- types.Named("y", types.S).Description("string with replaced substrings"),
- ),
- Categories: stringsCat,
-}
+var Split = v1.Split
-var ReplaceN = &Builtin{
- Name: "strings.replace_n",
- Description: `Replaces a string from a list of old, new string pairs.
-Replacements are performed in the order they appear in the target string, without overlapping matches.
-The old string comparisons are done in argument order.`,
- Decl: types.NewFunction(
- types.Args(
- types.Named("patterns", types.NewObject(
- nil,
- types.NewDynamicProperty(
- types.S,
- types.S)),
- ).Description("replacement pairs"),
- types.Named("value", types.S).Description("string to replace substring matches in"),
- ),
- types.Named("output", types.S),
- ),
-}
+var Replace = v1.Replace
-var RegexReplace = &Builtin{
- Name: "regex.replace",
- Description: `Find and replaces the text using the regular expression pattern.`,
- Decl: types.NewFunction(
- types.Args(
- types.Named("s", types.S).Description("string being processed"),
- types.Named("pattern", types.S).Description("regex pattern to be applied"),
- types.Named("value", types.S).Description("regex value"),
- ),
- types.Named("output", types.S),
- ),
-}
+var ReplaceN = v1.ReplaceN
-var Trim = &Builtin{
- Name: "trim",
- Description: "Returns `value` with all leading or trailing instances of the `cutset` characters removed.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("value", types.S).Description("string to trim"),
- types.Named("cutset", types.S).Description("string of characters that are cut off"),
- ),
- types.Named("output", types.S).Description("string trimmed of `cutset` characters"),
- ),
- Categories: stringsCat,
-}
+var RegexReplace = v1.RegexReplace
-var TrimLeft = &Builtin{
- Name: "trim_left",
- Description: "Returns `value` with all leading instances of the `cutset` characters removed.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("value", types.S).Description("string to trim"),
- types.Named("cutset", types.S).Description("string of characters that are cut off on the left"),
- ),
- types.Named("output", types.S).Description("string left-trimmed of `cutset` characters"),
- ),
- Categories: stringsCat,
-}
+var Trim = v1.Trim
-var TrimPrefix = &Builtin{
- Name: "trim_prefix",
- Description: "Returns `value` without the prefix. If `value` doesn't start with `prefix`, it is returned unchanged.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("value", types.S).Description("string to trim"),
- types.Named("prefix", types.S).Description("prefix to cut off"),
- ),
- types.Named("output", types.S).Description("string with `prefix` cut off"),
- ),
- Categories: stringsCat,
-}
+var TrimLeft = v1.TrimLeft
-var TrimRight = &Builtin{
- Name: "trim_right",
- Description: "Returns `value` with all trailing instances of the `cutset` characters removed.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("value", types.S).Description("string to trim"),
- types.Named("cutset", types.S).Description("string of characters that are cut off on the right"),
- ),
- types.Named("output", types.S).Description("string right-trimmed of `cutset` characters"),
- ),
- Categories: stringsCat,
-}
+var TrimPrefix = v1.TrimPrefix
-var TrimSuffix = &Builtin{
- Name: "trim_suffix",
- Description: "Returns `value` without the suffix. If `value` doesn't end with `suffix`, it is returned unchanged.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("value", types.S).Description("string to trim"),
- types.Named("suffix", types.S).Description("suffix to cut off"),
- ),
- types.Named("output", types.S).Description("string with `suffix` cut off"),
- ),
- Categories: stringsCat,
-}
+var TrimRight = v1.TrimRight
-var TrimSpace = &Builtin{
- Name: "trim_space",
- Description: "Return the given string with all leading and trailing white space removed.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("value", types.S).Description("string to trim"),
- ),
- types.Named("output", types.S).Description("string leading and trailing white space cut off"),
- ),
- Categories: stringsCat,
-}
+var TrimSuffix = v1.TrimSuffix
-var Sprintf = &Builtin{
- Name: "sprintf",
- Description: "Returns the given string, formatted.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("format", types.S).Description("string with formatting verbs"),
- types.Named("values", types.NewArray(nil, types.A)).Description("arguments to format into formatting verbs"),
- ),
- types.Named("output", types.S).Description("`format` formatted by the values in `values`"),
- ),
- Categories: stringsCat,
-}
+var TrimSpace = v1.TrimSpace
-var StringReverse = &Builtin{
- Name: "strings.reverse",
- Description: "Reverses a given string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S),
- ),
- types.Named("y", types.S),
- ),
- Categories: stringsCat,
-}
+var Sprintf = v1.Sprintf
-var RenderTemplate = &Builtin{
- Name: "strings.render_template",
- Description: `Renders a templated string with given template variables injected. For a given templated string and key/value mapping, values will be injected into the template where they are referenced by key.
- For examples of templating syntax, see https://pkg.go.dev/text/template`,
- Decl: types.NewFunction(
- types.Args(
- types.Named("value", types.S).Description("a templated string"),
- types.Named("vars", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("a mapping of template variable keys to values"),
- ),
- types.Named("result", types.S).Description("rendered template with template variables injected"),
- ),
- Categories: stringsCat,
-}
+var StringReverse = v1.StringReverse
+
+var RenderTemplate = v1.RenderTemplate
/**
* Numbers
@@ -1354,82 +236,19 @@ var RenderTemplate = &Builtin{
// RandIntn returns a random number 0 - n
// Marked non-deterministic because it relies on RNG internally.
-var RandIntn = &Builtin{
- Name: "rand.intn",
- Description: "Returns a random integer between `0` and `n` (`n` exclusive). If `n` is `0`, then `y` is always `0`. For any given argument pair (`str`, `n`), the output will be consistent throughout a query evaluation.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("str", types.S),
- types.Named("n", types.N),
- ),
- types.Named("y", types.N).Description("random integer in the range `[0, abs(n))`"),
- ),
- Categories: number,
- Nondeterministic: true,
-}
+var RandIntn = v1.RandIntn
-var NumbersRange = &Builtin{
- Name: "numbers.range",
- Description: "Returns an array of numbers in the given (inclusive) range. If `a==b`, then `range == [a]`; if `a > b`, then `range` is in descending order.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("a", types.N),
- types.Named("b", types.N),
- ),
- types.Named("range", types.NewArray(nil, types.N)).Description("the range between `a` and `b`"),
- ),
-}
+var NumbersRange = v1.NumbersRange
-var NumbersRangeStep = &Builtin{
- Name: "numbers.range_step",
- Description: `Returns an array of numbers in the given (inclusive) range incremented by a positive step.
- If "a==b", then "range == [a]"; if "a > b", then "range" is in descending order.
- If the provided "step" is less then 1, an error will be thrown.
- If "b" is not in the range of the provided "step", "b" won't be included in the result.
- `,
- Decl: types.NewFunction(
- types.Args(
- types.Named("a", types.N),
- types.Named("b", types.N),
- types.Named("step", types.N),
- ),
- types.Named("range", types.NewArray(nil, types.N)).Description("the range between `a` and `b` in `step` increments"),
- ),
-}
+var NumbersRangeStep = v1.NumbersRangeStep
/**
* Units
*/
-var UnitsParse = &Builtin{
- Name: "units.parse",
- Description: `Converts strings like "10G", "5K", "4M", "1500m" and the like into a number.
-This number can be a non-integer, such as 1.5, 0.22, etc. Supports standard metric decimal and
-binary SI units (e.g., K, Ki, M, Mi, G, Gi etc.) m, K, M, G, T, P, and E are treated as decimal
-units and Ki, Mi, Gi, Ti, Pi, and Ei are treated as binary units.
-
-Note that 'm' and 'M' are case-sensitive, to allow distinguishing between "milli" and "mega" units respectively. Other units are case-insensitive.`,
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S).Description("the unit to parse"),
- ),
- types.Named("y", types.N).Description("the parsed number"),
- ),
-}
+var UnitsParse = v1.UnitsParse
-var UnitsParseBytes = &Builtin{
- Name: "units.parse_bytes",
- Description: `Converts strings like "10GB", "5K", "4mb" into an integer number of bytes.
-Supports standard byte units (e.g., KB, KiB, etc.) KB, MB, GB, and TB are treated as decimal
-units and KiB, MiB, GiB, and TiB are treated as binary units. The bytes symbol (b/B) in the
-unit is optional and omitting it wil give the same result (e.g. Mi and MiB).`,
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S).Description("the byte unit to parse"),
- ),
- types.Named("y", types.N).Description("the parsed number"),
- ),
-}
+var UnitsParseBytes = v1.UnitsParseBytes
//
/**
@@ -1438,1372 +257,241 @@ unit is optional and omitting it wil give the same result (e.g. Mi and MiB).`,
// UUIDRFC4122 returns a version 4 UUID string.
// Marked non-deterministic because it relies on RNG internally.
-var UUIDRFC4122 = &Builtin{
- Name: "uuid.rfc4122",
- Description: "Returns a new UUIDv4.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("k", types.S),
- ),
- 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,
-}
+var UUIDRFC4122 = v1.UUIDRFC4122
-var UUIDParse = &Builtin{
- Name: "uuid.parse",
- Description: "Parses the string value as an UUID and returns an object with the well-defined fields of the UUID if valid.",
- Categories: nil,
- Decl: types.NewFunction(
- types.Args(
- types.Named("uuid", types.S),
- ),
- 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,
-}
+var UUIDParse = v1.UUIDParse
/**
* JSON
*/
-var objectCat = category("object")
-
-var JSONFilter = &Builtin{
- Name: "json.filter",
- Description: "Filters the object. " +
- "For example: `json.filter({\"a\": {\"b\": \"x\", \"c\": \"y\"}}, [\"a/b\"])` will result in `{\"a\": {\"b\": \"x\"}}`). " +
- "Paths are not filtered in-order and are deduplicated before being evaluated.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("object", types.NewObject(
- nil,
- types.NewDynamicProperty(types.A, types.A),
- )),
- types.Named("paths", types.NewAny(
- types.NewArray(
- nil,
- types.NewAny(
- types.S,
- types.NewArray(
- nil,
- types.A,
- ),
- ),
- ),
- types.NewSet(
- types.NewAny(
- types.S,
- types.NewArray(
- nil,
- types.A,
- ),
- ),
- ),
- )).Description("JSON string paths"),
- ),
- types.Named("filtered", types.A).Description("remaining data from `object` with only keys specified in `paths`"),
- ),
- Categories: objectCat,
-}
+var JSONFilter = v1.JSONFilter
-var JSONRemove = &Builtin{
- Name: "json.remove",
- Description: "Removes paths from an object. " +
- "For example: `json.remove({\"a\": {\"b\": \"x\", \"c\": \"y\"}}, [\"a/b\"])` will result in `{\"a\": {\"c\": \"y\"}}`. " +
- "Paths are not removed in-order and are deduplicated before being evaluated.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("object", types.NewObject(
- nil,
- types.NewDynamicProperty(types.A, types.A),
- )),
- types.Named("paths", types.NewAny(
- types.NewArray(
- nil,
- types.NewAny(
- types.S,
- types.NewArray(
- nil,
- types.A,
- ),
- ),
- ),
- types.NewSet(
- types.NewAny(
- types.S,
- types.NewArray(
- nil,
- types.A,
- ),
- ),
- ),
- )).Description("JSON string paths"),
- ),
- types.Named("output", types.A).Description("result of removing all keys specified in `paths`"),
- ),
- Categories: objectCat,
-}
+var JSONRemove = v1.JSONRemove
-var JSONPatch = &Builtin{
- Name: "json.patch",
- Description: "Patches an object according to RFC6902. " +
- "For example: `json.patch({\"a\": {\"foo\": 1}}, [{\"op\": \"add\", \"path\": \"/a/bar\", \"value\": 2}])` results in `{\"a\": {\"foo\": 1, \"bar\": 2}`. " +
- "The patches are applied atomically: if any of them fails, the result will be undefined. " +
- "Additionally works on sets, where a value contained in the set is considered to be its path.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("object", types.A), // TODO(sr): types.A?
- types.Named("patches", types.NewArray(
- nil,
- types.NewObject(
- []*types.StaticProperty{
- {Key: "op", Value: types.S},
- {Key: "path", Value: types.A},
- },
- types.NewDynamicProperty(types.A, types.A),
- ),
- )),
- ),
- types.Named("output", types.A).Description("result obtained after consecutively applying all patch operations in `patches`"),
- ),
- Categories: objectCat,
-}
+var JSONPatch = v1.JSONPatch
-var ObjectSubset = &Builtin{
- Name: "object.subset",
- Description: "Determines if an object `sub` is a subset of another object `super`." +
- "Object `sub` is a subset of object `super` if and only if every key in `sub` is also in `super`, " +
- "**and** for all keys which `sub` and `super` share, they have the same value. " +
- "This function works with objects, sets, arrays and a set of array and set." +
- "If both arguments are objects, then the operation is recursive, e.g. " +
- "`{\"c\": {\"x\": {10, 15, 20}}` is a subset of `{\"a\": \"b\", \"c\": {\"x\": {10, 15, 20, 25}, \"y\": \"z\"}`. " +
- "If both arguments are sets, then this function checks if every element of `sub` is a member of `super`, " +
- "but does not attempt to recurse. If both arguments are arrays, " +
- "then this function checks if `sub` appears contiguously in order within `super`, " +
- "and also does not attempt to recurse. If `super` is array and `sub` is set, " +
- "then this function checks if `super` contains every element of `sub` with no consideration of ordering, " +
- "and also does not attempt to recurse.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("super", types.NewAny(types.NewObject(
- nil,
- types.NewDynamicProperty(types.A, types.A),
- ),
- types.NewSet(types.A),
- types.NewArray(nil, types.A),
- )).Description("object to test if sub is a subset of"),
- types.Named("sub", types.NewAny(types.NewObject(
- nil,
- types.NewDynamicProperty(types.A, types.A),
- ),
- types.NewSet(types.A),
- types.NewArray(nil, types.A),
- )).Description("object to test if super is a superset of"),
- ),
- types.Named("result", types.A).Description("`true` if `sub` is a subset of `super`"),
- ),
-}
+var ObjectSubset = v1.ObjectSubset
-var ObjectUnion = &Builtin{
- Name: "object.union",
- Description: "Creates a new object of the asymmetric union of two objects. " +
- "For example: `object.union({\"a\": 1, \"b\": 2, \"c\": {\"d\": 3}}, {\"a\": 7, \"c\": {\"d\": 4, \"e\": 5}})` will result in `{\"a\": 7, \"b\": 2, \"c\": {\"d\": 4, \"e\": 5}}`.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("a", types.NewObject(
- nil,
- types.NewDynamicProperty(types.A, types.A),
- )),
- types.Named("b", types.NewObject(
- nil,
- types.NewDynamicProperty(types.A, types.A),
- )),
- ),
- 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)
-}
+var ObjectUnion = v1.ObjectUnion
-var ObjectUnionN = &Builtin{
- Name: "object.union_n",
- Description: "Creates a new object that is the asymmetric union of all objects merged from left to right. " +
- "For example: `object.union_n([{\"a\": 1}, {\"b\": 2}, {\"a\": 3}])` will result in `{\"b\": 2, \"a\": 3}`.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("objects", types.NewArray(
- nil,
- types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)),
- )),
- ),
- 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"),
- ),
-}
+var ObjectUnionN = v1.ObjectUnionN
-var ObjectRemove = &Builtin{
- Name: "object.remove",
- Description: "Removes specified keys from an object.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("object", types.NewObject(
- nil,
- types.NewDynamicProperty(types.A, types.A),
- )).Description("object to remove keys from"),
- types.Named("keys", types.NewAny(
- types.NewArray(nil, types.A),
- types.NewSet(types.A),
- types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)),
- )).Description("keys to remove from x"),
- ),
- types.Named("output", types.A).Description("result of removing the specified `keys` from `object`"),
- ),
-}
+var ObjectRemove = v1.ObjectRemove
-var ObjectFilter = &Builtin{
- Name: "object.filter",
- Description: "Filters the object by keeping only specified keys. " +
- "For example: `object.filter({\"a\": {\"b\": \"x\", \"c\": \"y\"}, \"d\": \"z\"}, [\"a\"])` will result in `{\"a\": {\"b\": \"x\", \"c\": \"y\"}}`).",
- Decl: types.NewFunction(
- types.Args(
- types.Named("object", types.NewObject(
- nil,
- types.NewDynamicProperty(types.A, types.A),
- )).Description("object to filter keys"),
- types.Named("keys", types.NewAny(
- types.NewArray(nil, types.A),
- types.NewSet(types.A),
- types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)),
- )),
- ),
- types.Named("filtered", types.A).Description("remaining data from `object` with only keys specified in `keys`"),
- ),
-}
+var ObjectFilter = v1.ObjectFilter
-var ObjectGet = &Builtin{
- Name: "object.get",
- Description: "Returns value of an object's key if present, otherwise a default. " +
- "If the supplied `key` is an `array`, then `object.get` will search through a nested object or array using each key in turn. " +
- "For example: `object.get({\"a\": [{ \"b\": true }]}, [\"a\", 0, \"b\"], false)` results in `true`.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("object", types.NewObject(nil, types.NewDynamicProperty(types.A, types.A))).Description("object to get `key` from"),
- types.Named("key", types.A).Description("key to lookup in `object`"),
- types.Named("default", types.A).Description("default to use when lookup fails"),
- ),
- types.Named("value", types.A).Description("`object[key]` if present, otherwise `default`"),
- ),
-}
+var ObjectGet = v1.ObjectGet
-var ObjectKeys = &Builtin{
- Name: "object.keys",
- Description: "Returns a set of an object's keys. " +
- "For example: `object.keys({\"a\": 1, \"b\": true, \"c\": \"d\")` results in `{\"a\", \"b\", \"c\"}`.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("object", types.NewObject(nil, types.NewDynamicProperty(types.A, types.A))).Description("object to get keys from"),
- ),
- types.Named("value", types.NewSet(types.A)).Description("set of `object`'s keys"),
- ),
-}
+var ObjectKeys = v1.ObjectKeys
/*
* Encoding
*/
-var encoding = category("encoding")
-
-var JSONMarshal = &Builtin{
- Name: "json.marshal",
- Description: "Serializes the input term to JSON.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A).Description("the term to serialize"),
- ),
- types.Named("y", types.S).Description("the JSON string representation of `x`"),
- ),
- Categories: encoding,
-}
-var JSONMarshalWithOptions = &Builtin{
- Name: "json.marshal_with_options",
- Description: "Serializes the input term JSON, with additional formatting options via the `opts` parameter. " +
- "`opts` accepts keys `pretty` (enable multi-line/formatted JSON), `prefix` (string to prefix lines with, default empty string) and `indent` (string to indent with, default `\\t`).",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A).Description("the term to serialize"),
- types.Named("opts", types.NewObject(
- []*types.StaticProperty{
- types.NewStaticProperty("pretty", types.B),
- types.NewStaticProperty("indent", types.S),
- types.NewStaticProperty("prefix", types.S),
- },
- types.NewDynamicProperty(types.S, types.A),
- )).Description("encoding options"),
- ),
- types.Named("y", types.S).Description("the JSON string representation of `x`, with configured prefix/indent string(s) as appropriate"),
- ),
- Categories: encoding,
-}
+var JSONMarshal = v1.JSONMarshal
-var JSONUnmarshal = &Builtin{
- Name: "json.unmarshal",
- Description: "Deserializes the input string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S).Description("a JSON string"),
- ),
- types.Named("y", types.A).Description("the term deserialized from `x`"),
- ),
- Categories: encoding,
-}
+var JSONMarshalWithOptions = v1.JSONMarshalWithOptions
-var JSONIsValid = &Builtin{
- Name: "json.is_valid",
- Description: "Verifies the input string is a valid JSON document.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S).Description("a JSON string"),
- ),
- types.Named("result", types.B).Description("`true` if `x` is valid JSON, `false` otherwise"),
- ),
- Categories: encoding,
-}
+var JSONUnmarshal = v1.JSONUnmarshal
-var Base64Encode = &Builtin{
- Name: "base64.encode",
- Description: "Serializes the input string into base64 encoding.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S),
- ),
- types.Named("y", types.S).Description("base64 serialization of `x`"),
- ),
- Categories: encoding,
-}
+var JSONIsValid = v1.JSONIsValid
-var Base64Decode = &Builtin{
- Name: "base64.decode",
- Description: "Deserializes the base64 encoded input string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S),
- ),
- types.Named("y", types.S).Description("base64 deserialization of `x`"),
- ),
- Categories: encoding,
-}
+var Base64Encode = v1.Base64Encode
-var Base64IsValid = &Builtin{
- Name: "base64.is_valid",
- Description: "Verifies the input string is base64 encoded.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S),
- ),
- types.Named("result", types.B).Description("`true` if `x` is valid base64 encoded value, `false` otherwise"),
- ),
- Categories: encoding,
-}
+var Base64Decode = v1.Base64Decode
-var Base64UrlEncode = &Builtin{
- Name: "base64url.encode",
- Description: "Serializes the input string into base64url encoding.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S),
- ),
- types.Named("y", types.S).Description("base64url serialization of `x`"),
- ),
- Categories: encoding,
-}
+var Base64IsValid = v1.Base64IsValid
-var Base64UrlEncodeNoPad = &Builtin{
- Name: "base64url.encode_no_pad",
- Description: "Serializes the input string into base64url encoding without padding.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S),
- ),
- types.Named("y", types.S).Description("base64url serialization of `x`"),
- ),
- Categories: encoding,
-}
+var Base64UrlEncode = v1.Base64UrlEncode
-var Base64UrlDecode = &Builtin{
- Name: "base64url.decode",
- Description: "Deserializes the base64url encoded input string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S),
- ),
- types.Named("y", types.S).Description("base64url deserialization of `x`"),
- ),
- Categories: encoding,
-}
+var Base64UrlEncodeNoPad = v1.Base64UrlEncodeNoPad
-var URLQueryDecode = &Builtin{
- Name: "urlquery.decode",
- Description: "Decodes a URL-encoded input string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S),
- ),
- types.Named("y", types.S).Description("URL-encoding deserialization of `x`"),
- ),
- Categories: encoding,
-}
+var Base64UrlDecode = v1.Base64UrlDecode
-var URLQueryEncode = &Builtin{
- Name: "urlquery.encode",
- Description: "Encodes the input string into a URL-encoded string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S),
- ),
- types.Named("y", types.S).Description("URL-encoding serialization of `x`"),
- ),
- Categories: encoding,
-}
+var URLQueryDecode = v1.URLQueryDecode
-var URLQueryEncodeObject = &Builtin{
- Name: "urlquery.encode_object",
- Description: "Encodes the given object into a URL encoded query string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("object", types.NewObject(
- nil,
- types.NewDynamicProperty(
- types.S,
- types.NewAny(
- types.S,
- types.NewArray(nil, types.S),
- types.NewSet(types.S)))))),
- types.Named("y", types.S).Description("the URL-encoded serialization of `object`"),
- ),
- Categories: encoding,
-}
+var URLQueryEncode = v1.URLQueryEncode
-var URLQueryDecodeObject = &Builtin{
- Name: "urlquery.decode_object",
- Description: "Decodes the given URL query string into an object.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S).Description("the query string"),
- ),
- types.Named("object", types.NewObject(nil, types.NewDynamicProperty(
- types.S,
- types.NewArray(nil, types.S)))).Description("the resulting object"),
- ),
- Categories: encoding,
-}
+var URLQueryEncodeObject = v1.URLQueryEncodeObject
-var YAMLMarshal = &Builtin{
- Name: "yaml.marshal",
- Description: "Serializes the input term to YAML.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A).Description("the term to serialize"),
- ),
- types.Named("y", types.S).Description("the YAML string representation of `x`"),
- ),
- Categories: encoding,
-}
+var URLQueryDecodeObject = v1.URLQueryDecodeObject
-var YAMLUnmarshal = &Builtin{
- Name: "yaml.unmarshal",
- Description: "Deserializes the input string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S).Description("a YAML string"),
- ),
- types.Named("y", types.A).Description("the term deserialized from `x`"),
- ),
- Categories: encoding,
-}
+var YAMLMarshal = v1.YAMLMarshal
+
+var YAMLUnmarshal = v1.YAMLUnmarshal
// YAMLIsValid verifies the input string is a valid YAML document.
-var YAMLIsValid = &Builtin{
- Name: "yaml.is_valid",
- Description: "Verifies the input string is a valid YAML document.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S).Description("a YAML string"),
- ),
- types.Named("result", types.B).Description("`true` if `x` is valid YAML, `false` otherwise"),
- ),
- Categories: encoding,
-}
+var YAMLIsValid = v1.YAMLIsValid
-var HexEncode = &Builtin{
- Name: "hex.encode",
- Description: "Serializes the input string using hex-encoding.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S),
- ),
- types.Named("y", types.S).Description("serialization of `x` using hex-encoding"),
- ),
- Categories: encoding,
-}
+var HexEncode = v1.HexEncode
-var HexDecode = &Builtin{
- Name: "hex.decode",
- Description: "Deserializes the hex-encoded input string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S).Description("a hex-encoded string"),
- ),
- types.Named("y", types.S).Description("deserialized from `x`"),
- ),
- Categories: encoding,
-}
+var HexDecode = v1.HexDecode
/**
* Tokens
*/
-var tokensCat = category("tokens")
-
-var JWTDecode = &Builtin{
- Name: "io.jwt.decode",
- Description: "Decodes a JSON Web Token and outputs it as an object.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("jwt", types.S).Description("JWT token to decode"),
- ),
- types.Named("output", types.NewArray([]types.Type{
- types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)),
- types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)),
- types.S,
- }, nil)).Description("`[header, payload, sig]`, where `header` and `payload` are objects; `sig` is the hexadecimal representation of the signature on the token."),
- ),
- Categories: tokensCat,
-}
-var JWTVerifyRS256 = &Builtin{
- Name: "io.jwt.verify_rs256",
- Description: "Verifies if a RS256 JWT signature is valid.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"),
- types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"),
- ),
- types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"),
- ),
- Categories: tokensCat,
-}
+var JWTDecode = v1.JWTDecode
-var JWTVerifyRS384 = &Builtin{
- Name: "io.jwt.verify_rs384",
- Description: "Verifies if a RS384 JWT signature is valid.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"),
- types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"),
- ),
- types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"),
- ),
- Categories: tokensCat,
-}
+var JWTVerifyRS256 = v1.JWTVerifyRS256
-var JWTVerifyRS512 = &Builtin{
- Name: "io.jwt.verify_rs512",
- Description: "Verifies if a RS512 JWT signature is valid.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"),
- types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"),
- ),
- types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"),
- ),
- Categories: tokensCat,
-}
+var JWTVerifyRS384 = v1.JWTVerifyRS384
-var JWTVerifyPS256 = &Builtin{
- Name: "io.jwt.verify_ps256",
- Description: "Verifies if a PS256 JWT signature is valid.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"),
- types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"),
- ),
- types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"),
- ),
- Categories: tokensCat,
-}
+var JWTVerifyRS512 = v1.JWTVerifyRS512
-var JWTVerifyPS384 = &Builtin{
- Name: "io.jwt.verify_ps384",
- Description: "Verifies if a PS384 JWT signature is valid.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"),
- types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"),
- ),
- types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"),
- ),
- Categories: tokensCat,
-}
+var JWTVerifyPS256 = v1.JWTVerifyPS256
-var JWTVerifyPS512 = &Builtin{
- Name: "io.jwt.verify_ps512",
- Description: "Verifies if a PS512 JWT signature is valid.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"),
- types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"),
- ),
- types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"),
- ),
- Categories: tokensCat,
-}
+var JWTVerifyPS384 = v1.JWTVerifyPS384
-var JWTVerifyES256 = &Builtin{
- Name: "io.jwt.verify_es256",
- Description: "Verifies if a ES256 JWT signature is valid.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"),
- types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"),
- ),
- types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"),
- ),
- Categories: tokensCat,
-}
+var JWTVerifyPS512 = v1.JWTVerifyPS512
-var JWTVerifyES384 = &Builtin{
- Name: "io.jwt.verify_es384",
- Description: "Verifies if a ES384 JWT signature is valid.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"),
- types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"),
- ),
- types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"),
- ),
- Categories: tokensCat,
-}
+var JWTVerifyES256 = v1.JWTVerifyES256
-var JWTVerifyES512 = &Builtin{
- Name: "io.jwt.verify_es512",
- Description: "Verifies if a ES512 JWT signature is valid.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"),
- types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"),
- ),
- types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"),
- ),
- Categories: tokensCat,
-}
+var JWTVerifyES384 = v1.JWTVerifyES384
-var JWTVerifyHS256 = &Builtin{
- Name: "io.jwt.verify_hs256",
- Description: "Verifies if a HS256 (secret) JWT signature is valid.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"),
- types.Named("secret", types.S).Description("plain text secret used to verify the signature"),
- ),
- types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"),
- ),
- Categories: tokensCat,
-}
+var JWTVerifyES512 = v1.JWTVerifyES512
-var JWTVerifyHS384 = &Builtin{
- Name: "io.jwt.verify_hs384",
- Description: "Verifies if a HS384 (secret) JWT signature is valid.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"),
- types.Named("secret", types.S).Description("plain text secret used to verify the signature"),
- ),
- types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"),
- ),
- Categories: tokensCat,
-}
+var JWTVerifyHS256 = v1.JWTVerifyHS256
-var JWTVerifyHS512 = &Builtin{
- Name: "io.jwt.verify_hs512",
- Description: "Verifies if a HS512 (secret) JWT signature is valid.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"),
- types.Named("secret", types.S).Description("plain text secret used to verify the signature"),
- ),
- types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"),
- ),
- Categories: tokensCat,
-}
+var JWTVerifyHS384 = v1.JWTVerifyHS384
-// Marked non-deterministic because it relies on time internally.
-var JWTDecodeVerify = &Builtin{
- Name: "io.jwt.decode_verify",
- Description: `Verifies a JWT signature under parameterized constraints and decodes the claims if it is valid.
-Supports the following algorithms: HS256, HS384, HS512, RS256, RS384, RS512, ES256, ES384, ES512, PS256, PS384 and PS512.`,
- Decl: types.NewFunction(
- types.Args(
- types.Named("jwt", types.S).Description("JWT token whose signature is to be verified and whose claims are to be checked"),
- types.Named("constraints", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("claim verification constraints"),
- ),
- types.Named("output", types.NewArray([]types.Type{
- types.B,
- types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)),
- types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)),
- }, nil)).Description("`[valid, header, payload]`: if the input token is verified and meets the requirements of `constraints` then `valid` is `true`; `header` and `payload` are objects containing the JOSE header and the JWT claim set; otherwise, `valid` is `false`, `header` and `payload` are `{}`"),
- ),
- Categories: tokensCat,
- Nondeterministic: true,
-}
+var JWTVerifyHS512 = v1.JWTVerifyHS512
-var tokenSign = category("tokensign")
+// Marked non-deterministic because it relies on time internally.
+var JWTDecodeVerify = v1.JWTDecodeVerify
// Marked non-deterministic because it relies on RNG internally.
-var JWTEncodeSignRaw = &Builtin{
- Name: "io.jwt.encode_sign_raw",
- Description: "Encodes and optionally signs a JSON Web Token.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("headers", types.S).Description("JWS Protected Header"),
- types.Named("payload", types.S).Description("JWS Payload"),
- types.Named("key", types.S).Description("JSON Web Key (RFC7517)"),
- ),
- types.Named("output", types.S).Description("signed JWT"),
- ),
- Categories: tokenSign,
- Nondeterministic: true,
-}
+var JWTEncodeSignRaw = v1.JWTEncodeSignRaw
// Marked non-deterministic because it relies on RNG internally.
-var JWTEncodeSign = &Builtin{
- Name: "io.jwt.encode_sign",
- Description: "Encodes and optionally signs a JSON Web Token. Inputs are taken as objects, not encoded strings (see `io.jwt.encode_sign_raw`).",
- Decl: types.NewFunction(
- types.Args(
- types.Named("headers", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("JWS Protected Header"),
- types.Named("payload", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("JWS Payload"),
- types.Named("key", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("JSON Web Key (RFC7517)"),
- ),
- types.Named("output", types.S).Description("signed JWT"),
- ),
- Categories: tokenSign,
- Nondeterministic: true,
-}
+var JWTEncodeSign = v1.JWTEncodeSign
/**
* Time
*/
// Marked non-deterministic because it relies on time directly.
-var NowNanos = &Builtin{
- Name: "time.now_ns",
- Description: "Returns the current time since epoch in nanoseconds.",
- Decl: types.NewFunction(
- nil,
- types.Named("now", types.N).Description("nanoseconds since epoch"),
- ),
- Nondeterministic: true,
-}
+var NowNanos = v1.NowNanos
-var ParseNanos = &Builtin{
- Name: "time.parse_ns",
- Description: "Returns the time in nanoseconds parsed from the string in the given format. `undefined` if the result would be outside the valid time range that can fit within an `int64`.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("layout", types.S).Description("format used for parsing, see the [Go `time` package documentation](https://golang.org/pkg/time/#Parse) for more details"),
- types.Named("value", types.S).Description("input to parse according to `layout`"),
- ),
- types.Named("ns", types.N).Description("`value` in nanoseconds since epoch"),
- ),
-}
+var ParseNanos = v1.ParseNanos
-var ParseRFC3339Nanos = &Builtin{
- Name: "time.parse_rfc3339_ns",
- Description: "Returns the time in nanoseconds parsed from the string in RFC3339 format. `undefined` if the result would be outside the valid time range that can fit within an `int64`.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("value", types.S),
- ),
- types.Named("ns", types.N).Description("`value` in nanoseconds since epoch"),
- ),
-}
+var ParseRFC3339Nanos = v1.ParseRFC3339Nanos
-var ParseDurationNanos = &Builtin{
- Name: "time.parse_duration_ns",
- Description: "Returns the duration in nanoseconds represented by a string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("duration", types.S).Description("a duration like \"3m\"; see the [Go `time` package documentation](https://golang.org/pkg/time/#ParseDuration) for more details"),
- ),
- types.Named("ns", types.N).Description("the `duration` in nanoseconds"),
- ),
-}
+var ParseDurationNanos = v1.ParseDurationNanos
-var Format = &Builtin{
- Name: "time.format",
- Description: "Returns the formatted timestamp for the nanoseconds since epoch.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.NewAny(
- types.N,
- types.NewArray([]types.Type{types.N, types.S}, nil),
- types.NewArray([]types.Type{types.N, types.S, types.S}, nil),
- )).Description("a number representing the nanoseconds since the epoch (UTC); or a two-element array of the nanoseconds, and a timezone string; or a three-element array of ns, timezone string and a layout string or golang defined formatting constant (see golang supported time formats)"),
- ),
- types.Named("formatted timestamp", types.S).Description("the formatted timestamp represented for the nanoseconds since the epoch in the supplied timezone (or UTC)"),
- ),
-}
+var Format = v1.Format
-var Date = &Builtin{
- Name: "time.date",
- Description: "Returns the `[year, month, day]` for the nanoseconds since epoch.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.NewAny(
- types.N,
- types.NewArray([]types.Type{types.N, types.S}, nil),
- )).Description("a number representing the nanoseconds since the epoch (UTC); or a two-element array of the nanoseconds, and a timezone string"),
- ),
- 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)"),
- ),
-}
+var Date = v1.Date
-var Clock = &Builtin{
- Name: "time.clock",
- Description: "Returns the `[hour, minute, second]` of the day for the nanoseconds since epoch.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.NewAny(
- types.N,
- types.NewArray([]types.Type{types.N, types.S}, nil),
- )).Description("a number representing the nanoseconds since the epoch (UTC); or a two-element array of the nanoseconds, and a timezone string"),
- ),
- 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)"),
- ),
-}
+var Clock = v1.Clock
-var Weekday = &Builtin{
- Name: "time.weekday",
- Description: "Returns the day of the week (Monday, Tuesday, ...) for the nanoseconds since epoch.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.NewAny(
- types.N,
- types.NewArray([]types.Type{types.N, types.S}, nil),
- )).Description("a number representing the nanoseconds since the epoch (UTC); or a two-element array of the nanoseconds, and a timezone string"),
- ),
- types.Named("day", types.S).Description("the weekday represented by `ns` nanoseconds since the epoch in the supplied timezone (or UTC)"),
- ),
-}
+var Weekday = v1.Weekday
-var AddDate = &Builtin{
- Name: "time.add_date",
- Description: "Returns the nanoseconds since epoch after adding years, months and days to nanoseconds. Month & day values outside their usual ranges after the operation and will be normalized - for example, October 32 would become November 1. `undefined` if the result would be outside the valid time range that can fit within an `int64`.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("ns", types.N).Description("nanoseconds since the epoch"),
- types.Named("years", types.N),
- types.Named("months", types.N),
- types.Named("days", types.N),
- ),
- types.Named("output", types.N).Description("nanoseconds since the epoch representing the input time, with years, months and days added"),
- ),
-}
+var AddDate = v1.AddDate
-var Diff = &Builtin{
- Name: "time.diff",
- Description: "Returns the difference between two unix timestamps in nanoseconds (with optional timezone strings).",
- Decl: types.NewFunction(
- types.Args(
- types.Named("ns1", types.NewAny(
- types.N,
- types.NewArray([]types.Type{types.N, types.S}, nil),
- )),
- types.Named("ns2", types.NewAny(
- types.N,
- types.NewArray([]types.Type{types.N, types.S}, nil),
- )),
- ),
- 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]`"),
- ),
-}
+var Diff = v1.Diff
/**
* Crypto.
*/
-var CryptoX509ParseCertificates = &Builtin{
- Name: "crypto.x509.parse_certificates",
- Description: `Returns zero or more certificates from the given encoded string containing
-DER certificate data.
-
-If the input is empty, the function will return null. The input string should be a list of one or more
-concatenated PEM blocks. The whole input of concatenated PEM blocks can optionally be Base64 encoded.`,
- Decl: types.NewFunction(
- types.Args(
- types.Named("certs", types.S).Description("base64 encoded DER or PEM data containing one or more certificates or a PEM string of one or more certificates"),
- ),
- types.Named("output", types.NewArray(nil, types.NewObject(nil, types.NewDynamicProperty(types.S, types.A)))).Description("parsed X.509 certificates represented as objects"),
- ),
-}
+var CryptoX509ParseCertificates = v1.CryptoX509ParseCertificates
-var CryptoX509ParseAndVerifyCertificates = &Builtin{
- Name: "crypto.x509.parse_and_verify_certificates",
- Description: `Returns one or more certificates from the given string containing PEM
-or base64 encoded DER certificates after verifying the supplied certificates form a complete
-certificate chain back to a trusted root.
-
-The first certificate is treated as the root and the last is treated as the leaf,
-with all others being treated as intermediates.`,
- Decl: types.NewFunction(
- types.Args(
- types.Named("certs", types.S).Description("base64 encoded DER or PEM data containing two or more certificates where the first is a root CA, the last is a leaf certificate, and all others are intermediate CAs"),
- ),
- types.Named("output", types.NewArray([]types.Type{
- types.B,
- 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 `[]`"),
- ),
-}
+var CryptoX509ParseAndVerifyCertificates = v1.CryptoX509ParseAndVerifyCertificates
-var CryptoX509ParseAndVerifyCertificatesWithOptions = &Builtin{
- Name: "crypto.x509.parse_and_verify_certificates_with_options",
- Description: `Returns one or more certificates from the given string containing PEM
-or base64 encoded DER certificates after verifying the supplied certificates form a complete
-certificate chain back to a trusted root. A config option passed as the second argument can
-be used to configure the validation options used.
-
-The first certificate is treated as the root and the last is treated as the leaf,
-with all others being treated as intermediates.`,
-
- Decl: types.NewFunction(
- types.Args(
- types.Named("certs", types.S).Description("base64 encoded DER or PEM data containing two or more certificates where the first is a root CA, the last is a leaf certificate, and all others are intermediate CAs"),
- types.Named("options", types.NewObject(
- nil,
- types.NewDynamicProperty(types.S, types.A),
- )).Description("object containing extra configs to verify the validity of certificates. `options` object supports four fields which maps to same fields in [x509.VerifyOptions struct](https://pkg.go.dev/crypto/x509#VerifyOptions). `DNSName`, `CurrentTime`: Nanoseconds since the Unix Epoch as a number, `MaxConstraintComparisons` and `KeyUsages`. `KeyUsages` is list and can have possible values as in: `\"KeyUsageAny\"`, `\"KeyUsageServerAuth\"`, `\"KeyUsageClientAuth\"`, `\"KeyUsageCodeSigning\"`, `\"KeyUsageEmailProtection\"`, `\"KeyUsageIPSECEndSystem\"`, `\"KeyUsageIPSECTunnel\"`, `\"KeyUsageIPSECUser\"`, `\"KeyUsageTimeStamping\"`, `\"KeyUsageOCSPSigning\"`, `\"KeyUsageMicrosoftServerGatedCrypto\"`, `\"KeyUsageNetscapeServerGatedCrypto\"`, `\"KeyUsageMicrosoftCommercialCodeSigning\"`, `\"KeyUsageMicrosoftKernelCodeSigning\"` "),
- ),
- types.Named("output", types.NewArray([]types.Type{
- types.B,
- 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 `[]`"),
- ),
-}
+var CryptoX509ParseAndVerifyCertificatesWithOptions = v1.CryptoX509ParseAndVerifyCertificatesWithOptions
-var CryptoX509ParseCertificateRequest = &Builtin{
- Name: "crypto.x509.parse_certificate_request",
- Description: "Returns a PKCS #10 certificate signing request from the given PEM-encoded PKCS#10 certificate signing request.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("csr", types.S).Description("base64 string containing either a PEM encoded or DER CSR or a string containing a PEM CSR"),
- ),
- types.Named("output", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("X.509 CSR represented as an object"),
- ),
-}
+var CryptoX509ParseCertificateRequest = v1.CryptoX509ParseCertificateRequest
-var CryptoX509ParseKeyPair = &Builtin{
- Name: "crypto.x509.parse_keypair",
- Description: "Returns a valid key pair",
- Decl: types.NewFunction(
- types.Args(
- types.Named("cert", types.S).Description("string containing PEM or base64 encoded DER certificates"),
- types.Named("pem", types.S).Description("string containing PEM or base64 encoded DER keys"),
- ),
- 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."),
- ),
-}
-var CryptoX509ParseRSAPrivateKey = &Builtin{
- Name: "crypto.x509.parse_rsa_private_key",
- Description: "Returns a JWK for signing a JWT from the given PEM-encoded RSA private key.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("pem", types.S).Description("base64 string containing a PEM encoded RSA private key"),
- ),
- types.Named("output", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("JWK as an object"),
- ),
-}
+var CryptoX509ParseKeyPair = v1.CryptoX509ParseKeyPair
+var CryptoX509ParseRSAPrivateKey = v1.CryptoX509ParseRSAPrivateKey
-var CryptoParsePrivateKeys = &Builtin{
- Name: "crypto.parse_private_keys",
- Description: `Returns zero or more private keys from the given encoded string containing DER certificate data.
-
-If the input is empty, the function will return null. The input string should be a list of one or more concatenated PEM blocks. The whole input of concatenated PEM blocks can optionally be Base64 encoded.`,
- Decl: types.NewFunction(
- types.Args(
- types.Named("keys", types.S).Description("PEM encoded data containing one or more private keys as concatenated blocks. Optionally Base64 encoded."),
- ),
- types.Named("output", types.NewArray(nil, types.NewObject(nil, types.NewDynamicProperty(types.S, types.A)))).Description("parsed private keys represented as objects"),
- ),
-}
+var CryptoParsePrivateKeys = v1.CryptoParsePrivateKeys
-var CryptoMd5 = &Builtin{
- Name: "crypto.md5",
- Description: "Returns a string representing the input string hashed with the MD5 function",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S),
- ),
- types.Named("y", types.S).Description("MD5-hash of `x`"),
- ),
-}
+var CryptoMd5 = v1.CryptoMd5
-var CryptoSha1 = &Builtin{
- Name: "crypto.sha1",
- Description: "Returns a string representing the input string hashed with the SHA1 function",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S),
- ),
- types.Named("y", types.S).Description("SHA1-hash of `x`"),
- ),
-}
+var CryptoSha1 = v1.CryptoSha1
-var CryptoSha256 = &Builtin{
- Name: "crypto.sha256",
- Description: "Returns a string representing the input string hashed with the SHA256 function",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S),
- ),
- types.Named("y", types.S).Description("SHA256-hash of `x`"),
- ),
-}
+var CryptoSha256 = v1.CryptoSha256
-var CryptoHmacMd5 = &Builtin{
- Name: "crypto.hmac.md5",
- Description: "Returns a string representing the MD5 HMAC of the input message using the input key.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S).Description("input string"),
- types.Named("key", types.S).Description("key to use"),
- ),
- types.Named("y", types.S).Description("MD5-HMAC of `x`"),
- ),
-}
+var CryptoHmacMd5 = v1.CryptoHmacMd5
-var CryptoHmacSha1 = &Builtin{
- Name: "crypto.hmac.sha1",
- Description: "Returns a string representing the SHA1 HMAC of the input message using the input key.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S).Description("input string"),
- types.Named("key", types.S).Description("key to use"),
- ),
- types.Named("y", types.S).Description("SHA1-HMAC of `x`"),
- ),
-}
+var CryptoHmacSha1 = v1.CryptoHmacSha1
-var CryptoHmacSha256 = &Builtin{
- Name: "crypto.hmac.sha256",
- Description: "Returns a string representing the SHA256 HMAC of the input message using the input key.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S).Description("input string"),
- types.Named("key", types.S).Description("key to use"),
- ),
- types.Named("y", types.S).Description("SHA256-HMAC of `x`"),
- ),
-}
+var CryptoHmacSha256 = v1.CryptoHmacSha256
-var CryptoHmacSha512 = &Builtin{
- Name: "crypto.hmac.sha512",
- Description: "Returns a string representing the SHA512 HMAC of the input message using the input key.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.S).Description("input string"),
- types.Named("key", types.S).Description("key to use"),
- ),
- types.Named("y", types.S).Description("SHA512-HMAC of `x`"),
- ),
-}
+var CryptoHmacSha512 = v1.CryptoHmacSha512
-var CryptoHmacEqual = &Builtin{
- Name: "crypto.hmac.equal",
- Description: "Returns a boolean representing the result of comparing two MACs for equality without leaking timing information.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("mac1", types.S).Description("mac1 to compare"),
- types.Named("mac2", types.S).Description("mac2 to compare"),
- ),
- types.Named("result", types.B).Description("`true` if the MACs are equals, `false` otherwise"),
- ),
-}
+var CryptoHmacEqual = v1.CryptoHmacEqual
/**
* Graphs.
*/
-var graphs = category("graph")
-
-var WalkBuiltin = &Builtin{
- Name: "walk",
- Relation: true,
- Description: "Generates `[path, value]` tuples for all nested documents of `x` (recursively). Queries can use `walk` to traverse documents nested under `x`.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A),
- ),
- types.Named("output", types.NewArray(
- []types.Type{
- types.NewArray(nil, types.A),
- types.A,
- },
- nil,
- )).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,
-}
-var ReachableBuiltin = &Builtin{
- Name: "graph.reachable",
- Description: "Computes the set of reachable nodes in the graph from a set of starting nodes.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("graph", types.NewObject(
- nil,
- types.NewDynamicProperty(
- types.A,
- types.NewAny(
- types.NewSet(types.A),
- types.NewArray(nil, types.A)),
- )),
- ).Description("object containing a set or array of neighboring vertices"),
- types.Named("initial", types.NewAny(types.NewSet(types.A), types.NewArray(nil, types.A))).Description("set or array of root vertices"),
- ),
- types.Named("output", types.NewSet(types.A)).Description("set of vertices reachable from the `initial` vertices in the directed `graph`"),
- ),
-}
+var WalkBuiltin = v1.WalkBuiltin
-var ReachablePathsBuiltin = &Builtin{
- Name: "graph.reachable_paths",
- Description: "Computes the set of reachable paths in the graph from a set of starting nodes.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("graph", types.NewObject(
- nil,
- types.NewDynamicProperty(
- types.A,
- types.NewAny(
- types.NewSet(types.A),
- types.NewArray(nil, types.A)),
- )),
- ).Description("object containing a set or array of root vertices"),
- types.Named("initial", types.NewAny(types.NewSet(types.A), types.NewArray(nil, types.A))).Description("initial paths"), // TODO(sr): copied. is that correct?
- ),
- types.Named("output", types.NewSet(types.NewArray(nil, types.A))).Description("paths reachable from the `initial` vertices in the directed `graph`"),
- ),
-}
+var ReachableBuiltin = v1.ReachableBuiltin
+
+var ReachablePathsBuiltin = v1.ReachablePathsBuiltin
/**
* Type
*/
-var typesCat = category("types")
-
-var IsNumber = &Builtin{
- Name: "is_number",
- Description: "Returns `true` if the input value is a number.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A),
- ),
- types.Named("result", types.B).Description("`true` if `x` is a number, `false` otherwise."),
- ),
- Categories: typesCat,
-}
-var IsString = &Builtin{
- Name: "is_string",
- Description: "Returns `true` if the input value is a string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A),
- ),
- types.Named("result", types.B).Description("`true` if `x` is a string, `false` otherwise."),
- ),
- Categories: typesCat,
-}
+var IsNumber = v1.IsNumber
-var IsBoolean = &Builtin{
- Name: "is_boolean",
- Description: "Returns `true` if the input value is a boolean.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A),
- ),
- types.Named("result", types.B).Description("`true` if `x` is an boolean, `false` otherwise."),
- ),
- Categories: typesCat,
-}
+var IsString = v1.IsString
-var IsArray = &Builtin{
- Name: "is_array",
- Description: "Returns `true` if the input value is an array.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A),
- ),
- types.Named("result", types.B).Description("`true` if `x` is an array, `false` otherwise."),
- ),
- Categories: typesCat,
-}
+var IsBoolean = v1.IsBoolean
-var IsSet = &Builtin{
- Name: "is_set",
- Description: "Returns `true` if the input value is a set.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A),
- ),
- types.Named("result", types.B).Description("`true` if `x` is a set, `false` otherwise."),
- ),
- Categories: typesCat,
-}
+var IsArray = v1.IsArray
-var IsObject = &Builtin{
- Name: "is_object",
- Description: "Returns true if the input value is an object",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A),
- ),
- types.Named("result", types.B).Description("`true` if `x` is an object, `false` otherwise."),
- ),
- Categories: typesCat,
-}
+var IsSet = v1.IsSet
-var IsNull = &Builtin{
- Name: "is_null",
- Description: "Returns `true` if the input value is null.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A),
- ),
- types.Named("result", types.B).Description("`true` if `x` is null, `false` otherwise."),
- ),
- Categories: typesCat,
-}
+var IsObject = v1.IsObject
+
+var IsNull = v1.IsNull
/**
* Type Name
*/
// TypeNameBuiltin returns the type of the input.
-var TypeNameBuiltin = &Builtin{
- Name: "type_name",
- Description: "Returns the type of its input value.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("x", types.A),
- ),
- types.Named("type", types.S).Description(`one of "null", "boolean", "number", "string", "array", "object", "set"`),
- ),
- Categories: typesCat,
-}
+var TypeNameBuiltin = v1.TypeNameBuiltin
/**
* HTTP Request
*/
// Marked non-deterministic because HTTP request results can be non-deterministic.
-var HTTPSend = &Builtin{
- Name: "http.send",
- Description: "Returns a HTTP response to the given HTTP request.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("request", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))),
- ),
- types.Named("response", types.NewObject(nil, types.NewDynamicProperty(types.A, types.A))),
- ),
- Nondeterministic: true,
-}
+var HTTPSend = v1.HTTPSend
/**
* GraphQL
*/
// GraphQLParse returns a pair of AST objects from parsing/validation.
-var GraphQLParse = &Builtin{
- Name: "graphql.parse",
- Description: "Returns AST objects for a given GraphQL query and schema after validating the query against the schema. Returns undefined if errors were encountered during parsing or validation. The query and/or schema can be either GraphQL strings or AST objects from the other GraphQL builtin functions.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("query", types.NewAny(types.S, types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)))),
- types.Named("schema", types.NewAny(types.S, types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)))),
- ),
- types.Named("output", types.NewArray([]types.Type{
- types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)),
- 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."),
- ),
-}
+var GraphQLParse = v1.GraphQLParse
// GraphQLParseAndVerify returns a boolean and a pair of AST object from parsing/validation.
-var GraphQLParseAndVerify = &Builtin{
- Name: "graphql.parse_and_verify",
- Description: "Returns a boolean indicating success or failure alongside the parsed ASTs for a given GraphQL query and schema after validating the query against the schema. The query and/or schema can be either GraphQL strings or AST objects from the other GraphQL builtin functions.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("query", types.NewAny(types.S, types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)))),
- types.Named("schema", types.NewAny(types.S, types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)))),
- ),
- types.Named("output", types.NewArray([]types.Type{
- types.B,
- types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)),
- 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 `{}`."),
- ),
-}
+var GraphQLParseAndVerify = v1.GraphQLParseAndVerify
// GraphQLParseQuery parses the input GraphQL query and returns a JSON
// representation of its AST.
-var GraphQLParseQuery = &Builtin{
- Name: "graphql.parse_query",
- Description: "Returns an AST object for a GraphQL query.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("query", types.S),
- ),
- types.Named("output", types.NewObject(nil, types.NewDynamicProperty(types.A, types.A))).Description("AST object for the GraphQL query."),
- ),
-}
+var GraphQLParseQuery = v1.GraphQLParseQuery
// GraphQLParseSchema parses the input GraphQL schema and returns a JSON
// representation of its AST.
-var GraphQLParseSchema = &Builtin{
- Name: "graphql.parse_schema",
- Description: "Returns an AST object for a GraphQL schema.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("schema", types.S),
- ),
- types.Named("output", types.NewObject(nil, types.NewDynamicProperty(types.A, types.A))).Description("AST object for the GraphQL schema."),
- ),
-}
+var GraphQLParseSchema = v1.GraphQLParseSchema
// GraphQLIsValid returns true if a GraphQL query is valid with a given
// schema, and returns false for all other inputs.
-var GraphQLIsValid = &Builtin{
- Name: "graphql.is_valid",
- Description: "Checks that a GraphQL query is valid against a given schema. The query and/or schema can be either GraphQL strings or AST objects from the other GraphQL builtin functions.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("query", types.NewAny(types.S, types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)))),
- types.Named("schema", types.NewAny(types.S, types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)))),
- ),
- types.Named("output", types.B).Description("`true` if the query is valid under the given schema. `false` otherwise."),
- ),
-}
+var GraphQLIsValid = v1.GraphQLIsValid
// GraphQLSchemaIsValid returns true if the input is valid GraphQL schema,
// and returns false for all other inputs.
-var GraphQLSchemaIsValid = &Builtin{
- Name: "graphql.schema_is_valid",
- Description: "Checks that the input is a valid GraphQL schema. The schema can be either a GraphQL string or an AST object from the other GraphQL builtin functions.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("schema", types.NewAny(types.S, types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)))),
- ),
- types.Named("output", types.B).Description("`true` if the schema is a valid GraphQL schema. `false` otherwise."),
- ),
-}
+var GraphQLSchemaIsValid = v1.GraphQLSchemaIsValid
/**
* JSON Schema
@@ -2811,313 +499,76 @@ var GraphQLSchemaIsValid = &Builtin{
// JSONSchemaVerify returns empty string if the input is valid JSON schema
// and returns error string for all other inputs.
-var JSONSchemaVerify = &Builtin{
- Name: "json.verify_schema",
- Description: "Checks that the input is a valid JSON schema object. The schema can be either a JSON string or an JSON object.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("schema", types.NewAny(types.S, types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)))).
- Description("the schema to verify"),
- ),
- types.Named("output", types.NewArray([]types.Type{
- types.B,
- types.NewAny(types.S, types.Null{}),
- }, nil)).
- 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,
-}
+var JSONSchemaVerify = v1.JSONSchemaVerify
// JSONMatchSchema returns empty array if the document matches the JSON schema,
// and returns non-empty array with error objects otherwise.
-var JSONMatchSchema = &Builtin{
- Name: "json.match_schema",
- Description: "Checks that the document matches the JSON schema.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("document", types.NewAny(types.S, types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)))).
- Description("document to verify by schema"),
- types.Named("schema", types.NewAny(types.S, types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)))).
- Description("schema to verify document by"),
- ),
- types.Named("output", types.NewArray([]types.Type{
- types.B,
- types.NewArray(
- nil, types.NewObject(
- []*types.StaticProperty{
- {Key: "error", Value: types.S},
- {Key: "type", Value: types.S},
- {Key: "field", Value: types.S},
- {Key: "desc", Value: types.S},
- },
- nil,
- ),
- ),
- }, nil)).
- 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,
-}
+var JSONMatchSchema = v1.JSONMatchSchema
/**
* Cloud Provider Helper Functions
*/
-var providersAWSCat = category("providers.aws")
-
-var ProvidersAWSSignReqObj = &Builtin{
- Name: "providers.aws.sign_req",
- Description: "Signs an HTTP request object for Amazon Web Services. Currently implements [AWS Signature Version 4 request signing](https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html) by the `Authorization` header method.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("request", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))),
- types.Named("aws_config", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))),
- types.Named("time_ns", types.N),
- ),
- types.Named("signed_request", types.NewObject(nil, types.NewDynamicProperty(types.A, types.A))),
- ),
- Categories: providersAWSCat,
-}
+
+var ProvidersAWSSignReqObj = v1.ProvidersAWSSignReqObj
/**
* Rego
*/
-var RegoParseModule = &Builtin{
- Name: "rego.parse_module",
- Description: "Parses the input Rego string and returns an object representation of the AST.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("filename", types.S).Description("file name to attach to AST nodes' locations"),
- types.Named("rego", types.S).Description("Rego module"),
- ),
- types.Named("output", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))), // TODO(tsandall): import AST schema
- ),
-}
+var RegoParseModule = v1.RegoParseModule
-var RegoMetadataChain = &Builtin{
- Name: "rego.metadata.chain",
- Description: `Returns the chain of metadata for the active rule.
-Ordered starting at the active rule, going outward to the most distant node in its package ancestry.
-A chain entry is a JSON document with two members: "path", an array representing the path of the node; and "annotations", a JSON document containing the annotations declared for the node.
-The first entry in the chain always points to the active rule, even if it has no declared annotations (in which case the "annotations" member is not present).`,
- Decl: types.NewFunction(
- 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"),
- ),
-}
+var RegoMetadataChain = v1.RegoMetadataChain
// RegoMetadataRule returns the metadata for the active rule
-var RegoMetadataRule = &Builtin{
- Name: "rego.metadata.rule",
- Description: "Returns annotations declared for the active rule and using the _rule_ scope.",
- Decl: types.NewFunction(
- types.Args(),
- types.Named("output", types.A).Description("\"rule\" scope annotations for this rule; empty object if no annotations exist"),
- ),
-}
+var RegoMetadataRule = v1.RegoMetadataRule
/**
* OPA
*/
// Marked non-deterministic because of unpredictable config/environment-dependent results.
-var OPARuntime = &Builtin{
- Name: "opa.runtime",
- Description: "Returns an object that describes the runtime environment where OPA is deployed.",
- Decl: types.NewFunction(
- nil,
- types.Named("output", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).
- 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,
-}
+var OPARuntime = v1.OPARuntime
/**
* Trace
*/
-var tracing = category("tracing")
-
-var Trace = &Builtin{
- Name: "trace",
- Description: "Emits `note` as a `Note` event in the query explanation. Query explanations show the exact expressions evaluated by OPA during policy execution. For example, `trace(\"Hello There!\")` includes `Note \"Hello There!\"` in the query explanation. To include variables in the message, use `sprintf`. For example, `person := \"Bob\"; trace(sprintf(\"Hello There! %v\", [person]))` will emit `Note \"Hello There! Bob\"` inside of the explanation.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("note", types.S).Description("the note to include"),
- ),
- types.Named("result", types.B).Description("always `true`"),
- ),
- Categories: tracing,
-}
+
+var Trace = v1.Trace
/**
* Glob
*/
-var GlobMatch = &Builtin{
- Name: "glob.match",
- Description: "Parses and matches strings against the glob notation. Not to be confused with `regex.globs_match`.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("pattern", types.S),
- types.Named("delimiters", types.NewAny(
- types.NewArray(nil, types.S),
- types.NewNull(),
- )).Description("glob pattern delimiters, e.g. `[\".\", \":\"]`, defaults to `[\".\"]` if unset. If `delimiters` is `null`, glob match without delimiter."),
- types.Named("match", types.S),
- ),
- types.Named("result", types.B).Description("true if `match` can be found in `pattern` which is separated by `delimiters`"),
- ),
-}
+var GlobMatch = v1.GlobMatch
-var GlobQuoteMeta = &Builtin{
- Name: "glob.quote_meta",
- Description: "Returns a string which represents a version of the pattern where all asterisks have been escaped.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("pattern", types.S),
- ),
- types.Named("output", types.S).Description("the escaped string of `pattern`"),
- ),
- // TODO(sr): example for this was: Calling ``glob.quote_meta("*.github.com", output)`` returns ``\\*.github.com`` as ``output``.
-}
+var GlobQuoteMeta = v1.GlobQuoteMeta
/**
* Networking
*/
-var NetCIDRIntersects = &Builtin{
- Name: "net.cidr_intersects",
- Description: "Checks if a CIDR intersects with another CIDR (e.g. `192.168.0.0/16` overlaps with `192.168.1.0/24`). Supports both IPv4 and IPv6 notations.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("cidr1", types.S),
- types.Named("cidr2", types.S),
- ),
- types.Named("result", types.B),
- ),
-}
+var NetCIDRIntersects = v1.NetCIDRIntersects
-var NetCIDRExpand = &Builtin{
- Name: "net.cidr_expand",
- Description: "Expands CIDR to set of hosts (e.g., `net.cidr_expand(\"192.168.0.0/30\")` generates 4 hosts: `{\"192.168.0.0\", \"192.168.0.1\", \"192.168.0.2\", \"192.168.0.3\"}`).",
- Decl: types.NewFunction(
- types.Args(
- types.Named("cidr", types.S),
- ),
- types.Named("hosts", types.NewSet(types.S)).Description("set of IP addresses the CIDR `cidr` expands to"),
- ),
-}
+var NetCIDRExpand = v1.NetCIDRExpand
-var NetCIDRContains = &Builtin{
- Name: "net.cidr_contains",
- Description: "Checks if a CIDR or IP is contained within another CIDR. `output` is `true` if `cidr_or_ip` (e.g. `127.0.0.64/26` or `127.0.0.1`) is contained within `cidr` (e.g. `127.0.0.1/24`) and `false` otherwise. Supports both IPv4 and IPv6 notations.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("cidr", types.S),
- types.Named("cidr_or_ip", types.S),
- ),
- types.Named("result", types.B),
- ),
-}
+var NetCIDRContains = v1.NetCIDRContains
-var NetCIDRContainsMatches = &Builtin{
- Name: "net.cidr_contains_matches",
- Description: "Checks if collections of cidrs or ips are contained within another collection of cidrs and returns matches. " +
- "This function is similar to `net.cidr_contains` except it allows callers to pass collections of CIDRs or IPs as arguments and returns the matches (as opposed to a boolean result indicating a match between two CIDRs/IPs).",
- Decl: types.NewFunction(
- types.Args(
- types.Named("cidrs", netCidrContainsMatchesOperandType),
- types.Named("cidrs_or_ips", netCidrContainsMatchesOperandType),
- ),
- 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`"),
- ),
-}
+var NetCIDRContainsMatches = v1.NetCIDRContainsMatches
-var NetCIDRMerge = &Builtin{
- Name: "net.cidr_merge",
- Description: "Merges IP addresses and subnets into the smallest possible list of CIDRs (e.g., `net.cidr_merge([\"192.0.128.0/24\", \"192.0.129.0/24\"])` generates `{\"192.0.128.0/23\"}`." +
- `This function merges adjacent subnets where possible, those contained within others and also removes any duplicates.
-Supports both IPv4 and IPv6 notations. IPv6 inputs need a prefix length (e.g. "/128").`,
- Decl: types.NewFunction(
- types.Args(
- types.Named("addrs", types.NewAny(
- types.NewArray(nil, types.NewAny(types.S)),
- types.NewSet(types.S),
- )).Description("CIDRs or IP addresses"),
- ),
- types.Named("output", types.NewSet(types.S)).Description("smallest possible set of CIDRs obtained after merging the provided list of IP addresses and subnets in `addrs`"),
- ),
-}
+var NetCIDRMerge = v1.NetCIDRMerge
-var NetCIDRIsValid = &Builtin{
- Name: "net.cidr_is_valid",
- Description: "Parses an IPv4/IPv6 CIDR and returns a boolean indicating if the provided CIDR is valid.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("cidr", types.S),
- ),
- types.Named("result", types.B),
- ),
-}
-
-var netCidrContainsMatchesOperandType = types.NewAny(
- types.S,
- types.NewArray(nil, types.NewAny(
- types.S,
- types.NewArray(nil, types.A),
- )),
- types.NewSet(types.NewAny(
- types.S,
- types.NewArray(nil, types.A),
- )),
- types.NewObject(nil, types.NewDynamicProperty(
- types.S,
- types.NewAny(
- types.S,
- types.NewArray(nil, types.A),
- ),
- )),
-)
+var NetCIDRIsValid = v1.NetCIDRIsValid
// Marked non-deterministic because DNS resolution results can be non-deterministic.
-var NetLookupIPAddr = &Builtin{
- Name: "net.lookup_ip_addr",
- Description: "Returns the set of IP addresses (both v4 and v6) that the passed-in `name` resolves to using the standard name resolution mechanisms available.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("name", types.S).Description("domain name to resolve"),
- ),
- types.Named("addrs", types.NewSet(types.S)).Description("IP addresses (v4 and v6) that `name` resolves to"),
- ),
- Nondeterministic: true,
-}
+var NetLookupIPAddr = v1.NetLookupIPAddr
/**
* Semantic Versions
*/
-var SemVerIsValid = &Builtin{
- Name: "semver.is_valid",
- Description: "Validates that the input is a valid SemVer string.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("vsn", types.A),
- ),
- types.Named("result", types.B).Description("`true` if `vsn` is a valid SemVer; `false` otherwise"),
- ),
-}
+var SemVerIsValid = v1.SemVerIsValid
-var SemVerCompare = &Builtin{
- Name: "semver.compare",
- Description: "Compares valid SemVer formatted version strings.",
- Decl: types.NewFunction(
- types.Args(
- types.Named("a", types.S),
- types.Named("b", types.S),
- ),
- types.Named("result", types.N).Description("`-1` if `a < b`; `1` if `a > b`; `0` if `a == b`"),
- ),
-}
+var SemVerCompare = v1.SemVerCompare
/**
* Printing
@@ -3128,248 +579,56 @@ var SemVerCompare = &Builtin{
// operands may be of any type. Furthermore, unlike other built-in functions,
// undefined operands DO NOT cause the print() function to fail during
// evaluation.
-var Print = &Builtin{
- Name: "print",
- Decl: types.NewVariadicFunction(nil, types.A, nil),
-}
+var Print = v1.Print
// InternalPrint represents the internal implementation of the print() function.
// The compiler rewrites print() calls to refer to the internal implementation.
-var InternalPrint = &Builtin{
- Name: "internal.print",
- Decl: types.NewFunction([]types.Type{types.NewArray(nil, types.NewSet(types.A))}, nil),
-}
+var InternalPrint = v1.InternalPrint
/**
* Deprecated built-ins.
*/
// SetDiff has been replaced by the minus built-in.
-var SetDiff = &Builtin{
- Name: "set_diff",
- Decl: types.NewFunction(
- types.Args(
- types.NewSet(types.A),
- types.NewSet(types.A),
- ),
- types.NewSet(types.A),
- ),
- deprecated: true,
-}
+var SetDiff = v1.SetDiff
// NetCIDROverlap has been replaced by the `net.cidr_contains` built-in.
-var NetCIDROverlap = &Builtin{
- Name: "net.cidr_overlap",
- Decl: types.NewFunction(
- types.Args(
- types.S,
- types.S,
- ),
- types.B,
- ),
- deprecated: true,
-}
+var NetCIDROverlap = v1.NetCIDROverlap
// CastArray checks the underlying type of the input. If it is array or set, an array
// containing the values is returned. If it is not an array, an error is thrown.
-var CastArray = &Builtin{
- Name: "cast_array",
- Decl: types.NewFunction(
- types.Args(types.A),
- types.NewArray(nil, types.A),
- ),
- deprecated: true,
-}
+var CastArray = v1.CastArray
// CastSet checks the underlying type of the input.
// If it is a set, the set is returned.
// If it is an array, the array is returned in set form (all duplicates removed)
// If neither, an error is thrown
-var CastSet = &Builtin{
- Name: "cast_set",
- Decl: types.NewFunction(
- types.Args(types.A),
- types.NewSet(types.A),
- ),
- deprecated: true,
-}
+var CastSet = v1.CastSet
// CastString returns input if it is a string; if not returns error.
// For formatting variables, see sprintf
-var CastString = &Builtin{
- Name: "cast_string",
- Decl: types.NewFunction(
- types.Args(types.A),
- types.S,
- ),
- deprecated: true,
-}
+var CastString = v1.CastString
// CastBoolean returns input if it is a boolean; if not returns error.
-var CastBoolean = &Builtin{
- Name: "cast_boolean",
- Decl: types.NewFunction(
- types.Args(types.A),
- types.B,
- ),
- deprecated: true,
-}
+var CastBoolean = v1.CastBoolean
// CastNull returns null if input is null; if not returns error.
-var CastNull = &Builtin{
- Name: "cast_null",
- Decl: types.NewFunction(
- types.Args(types.A),
- types.NewNull(),
- ),
- deprecated: true,
-}
+var CastNull = v1.CastNull
// CastObject returns the given object if it is null; throws an error otherwise
-var CastObject = &Builtin{
- Name: "cast_object",
- Decl: types.NewFunction(
- types.Args(types.A),
- types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)),
- ),
- deprecated: true,
-}
+var CastObject = v1.CastObject
// RegexMatchDeprecated declares `re_match` which has been deprecated. Use `regex.match` instead.
-var RegexMatchDeprecated = &Builtin{
- Name: "re_match",
- Decl: types.NewFunction(
- types.Args(
- types.S,
- types.S,
- ),
- types.B,
- ),
- deprecated: true,
-}
+var RegexMatchDeprecated = v1.RegexMatchDeprecated
// All takes a list and returns true if all of the items
// are true. A collection of length 0 returns true.
-var All = &Builtin{
- Name: "all",
- Decl: types.NewFunction(
- types.Args(
- types.NewAny(
- types.NewSet(types.A),
- types.NewArray(nil, types.A),
- ),
- ),
- types.B,
- ),
- deprecated: true,
-}
+var All = v1.All
// Any takes a collection and returns true if any of the items
// is true. A collection of length 0 returns false.
-var Any = &Builtin{
- Name: "any",
- Decl: types.NewFunction(
- types.Args(
- types.NewAny(
- types.NewSet(types.A),
- types.NewArray(nil, types.A),
- ),
- ),
- types.B,
- ),
- deprecated: true,
-}
+var Any = v1.Any
// Builtin represents a built-in function supported by OPA. Every built-in
// function is uniquely identified by a name.
-type Builtin struct {
- Name string `json:"name"` // Unique name of built-in function, e.g., (arg1,arg2,...,argN)
- Description string `json:"description,omitempty"` // Description of what the built-in function does.
-
- // Categories of the built-in function. Omitted for namespaced
- // built-ins, i.e. "array.concat" is taken to be of the "array" category.
- // "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.
- Nondeterministic bool `json:"nondeterministic,omitempty"` // Indicates if the built-in returns non-deterministic results.
-}
-
-// category is a helper for specifying a Builtin's Categories
-func category(cs ...string) []string {
- return cs
-}
-
-// Minimal returns a shallow copy of b with the descriptions and categories and
-// named arguments stripped out.
-func (b *Builtin) Minimal() *Builtin {
- cpy := *b
- fargs := b.Decl.FuncArgs()
- if fargs.Variadic != nil {
- cpy.Decl = types.NewVariadicFunction(fargs.Args, fargs.Variadic, b.Decl.Result())
- } else {
- cpy.Decl = types.NewFunction(fargs.Args, b.Decl.Result())
- }
- cpy.Categories = nil
- cpy.Description = ""
- return &cpy
-}
-
-// IsDeprecated returns true if the Builtin function is deprecated and will be removed in a future release.
-func (b *Builtin) IsDeprecated() bool {
- return b.deprecated
-}
-
-// IsDeterministic returns true if the Builtin function returns non-deterministic results.
-func (b *Builtin) IsNondeterministic() bool {
- return b.Nondeterministic
-}
-
-// Expr creates a new expression for the built-in with the given operands.
-func (b *Builtin) Expr(operands ...*Term) *Expr {
- ts := make([]*Term, len(operands)+1)
- ts[0] = NewTerm(b.Ref())
- for i := range operands {
- ts[i+1] = operands[i]
- }
- return &Expr{
- Terms: ts,
- }
-}
-
-// Call creates a new term for the built-in with the given operands.
-func (b *Builtin) Call(operands ...*Term) *Term {
- call := make(Call, len(operands)+1)
- call[0] = NewTerm(b.Ref())
- for i := range operands {
- call[i+1] = operands[i]
- }
- return NewTerm(call)
-}
-
-// Ref returns a Ref that refers to the built-in function.
-func (b *Builtin) Ref() Ref {
- parts := strings.Split(b.Name, ".")
- ref := make(Ref, len(parts))
- ref[0] = VarTerm(parts[0])
- for i := 1; i < len(parts); i++ {
- ref[i] = StringTerm(parts[i])
- }
- return ref
-}
-
-// IsTargetPos returns true if a variable in the i-th position will be bound by
-// evaluating the call expression.
-func (b *Builtin) IsTargetPos(i int) bool {
- return len(b.Decl.FuncArgs().Args) == i
-}
-
-func init() {
- BuiltinMap = map[string]*Builtin{}
- for _, b := range DefaultBuiltins {
- RegisterBuiltin(b)
- }
-}
+type Builtin = v1.Builtin
diff --git a/vendor/github.com/open-policy-agent/opa/ast/capabilities.go b/vendor/github.com/open-policy-agent/opa/ast/capabilities.go
index 3b95d79e57..bc7278a885 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/capabilities.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/capabilities.go
@@ -5,228 +5,54 @@
package ast
import (
- "bytes"
- _ "embed"
- "encoding/json"
- "fmt"
"io"
- "os"
- "sort"
- "strings"
- caps "github.com/open-policy-agent/opa/capabilities"
- "github.com/open-policy-agent/opa/internal/semver"
- "github.com/open-policy-agent/opa/internal/wasm/sdk/opa/capabilities"
- "github.com/open-policy-agent/opa/util"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
// VersonIndex contains an index from built-in function name, language feature,
// and future rego keyword to version number. During the build, this is used to
// create an index of the minimum version required for the built-in/feature/kw.
-type VersionIndex struct {
- Builtins map[string]semver.Version `json:"builtins"`
- Features map[string]semver.Version `json:"features"`
- Keywords map[string]semver.Version `json:"keywords"`
-}
-
-// NOTE(tsandall): this file is generated by internal/cmd/genversionindex/main.go
-// and run as part of go:generate. We generate the version index as part of the
-// build process because it's relatively expensive to build (it takes ~500ms on
-// my machine) and never changes.
-//
-//go:embed version_index.json
-var versionIndexBs []byte
-
-var minVersionIndex = func() VersionIndex {
- var vi VersionIndex
- err := json.Unmarshal(versionIndexBs, &vi)
- if err != nil {
- panic(err)
- }
- return vi
-}()
+type VersionIndex = v1.VersionIndex
// In the compiler, we used this to check that we're OK working with ref heads.
// If this isn't present, we'll fail. This is to ensure that older versions of
// OPA can work with policies that we're compiling -- if they don't know ref
// heads, they wouldn't be able to parse them.
-const FeatureRefHeadStringPrefixes = "rule_head_ref_string_prefixes"
-const FeatureRefHeads = "rule_head_refs"
-const FeatureRegoV1Import = "rego_v1_import"
+const FeatureRefHeadStringPrefixes = v1.FeatureRefHeadStringPrefixes
+const FeatureRefHeads = v1.FeatureRefHeads
+const FeatureRegoV1 = v1.FeatureRegoV1
+const FeatureRegoV1Import = v1.FeatureRegoV1Import
// Capabilities defines a structure containing data that describes the capabilities
// or features supported by a particular version of OPA.
-type Capabilities struct {
- Builtins []*Builtin `json:"builtins,omitempty"`
- FutureKeywords []string `json:"future_keywords,omitempty"`
- WasmABIVersions []WasmABIVersion `json:"wasm_abi_versions,omitempty"`
-
- // Features is a bit of a mixed bag for checking that an older version of OPA
- // is able to do what needs to be done.
- // TODO(sr): find better words ^^
- Features []string `json:"features,omitempty"`
-
- // allow_net is an array of hostnames or IP addresses, that an OPA instance is
- // allowed to connect to.
- // If omitted, ANY host can be connected to. If empty, NO host can be connected to.
- // 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"`
-}
+type Capabilities = v1.Capabilities
// WasmABIVersion captures the Wasm ABI version. Its `Minor` version is indicating
// backwards-compatible changes.
-type WasmABIVersion struct {
- Version int `json:"version"`
- Minor int `json:"minor_version"`
-}
+type WasmABIVersion = v1.WasmABIVersion
// CapabilitiesForThisVersion returns the capabilities of this version of OPA.
func CapabilitiesForThisVersion() *Capabilities {
- f := &Capabilities{}
-
- for _, vers := range capabilities.ABIVersions() {
- f.WasmABIVersions = append(f.WasmABIVersions, WasmABIVersion{Version: vers[0], Minor: vers[1]})
- }
-
- f.Builtins = make([]*Builtin, len(Builtins))
- copy(f.Builtins, Builtins)
- sort.Slice(f.Builtins, func(i, j int) bool {
- return f.Builtins[i].Name < f.Builtins[j].Name
- })
-
- for kw := range futureKeywords {
- f.FutureKeywords = append(f.FutureKeywords, kw)
- }
- sort.Strings(f.FutureKeywords)
-
- f.Features = []string{
- FeatureRefHeadStringPrefixes,
- FeatureRefHeads,
- FeatureRegoV1Import,
- }
-
- return f
+ return v1.CapabilitiesForThisVersion(v1.CapabilitiesRegoVersion(DefaultRegoVersion))
}
// LoadCapabilitiesJSON loads a JSON serialized capabilities structure from the reader r.
func LoadCapabilitiesJSON(r io.Reader) (*Capabilities, error) {
- d := util.NewJSONDecoder(r)
- var c Capabilities
- return &c, d.Decode(&c)
+ return v1.LoadCapabilitiesJSON(r)
}
// LoadCapabilitiesVersion loads a JSON serialized capabilities structure from the specific version.
func LoadCapabilitiesVersion(version string) (*Capabilities, error) {
- cvs, err := LoadCapabilitiesVersions()
- if err != nil {
- return nil, err
- }
-
- for _, cv := range cvs {
- if cv == version {
- cont, err := caps.FS.ReadFile(cv + ".json")
- if err != nil {
- return nil, err
- }
-
- return LoadCapabilitiesJSON(bytes.NewReader(cont))
- }
-
- }
- return nil, fmt.Errorf("no capabilities version found %v", version)
+ return v1.LoadCapabilitiesVersion(version)
}
// LoadCapabilitiesFile loads a JSON serialized capabilities structure from a file.
func LoadCapabilitiesFile(file string) (*Capabilities, error) {
- fd, err := os.Open(file)
- if err != nil {
- return nil, err
- }
- defer fd.Close()
- return LoadCapabilitiesJSON(fd)
+ return v1.LoadCapabilitiesFile(file)
}
// LoadCapabilitiesVersions loads all capabilities versions
func LoadCapabilitiesVersions() ([]string, error) {
- ents, err := caps.FS.ReadDir(".")
- if err != nil {
- return nil, err
- }
-
- capabilitiesVersions := make([]string, 0, len(ents))
- for _, ent := range ents {
- capabilitiesVersions = append(capabilitiesVersions, strings.Replace(ent.Name(), ".json", "", 1))
- }
- return capabilitiesVersions, nil
-}
-
-// MinimumCompatibleVersion returns the minimum compatible OPA version based on
-// the built-ins, features, and keywords in c.
-func (c *Capabilities) MinimumCompatibleVersion() (string, bool) {
-
- var maxVersion semver.Version
-
- // this is the oldest OPA release that includes capabilities
- if err := maxVersion.Set("0.17.0"); err != nil {
- panic("unreachable")
- }
-
- for _, bi := range c.Builtins {
- v, ok := minVersionIndex.Builtins[bi.Name]
- if !ok {
- return "", false
- }
- if v.Compare(maxVersion) > 0 {
- maxVersion = v
- }
- }
-
- for _, kw := range c.FutureKeywords {
- v, ok := minVersionIndex.Keywords[kw]
- if !ok {
- return "", false
- }
- if v.Compare(maxVersion) > 0 {
- maxVersion = v
- }
- }
-
- for _, feat := range c.Features {
- v, ok := minVersionIndex.Features[feat]
- if !ok {
- return "", false
- }
- if v.Compare(maxVersion) > 0 {
- maxVersion = v
- }
- }
-
- return maxVersion.String(), true
-}
-
-func (c *Capabilities) ContainsFeature(feature string) bool {
- for _, f := range c.Features {
- if f == feature {
- return true
- }
- }
- return false
-}
-
-// addBuiltinSorted inserts a built-in into c in sorted order. An existing built-in with the same name
-// will be overwritten.
-func (c *Capabilities) addBuiltinSorted(bi *Builtin) {
- i := sort.Search(len(c.Builtins), func(x int) bool {
- return c.Builtins[x].Name >= bi.Name
- })
- if i < len(c.Builtins) && bi.Name == c.Builtins[i].Name {
- c.Builtins[i] = bi
- return
- }
- c.Builtins = append(c.Builtins, nil)
- copy(c.Builtins[i+1:], c.Builtins[i:])
- c.Builtins[i] = bi
+ return v1.LoadCapabilitiesVersions()
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/check.go b/vendor/github.com/open-policy-agent/opa/ast/check.go
index 03d31123cf..4cf00436df 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/check.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/check.go
@@ -5,1317 +5,18 @@
package ast
import (
- "fmt"
- "sort"
- "strings"
-
- "github.com/open-policy-agent/opa/types"
- "github.com/open-policy-agent/opa/util"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
-type varRewriter func(Ref) Ref
-
-// exprChecker defines the interface for executing type checking on a single
-// expression. The exprChecker must update the provided TypeEnv with inferred
-// types of vars.
-type exprChecker func(*TypeEnv, *Expr) *Error
-
-// typeChecker implements type checking on queries and rules. Errors are
-// accumulated on the typeChecker so that a single run can report multiple
-// issues.
-type typeChecker struct {
- builtins map[string]*Builtin
- required *Capabilities
- errs Errors
- exprCheckers map[string]exprChecker
- varRewriter varRewriter
- ss *SchemaSet
- allowNet []string
- input types.Type
- allowUndefinedFuncs bool
- schemaTypes map[string]types.Type
-}
-
-// newTypeChecker returns a new typeChecker object that has no errors.
-func newTypeChecker() *typeChecker {
- return &typeChecker{
- builtins: make(map[string]*Builtin),
- schemaTypes: make(map[string]types.Type),
- exprCheckers: map[string]exprChecker{
- "eq": checkExprEq,
- },
- }
-}
-
-func (tc *typeChecker) newEnv(exist *TypeEnv) *TypeEnv {
- if exist != nil {
- return exist.wrap()
- }
- env := newTypeEnv(tc.copy)
- if tc.input != nil {
- env.tree.Put(InputRootRef, tc.input)
- }
- return env
-}
-
-func (tc *typeChecker) copy() *typeChecker {
- return newTypeChecker().
- WithVarRewriter(tc.varRewriter).
- WithSchemaSet(tc.ss).
- WithAllowNet(tc.allowNet).
- WithInputType(tc.input).
- WithAllowUndefinedFunctionCalls(tc.allowUndefinedFuncs).
- WithBuiltins(tc.builtins).
- WithRequiredCapabilities(tc.required)
-}
-
-func (tc *typeChecker) WithRequiredCapabilities(c *Capabilities) *typeChecker {
- tc.required = c
- return tc
-}
-
-func (tc *typeChecker) WithBuiltins(builtins map[string]*Builtin) *typeChecker {
- tc.builtins = builtins
- return tc
-}
-
-func (tc *typeChecker) WithSchemaSet(ss *SchemaSet) *typeChecker {
- tc.ss = ss
- return tc
-}
-
-func (tc *typeChecker) WithAllowNet(hosts []string) *typeChecker {
- tc.allowNet = hosts
- return tc
-}
-
-func (tc *typeChecker) WithVarRewriter(f varRewriter) *typeChecker {
- tc.varRewriter = f
- return tc
-}
-
-func (tc *typeChecker) WithInputType(tpe types.Type) *typeChecker {
- tc.input = tpe
- return tc
-}
-
-// WithAllowUndefinedFunctionCalls sets the type checker to allow references to undefined functions.
-// Additionally, the 'CheckUndefinedFuncs' and 'CheckSafetyRuleBodies' compiler stages are skipped.
-func (tc *typeChecker) WithAllowUndefinedFunctionCalls(allow bool) *typeChecker {
- tc.allowUndefinedFuncs = allow
- return tc
-}
-
-// Env returns a type environment for the specified built-ins with any other
-// global types configured on the checker. In practice, this is the default
-// environment that other statements will be checked against.
-func (tc *typeChecker) Env(builtins map[string]*Builtin) *TypeEnv {
- env := tc.newEnv(nil)
- for _, bi := range builtins {
- env.tree.Put(bi.Ref(), bi.Decl)
- }
- return env
-}
-
-// CheckBody runs type checking on the body and returns a TypeEnv if no errors
-// are found. The resulting TypeEnv wraps the provided one. The resulting
-// TypeEnv will be able to resolve types of vars contained in the body.
-func (tc *typeChecker) CheckBody(env *TypeEnv, body Body) (*TypeEnv, Errors) {
-
- errors := []*Error{}
- env = tc.newEnv(env)
-
- WalkExprs(body, func(expr *Expr) bool {
-
- closureErrs := tc.checkClosures(env, expr)
- for _, err := range closureErrs {
- errors = append(errors, err)
- }
-
- hasClosureErrors := len(closureErrs) > 0
-
- vis := newRefChecker(env, tc.varRewriter)
- NewGenericVisitor(vis.Visit).Walk(expr)
- for _, err := range vis.errs {
- errors = append(errors, err)
- }
-
- hasRefErrors := len(vis.errs) > 0
-
- if err := tc.checkExpr(env, expr); err != nil {
- // Suppress this error if a more actionable one has occurred. In
- // this case, if an error occurred in a ref or closure contained in
- // this expression, and the error is due to a nil type, then it's
- // likely to be the result of the more specific error.
- skip := (hasClosureErrors || hasRefErrors) && causedByNilType(err)
- if !skip {
- errors = append(errors, err)
- }
- }
- return true
- })
-
- tc.err(errors)
- return env, errors
-}
-
-// CheckTypes runs type checking on the rules returns a TypeEnv if no errors
-// are found. The resulting TypeEnv wraps the provided one. The resulting
-// TypeEnv will be able to resolve types of refs that refer to rules.
-func (tc *typeChecker) CheckTypes(env *TypeEnv, sorted []util.T, as *AnnotationSet) (*TypeEnv, Errors) {
- env = tc.newEnv(env)
- for _, s := range sorted {
- tc.checkRule(env, as, s.(*Rule))
- }
- tc.errs.Sort()
- return env, tc.errs
-}
-
-func (tc *typeChecker) checkClosures(env *TypeEnv, expr *Expr) Errors {
- var result Errors
- WalkClosures(expr, func(x interface{}) bool {
- switch x := x.(type) {
- case *ArrayComprehension:
- _, errs := tc.copy().CheckBody(env, x.Body)
- if len(errs) > 0 {
- result = errs
- return true
- }
- case *SetComprehension:
- _, errs := tc.copy().CheckBody(env, x.Body)
- if len(errs) > 0 {
- result = errs
- return true
- }
- case *ObjectComprehension:
- _, errs := tc.copy().CheckBody(env, x.Body)
- if len(errs) > 0 {
- result = errs
- return true
- }
- }
- return false
- })
- return result
-}
-
-func (tc *typeChecker) getSchemaType(schemaAnnot *SchemaAnnotation, rule *Rule) (types.Type, *Error) {
- if refType, exists := tc.schemaTypes[schemaAnnot.Schema.String()]; exists {
- return refType, nil
- }
-
- refType, err := processAnnotation(tc.ss, schemaAnnot, rule, tc.allowNet)
- if err != nil {
- return nil, err
- }
-
- if refType == nil {
- return nil, nil
- }
-
- tc.schemaTypes[schemaAnnot.Schema.String()] = refType
- return refType, nil
-
-}
-
-func (tc *typeChecker) checkRule(env *TypeEnv, as *AnnotationSet, rule *Rule) {
-
- env = env.wrap()
-
- schemaAnnots := getRuleAnnotation(as, rule)
- for _, schemaAnnot := range schemaAnnots {
- refType, err := tc.getSchemaType(schemaAnnot, rule)
- if err != nil {
- tc.err([]*Error{err})
- continue
- }
-
- ref := schemaAnnot.Path
- // if we do not have a ref or a reftype, we should not evaluate this rule.
- if ref == nil || refType == nil {
- continue
- }
-
- prefixRef, t := getPrefix(env, ref)
- if t == nil || len(prefixRef) == len(ref) {
- env.tree.Put(ref, refType)
- } else {
- newType, err := override(ref[len(prefixRef):], t, refType, rule)
- if err != nil {
- tc.err([]*Error{err})
- continue
- }
- env.tree.Put(prefixRef, newType)
- }
- }
-
- cpy, err := tc.CheckBody(env, rule.Body)
- env = env.next
- path := rule.Ref()
-
- if len(err) > 0 {
- // if the rule/function contains an error, add it to the type env so
- // that expressions that refer to this rule/function do not encounter
- // type errors.
- env.tree.Put(path, types.A)
- return
- }
-
- var tpe types.Type
-
- if len(rule.Head.Args) > 0 {
- // If args are not referred to in body, infer as any.
- WalkVars(rule.Head.Args, func(v Var) bool {
- if cpy.Get(v) == nil {
- cpy.tree.PutOne(v, types.A)
- }
- return false
- })
-
- // Construct function type.
- args := make([]types.Type, len(rule.Head.Args))
- for i := 0; i < len(rule.Head.Args); i++ {
- args[i] = cpy.Get(rule.Head.Args[i])
- }
-
- f := types.NewFunction(args, cpy.Get(rule.Head.Value))
-
- tpe = f
- } else {
- switch rule.Head.RuleKind() {
- case SingleValue:
- typeV := cpy.Get(rule.Head.Value)
- if !path.IsGround() {
- // e.g. store object[string: whatever] at data.p.q.r, not data.p.q.r[x] or data.p.q.r[x].y[z]
- objPath := path.DynamicSuffix()
- path = path.GroundPrefix()
-
- var err error
- tpe, err = nestedObject(cpy, objPath, typeV)
- if err != nil {
- tc.err([]*Error{NewError(TypeErr, rule.Head.Location, err.Error())})
- tpe = nil
- }
- } else {
- if typeV != nil {
- tpe = typeV
- }
- }
- case MultiValue:
- typeK := cpy.Get(rule.Head.Key)
- if typeK != nil {
- tpe = types.NewSet(typeK)
- }
- }
- }
-
- if tpe != nil {
- env.tree.Insert(path, tpe, env)
- }
-}
-
-// nestedObject creates a nested structure of object types, where each term on path corresponds to a level in the
-// nesting. Each term in the path only contributes to the dynamic portion of its corresponding object.
-func nestedObject(env *TypeEnv, path Ref, tpe types.Type) (types.Type, error) {
- if len(path) == 0 {
- return tpe, nil
- }
-
- k := path[0]
- typeV, err := nestedObject(env, path[1:], tpe)
- if err != nil {
- return nil, err
- }
- if typeV == nil {
- return nil, nil
- }
-
- var dynamicProperty *types.DynamicProperty
- typeK := env.Get(k)
- if typeK == nil {
- return nil, nil
- }
- dynamicProperty = types.NewDynamicProperty(typeK, typeV)
-
- return types.NewObject(nil, dynamicProperty), nil
-}
-
-func (tc *typeChecker) checkExpr(env *TypeEnv, expr *Expr) *Error {
- if err := tc.checkExprWith(env, expr, 0); err != nil {
- return err
- }
- if !expr.IsCall() {
- return nil
- }
-
- operator := expr.Operator().String()
-
- // If the type checker wasn't provided with a required capabilities
- // structure then just skip. In some cases, type checking might be run
- // without the need to record what builtins are required.
- if tc.required != nil {
- if bi, ok := tc.builtins[operator]; ok {
- tc.required.addBuiltinSorted(bi)
- }
- }
-
- checker := tc.exprCheckers[operator]
- if checker != nil {
- return checker(env, expr)
- }
-
- return tc.checkExprBuiltin(env, expr)
-}
-
-func (tc *typeChecker) checkExprBuiltin(env *TypeEnv, expr *Expr) *Error {
-
- args := expr.Operands()
- pre := getArgTypes(env, args)
-
- // NOTE(tsandall): undefined functions will have been caught earlier in the
- // compiler. We check for undefined functions before the safety check so
- // that references to non-existent functions result in undefined function
- // errors as opposed to unsafe var errors.
- //
- // We cannot run type checking before the safety check because part of the
- // type checker relies on reordering (in particular for references to local
- // vars).
- name := expr.Operator()
- tpe := env.Get(name)
-
- if tpe == nil {
- if tc.allowUndefinedFuncs {
- return nil
- }
- return NewError(TypeErr, expr.Location, "undefined function %v", name)
- }
-
- // check if the expression refers to a function that contains an error
- _, ok := tpe.(types.Any)
- if ok {
- return nil
- }
-
- ftpe, ok := tpe.(*types.Function)
- if !ok {
- return NewError(TypeErr, expr.Location, "undefined function %v", name)
- }
-
- fargs := ftpe.FuncArgs()
- namedFargs := ftpe.NamedFuncArgs()
-
- if ftpe.Result() != nil {
- fargs.Args = append(fargs.Args, ftpe.Result())
- namedFargs.Args = append(namedFargs.Args, ftpe.NamedResult())
- }
-
- if len(args) > len(fargs.Args) && fargs.Variadic == nil {
- return newArgError(expr.Location, name, "too many arguments", pre, namedFargs)
- }
-
- if len(args) < len(ftpe.FuncArgs().Args) {
- return newArgError(expr.Location, name, "too few arguments", pre, namedFargs)
- }
-
- for i := range args {
- if !unify1(env, args[i], fargs.Arg(i), false) {
- post := make([]types.Type, len(args))
- for i := range args {
- post[i] = env.Get(args[i])
- }
- return newArgError(expr.Location, name, "invalid argument(s)", post, namedFargs)
- }
- }
-
- return nil
-}
-
-func checkExprEq(env *TypeEnv, expr *Expr) *Error {
-
- pre := getArgTypes(env, expr.Operands())
- exp := Equality.Decl.FuncArgs()
-
- if len(pre) < len(exp.Args) {
- return newArgError(expr.Location, expr.Operator(), "too few arguments", pre, exp)
- }
-
- if len(exp.Args) < len(pre) {
- return newArgError(expr.Location, expr.Operator(), "too many arguments", pre, exp)
- }
-
- a, b := expr.Operand(0), expr.Operand(1)
- typeA, typeB := env.Get(a), env.Get(b)
-
- if !unify2(env, a, typeA, b, typeB) {
- err := NewError(TypeErr, expr.Location, "match error")
- err.Details = &UnificationErrDetail{
- Left: typeA,
- Right: typeB,
- }
- return err
- }
-
- return nil
-}
-
-func (tc *typeChecker) checkExprWith(env *TypeEnv, expr *Expr, i int) *Error {
- if i == len(expr.With) {
- return nil
- }
-
- target, value := expr.With[i].Target, expr.With[i].Value
- targetType, valueType := env.Get(target), env.Get(value)
-
- if t, ok := targetType.(*types.Function); ok { // built-in function replacement
- switch v := valueType.(type) {
- case *types.Function: // ...by function
- if !unifies(targetType, valueType) {
- return newArgError(expr.With[i].Loc(), target.Value.(Ref), "arity mismatch", v.FuncArgs().Args, t.NamedFuncArgs())
- }
- default: // ... by value, nothing to check
- }
- }
-
- return tc.checkExprWith(env, expr, i+1)
-}
-
-func unify2(env *TypeEnv, a *Term, typeA types.Type, b *Term, typeB types.Type) bool {
-
- nilA := types.Nil(typeA)
- nilB := types.Nil(typeB)
-
- if nilA && !nilB {
- return unify1(env, a, typeB, false)
- } else if nilB && !nilA {
- return unify1(env, b, typeA, false)
- } else if !nilA && !nilB {
- return unifies(typeA, typeB)
- }
-
- switch a.Value.(type) {
- case *Array:
- return unify2Array(env, a, b)
- case *object:
- return unify2Object(env, a, b)
- case Var:
- switch b.Value.(type) {
- case Var:
- return unify1(env, a, types.A, false) && unify1(env, b, env.Get(a), false)
- case *Array:
- return unify2Array(env, b, a)
- case *object:
- return unify2Object(env, b, a)
- }
- }
-
- return false
-}
-
-func unify2Array(env *TypeEnv, a *Term, b *Term) bool {
- arr := a.Value.(*Array)
- switch bv := b.Value.(type) {
- case *Array:
- if arr.Len() == bv.Len() {
- for i := 0; i < arr.Len(); i++ {
- if !unify2(env, arr.Elem(i), env.Get(arr.Elem(i)), bv.Elem(i), env.Get(bv.Elem(i))) {
- return false
- }
- }
- return true
- }
- case Var:
- return unify1(env, a, types.A, false) && unify1(env, b, env.Get(a), false)
- }
- return false
-}
-
-func unify2Object(env *TypeEnv, a *Term, b *Term) bool {
- obj := a.Value.(Object)
- switch bv := b.Value.(type) {
- case *object:
- cv := obj.Intersect(bv)
- if obj.Len() == bv.Len() && bv.Len() == len(cv) {
- for i := range cv {
- if !unify2(env, cv[i][1], env.Get(cv[i][1]), cv[i][2], env.Get(cv[i][2])) {
- return false
- }
- }
- return true
- }
- case Var:
- return unify1(env, a, types.A, false) && unify1(env, b, env.Get(a), false)
- }
- return false
-}
-
-func unify1(env *TypeEnv, term *Term, tpe types.Type, union bool) bool {
- switch v := term.Value.(type) {
- case *Array:
- switch tpe := tpe.(type) {
- case *types.Array:
- return unify1Array(env, v, tpe, union)
- case types.Any:
- if types.Compare(tpe, types.A) == 0 {
- for i := 0; i < v.Len(); i++ {
- unify1(env, v.Elem(i), types.A, true)
- }
- return true
- }
- unifies := false
- for i := range tpe {
- unifies = unify1(env, term, tpe[i], true) || unifies
- }
- return unifies
- }
- return false
- case *object:
- switch tpe := tpe.(type) {
- case *types.Object:
- return unify1Object(env, v, tpe, union)
- case types.Any:
- if types.Compare(tpe, types.A) == 0 {
- v.Foreach(func(key, value *Term) {
- unify1(env, key, types.A, true)
- unify1(env, value, types.A, true)
- })
- return true
- }
- unifies := false
- for i := range tpe {
- unifies = unify1(env, term, tpe[i], true) || unifies
- }
- return unifies
- }
- return false
- case Set:
- switch tpe := tpe.(type) {
- case *types.Set:
- return unify1Set(env, v, tpe, union)
- case types.Any:
- if types.Compare(tpe, types.A) == 0 {
- v.Foreach(func(elem *Term) {
- unify1(env, elem, types.A, true)
- })
- return true
- }
- unifies := false
- for i := range tpe {
- unifies = unify1(env, term, tpe[i], true) || unifies
- }
- return unifies
- }
- return false
- case Ref, *ArrayComprehension, *ObjectComprehension, *SetComprehension:
- return unifies(env.Get(v), tpe)
- case Var:
- if !union {
- if exist := env.Get(v); exist != nil {
- return unifies(exist, tpe)
- }
- env.tree.PutOne(term.Value, tpe)
- } else {
- env.tree.PutOne(term.Value, types.Or(env.Get(v), tpe))
- }
- return true
- default:
- if !IsConstant(v) {
- panic("unreachable")
- }
- return unifies(env.Get(term), tpe)
- }
-}
-
-func unify1Array(env *TypeEnv, val *Array, tpe *types.Array, union bool) bool {
- if val.Len() != tpe.Len() && tpe.Dynamic() == nil {
- return false
- }
- for i := 0; i < val.Len(); i++ {
- if !unify1(env, val.Elem(i), tpe.Select(i), union) {
- return false
- }
- }
- return true
-}
-
-func unify1Object(env *TypeEnv, val Object, tpe *types.Object, union bool) bool {
- if val.Len() != len(tpe.Keys()) && tpe.DynamicValue() == nil {
- return false
- }
- stop := val.Until(func(k, v *Term) bool {
- if IsConstant(k.Value) {
- if child := selectConstant(tpe, k); child != nil {
- if !unify1(env, v, child, union) {
- return true
- }
- } else {
- return true
- }
- } else {
- // Inferring type of value under dynamic key would involve unioning
- // with all property values of tpe whose keys unify. For now, type
- // these values as Any. We can investigate stricter inference in
- // the future.
- unify1(env, v, types.A, union)
- }
- return false
- })
- return !stop
-}
-
-func unify1Set(env *TypeEnv, val Set, tpe *types.Set, union bool) bool {
- of := types.Values(tpe)
- return !val.Until(func(elem *Term) bool {
- return !unify1(env, elem, of, union)
- })
-}
-
-func (tc *typeChecker) err(errors []*Error) {
- tc.errs = append(tc.errs, errors...)
-}
-
-type refChecker struct {
- env *TypeEnv
- errs Errors
- varRewriter varRewriter
-}
-
-func rewriteVarsNop(node Ref) Ref {
- return node
-}
-
-func newRefChecker(env *TypeEnv, f varRewriter) *refChecker {
-
- if f == nil {
- f = rewriteVarsNop
- }
-
- return &refChecker{
- env: env,
- errs: nil,
- varRewriter: f,
- }
-}
-
-func (rc *refChecker) Visit(x interface{}) bool {
- switch x := x.(type) {
- case *ArrayComprehension, *ObjectComprehension, *SetComprehension:
- return true
- case *Expr:
- switch terms := x.Terms.(type) {
- case []*Term:
- for i := 1; i < len(terms); i++ {
- NewGenericVisitor(rc.Visit).Walk(terms[i])
- }
- return true
- case *Term:
- NewGenericVisitor(rc.Visit).Walk(terms)
- return true
- }
- case Ref:
- if err := rc.checkApply(rc.env, x); err != nil {
- rc.errs = append(rc.errs, err)
- return true
- }
- if err := rc.checkRef(rc.env, rc.env.tree, x, 0); err != nil {
- rc.errs = append(rc.errs, err)
- }
- }
- return false
-}
-
-func (rc *refChecker) checkApply(curr *TypeEnv, ref Ref) *Error {
- switch tpe := curr.Get(ref).(type) {
- case *types.Function: // NOTE(sr): We don't support first-class functions, except for `with`.
- return newRefErrUnsupported(ref[0].Location, rc.varRewriter(ref), len(ref)-1, tpe)
- }
-
- return nil
-}
-
-func (rc *refChecker) checkRef(curr *TypeEnv, node *typeTreeNode, ref Ref, idx int) *Error {
-
- if idx == len(ref) {
- return nil
- }
-
- head := ref[idx]
-
- // NOTE(sr): as long as package statements are required, this isn't possible:
- // the shortest possible rule ref is data.a.b (b is idx 2), idx 1 and 2 need to
- // be strings or vars.
- if idx == 1 || idx == 2 {
- switch head.Value.(type) {
- case Var, String: // OK
- default:
- have := rc.env.Get(head.Value)
- return newRefErrInvalid(ref[0].Location, rc.varRewriter(ref), idx, have, types.S, getOneOfForNode(node))
- }
- }
-
- if v, ok := head.Value.(Var); ok && idx != 0 {
- tpe := types.Keys(rc.env.getRefRecExtent(node))
- if exist := rc.env.Get(v); exist != nil {
- if !unifies(tpe, exist) {
- return newRefErrInvalid(ref[0].Location, rc.varRewriter(ref), idx, exist, tpe, getOneOfForNode(node))
- }
- } else {
- rc.env.tree.PutOne(v, tpe)
- }
- }
-
- child := node.Child(head.Value)
- if child == nil {
- // NOTE(sr): idx is reset on purpose: we start over
- switch {
- case curr.next != nil:
- next := curr.next
- return rc.checkRef(next, next.tree, ref, 0)
-
- case RootDocumentNames.Contains(ref[0]):
- if idx != 0 {
- node.Children().Iter(func(_, child util.T) bool {
- _ = rc.checkRef(curr, child.(*typeTreeNode), ref, idx+1) // ignore error
- return false
- })
- return nil
- }
- return rc.checkRefLeaf(types.A, ref, 1)
-
- default:
- return rc.checkRefLeaf(types.A, ref, 0)
- }
- }
-
- if child.Leaf() {
- return rc.checkRefLeaf(child.Value(), ref, idx+1)
- }
-
- return rc.checkRef(curr, child, ref, idx+1)
-}
-
-func (rc *refChecker) checkRefLeaf(tpe types.Type, ref Ref, idx int) *Error {
-
- if idx == len(ref) {
- return nil
- }
-
- head := ref[idx]
-
- keys := types.Keys(tpe)
- if keys == nil {
- return newRefErrUnsupported(ref[0].Location, rc.varRewriter(ref), idx-1, tpe)
- }
-
- switch value := head.Value.(type) {
-
- case Var:
- if exist := rc.env.Get(value); exist != nil {
- if !unifies(exist, keys) {
- return newRefErrInvalid(ref[0].Location, rc.varRewriter(ref), idx, exist, keys, getOneOfForType(tpe))
- }
- } else {
- rc.env.tree.PutOne(value, types.Keys(tpe))
- }
-
- case Ref:
- if exist := rc.env.Get(value); exist != nil {
- if !unifies(exist, keys) {
- return newRefErrInvalid(ref[0].Location, rc.varRewriter(ref), idx, exist, keys, getOneOfForType(tpe))
- }
- }
-
- case *Array, Object, Set:
- if !unify1(rc.env, head, keys, false) {
- return newRefErrInvalid(ref[0].Location, rc.varRewriter(ref), idx, rc.env.Get(head), keys, nil)
- }
-
- default:
- child := selectConstant(tpe, head)
- if child == nil {
- return newRefErrInvalid(ref[0].Location, rc.varRewriter(ref), idx, nil, types.Keys(tpe), getOneOfForType(tpe))
- }
- return rc.checkRefLeaf(child, ref, idx+1)
- }
-
- return rc.checkRefLeaf(types.Values(tpe), ref, idx+1)
-}
-
-func unifies(a, b types.Type) bool {
-
- if a == nil || b == nil {
- return false
- }
-
- anyA, ok1 := a.(types.Any)
- if ok1 {
- if unifiesAny(anyA, b) {
- return true
- }
- }
-
- anyB, ok2 := b.(types.Any)
- if ok2 {
- if unifiesAny(anyB, a) {
- return true
- }
- }
-
- if ok1 || ok2 {
- return false
- }
-
- switch a := a.(type) {
- case types.Null:
- _, ok := b.(types.Null)
- return ok
- case types.Boolean:
- _, ok := b.(types.Boolean)
- return ok
- case types.Number:
- _, ok := b.(types.Number)
- return ok
- case types.String:
- _, ok := b.(types.String)
- return ok
- case *types.Array:
- b, ok := b.(*types.Array)
- if !ok {
- return false
- }
- return unifiesArrays(a, b)
- case *types.Object:
- b, ok := b.(*types.Object)
- if !ok {
- return false
- }
- return unifiesObjects(a, b)
- case *types.Set:
- b, ok := b.(*types.Set)
- if !ok {
- return false
- }
- return unifies(types.Values(a), types.Values(b))
- case *types.Function:
- // NOTE(sr): variadic functions can only be internal ones, and we've forbidden
- // their replacement via `with`; so we disregard variadic here
- if types.Arity(a) == types.Arity(b) {
- b := b.(*types.Function)
- for i := range a.FuncArgs().Args {
- if !unifies(a.FuncArgs().Arg(i), b.FuncArgs().Arg(i)) {
- return false
- }
- }
- return true
- }
- return false
- default:
- panic("unreachable")
- }
-}
-
-func unifiesAny(a types.Any, b types.Type) bool {
- if _, ok := b.(*types.Function); ok {
- return false
- }
- for i := range a {
- if unifies(a[i], b) {
- return true
- }
- }
- return len(a) == 0
-}
-
-func unifiesArrays(a, b *types.Array) bool {
-
- if !unifiesArraysStatic(a, b) {
- return false
- }
-
- if !unifiesArraysStatic(b, a) {
- return false
- }
-
- return a.Dynamic() == nil || b.Dynamic() == nil || unifies(a.Dynamic(), b.Dynamic())
-}
-
-func unifiesArraysStatic(a, b *types.Array) bool {
- if a.Len() != 0 {
- for i := 0; i < a.Len(); i++ {
- if !unifies(a.Select(i), b.Select(i)) {
- return false
- }
- }
- }
- return true
-}
-
-func unifiesObjects(a, b *types.Object) bool {
- if !unifiesObjectsStatic(a, b) {
- return false
- }
-
- if !unifiesObjectsStatic(b, a) {
- return false
- }
-
- return a.DynamicValue() == nil || b.DynamicValue() == nil || unifies(a.DynamicValue(), b.DynamicValue())
-}
-
-func unifiesObjectsStatic(a, b *types.Object) bool {
- for _, k := range a.Keys() {
- if !unifies(a.Select(k), b.Select(k)) {
- return false
- }
- }
- return true
-}
-
-// typeErrorCause defines an interface to determine the reason for a type
-// error. The type error details implement this interface so that type checking
-// can report more actionable errors.
-type typeErrorCause interface {
- nilType() bool
-}
-
-func causedByNilType(err *Error) bool {
- cause, ok := err.Details.(typeErrorCause)
- if !ok {
- return false
- }
- return cause.nilType()
-}
-
-// ArgErrDetail represents a generic argument error.
-type ArgErrDetail struct {
- Have []types.Type `json:"have"`
- Want types.FuncArgs `json:"want"`
-}
-
-// Lines returns the string representation of the detail.
-func (d *ArgErrDetail) Lines() []string {
- lines := make([]string, 2)
- lines[0] = "have: " + formatArgs(d.Have)
- lines[1] = "want: " + fmt.Sprint(d.Want)
- return lines
-}
-
-func (d *ArgErrDetail) nilType() bool {
- for i := range d.Have {
- if types.Nil(d.Have[i]) {
- return true
- }
- }
- return false
-}
-
// UnificationErrDetail describes a type mismatch error when two values are
// unified (e.g., x = [1,2,y]).
-type UnificationErrDetail struct {
- Left types.Type `json:"a"`
- Right types.Type `json:"b"`
-}
-
-func (a *UnificationErrDetail) nilType() bool {
- return types.Nil(a.Left) || types.Nil(a.Right)
-}
-
-// Lines returns the string representation of the detail.
-func (a *UnificationErrDetail) Lines() []string {
- lines := make([]string, 2)
- lines[0] = fmt.Sprint("left : ", types.Sprint(a.Left))
- lines[1] = fmt.Sprint("right : ", types.Sprint(a.Right))
- return lines
-}
+type UnificationErrDetail = v1.UnificationErrDetail
// RefErrUnsupportedDetail describes an undefined reference error where the
// referenced value does not support dereferencing (e.g., scalars).
-type RefErrUnsupportedDetail struct {
- Ref Ref `json:"ref"` // invalid ref
- Pos int `json:"pos"` // invalid element
- Have types.Type `json:"have"` // referenced type
-}
-
-// Lines returns the string representation of the detail.
-func (r *RefErrUnsupportedDetail) Lines() []string {
- lines := []string{
- r.Ref.String(),
- strings.Repeat("^", len(r.Ref[:r.Pos+1].String())),
- fmt.Sprintf("have: %v", r.Have),
- }
- return lines
-}
+type RefErrUnsupportedDetail = v1.RefErrUnsupportedDetail
// RefErrInvalidDetail describes an undefined reference error where the referenced
// value does not support the reference operand (e.g., missing object key,
// invalid key type, etc.)
-type RefErrInvalidDetail struct {
- Ref Ref `json:"ref"` // invalid ref
- Pos int `json:"pos"` // invalid element
- Have types.Type `json:"have,omitempty"` // type of invalid element (for var/ref elements)
- Want types.Type `json:"want"` // allowed type (for non-object values)
- OneOf []Value `json:"oneOf"` // allowed values (e.g., for object keys)
-}
-
-// Lines returns the string representation of the detail.
-func (r *RefErrInvalidDetail) Lines() []string {
- lines := []string{r.Ref.String()}
- offset := len(r.Ref[:r.Pos].String()) + 1
- pad := strings.Repeat(" ", offset)
- lines = append(lines, fmt.Sprintf("%s^", pad))
- if r.Have != nil {
- lines = append(lines, fmt.Sprintf("%shave (type): %v", pad, r.Have))
- } else {
- lines = append(lines, fmt.Sprintf("%shave: %v", pad, r.Ref[r.Pos]))
- }
- if len(r.OneOf) > 0 {
- lines = append(lines, fmt.Sprintf("%swant (one of): %v", pad, r.OneOf))
- } else {
- lines = append(lines, fmt.Sprintf("%swant (type): %v", pad, r.Want))
- }
- return lines
-}
-
-func formatArgs(args []types.Type) string {
- buf := make([]string, len(args))
- for i := range args {
- buf[i] = types.Sprint(args[i])
- }
- return "(" + strings.Join(buf, ", ") + ")"
-}
-
-func newRefErrInvalid(loc *Location, ref Ref, idx int, have, want types.Type, oneOf []Value) *Error {
- err := newRefError(loc, ref)
- err.Details = &RefErrInvalidDetail{
- Ref: ref,
- Pos: idx,
- Have: have,
- Want: want,
- OneOf: oneOf,
- }
- return err
-}
-
-func newRefErrUnsupported(loc *Location, ref Ref, idx int, have types.Type) *Error {
- err := newRefError(loc, ref)
- err.Details = &RefErrUnsupportedDetail{
- Ref: ref,
- Pos: idx,
- Have: have,
- }
- return err
-}
-
-func newRefError(loc *Location, ref Ref) *Error {
- return NewError(TypeErr, loc, "undefined ref: %v", ref)
-}
-
-func newArgError(loc *Location, builtinName Ref, msg string, have []types.Type, want types.FuncArgs) *Error {
- err := NewError(TypeErr, loc, "%v: %v", builtinName, msg)
- err.Details = &ArgErrDetail{
- Have: have,
- Want: want,
- }
- return err
-}
-
-func getOneOfForNode(node *typeTreeNode) (result []Value) {
- node.Children().Iter(func(k, _ util.T) bool {
- result = append(result, k.(Value))
- return false
- })
-
- sortValueSlice(result)
- return result
-}
-
-func getOneOfForType(tpe types.Type) (result []Value) {
- switch tpe := tpe.(type) {
- case *types.Object:
- for _, k := range tpe.Keys() {
- v, err := InterfaceToValue(k)
- if err != nil {
- panic(err)
- }
- result = append(result, v)
- }
-
- case types.Any:
- for _, object := range tpe {
- objRes := getOneOfForType(object)
- result = append(result, objRes...)
- }
- }
-
- result = removeDuplicate(result)
- sortValueSlice(result)
- return result
-}
-
-func sortValueSlice(sl []Value) {
- sort.Slice(sl, func(i, j int) bool {
- return sl[i].Compare(sl[j]) < 0
- })
-}
-
-func removeDuplicate(list []Value) []Value {
- seen := make(map[Value]bool)
- var newResult []Value
- for _, item := range list {
- if !seen[item] {
- newResult = append(newResult, item)
- seen[item] = true
- }
- }
- return newResult
-}
-
-func getArgTypes(env *TypeEnv, args []*Term) []types.Type {
- pre := make([]types.Type, len(args))
- for i := range args {
- pre[i] = env.Get(args[i])
- }
- return pre
-}
-
-// getPrefix returns the shortest prefix of ref that exists in env
-func getPrefix(env *TypeEnv, ref Ref) (Ref, types.Type) {
- if len(ref) == 1 {
- t := env.Get(ref)
- if t != nil {
- return ref, t
- }
- }
- for i := 1; i < len(ref); i++ {
- t := env.Get(ref[:i])
- if t != nil {
- return ref[:i], t
- }
- }
- return nil, nil
-}
-
-// override takes a type t and returns a type obtained from t where the path represented by ref within it has type o (overriding the original type of that path)
-func override(ref Ref, t types.Type, o types.Type, rule *Rule) (types.Type, *Error) {
- var newStaticProps []*types.StaticProperty
- obj, ok := t.(*types.Object)
- if !ok {
- newType, err := getObjectType(ref, o, rule, types.NewDynamicProperty(types.A, types.A))
- if err != nil {
- return nil, err
- }
- return newType, nil
- }
- found := false
- if ok {
- staticProps := obj.StaticProperties()
- for _, prop := range staticProps {
- valueCopy := prop.Value
- key, err := InterfaceToValue(prop.Key)
- if err != nil {
- return nil, NewError(TypeErr, rule.Location, "unexpected error in override: %s", err.Error())
- }
- if len(ref) > 0 && ref[0].Value.Compare(key) == 0 {
- found = true
- if len(ref) == 1 {
- valueCopy = o
- } else {
- newVal, err := override(ref[1:], valueCopy, o, rule)
- if err != nil {
- return nil, err
- }
- valueCopy = newVal
- }
- }
- newStaticProps = append(newStaticProps, types.NewStaticProperty(prop.Key, valueCopy))
- }
- }
-
- // ref[0] is not a top-level key in staticProps, so it must be added
- if !found {
- newType, err := getObjectType(ref, o, rule, obj.DynamicProperties())
- if err != nil {
- return nil, err
- }
- newStaticProps = append(newStaticProps, newType.StaticProperties()...)
- }
- return types.NewObject(newStaticProps, obj.DynamicProperties()), nil
-}
-
-func getKeys(ref Ref, rule *Rule) ([]interface{}, *Error) {
- keys := []interface{}{}
- for _, refElem := range ref {
- key, err := JSON(refElem.Value)
- if err != nil {
- return nil, NewError(TypeErr, rule.Location, "error getting key from value: %s", err.Error())
- }
- keys = append(keys, key)
- }
- return keys, nil
-}
-
-func getObjectTypeRec(keys []interface{}, o types.Type, d *types.DynamicProperty) *types.Object {
- if len(keys) == 1 {
- staticProps := []*types.StaticProperty{types.NewStaticProperty(keys[0], o)}
- return types.NewObject(staticProps, d)
- }
-
- staticProps := []*types.StaticProperty{types.NewStaticProperty(keys[0], getObjectTypeRec(keys[1:], o, d))}
- return types.NewObject(staticProps, d)
-}
-
-func getObjectType(ref Ref, o types.Type, rule *Rule, d *types.DynamicProperty) (*types.Object, *Error) {
- keys, err := getKeys(ref, rule)
- if err != nil {
- return nil, err
- }
- return getObjectTypeRec(keys, o, d), nil
-}
-
-func getRuleAnnotation(as *AnnotationSet, rule *Rule) (result []*SchemaAnnotation) {
-
- for _, x := range as.GetSubpackagesScope(rule.Module.Package.Path) {
- result = append(result, x.Schemas...)
- }
-
- if x := as.GetPackageScope(rule.Module.Package); x != nil {
- result = append(result, x.Schemas...)
- }
-
- if x := as.GetDocumentScope(rule.Ref().GroundPrefix()); x != nil {
- result = append(result, x.Schemas...)
- }
-
- for _, x := range as.GetRuleScope(rule) {
- result = append(result, x.Schemas...)
- }
-
- return result
-}
-
-func processAnnotation(ss *SchemaSet, annot *SchemaAnnotation, rule *Rule, allowNet []string) (types.Type, *Error) {
-
- var schema interface{}
-
- if annot.Schema != nil {
- if ss == nil {
- return nil, nil
- }
- schema = ss.Get(annot.Schema)
- if schema == nil {
- return nil, NewError(TypeErr, rule.Location, "undefined schema: %v", annot.Schema)
- }
- } else if annot.Definition != nil {
- schema = *annot.Definition
- }
-
- tpe, err := loadSchema(schema, allowNet)
- if err != nil {
- return nil, NewError(TypeErr, rule.Location, err.Error())
- }
-
- return tpe, nil
-}
-
-func errAnnotationRedeclared(a *Annotations, other *Location) *Error {
- return NewError(TypeErr, a.Location, "%v annotation redeclared: %v", a.Scope, other)
-}
+type RefErrInvalidDetail = v1.RefErrInvalidDetail
diff --git a/vendor/github.com/open-policy-agent/opa/ast/compare.go b/vendor/github.com/open-policy-agent/opa/ast/compare.go
index 3bb6f2a75d..5e617e992f 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/compare.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/compare.go
@@ -5,9 +5,7 @@
package ast
import (
- "encoding/json"
- "fmt"
- "math/big"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
// Compare returns an integer indicating whether two AST values are less than,
@@ -36,361 +34,6 @@ import (
// Sets are considered equal if and only if the symmetric difference of a and b
// is empty.
// Other comparisons are consistent but not defined.
-func Compare(a, b interface{}) int {
-
- if t, ok := a.(*Term); ok {
- if t == nil {
- a = nil
- } else {
- a = t.Value
- }
- }
-
- if t, ok := b.(*Term); ok {
- if t == nil {
- b = nil
- } else {
- b = t.Value
- }
- }
-
- if a == nil {
- if b == nil {
- return 0
- }
- return -1
- }
- if b == nil {
- return 1
- }
-
- sortA := sortOrder(a)
- sortB := sortOrder(b)
-
- if sortA < sortB {
- return -1
- } else if sortB < sortA {
- return 1
- }
-
- switch a := a.(type) {
- case Null:
- return 0
- case Boolean:
- b := b.(Boolean)
- if a.Equal(b) {
- return 0
- }
- if !a {
- return -1
- }
- 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)
- case String:
- b := b.(String)
- if a.Equal(b) {
- return 0
- }
- if a < b {
- return -1
- }
- return 1
- case Var:
- b := b.(Var)
- if a.Equal(b) {
- return 0
- }
- if a < b {
- return -1
- }
- return 1
- case Ref:
- b := b.(Ref)
- return termSliceCompare(a, b)
- case *Array:
- b := b.(*Array)
- return termSliceCompare(a.elems, b.elems)
- case *lazyObj:
- return Compare(a.force(), b)
- case *object:
- if x, ok := b.(*lazyObj); ok {
- b = x.force()
- }
- b := b.(*object)
- return a.Compare(b)
- case Set:
- b := b.(Set)
- return a.Compare(b)
- case *ArrayComprehension:
- b := b.(*ArrayComprehension)
- if cmp := Compare(a.Term, b.Term); cmp != 0 {
- return cmp
- }
- return Compare(a.Body, b.Body)
- case *ObjectComprehension:
- b := b.(*ObjectComprehension)
- if cmp := Compare(a.Key, b.Key); cmp != 0 {
- return cmp
- }
- if cmp := Compare(a.Value, b.Value); cmp != 0 {
- return cmp
- }
- return Compare(a.Body, b.Body)
- case *SetComprehension:
- b := b.(*SetComprehension)
- if cmp := Compare(a.Term, b.Term); cmp != 0 {
- return cmp
- }
- return Compare(a.Body, b.Body)
- case Call:
- b := b.(Call)
- return termSliceCompare(a, b)
- case *Expr:
- b := b.(*Expr)
- return a.Compare(b)
- case *SomeDecl:
- b := b.(*SomeDecl)
- return a.Compare(b)
- case *Every:
- b := b.(*Every)
- return a.Compare(b)
- case *With:
- b := b.(*With)
- return a.Compare(b)
- case Body:
- b := b.(Body)
- return a.Compare(b)
- case *Head:
- b := b.(*Head)
- return a.Compare(b)
- case *Rule:
- b := b.(*Rule)
- return a.Compare(b)
- case Args:
- b := b.(Args)
- return termSliceCompare(a, b)
- case *Import:
- b := b.(*Import)
- return a.Compare(b)
- case *Package:
- b := b.(*Package)
- return a.Compare(b)
- case *Annotations:
- b := b.(*Annotations)
- return a.Compare(b)
- case *Module:
- b := b.(*Module)
- return a.Compare(b)
- }
- panic(fmt.Sprintf("illegal value: %T", a))
-}
-
-type termSlice []*Term
-
-func (s termSlice) Less(i, j int) bool { return Compare(s[i].Value, s[j].Value) < 0 }
-func (s termSlice) Swap(i, j int) { x := s[i]; s[i] = s[j]; s[j] = x }
-func (s termSlice) Len() int { return len(s) }
-
-func sortOrder(x interface{}) int {
- switch x.(type) {
- case Null:
- return 0
- case Boolean:
- return 1
- case Number:
- return 2
- case String:
- return 3
- case Var:
- return 4
- case Ref:
- return 5
- case *Array:
- return 6
- case Object:
- return 7
- case Set:
- return 8
- case *ArrayComprehension:
- return 9
- case *ObjectComprehension:
- return 10
- case *SetComprehension:
- return 11
- case Call:
- return 12
- case Args:
- return 13
- case *Expr:
- return 100
- case *SomeDecl:
- return 101
- case *Every:
- return 102
- case *With:
- return 110
- case *Head:
- return 120
- case Body:
- return 200
- case *Rule:
- return 1000
- case *Import:
- return 1001
- case *Package:
- return 1002
- case *Annotations:
- return 1003
- case *Module:
- return 10000
- }
- panic(fmt.Sprintf("illegal value: %T", x))
-}
-
-func importsCompare(a, b []*Import) int {
- minLen := len(a)
- if len(b) < minLen {
- minLen = len(b)
- }
- for i := 0; i < minLen; i++ {
- if cmp := a[i].Compare(b[i]); cmp != 0 {
- return cmp
- }
- }
- if len(a) < len(b) {
- return -1
- }
- if len(b) < len(a) {
- return 1
- }
- return 0
-}
-
-func annotationsCompare(a, b []*Annotations) int {
- minLen := len(a)
- if len(b) < minLen {
- minLen = len(b)
- }
- for i := 0; i < minLen; i++ {
- if cmp := a[i].Compare(b[i]); cmp != 0 {
- return cmp
- }
- }
- if len(a) < len(b) {
- return -1
- }
- if len(b) < len(a) {
- return 1
- }
- return 0
-}
-
-func rulesCompare(a, b []*Rule) int {
- minLen := len(a)
- if len(b) < minLen {
- minLen = len(b)
- }
- for i := 0; i < minLen; i++ {
- if cmp := a[i].Compare(b[i]); cmp != 0 {
- return cmp
- }
- }
- if len(a) < len(b) {
- return -1
- }
- if len(b) < len(a) {
- return 1
- }
- return 0
-}
-
-func termSliceCompare(a, b []*Term) int {
- minLen := len(a)
- if len(b) < minLen {
- minLen = len(b)
- }
- for i := 0; i < minLen; i++ {
- if cmp := Compare(a[i], b[i]); cmp != 0 {
- return cmp
- }
- }
- if len(a) < len(b) {
- return -1
- } else if len(b) < len(a) {
- return 1
- }
- return 0
-}
-
-func withSliceCompare(a, b []*With) int {
- minLen := len(a)
- if len(b) < minLen {
- minLen = len(b)
- }
- for i := 0; i < minLen; i++ {
- if cmp := Compare(a[i], b[i]); cmp != 0 {
- return cmp
- }
- }
- if len(a) < len(b) {
- return -1
- } else if len(b) < len(a) {
- return 1
- }
- return 0
+func Compare(a, b any) int {
+ return v1.Compare(a, b)
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/compile.go b/vendor/github.com/open-policy-agent/opa/ast/compile.go
index 9025f862b2..5a3daa910a 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/compile.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/compile.go
@@ -5,5882 +5,123 @@
package ast
import (
- "errors"
- "fmt"
- "io"
- "sort"
- "strconv"
- "strings"
-
- "github.com/open-policy-agent/opa/ast/location"
- "github.com/open-policy-agent/opa/internal/debug"
- "github.com/open-policy-agent/opa/internal/gojsonschema"
- "github.com/open-policy-agent/opa/metrics"
- "github.com/open-policy-agent/opa/types"
- "github.com/open-policy-agent/opa/util"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
// CompileErrorLimitDefault is the default number errors a compiler will allow before
// exiting.
const CompileErrorLimitDefault = 10
-var errLimitReached = NewError(CompileErr, nil, "error limit reached")
-
// Compiler contains the state of a compilation process.
-type Compiler struct {
-
- // Errors contains errors that occurred during the compilation process.
- // If there are one or more errors, the compilation process is considered
- // "failed".
- Errors Errors
-
- // Modules contains the compiled modules. The compiled modules are the
- // output of the compilation process. If the compilation process failed,
- // there is no guarantee about the state of the modules.
- Modules map[string]*Module
-
- // ModuleTree organizes the modules into a tree where each node is keyed by
- // an element in the module's package path. E.g., given modules containing
- // the following package directives: "a", "a.b", "a.c", and "a.b", the
- // resulting module tree would be:
- //
- // root
- // |
- // +--- data (no modules)
- // |
- // +--- a (1 module)
- // |
- // +--- b (2 modules)
- // |
- // +--- c (1 module)
- //
- ModuleTree *ModuleTreeNode
-
- // RuleTree organizes rules into a tree where each node is keyed by an
- // element in the rule's path. The rule path is the concatenation of the
- // containing package and the stringified rule name. E.g., given the
- // following module:
- //
- // package ex
- // p[1] { true }
- // p[2] { true }
- // q = true
- // a.b.c = 3
- //
- // root
- // |
- // +--- data (no rules)
- // |
- // +--- ex (no rules)
- // |
- // +--- p (2 rules)
- // |
- // +--- q (1 rule)
- // |
- // +--- a
- // |
- // +--- b
- // |
- // +--- c (1 rule)
- //
- // Another example with general refs containing vars at arbitrary locations:
- //
- // package ex
- // a.b[x].d { x := "c" } # R1
- // a.b.c[x] { x := "d" } # R2
- // a.b[x][y] { x := "c"; y := "d" } # R3
- // p := true # R4
- //
- // root
- // |
- // +--- data (no rules)
- // |
- // +--- ex (no rules)
- // |
- // +--- a
- // | |
- // | +--- b (R1, R3)
- // | |
- // | +--- c (R2)
- // |
- // +--- p (R4)
- RuleTree *TreeNode
-
- // Graph contains dependencies between rules. An edge (u,v) is added to the
- // graph if rule 'u' refers to the virtual document defined by 'v'.
- Graph *Graph
-
- // TypeEnv holds type information for values inferred by the compiler.
- TypeEnv *TypeEnv
-
- // RewrittenVars is a mapping of variables that have been rewritten
- // with the key being the generated name and value being the original.
- RewrittenVars map[Var]Var
-
- // Capabliities required by the modules that were compiled.
- Required *Capabilities
-
- localvargen *localVarGenerator
- moduleLoader ModuleLoader
- ruleIndices *util.HashMap
- stages []stage
- maxErrs int
- sorted []string // list of sorted module names
- pathExists func([]string) (bool, error)
- after map[string][]CompilerStageDefinition
- metrics metrics.Metrics
- capabilities *Capabilities // user-supplied capabilities
- imports map[string][]*Import // saved imports from stripping
- builtins map[string]*Builtin // universe of built-in functions
- customBuiltins map[string]*Builtin // user-supplied custom built-in functions (deprecated: use capabilities)
- unsafeBuiltinsMap map[string]struct{} // user-supplied set of unsafe built-ins functions to block (deprecated: use capabilities)
- deprecatedBuiltinsMap map[string]struct{} // set of deprecated, but not removed, built-in functions
- enablePrintStatements bool // indicates if print statements should be elided (default)
- comprehensionIndices map[*Term]*ComprehensionIndex // comprehension key index
- initialized bool // indicates if init() has been called
- debug debug.Debug // emits debug information produced during compilation
- schemaSet *SchemaSet // user-supplied schemas for input and data documents
- inputType types.Type // global input type retrieved from schema set
- annotationSet *AnnotationSet // hierarchical set of annotations
- strict bool // enforce strict compilation checks
- keepModules bool // whether to keep the unprocessed, parse modules (below)
- parsedModules map[string]*Module // parsed, but otherwise unprocessed modules, kept track of when keepModules is true
- useTypeCheckAnnotations bool // whether to provide annotated information (schemas) to the type checker
- allowUndefinedFuncCalls bool // don't error on calls to unknown functions.
- evalMode CompilerEvalMode //
- rewriteTestRulesForTracing bool // rewrite test rules to capture dynamic values for tracing.
-}
+type Compiler = v1.Compiler
// CompilerStage defines the interface for stages in the compiler.
-type CompilerStage func(*Compiler) *Error
+type CompilerStage = v1.CompilerStage
// CompilerEvalMode allows toggling certain stages that are only
// needed for certain modes, Concretely, only "topdown" mode will
// have the compiler build comprehension and rule indices.
-type CompilerEvalMode int
+type CompilerEvalMode = v1.CompilerEvalMode
const (
// EvalModeTopdown (default) instructs the compiler to build rule
// and comprehension indices used by topdown evaluation.
- EvalModeTopdown CompilerEvalMode = iota
+ EvalModeTopdown = v1.EvalModeTopdown
// EvalModeIR makes the compiler skip the stages for comprehension
// and rule indices.
- EvalModeIR
+ EvalModeIR = v1.EvalModeIR
)
// CompilerStageDefinition defines a compiler stage
-type CompilerStageDefinition struct {
- Name string
- MetricName string
- Stage CompilerStage
-}
+type CompilerStageDefinition = v1.CompilerStageDefinition
// RulesOptions defines the options for retrieving rules by Ref from the
// compiler.
-type RulesOptions struct {
- // IncludeHiddenModules determines if the result contains hidden modules,
- // currently only the "system" namespace, i.e. "data.system.*".
- IncludeHiddenModules bool
-}
+type RulesOptions = v1.RulesOptions
// QueryContext contains contextual information for running an ad-hoc query.
//
// Ad-hoc queries can be run in the context of a package and imports may be
// included to provide concise access to data.
-type QueryContext struct {
- Package *Package
- Imports []*Import
-}
+type QueryContext = v1.QueryContext
// NewQueryContext returns a new QueryContext object.
func NewQueryContext() *QueryContext {
- return &QueryContext{}
-}
-
-// WithPackage sets the pkg on qc.
-func (qc *QueryContext) WithPackage(pkg *Package) *QueryContext {
- if qc == nil {
- qc = NewQueryContext()
- }
- qc.Package = pkg
- return qc
-}
-
-// WithImports sets the imports on qc.
-func (qc *QueryContext) WithImports(imports []*Import) *QueryContext {
- if qc == nil {
- qc = NewQueryContext()
- }
- qc.Imports = imports
- return qc
-}
-
-// Copy returns a deep copy of qc.
-func (qc *QueryContext) Copy() *QueryContext {
- if qc == nil {
- return nil
- }
- cpy := *qc
- if cpy.Package != nil {
- cpy.Package = qc.Package.Copy()
- }
- cpy.Imports = make([]*Import, len(qc.Imports))
- for i := range qc.Imports {
- cpy.Imports[i] = qc.Imports[i].Copy()
- }
- return &cpy
+ return v1.NewQueryContext()
}
// QueryCompiler defines the interface for compiling ad-hoc queries.
-type QueryCompiler interface {
-
- // Compile should be called to compile ad-hoc queries. The return value is
- // the compiled version of the query.
- Compile(q Body) (Body, error)
-
- // TypeEnv returns the type environment built after running type checking
- // on the query.
- TypeEnv() *TypeEnv
-
- // WithContext sets the QueryContext on the QueryCompiler. Subsequent calls
- // to Compile will take the QueryContext into account.
- WithContext(qctx *QueryContext) QueryCompiler
-
- // WithEnablePrintStatements enables print statements in queries compiled
- // with the QueryCompiler.
- WithEnablePrintStatements(yes bool) QueryCompiler
-
- // WithUnsafeBuiltins sets the built-in functions to treat as unsafe and not
- // allow inside of queries. By default the query compiler inherits the
- // compiler's unsafe built-in functions. This function allows callers to
- // override that set. If an empty (non-nil) map is provided, all built-ins
- // are allowed.
- WithUnsafeBuiltins(unsafe map[string]struct{}) QueryCompiler
-
- // WithStageAfter registers a stage to run during query compilation after
- // the named stage.
- WithStageAfter(after string, stage QueryCompilerStageDefinition) QueryCompiler
-
- // RewrittenVars maps generated vars in the compiled query to vars from the
- // parsed query. For example, given the query "input := 1" the rewritten
- // query would be "__local0__ = 1". The mapping would then be {__local0__: input}.
- RewrittenVars() map[Var]Var
-
- // ComprehensionIndex returns an index data structure for the given comprehension
- // term. If no index is found, returns nil.
- ComprehensionIndex(term *Term) *ComprehensionIndex
-
- // WithStrict enables strict mode for the query compiler.
- WithStrict(strict bool) QueryCompiler
-}
+type QueryCompiler = v1.QueryCompiler
// QueryCompilerStage defines the interface for stages in the query compiler.
-type QueryCompilerStage func(QueryCompiler, Body) (Body, error)
+type QueryCompilerStage = v1.QueryCompilerStage
// QueryCompilerStageDefinition defines a QueryCompiler stage
-type QueryCompilerStageDefinition struct {
- Name string
- MetricName string
- Stage QueryCompilerStage
-}
-
-type stage struct {
- name string
- metricName string
- f func()
-}
+type QueryCompilerStageDefinition = v1.QueryCompilerStageDefinition
// NewCompiler returns a new empty compiler.
func NewCompiler() *Compiler {
-
- c := &Compiler{
- Modules: map[string]*Module{},
- RewrittenVars: map[Var]Var{},
- Required: &Capabilities{},
- ruleIndices: util.NewHashMap(func(a, b util.T) bool {
- r1, r2 := a.(Ref), b.(Ref)
- return r1.Equal(r2)
- }, func(x util.T) int {
- return x.(Ref).Hash()
- }),
- maxErrs: CompileErrorLimitDefault,
- after: map[string][]CompilerStageDefinition{},
- unsafeBuiltinsMap: map[string]struct{}{},
- deprecatedBuiltinsMap: map[string]struct{}{},
- comprehensionIndices: map[*Term]*ComprehensionIndex{},
- debug: debug.Discard(),
- }
-
- c.ModuleTree = NewModuleTree(nil)
- c.RuleTree = NewRuleTree(c.ModuleTree)
-
- c.stages = []stage{
- // Reference resolution should run first as it may be used to lazily
- // load additional modules. If any stages run before resolution, they
- // need to be re-run after resolution.
- {"ResolveRefs", "compile_stage_resolve_refs", c.resolveAllRefs},
- // The local variable generator must be initialized after references are
- // resolved and the dynamic module loader has run but before subsequent
- // stages that need to generate variables.
- {"InitLocalVarGen", "compile_stage_init_local_var_gen", c.initLocalVarGen},
- {"RewriteRuleHeadRefs", "compile_stage_rewrite_rule_head_refs", c.rewriteRuleHeadRefs},
- {"CheckKeywordOverrides", "compile_stage_check_keyword_overrides", c.checkKeywordOverrides},
- {"CheckDuplicateImports", "compile_stage_check_duplicate_imports", c.checkDuplicateImports},
- {"RemoveImports", "compile_stage_remove_imports", c.removeImports},
- {"SetModuleTree", "compile_stage_set_module_tree", c.setModuleTree},
- {"SetRuleTree", "compile_stage_set_rule_tree", c.setRuleTree}, // depends on RewriteRuleHeadRefs
- {"RewriteLocalVars", "compile_stage_rewrite_local_vars", c.rewriteLocalVars},
- {"CheckVoidCalls", "compile_stage_check_void_calls", c.checkVoidCalls},
- {"RewritePrintCalls", "compile_stage_rewrite_print_calls", c.rewritePrintCalls},
- {"RewriteExprTerms", "compile_stage_rewrite_expr_terms", c.rewriteExprTerms},
- {"ParseMetadataBlocks", "compile_stage_parse_metadata_blocks", c.parseMetadataBlocks},
- {"SetAnnotationSet", "compile_stage_set_annotationset", c.setAnnotationSet},
- {"RewriteRegoMetadataCalls", "compile_stage_rewrite_rego_metadata_calls", c.rewriteRegoMetadataCalls},
- {"SetGraph", "compile_stage_set_graph", c.setGraph},
- {"RewriteComprehensionTerms", "compile_stage_rewrite_comprehension_terms", c.rewriteComprehensionTerms},
- {"RewriteRefsInHead", "compile_stage_rewrite_refs_in_head", c.rewriteRefsInHead},
- {"RewriteWithValues", "compile_stage_rewrite_with_values", c.rewriteWithModifiers},
- {"CheckRuleConflicts", "compile_stage_check_rule_conflicts", c.checkRuleConflicts},
- {"CheckUndefinedFuncs", "compile_stage_check_undefined_funcs", c.checkUndefinedFuncs},
- {"CheckSafetyRuleHeads", "compile_stage_check_safety_rule_heads", c.checkSafetyRuleHeads},
- {"CheckSafetyRuleBodies", "compile_stage_check_safety_rule_bodies", c.checkSafetyRuleBodies},
- {"RewriteEquals", "compile_stage_rewrite_equals", c.rewriteEquals},
- {"RewriteDynamicTerms", "compile_stage_rewrite_dynamic_terms", c.rewriteDynamicTerms},
- {"RewriteTestRulesForTracing", "compile_stage_rewrite_test_rules_for_tracing", c.rewriteTestRuleEqualities}, // must run after RewriteDynamicTerms
- {"CheckRecursion", "compile_stage_check_recursion", c.checkRecursion},
- {"CheckTypes", "compile_stage_check_types", c.checkTypes}, // must be run after CheckRecursion
- {"CheckUnsafeBuiltins", "compile_state_check_unsafe_builtins", c.checkUnsafeBuiltins},
- {"CheckDeprecatedBuiltins", "compile_state_check_deprecated_builtins", c.checkDeprecatedBuiltins},
- {"BuildRuleIndices", "compile_stage_rebuild_indices", c.buildRuleIndices},
- {"BuildComprehensionIndices", "compile_stage_rebuild_comprehension_indices", c.buildComprehensionIndices},
- {"BuildRequiredCapabilities", "compile_stage_build_required_capabilities", c.buildRequiredCapabilities},
- }
-
- return c
-}
-
-// SetErrorLimit sets the number of errors the compiler can encounter before it
-// quits. Zero or a negative number indicates no limit.
-func (c *Compiler) SetErrorLimit(limit int) *Compiler {
- c.maxErrs = limit
- return c
-}
-
-// WithEnablePrintStatements enables print statements inside of modules compiled
-// by the compiler. If print statements are not enabled, calls to print() are
-// erased at compile-time.
-func (c *Compiler) WithEnablePrintStatements(yes bool) *Compiler {
- c.enablePrintStatements = yes
- return c
-}
-
-// WithPathConflictsCheck enables base-virtual document conflict
-// detection. The compiler will check that rules don't overlap with
-// paths that exist as determined by the provided callable.
-func (c *Compiler) WithPathConflictsCheck(fn func([]string) (bool, error)) *Compiler {
- c.pathExists = fn
- return c
-}
-
-// WithStageAfter registers a stage to run during compilation after
-// the named stage.
-func (c *Compiler) WithStageAfter(after string, stage CompilerStageDefinition) *Compiler {
- c.after[after] = append(c.after[after], stage)
- return c
-}
-
-// WithMetrics will set a metrics.Metrics and be used for profiling
-// the Compiler instance.
-func (c *Compiler) WithMetrics(metrics metrics.Metrics) *Compiler {
- c.metrics = metrics
- return c
-}
-
-// WithCapabilities sets capabilities to enable during compilation. Capabilities allow the caller
-// to specify the set of built-in functions available to the policy. In the future, capabilities
-// may be able to restrict access to other language features. Capabilities allow callers to check
-// if policies are compatible with a particular version of OPA. If policies are a compiled for a
-// specific version of OPA, there is no guarantee that _this_ version of OPA can evaluate them
-// successfully.
-func (c *Compiler) WithCapabilities(capabilities *Capabilities) *Compiler {
- c.capabilities = capabilities
- return c
-}
-
-// Capabilities returns the capabilities enabled during compilation.
-func (c *Compiler) Capabilities() *Capabilities {
- return c.capabilities
-}
-
-// WithDebug sets where debug messages are written to. Passing `nil` has no
-// effect.
-func (c *Compiler) WithDebug(sink io.Writer) *Compiler {
- if sink != nil {
- c.debug = debug.New(sink)
- }
- return c
-}
-
-// WithBuiltins is deprecated. Use WithCapabilities instead.
-func (c *Compiler) WithBuiltins(builtins map[string]*Builtin) *Compiler {
- c.customBuiltins = make(map[string]*Builtin)
- for k, v := range builtins {
- c.customBuiltins[k] = v
- }
- return c
-}
-
-// WithUnsafeBuiltins is deprecated. Use WithCapabilities instead.
-func (c *Compiler) WithUnsafeBuiltins(unsafeBuiltins map[string]struct{}) *Compiler {
- for name := range unsafeBuiltins {
- c.unsafeBuiltinsMap[name] = struct{}{}
- }
- return c
-}
-
-// WithStrict enables strict mode in the compiler.
-func (c *Compiler) WithStrict(strict bool) *Compiler {
- c.strict = strict
- return c
-}
-
-// WithKeepModules enables retaining unprocessed modules in the compiler.
-// Note that the modules aren't copied on the way in or out -- so when
-// accessing them via ParsedModules(), mutations will occur in the module
-// map that was passed into Compile().`
-func (c *Compiler) WithKeepModules(y bool) *Compiler {
- c.keepModules = y
- return c
-}
-
-// WithUseTypeCheckAnnotations use schema annotations during type checking
-func (c *Compiler) WithUseTypeCheckAnnotations(enabled bool) *Compiler {
- c.useTypeCheckAnnotations = enabled
- return c
-}
-
-func (c *Compiler) WithAllowUndefinedFunctionCalls(allow bool) *Compiler {
- c.allowUndefinedFuncCalls = allow
- return c
-}
-
-// WithEvalMode allows setting the CompilerEvalMode of the compiler
-func (c *Compiler) WithEvalMode(e CompilerEvalMode) *Compiler {
- c.evalMode = e
- return c
-}
-
-// WithRewriteTestRules enables rewriting test rules to capture dynamic values in local variables,
-// so they can be accessed by tracing.
-func (c *Compiler) WithRewriteTestRules(rewrite bool) *Compiler {
- c.rewriteTestRulesForTracing = rewrite
- return c
-}
-
-// ParsedModules returns the parsed, unprocessed modules from the compiler.
-// It is `nil` if keeping modules wasn't enabled via `WithKeepModules(true)`.
-// The map includes all modules loaded via the ModuleLoader, if one was used.
-func (c *Compiler) ParsedModules() map[string]*Module {
- return c.parsedModules
-}
-
-func (c *Compiler) QueryCompiler() QueryCompiler {
- c.init()
- c0 := *c
- return newQueryCompiler(&c0)
-}
-
-// Compile runs the compilation process on the input modules. The compiled
-// version of the modules and associated data structures are stored on the
-// compiler. If the compilation process fails for any reason, the compiler will
-// contain a slice of errors.
-func (c *Compiler) Compile(modules map[string]*Module) {
-
- c.init()
-
- c.Modules = make(map[string]*Module, len(modules))
- c.sorted = make([]string, 0, len(modules))
-
- if c.keepModules {
- c.parsedModules = make(map[string]*Module, len(modules))
- } else {
- c.parsedModules = nil
- }
-
- for k, v := range modules {
- c.Modules[k] = v.Copy()
- c.sorted = append(c.sorted, k)
- if c.parsedModules != nil {
- c.parsedModules[k] = v
- }
- }
-
- sort.Strings(c.sorted)
-
- c.compile()
-}
-
-// WithSchemas sets a schemaSet to the compiler
-func (c *Compiler) WithSchemas(schemas *SchemaSet) *Compiler {
- c.schemaSet = schemas
- return c
-}
-
-// Failed returns true if a compilation error has been encountered.
-func (c *Compiler) Failed() bool {
- return len(c.Errors) > 0
-}
-
-// ComprehensionIndex returns a data structure specifying how to index comprehension
-// results so that callers do not have to recompute the comprehension more than once.
-// If no index is found, returns nil.
-func (c *Compiler) ComprehensionIndex(term *Term) *ComprehensionIndex {
- return c.comprehensionIndices[term]
-}
-
-// GetArity returns the number of args a function referred to by ref takes. If
-// ref refers to built-in function, the built-in declaration is consulted,
-// otherwise, the ref is used to perform a ruleset lookup.
-func (c *Compiler) GetArity(ref Ref) int {
- if bi := c.builtins[ref.String()]; bi != nil {
- return len(bi.Decl.FuncArgs().Args)
- }
- rules := c.GetRulesExact(ref)
- if len(rules) == 0 {
- return -1
- }
- return len(rules[0].Head.Args)
-}
-
-// GetRulesExact returns a slice of rules referred to by the reference.
-//
-// E.g., given the following module:
-//
-// package a.b.c
-//
-// p[k] = v { ... } # rule1
-// p[k1] = v1 { ... } # rule2
-//
-// The following calls yield the rules on the right.
-//
-// GetRulesExact("data.a.b.c.p") => [rule1, rule2]
-// GetRulesExact("data.a.b.c.p.x") => nil
-// GetRulesExact("data.a.b.c") => nil
-func (c *Compiler) GetRulesExact(ref Ref) (rules []*Rule) {
- node := c.RuleTree
-
- for _, x := range ref {
- if node = node.Child(x.Value); node == nil {
- return nil
- }
- }
-
- return extractRules(node.Values)
-}
-
-// GetRulesForVirtualDocument returns a slice of rules that produce the virtual
-// document referred to by the reference.
-//
-// E.g., given the following module:
-//
-// package a.b.c
-//
-// p[k] = v { ... } # rule1
-// p[k1] = v1 { ... } # rule2
-//
-// The following calls yield the rules on the right.
-//
-// GetRulesForVirtualDocument("data.a.b.c.p") => [rule1, rule2]
-// GetRulesForVirtualDocument("data.a.b.c.p.x") => [rule1, rule2]
-// GetRulesForVirtualDocument("data.a.b.c") => nil
-func (c *Compiler) GetRulesForVirtualDocument(ref Ref) (rules []*Rule) {
-
- node := c.RuleTree
-
- for _, x := range ref {
- if node = node.Child(x.Value); node == nil {
- return nil
- }
- if len(node.Values) > 0 {
- return extractRules(node.Values)
- }
- }
-
- return extractRules(node.Values)
-}
-
-// GetRulesWithPrefix returns a slice of rules that share the prefix ref.
-//
-// E.g., given the following module:
-//
-// package a.b.c
-//
-// p[x] = y { ... } # rule1
-// p[k] = v { ... } # rule2
-// q { ... } # rule3
-//
-// The following calls yield the rules on the right.
-//
-// GetRulesWithPrefix("data.a.b.c.p") => [rule1, rule2]
-// GetRulesWithPrefix("data.a.b.c.p.a") => nil
-// GetRulesWithPrefix("data.a.b.c") => [rule1, rule2, rule3]
-func (c *Compiler) GetRulesWithPrefix(ref Ref) (rules []*Rule) {
-
- node := c.RuleTree
-
- for _, x := range ref {
- if node = node.Child(x.Value); node == nil {
- return nil
- }
- }
-
- var acc func(node *TreeNode)
-
- acc = func(node *TreeNode) {
- rules = append(rules, extractRules(node.Values)...)
- for _, child := range node.Children {
- if child.Hide {
- continue
- }
- acc(child)
- }
- }
-
- acc(node)
-
- return rules
-}
-
-func extractRules(s []util.T) []*Rule {
- rules := make([]*Rule, len(s))
- for i := range s {
- rules[i] = s[i].(*Rule)
- }
- return rules
-}
-
-// GetRules returns a slice of rules that are referred to by ref.
-//
-// E.g., given the following module:
-//
-// package a.b.c
-//
-// p[x] = y { q[x] = y; ... } # rule1
-// q[x] = y { ... } # rule2
-//
-// The following calls yield the rules on the right.
-//
-// GetRules("data.a.b.c.p") => [rule1]
-// GetRules("data.a.b.c.p.x") => [rule1]
-// GetRules("data.a.b.c.q") => [rule2]
-// GetRules("data.a.b.c") => [rule1, rule2]
-// GetRules("data.a.b.d") => nil
-func (c *Compiler) GetRules(ref Ref) (rules []*Rule) {
-
- set := map[*Rule]struct{}{}
-
- for _, rule := range c.GetRulesForVirtualDocument(ref) {
- set[rule] = struct{}{}
- }
-
- for _, rule := range c.GetRulesWithPrefix(ref) {
- set[rule] = struct{}{}
- }
-
- for rule := range set {
- rules = append(rules, rule)
- }
-
- return rules
-}
-
-// GetRulesDynamic returns a slice of rules that could be referred to by a ref.
-//
-// Deprecated: use GetRulesDynamicWithOpts
-func (c *Compiler) GetRulesDynamic(ref Ref) []*Rule {
- return c.GetRulesDynamicWithOpts(ref, RulesOptions{})
-}
-
-// GetRulesDynamicWithOpts returns a slice of rules that could be referred to by
-// a ref.
-// When parts of the ref are statically known, we use that information to narrow
-// down which rules the ref could refer to, but in the most general case this
-// will be an over-approximation.
-//
-// E.g., given the following modules:
-//
-// package a.b.c
-//
-// r1 = 1 # rule1
-//
-// and:
-//
-// package a.d.c
-//
-// r2 = 2 # rule2
-//
-// The following calls yield the rules on the right.
-//
-// GetRulesDynamicWithOpts("data.a[x].c[y]", opts) => [rule1, rule2]
-// GetRulesDynamicWithOpts("data.a[x].c.r2", opts) => [rule2]
-// GetRulesDynamicWithOpts("data.a.b[x][y]", opts) => [rule1]
-//
-// Using the RulesOptions parameter, the inclusion of hidden modules can be
-// controlled:
-//
-// With
-//
-// package system.main
-//
-// r3 = 3 # rule3
-//
-// We'd get this result:
-//
-// GetRulesDynamicWithOpts("data[x]", RulesOptions{IncludeHiddenModules: true}) => [rule1, rule2, rule3]
-//
-// Without the options, it would be excluded.
-func (c *Compiler) GetRulesDynamicWithOpts(ref Ref, opts RulesOptions) []*Rule {
- node := c.RuleTree
-
- set := map[*Rule]struct{}{}
- var walk func(node *TreeNode, i int)
- walk = func(node *TreeNode, i int) {
- switch {
- case i >= len(ref):
- // We've reached the end of the reference and want to collect everything
- // under this "prefix".
- node.DepthFirst(func(descendant *TreeNode) bool {
- insertRules(set, descendant.Values)
- if opts.IncludeHiddenModules {
- return false
- }
- return descendant.Hide
- })
-
- case i == 0 || IsConstant(ref[i].Value):
- // The head of the ref is always grounded. In case another part of the
- // ref is also grounded, we can lookup the exact child. If it's not found
- // we can immediately return...
- if child := node.Child(ref[i].Value); child != nil {
- if len(child.Values) > 0 {
- // Add any rules at this position
- insertRules(set, child.Values)
- }
- // There might still be "sub-rules" contributing key-value "overrides" for e.g. partial object rules, continue walking
- walk(child, i+1)
- } else {
- return
- }
-
- default:
- // This part of the ref is a dynamic term. We can't know what it refers
- // to and will just need to try all of the children.
- for _, child := range node.Children {
- if child.Hide && !opts.IncludeHiddenModules {
- continue
- }
- insertRules(set, child.Values)
- walk(child, i+1)
- }
- }
- }
-
- walk(node, 0)
- rules := make([]*Rule, 0, len(set))
- for rule := range set {
- rules = append(rules, rule)
- }
- return rules
-}
-
-// Utility: add all rule values to the set.
-func insertRules(set map[*Rule]struct{}, rules []util.T) {
- for _, rule := range rules {
- set[rule.(*Rule)] = struct{}{}
- }
-}
-
-// RuleIndex returns a RuleIndex built for the rule set referred to by path.
-// The path must refer to the rule set exactly, i.e., given a rule set at path
-// data.a.b.c.p, refs data.a.b.c.p.x and data.a.b.c would not return a
-// RuleIndex built for the rule.
-func (c *Compiler) RuleIndex(path Ref) RuleIndex {
- r, ok := c.ruleIndices.Get(path)
- if !ok {
- return nil
- }
- return r.(RuleIndex)
-}
-
-// PassesTypeCheck determines whether the given body passes type checking
-func (c *Compiler) PassesTypeCheck(body Body) bool {
- checker := newTypeChecker().WithSchemaSet(c.schemaSet).WithInputType(c.inputType)
- env := c.TypeEnv
- _, errs := checker.CheckBody(env, body)
- return len(errs) == 0
-}
-
-// PassesTypeCheckRules determines whether the given rules passes type checking
-func (c *Compiler) PassesTypeCheckRules(rules []*Rule) Errors {
- elems := []util.T{}
-
- for _, rule := range rules {
- elems = append(elems, rule)
- }
-
- // Load the global input schema if one was provided.
- if c.schemaSet != nil {
- if schema := c.schemaSet.Get(SchemaRootRef); schema != nil {
-
- var allowNet []string
- if c.capabilities != nil {
- allowNet = c.capabilities.AllowNet
- }
-
- tpe, err := loadSchema(schema, allowNet)
- if err != nil {
- return Errors{NewError(TypeErr, nil, err.Error())}
- }
- c.inputType = tpe
- }
- }
-
- var as *AnnotationSet
- if c.useTypeCheckAnnotations {
- as = c.annotationSet
- }
-
- checker := newTypeChecker().WithSchemaSet(c.schemaSet).WithInputType(c.inputType)
-
- if c.TypeEnv == nil {
- if c.capabilities == nil {
- c.capabilities = CapabilitiesForThisVersion()
- }
-
- c.builtins = make(map[string]*Builtin, len(c.capabilities.Builtins)+len(c.customBuiltins))
-
- for _, bi := range c.capabilities.Builtins {
- c.builtins[bi.Name] = bi
- }
-
- for name, bi := range c.customBuiltins {
- c.builtins[name] = bi
- }
-
- c.TypeEnv = checker.Env(c.builtins)
- }
-
- _, errs := checker.CheckTypes(c.TypeEnv, elems, as)
- return errs
+ return v1.NewCompiler().WithDefaultRegoVersion(DefaultRegoVersion)
}
// ModuleLoader defines the interface that callers can implement to enable lazy
// loading of modules during compilation.
-type ModuleLoader func(resolved map[string]*Module) (parsed map[string]*Module, err error)
-
-// WithModuleLoader sets f as the ModuleLoader on the compiler.
-//
-// The compiler will invoke the ModuleLoader after resolving all references in
-// the current set of input modules. The ModuleLoader can return a new
-// collection of parsed modules that are to be included in the compilation
-// process. This process will repeat until the ModuleLoader returns an empty
-// collection or an error. If an error is returned, compilation will stop
-// immediately.
-func (c *Compiler) WithModuleLoader(f ModuleLoader) *Compiler {
- c.moduleLoader = f
- return c
-}
-
-func (c *Compiler) counterAdd(name string, n uint64) {
- if c.metrics == nil {
- return
- }
- c.metrics.Counter(name).Add(n)
-}
-
-func (c *Compiler) buildRuleIndices() {
-
- c.RuleTree.DepthFirst(func(node *TreeNode) bool {
- if len(node.Values) == 0 {
- return false
- }
- rules := extractRules(node.Values)
- hasNonGroundRef := false
- for _, r := range rules {
- hasNonGroundRef = !r.Head.Ref().IsGround()
- }
- if hasNonGroundRef {
- // Collect children to ensure that all rules within the extent of a rule with a general ref
- // are found on the same index. E.g. the following rules should be indexed under data.a.b.c:
- //
- // package a
- // b.c[x].e := 1 { x := input.x }
- // b.c.d := 2
- // b.c.d2.e[x] := 3 { x := input.x }
- for _, child := range node.Children {
- child.DepthFirst(func(c *TreeNode) bool {
- rules = append(rules, extractRules(c.Values)...)
- return false
- })
- }
- }
-
- index := newBaseDocEqIndex(func(ref Ref) bool {
- return isVirtual(c.RuleTree, ref.GroundPrefix())
- })
- if index.Build(rules) {
- c.ruleIndices.Put(rules[0].Ref().GroundPrefix(), index)
- }
- return hasNonGroundRef // currently, we don't allow those branches to go deeper
- })
-
-}
-
-func (c *Compiler) buildComprehensionIndices() {
- for _, name := range c.sorted {
- WalkRules(c.Modules[name], func(r *Rule) bool {
- candidates := r.Head.Args.Vars()
- candidates.Update(ReservedVars)
- n := buildComprehensionIndices(c.debug, c.GetArity, candidates, c.RewrittenVars, r.Body, c.comprehensionIndices)
- c.counterAdd(compileStageComprehensionIndexBuild, n)
- return false
- })
- }
-}
+type ModuleLoader = v1.ModuleLoader
-// buildRequiredCapabilities updates the required capabilities on the compiler
-// to include any keyword and feature dependencies present in the modules. The
-// built-in function dependencies will have already been added by the type
-// checker.
-func (c *Compiler) buildRequiredCapabilities() {
-
- features := map[string]struct{}{}
-
- // extract required keywords from modules
- keywords := map[string]struct{}{}
- futureKeywordsPrefix := Ref{FutureRootDocument, StringTerm("keywords")}
- for _, name := range c.sorted {
- for _, imp := range c.imports[name] {
- path := imp.Path.Value.(Ref)
- switch {
- case path.Equal(RegoV1CompatibleRef):
- features[FeatureRegoV1Import] = struct{}{}
- case path.HasPrefix(futureKeywordsPrefix):
- if len(path) == 2 {
- for kw := range futureKeywords {
- keywords[kw] = struct{}{}
- }
- } else {
- keywords[string(path[2].Value.(String))] = struct{}{}
- }
- }
- }
- }
-
- c.Required.FutureKeywords = stringMapToSortedSlice(keywords)
-
- // extract required features from modules
-
- for _, name := range c.sorted {
- for _, rule := range c.Modules[name].Rules {
- refLen := len(rule.Head.Reference)
- if refLen >= 3 {
- if refLen > len(rule.Head.Reference.ConstantPrefix()) {
- features[FeatureRefHeads] = struct{}{}
- } else {
- features[FeatureRefHeadStringPrefixes] = struct{}{}
- }
- }
- }
- }
-
- c.Required.Features = stringMapToSortedSlice(features)
-
- for i, bi := range c.Required.Builtins {
- c.Required.Builtins[i] = bi.Minimal()
- }
-}
-
-func stringMapToSortedSlice(xs map[string]struct{}) []string {
- if len(xs) == 0 {
- return nil
- }
- s := make([]string, 0, len(xs))
- for k := range xs {
- s = append(s, k)
- }
- sort.Strings(s)
- return s
-}
-
-// checkRecursion ensures that there are no recursive definitions, i.e., there are
-// no cycles in the Graph.
-func (c *Compiler) checkRecursion() {
- eq := func(a, b util.T) bool {
- return a.(*Rule) == b.(*Rule)
- }
-
- c.RuleTree.DepthFirst(func(node *TreeNode) bool {
- for _, rule := range node.Values {
- for node := rule.(*Rule); node != nil; node = node.Else {
- c.checkSelfPath(node.Loc(), eq, node, node)
- }
- }
- return false
- })
-}
-
-func (c *Compiler) checkSelfPath(loc *Location, eq func(a, b util.T) bool, a, b util.T) {
- tr := NewGraphTraversal(c.Graph)
- if p := util.DFSPath(tr, eq, a, b); len(p) > 0 {
- n := make([]string, 0, len(p))
- for _, x := range p {
- n = append(n, astNodeToString(x))
- }
- c.err(NewError(RecursionErr, loc, "rule %v is recursive: %v", astNodeToString(a), strings.Join(n, " -> ")))
- }
-}
-
-func astNodeToString(x interface{}) string {
- return x.(*Rule).Ref().String()
-}
-
-// checkRuleConflicts ensures that rules definitions are not in conflict.
-func (c *Compiler) checkRuleConflicts() {
- rw := rewriteVarsInRef(c.RewrittenVars)
-
- c.RuleTree.DepthFirst(func(node *TreeNode) bool {
- if len(node.Values) == 0 {
- return false // go deeper
- }
-
- kinds := make(map[RuleKind]struct{}, len(node.Values))
- defaultRules := 0
- completeRules := 0
- partialRules := 0
- arities := make(map[int]struct{}, len(node.Values))
- name := ""
- var conflicts []Ref
-
- for _, rule := range node.Values {
- r := rule.(*Rule)
- ref := r.Ref()
- name = rw(ref.Copy()).String() // varRewriter operates in-place
- kinds[r.Head.RuleKind()] = struct{}{}
- arities[len(r.Head.Args)] = struct{}{}
- if r.Default {
- defaultRules++
- }
-
- // Single-value rules may not have any other rules in their extent.
- // Rules with vars in their ref are allowed to have rules inside their extent.
- // Only the ground portion (terms before the first var term) of a rule's ref is considered when determining
- // whether it's inside the extent of another (c.RuleTree is organized this way already).
- // These pairs are invalid:
- //
- // data.p.q.r { true } # data.p.q is { "r": true }
- // data.p.q.r.s { true }
- //
- // data.p.q.r { true }
- // data.p.q.r[s].t { s = input.key }
- //
- // But this is allowed:
- //
- // data.p.q.r { true }
- // data.p.q[r].s.t { r = input.key }
- //
- // data.p[r] := x { r = input.key; x = input.bar }
- // data.p.q[r] := x { r = input.key; x = input.bar }
- //
- // data.p.q[r] { r := input.r }
- // data.p.q.r.s { true }
- //
- // data.p.q[r] = 1 { r := "r" }
- // data.p.q.s = 2
- //
- // data.p[q][r] { q := input.q; r := input.r }
- // data.p.q.r { true }
- //
- // data.p.q[r] { r := input.r }
- // data.p[q].r { q := input.q }
- //
- // data.p.q[r][s] { r := input.r; s := input.s }
- // data.p[q].r.s { q := input.q }
-
- if r.Ref().IsGround() && len(node.Children) > 0 {
- conflicts = node.flattenChildren()
- }
-
- if r.Head.RuleKind() == SingleValue && r.Head.Ref().IsGround() {
- completeRules++
- } else {
- partialRules++
- }
- }
-
- switch {
- case conflicts != nil:
- c.err(NewError(TypeErr, node.Values[0].(*Rule).Loc(), "rule %v conflicts with %v", name, conflicts))
-
- case len(kinds) > 1 || len(arities) > 1 || (completeRules >= 1 && partialRules >= 1):
- c.err(NewError(TypeErr, node.Values[0].(*Rule).Loc(), "conflicting rules %v found", name))
-
- case defaultRules > 1:
- c.err(NewError(TypeErr, node.Values[0].(*Rule).Loc(), "multiple default rules %s found", name))
- }
-
- return false
- })
+// SafetyCheckVisitorParams defines the AST visitor parameters to use for collecting
+// variables during the safety check. This has to be exported because it's relied on
+// by the copy propagation implementation in topdown.
+var SafetyCheckVisitorParams = v1.SafetyCheckVisitorParams
- if c.pathExists != nil {
- for _, err := range CheckPathConflicts(c, c.pathExists) {
- c.err(err)
- }
- }
+// ComprehensionIndex specifies how the comprehension term can be indexed. The keys
+// tell the evaluator what variables to use for indexing. In the future, the index
+// could be expanded with more information that would allow the evaluator to index
+// a larger fragment of comprehensions (e.g., by closing over variables in the outer
+// query.)
+type ComprehensionIndex = v1.ComprehensionIndex
- // NOTE(sr): depthfirst might better use sorted for stable errs?
- c.ModuleTree.DepthFirst(func(node *ModuleTreeNode) bool {
- for _, mod := range node.Modules {
- for _, rule := range mod.Rules {
- ref := rule.Head.Ref().GroundPrefix()
- // Rules with a dynamic portion in their ref are exempted, as a conflict within the dynamic portion
- // can only be detected at eval-time.
- if len(ref) < len(rule.Head.Ref()) {
- continue
- }
+// ModuleTreeNode represents a node in the module tree. The module
+// tree is keyed by the package path.
+type ModuleTreeNode = v1.ModuleTreeNode
- childNode, tail := node.find(ref)
- if childNode != nil && len(tail) == 0 {
- for _, childMod := range childNode.Modules {
- // Avoid recursively checking a module for equality unless we know it's a possible self-match.
- if childMod.Equal(mod) {
- continue // don't self-conflict
- }
- msg := fmt.Sprintf("%v conflicts with rule %v defined at %v", childMod.Package, rule.Head.Ref(), rule.Loc())
- c.err(NewError(TypeErr, mod.Package.Loc(), msg))
- }
- }
- }
- }
- return false
- })
-}
+// TreeNode represents a node in the rule tree. The rule tree is keyed by
+// rule path.
+type TreeNode = v1.TreeNode
-func (c *Compiler) checkUndefinedFuncs() {
- for _, name := range c.sorted {
- m := c.Modules[name]
- for _, err := range checkUndefinedFuncs(c.TypeEnv, m, c.GetArity, c.RewrittenVars) {
- c.err(err)
- }
- }
+// NewRuleTree returns a new TreeNode that represents the root
+// of the rule tree populated with the given rules.
+func NewRuleTree(mtree *ModuleTreeNode) *TreeNode {
+ return v1.NewRuleTree(mtree)
}
-func checkUndefinedFuncs(env *TypeEnv, x interface{}, arity func(Ref) int, rwVars map[Var]Var) Errors {
-
- var errs Errors
-
- WalkExprs(x, func(expr *Expr) bool {
- if !expr.IsCall() {
- return false
- }
- ref := expr.Operator()
- if arity := arity(ref); arity >= 0 {
- operands := len(expr.Operands())
- if expr.Generated { // an output var was added
- if !expr.IsEquality() && operands != arity+1 {
- ref = rewriteVarsInRef(rwVars)(ref)
- errs = append(errs, arityMismatchError(env, ref, expr, arity, operands-1))
- return true
- }
- } else { // either output var or not
- if operands != arity && operands != arity+1 {
- ref = rewriteVarsInRef(rwVars)(ref)
- errs = append(errs, arityMismatchError(env, ref, expr, arity, operands))
- return true
- }
- }
- return false
- }
- ref = rewriteVarsInRef(rwVars)(ref)
- errs = append(errs, NewError(TypeErr, expr.Loc(), "undefined function %v", ref))
- return true
- })
-
- return errs
-}
+// Graph represents the graph of dependencies between rules.
+type Graph = v1.Graph
-func arityMismatchError(env *TypeEnv, f Ref, expr *Expr, exp, act int) *Error {
- if want, ok := env.Get(f).(*types.Function); ok { // generate richer error for built-in functions
- have := make([]types.Type, len(expr.Operands()))
- for i, op := range expr.Operands() {
- have[i] = env.Get(op)
- }
- return newArgError(expr.Loc(), f, "arity mismatch", have, want.NamedFuncArgs())
- }
- if act != 1 {
- return NewError(TypeErr, expr.Loc(), "function %v has arity %d, got %d arguments", f, exp, act)
- }
- return NewError(TypeErr, expr.Loc(), "function %v has arity %d, got %d argument", f, exp, act)
+// NewGraph returns a new Graph based on modules. The list function must return
+// the rules referred to directly by the ref.
+func NewGraph(modules map[string]*Module, list func(Ref) []*Rule) *Graph {
+ return v1.NewGraph(modules, list)
}
-// checkSafetyRuleBodies ensures that variables appearing in negated expressions or non-target
-// positions of built-in expressions will be bound when evaluating the rule from left
-// to right, re-ordering as necessary.
-func (c *Compiler) checkSafetyRuleBodies() {
- for _, name := range c.sorted {
- m := c.Modules[name]
- WalkRules(m, func(r *Rule) bool {
- safe := ReservedVars.Copy()
- safe.Update(r.Head.Args.Vars())
- r.Body = c.checkBodySafety(safe, r.Body)
- return false
- })
- }
-}
+// GraphTraversal is a Traversal that understands the dependency graph
+type GraphTraversal = v1.GraphTraversal
-func (c *Compiler) checkBodySafety(safe VarSet, b Body) Body {
- reordered, unsafe := reorderBodyForSafety(c.builtins, c.GetArity, safe, b)
- if errs := safetyErrorSlice(unsafe, c.RewrittenVars); len(errs) > 0 {
- for _, err := range errs {
- c.err(err)
- }
- return b
- }
- return reordered
+// NewGraphTraversal returns a Traversal for the dependency graph
+func NewGraphTraversal(graph *Graph) *GraphTraversal {
+ return v1.NewGraphTraversal(graph)
}
-// SafetyCheckVisitorParams defines the AST visitor parameters to use for collecting
-// variables during the safety check. This has to be exported because it's relied on
-// by the copy propagation implementation in topdown.
-var SafetyCheckVisitorParams = VarVisitorParams{
- SkipRefCallHead: true,
- SkipClosures: true,
+// OutputVarsFromBody returns all variables which are the "output" for
+// the given body. For safety checks this means that they would be
+// made safe by the body.
+func OutputVarsFromBody(c *Compiler, body Body, safe VarSet) VarSet {
+ return v1.OutputVarsFromBody(c, body, safe)
}
-// checkSafetyRuleHeads ensures that variables appearing in the head of a
-// rule also appear in the body.
-func (c *Compiler) checkSafetyRuleHeads() {
-
- for _, name := range c.sorted {
- m := c.Modules[name]
- WalkRules(m, func(r *Rule) bool {
- safe := r.Body.Vars(SafetyCheckVisitorParams)
- safe.Update(r.Head.Args.Vars())
- unsafe := r.Head.Vars().Diff(safe)
- for v := range unsafe {
- if w, ok := c.RewrittenVars[v]; ok {
- v = w
- }
- if !v.IsGenerated() {
- c.err(NewError(UnsafeVarErr, r.Loc(), "var %v is unsafe", v))
- }
- }
- return false
- })
- }
-}
-
-func compileSchema(goSchema interface{}, allowNet []string) (*gojsonschema.Schema, error) {
- gojsonschema.SetAllowNet(allowNet)
-
- var refLoader gojsonschema.JSONLoader
- sl := gojsonschema.NewSchemaLoader()
-
- if goSchema != nil {
- refLoader = gojsonschema.NewGoLoader(goSchema)
- } else {
- return nil, fmt.Errorf("no schema as input to compile")
- }
- schemasCompiled, err := sl.Compile(refLoader)
- if err != nil {
- return nil, fmt.Errorf("unable to compile the schema: %w", err)
- }
- return schemasCompiled, nil
-}
-
-func mergeSchemas(schemas ...*gojsonschema.SubSchema) (*gojsonschema.SubSchema, error) {
- if len(schemas) == 0 {
- return nil, nil
- }
- var result = schemas[0]
-
- for i := range schemas {
- if len(schemas[i].PropertiesChildren) > 0 {
- if !schemas[i].Types.Contains("object") {
- if err := schemas[i].Types.Add("object"); err != nil {
- return nil, fmt.Errorf("unable to set the type in schemas")
- }
- }
- } else if len(schemas[i].ItemsChildren) > 0 {
- if !schemas[i].Types.Contains("array") {
- if err := schemas[i].Types.Add("array"); err != nil {
- return nil, fmt.Errorf("unable to set the type in schemas")
- }
- }
- }
- }
-
- for i := 1; i < len(schemas); i++ {
- if result.Types.String() != schemas[i].Types.String() {
- return nil, fmt.Errorf("unable to merge these schemas: type mismatch: %v and %v", result.Types.String(), schemas[i].Types.String())
- } else if result.Types.Contains("object") && len(result.PropertiesChildren) > 0 && schemas[i].Types.Contains("object") && len(schemas[i].PropertiesChildren) > 0 {
- result.PropertiesChildren = append(result.PropertiesChildren, schemas[i].PropertiesChildren...)
- } else if result.Types.Contains("array") && len(result.ItemsChildren) > 0 && schemas[i].Types.Contains("array") && len(schemas[i].ItemsChildren) > 0 {
- for j := 0; j < len(schemas[i].ItemsChildren); j++ {
- if len(result.ItemsChildren)-1 < j && !(len(schemas[i].ItemsChildren)-1 < j) {
- result.ItemsChildren = append(result.ItemsChildren, schemas[i].ItemsChildren[j])
- }
- if result.ItemsChildren[j].Types.String() != schemas[i].ItemsChildren[j].Types.String() {
- return nil, fmt.Errorf("unable to merge these schemas")
- }
- }
- }
- }
- return result, nil
-}
-
-type schemaParser struct {
- definitionCache map[string]*cachedDef
-}
-
-type cachedDef struct {
- properties []*types.StaticProperty
-}
-
-func newSchemaParser() *schemaParser {
- return &schemaParser{
- definitionCache: map[string]*cachedDef{},
- }
-}
-
-func (parser *schemaParser) parseSchema(schema interface{}) (types.Type, error) {
- return parser.parseSchemaWithPropertyKey(schema, "")
-}
-
-func (parser *schemaParser) parseSchemaWithPropertyKey(schema interface{}, propertyKey string) (types.Type, error) {
- subSchema, ok := schema.(*gojsonschema.SubSchema)
- if !ok {
- return nil, fmt.Errorf("unexpected schema type %v", subSchema)
- }
-
- // Handle referenced schemas, returns directly when a $ref is found
- if subSchema.RefSchema != nil {
- if existing, ok := parser.definitionCache[subSchema.Ref.String()]; ok {
- return types.NewObject(existing.properties, nil), nil
- }
- return parser.parseSchemaWithPropertyKey(subSchema.RefSchema, subSchema.Ref.String())
- }
-
- // Handle anyOf
- if subSchema.AnyOf != nil {
- var orType types.Type
-
- // If there is a core schema, find its type first
- if subSchema.Types.IsTyped() {
- copySchema := *subSchema
- copySchemaRef := ©Schema
- copySchemaRef.AnyOf = nil
- coreType, err := parser.parseSchema(copySchemaRef)
- if err != nil {
- return nil, fmt.Errorf("unexpected schema type %v: %w", subSchema, err)
- }
-
- // Only add Object type with static props to orType
- if objType, ok := coreType.(*types.Object); ok {
- if objType.StaticProperties() != nil && objType.DynamicProperties() == nil {
- orType = types.Or(orType, coreType)
- }
- }
- }
-
- // Iterate through every property of AnyOf and add it to orType
- for _, pSchema := range subSchema.AnyOf {
- newtype, err := parser.parseSchema(pSchema)
- if err != nil {
- return nil, fmt.Errorf("unexpected schema type %v: %w", pSchema, err)
- }
- orType = types.Or(newtype, orType)
- }
-
- return orType, nil
- }
-
- if subSchema.AllOf != nil {
- subSchemaArray := subSchema.AllOf
- allOfResult, err := mergeSchemas(subSchemaArray...)
- if err != nil {
- return nil, err
- }
-
- if subSchema.Types.IsTyped() {
- if (subSchema.Types.Contains("object") && allOfResult.Types.Contains("object")) || (subSchema.Types.Contains("array") && allOfResult.Types.Contains("array")) {
- objectOrArrayResult, err := mergeSchemas(allOfResult, subSchema)
- if err != nil {
- return nil, err
- }
- return parser.parseSchema(objectOrArrayResult)
- } else if subSchema.Types.String() != allOfResult.Types.String() {
- return nil, fmt.Errorf("unable to merge these schemas")
- }
- }
- return parser.parseSchema(allOfResult)
- }
-
- if subSchema.Types.IsTyped() {
- if subSchema.Types.Contains("boolean") {
- return types.B, nil
-
- } else if subSchema.Types.Contains("string") {
- return types.S, nil
-
- } else if subSchema.Types.Contains("integer") || subSchema.Types.Contains("number") {
- return types.N, nil
-
- } else if subSchema.Types.Contains("object") {
- if len(subSchema.PropertiesChildren) > 0 {
- def := &cachedDef{
- properties: make([]*types.StaticProperty, 0, len(subSchema.PropertiesChildren)),
- }
- for _, pSchema := range subSchema.PropertiesChildren {
- def.properties = append(def.properties, types.NewStaticProperty(pSchema.Property, nil))
- }
- if propertyKey != "" {
- parser.definitionCache[propertyKey] = def
- }
- for _, pSchema := range subSchema.PropertiesChildren {
- newtype, err := parser.parseSchema(pSchema)
- if err != nil {
- return nil, fmt.Errorf("unexpected schema type %v: %w", pSchema, err)
- }
- for i, prop := range def.properties {
- if prop.Key == pSchema.Property {
- def.properties[i].Value = newtype
- break
- }
- }
- }
- return types.NewObject(def.properties, nil), nil
- }
- return types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)), nil
-
- } else if subSchema.Types.Contains("array") {
- if len(subSchema.ItemsChildren) > 0 {
- if subSchema.ItemsChildrenIsSingleSchema {
- iSchema := subSchema.ItemsChildren[0]
- newtype, err := parser.parseSchema(iSchema)
- if err != nil {
- return nil, fmt.Errorf("unexpected schema type %v", iSchema)
- }
- return types.NewArray(nil, newtype), nil
- }
- newTypes := make([]types.Type, 0, len(subSchema.ItemsChildren))
- for i := 0; i != len(subSchema.ItemsChildren); i++ {
- iSchema := subSchema.ItemsChildren[i]
- newtype, err := parser.parseSchema(iSchema)
- if err != nil {
- return nil, fmt.Errorf("unexpected schema type %v", iSchema)
- }
- newTypes = append(newTypes, newtype)
- }
- return types.NewArray(newTypes, nil), nil
- }
- return types.NewArray(nil, types.A), nil
- }
- }
-
- // Assume types if not specified in schema
- if len(subSchema.PropertiesChildren) > 0 {
- if err := subSchema.Types.Add("object"); err == nil {
- return parser.parseSchema(subSchema)
- }
- } else if len(subSchema.ItemsChildren) > 0 {
- if err := subSchema.Types.Add("array"); err == nil {
- return parser.parseSchema(subSchema)
- }
- }
-
- return types.A, nil
-}
-
-func (c *Compiler) setAnnotationSet() {
- // Sorting modules by name for stable error reporting
- sorted := make([]*Module, 0, len(c.Modules))
- for _, mName := range c.sorted {
- sorted = append(sorted, c.Modules[mName])
- }
-
- as, errs := BuildAnnotationSet(sorted)
- for _, err := range errs {
- c.err(err)
- }
- c.annotationSet = as
-}
-
-// checkTypes runs the type checker on all rules. The type checker builds a
-// TypeEnv that is stored on the compiler.
-func (c *Compiler) checkTypes() {
- // Recursion is caught in earlier step, so this cannot fail.
- sorted, _ := c.Graph.Sort()
- checker := newTypeChecker().
- WithAllowNet(c.capabilities.AllowNet).
- WithSchemaSet(c.schemaSet).
- WithInputType(c.inputType).
- WithBuiltins(c.builtins).
- WithRequiredCapabilities(c.Required).
- WithVarRewriter(rewriteVarsInRef(c.RewrittenVars)).
- WithAllowUndefinedFunctionCalls(c.allowUndefinedFuncCalls)
- var as *AnnotationSet
- if c.useTypeCheckAnnotations {
- as = c.annotationSet
- }
- env, errs := checker.CheckTypes(c.TypeEnv, sorted, as)
- for _, err := range errs {
- c.err(err)
- }
- c.TypeEnv = env
-}
-
-func (c *Compiler) checkUnsafeBuiltins() {
- for _, name := range c.sorted {
- errs := checkUnsafeBuiltins(c.unsafeBuiltinsMap, c.Modules[name])
- for _, err := range errs {
- c.err(err)
- }
- }
-}
-
-func (c *Compiler) checkDeprecatedBuiltins() {
- for _, name := range c.sorted {
- mod := c.Modules[name]
- if c.strict || mod.regoV1Compatible() {
- errs := checkDeprecatedBuiltins(c.deprecatedBuiltinsMap, mod)
- for _, err := range errs {
- c.err(err)
- }
- }
- }
-}
-
-func (c *Compiler) runStage(metricName string, f func()) {
- if c.metrics != nil {
- c.metrics.Timer(metricName).Start()
- defer c.metrics.Timer(metricName).Stop()
- }
- f()
-}
-
-func (c *Compiler) runStageAfter(metricName string, s CompilerStage) *Error {
- if c.metrics != nil {
- c.metrics.Timer(metricName).Start()
- defer c.metrics.Timer(metricName).Stop()
- }
- return s(c)
-}
-
-func (c *Compiler) compile() {
-
- defer func() {
- if r := recover(); r != nil && r != errLimitReached {
- panic(r)
- }
- }()
-
- for _, s := range c.stages {
- if c.evalMode == EvalModeIR {
- switch s.name {
- case "BuildRuleIndices", "BuildComprehensionIndices":
- continue // skip these stages
- }
- }
-
- if c.allowUndefinedFuncCalls && (s.name == "CheckUndefinedFuncs" || s.name == "CheckSafetyRuleBodies") {
- continue
- }
-
- c.runStage(s.metricName, s.f)
- if c.Failed() {
- return
- }
- for _, a := range c.after[s.name] {
- if err := c.runStageAfter(a.MetricName, a.Stage); err != nil {
- c.err(err)
- return
- }
- }
- }
-}
-
-func (c *Compiler) init() {
-
- if c.initialized {
- return
- }
-
- if c.capabilities == nil {
- c.capabilities = CapabilitiesForThisVersion()
- }
-
- c.builtins = make(map[string]*Builtin, len(c.capabilities.Builtins)+len(c.customBuiltins))
-
- for _, bi := range c.capabilities.Builtins {
- c.builtins[bi.Name] = bi
- if bi.IsDeprecated() {
- c.deprecatedBuiltinsMap[bi.Name] = struct{}{}
- }
- }
-
- for name, bi := range c.customBuiltins {
- c.builtins[name] = bi
- }
-
- // Load the global input schema if one was provided.
- if c.schemaSet != nil {
- if schema := c.schemaSet.Get(SchemaRootRef); schema != nil {
- tpe, err := loadSchema(schema, c.capabilities.AllowNet)
- if err != nil {
- c.err(NewError(TypeErr, nil, err.Error()))
- } else {
- c.inputType = tpe
- }
- }
- }
-
- c.TypeEnv = newTypeChecker().
- WithSchemaSet(c.schemaSet).
- WithInputType(c.inputType).
- Env(c.builtins)
-
- c.initialized = true
-}
-
-func (c *Compiler) err(err *Error) {
- if c.maxErrs > 0 && len(c.Errors) >= c.maxErrs {
- c.Errors = append(c.Errors, errLimitReached)
- panic(errLimitReached)
- }
- c.Errors = append(c.Errors, err)
-}
-
-func (c *Compiler) getExports() *util.HashMap {
-
- rules := util.NewHashMap(func(a, b util.T) bool {
- return a.(Ref).Equal(b.(Ref))
- }, func(v util.T) int {
- return v.(Ref).Hash()
- })
-
- for _, name := range c.sorted {
- mod := c.Modules[name]
-
- for _, rule := range mod.Rules {
- hashMapAdd(rules, mod.Package.Path, rule.Head.Ref().GroundPrefix())
- }
- }
-
- return rules
-}
-
-func hashMapAdd(rules *util.HashMap, pkg, rule Ref) {
- prev, ok := rules.Get(pkg)
- if !ok {
- rules.Put(pkg, []Ref{rule})
- return
- }
- for _, p := range prev.([]Ref) {
- if p.Equal(rule) {
- return
- }
- }
- rules.Put(pkg, append(prev.([]Ref), rule))
-}
-
-func (c *Compiler) GetAnnotationSet() *AnnotationSet {
- return c.annotationSet
-}
-
-func (c *Compiler) checkDuplicateImports() {
- modules := make([]*Module, 0, len(c.Modules))
-
- for _, name := range c.sorted {
- mod := c.Modules[name]
- if c.strict || mod.regoV1Compatible() {
- modules = append(modules, mod)
- }
- }
-
- errs := checkDuplicateImports(modules)
- for _, err := range errs {
- c.err(err)
- }
-}
-
-func (c *Compiler) checkKeywordOverrides() {
- for _, name := range c.sorted {
- mod := c.Modules[name]
- if c.strict || mod.regoV1Compatible() {
- errs := checkRootDocumentOverrides(mod)
- for _, err := range errs {
- c.err(err)
- }
- }
- }
-}
-
-// resolveAllRefs resolves references in expressions to their fully qualified values.
-//
-// For instance, given the following module:
-//
-// package a.b
-// import data.foo.bar
-// p[x] { bar[_] = x }
-//
-// The reference "bar[_]" would be resolved to "data.foo.bar[_]".
-//
-// Ref rules are resolved, too:
-//
-// package a.b
-// q { c.d.e == 1 }
-// c.d[e] := 1 if e := "e"
-//
-// The reference "c.d.e" would be resolved to "data.a.b.c.d.e".
-func (c *Compiler) resolveAllRefs() {
-
- rules := c.getExports()
-
- for _, name := range c.sorted {
- mod := c.Modules[name]
-
- var ruleExports []Ref
- if x, ok := rules.Get(mod.Package.Path); ok {
- ruleExports = x.([]Ref)
- }
-
- globals := getGlobals(mod.Package, ruleExports, mod.Imports)
-
- WalkRules(mod, func(rule *Rule) bool {
- err := resolveRefsInRule(globals, rule)
- if err != nil {
- c.err(NewError(CompileErr, rule.Location, err.Error()))
- }
- return false
- })
-
- if c.strict { // check for unused imports
- for _, imp := range mod.Imports {
- path := imp.Path.Value.(Ref)
- if FutureRootDocument.Equal(path[0]) || RegoRootDocument.Equal(path[0]) {
- continue // ignore future and rego imports
- }
-
- for v, u := range globals {
- if v.Equal(imp.Name()) && !u.used {
- c.err(NewError(CompileErr, imp.Location, "%s unused", imp.String()))
- }
- }
- }
- }
- }
-
- if c.moduleLoader != nil {
-
- parsed, err := c.moduleLoader(c.Modules)
- if err != nil {
- c.err(NewError(CompileErr, nil, err.Error()))
- return
- }
-
- if len(parsed) == 0 {
- return
- }
-
- for id, module := range parsed {
- c.Modules[id] = module.Copy()
- c.sorted = append(c.sorted, id)
- if c.parsedModules != nil {
- c.parsedModules[id] = module
- }
- }
-
- sort.Strings(c.sorted)
- c.resolveAllRefs()
- }
-}
-
-func (c *Compiler) removeImports() {
- c.imports = make(map[string][]*Import, len(c.Modules))
- for name := range c.Modules {
- c.imports[name] = c.Modules[name].Imports
- c.Modules[name].Imports = nil
- }
-}
-
-func (c *Compiler) initLocalVarGen() {
- c.localvargen = newLocalVarGeneratorForModuleSet(c.sorted, c.Modules)
-}
-
-func (c *Compiler) rewriteComprehensionTerms() {
- f := newEqualityFactory(c.localvargen)
- for _, name := range c.sorted {
- mod := c.Modules[name]
- _, _ = rewriteComprehensionTerms(f, mod) // ignore error
- }
-}
-
-func (c *Compiler) rewriteExprTerms() {
- for _, name := range c.sorted {
- mod := c.Modules[name]
- WalkRules(mod, func(rule *Rule) bool {
- rewriteExprTermsInHead(c.localvargen, rule)
- rule.Body = rewriteExprTermsInBody(c.localvargen, rule.Body)
- return false
- })
- }
-}
-
-func (c *Compiler) rewriteRuleHeadRefs() {
- f := newEqualityFactory(c.localvargen)
- for _, name := range c.sorted {
- WalkRules(c.Modules[name], func(rule *Rule) bool {
-
- ref := rule.Head.Ref()
- // NOTE(sr): We're backfilling Refs here -- all parser code paths would have them, but
- // it's possible to construct Module{} instances from Golang code, so we need
- // to accommodate for that, too.
- if len(rule.Head.Reference) == 0 {
- rule.Head.Reference = ref
- }
-
- cannotSpeakStringPrefixRefs := true
- cannotSpeakGeneralRefs := true
- for _, f := range c.capabilities.Features {
- switch f {
- case FeatureRefHeadStringPrefixes:
- cannotSpeakStringPrefixRefs = false
- case FeatureRefHeads:
- cannotSpeakGeneralRefs = false
- }
- }
-
- if cannotSpeakStringPrefixRefs && cannotSpeakGeneralRefs && rule.Head.Name == "" {
- c.err(NewError(CompileErr, rule.Loc(), "rule heads with refs are not supported: %v", rule.Head.Reference))
- return true
- }
-
- for i := 1; i < len(ref); i++ {
- if cannotSpeakGeneralRefs && (rule.Head.RuleKind() == MultiValue || i != len(ref)-1) { // last
- if _, ok := ref[i].Value.(String); !ok {
- c.err(NewError(TypeErr, rule.Loc(), "rule heads with general refs (containing variables) are not supported: %v", rule.Head.Reference))
- continue
- }
- }
-
- // Rewrite so that any non-scalar elements in the rule's ref are vars:
- // p.q.r[y.z] { ... } => p.q.r[__local0__] { __local0__ = y.z }
- // p.q[a.b][c.d] { ... } => p.q[__local0__] { __local0__ = a.b; __local1__ = c.d }
- // because that's what the RuleTree knows how to deal with.
- if _, ok := ref[i].Value.(Var); !ok && !IsScalar(ref[i].Value) {
- expr := f.Generate(ref[i])
- if i == len(ref)-1 && rule.Head.Key.Equal(ref[i]) {
- rule.Head.Key = expr.Operand(0)
- }
- rule.Head.Reference[i] = expr.Operand(0)
- rule.Body.Append(expr)
- }
- }
-
- return true
- })
- }
-}
-
-func (c *Compiler) checkVoidCalls() {
- for _, name := range c.sorted {
- mod := c.Modules[name]
- for _, err := range checkVoidCalls(c.TypeEnv, mod) {
- c.err(err)
- }
- }
-}
-
-func (c *Compiler) rewritePrintCalls() {
- var modified bool
- if !c.enablePrintStatements {
- for _, name := range c.sorted {
- if erasePrintCalls(c.Modules[name]) {
- modified = true
- }
- }
- } else {
- for _, name := range c.sorted {
- mod := c.Modules[name]
- WalkRules(mod, func(r *Rule) bool {
- safe := r.Head.Args.Vars()
- safe.Update(ReservedVars)
- vis := func(b Body) bool {
- modrec, errs := rewritePrintCalls(c.localvargen, c.GetArity, safe, b)
- if modrec {
- modified = true
- }
- for _, err := range errs {
- c.err(err)
- }
- return false
- }
- WalkBodies(r.Head, vis)
- WalkBodies(r.Body, vis)
- return false
- })
- }
- }
- if modified {
- c.Required.addBuiltinSorted(Print)
- }
-}
-
-// checkVoidCalls returns errors for any expressions that treat void function
-// calls as values. The only void functions in Rego are specific built-ins like
-// print().
-func checkVoidCalls(env *TypeEnv, x interface{}) Errors {
- var errs Errors
- WalkTerms(x, func(x *Term) bool {
- if call, ok := x.Value.(Call); ok {
- if tpe, ok := env.Get(call[0]).(*types.Function); ok && tpe.Result() == nil {
- errs = append(errs, NewError(TypeErr, x.Loc(), "%v used as value", call))
- }
- }
- return false
- })
- return errs
-}
-
-// rewritePrintCalls will rewrite the body so that print operands are captured
-// in local variables and their evaluation occurs within a comprehension.
-// Wrapping the terms inside of a comprehension ensures that undefined values do
-// not short-circuit evaluation.
-//
-// For example, given the following print statement:
-//
-// print("the value of x is:", input.x)
-//
-// The expression would be rewritten to:
-//
-// print({__local0__ | __local0__ = "the value of x is:"}, {__local1__ | __local1__ = input.x})
-func rewritePrintCalls(gen *localVarGenerator, getArity func(Ref) int, globals VarSet, body Body) (bool, Errors) {
-
- var errs Errors
- var modified bool
-
- // Visit comprehension bodies recursively to ensure print statements inside
- // those bodies only close over variables that are safe.
- for i := range body {
- if ContainsClosures(body[i]) {
- safe := outputVarsForBody(body[:i], getArity, globals)
- safe.Update(globals)
- WalkClosures(body[i], func(x interface{}) bool {
- var modrec bool
- var errsrec Errors
- switch x := x.(type) {
- case *SetComprehension:
- modrec, errsrec = rewritePrintCalls(gen, getArity, safe, x.Body)
- case *ArrayComprehension:
- modrec, errsrec = rewritePrintCalls(gen, getArity, safe, x.Body)
- case *ObjectComprehension:
- modrec, errsrec = rewritePrintCalls(gen, getArity, safe, x.Body)
- case *Every:
- safe.Update(x.KeyValueVars())
- modrec, errsrec = rewritePrintCalls(gen, getArity, safe, x.Body)
- }
- if modrec {
- modified = true
- }
- errs = append(errs, errsrec...)
- return true
- })
- if len(errs) > 0 {
- return false, errs
- }
- }
- }
-
- for i := range body {
-
- if !isPrintCall(body[i]) {
- continue
- }
-
- modified = true
-
- var errs Errors
- safe := outputVarsForBody(body[:i], getArity, globals)
- safe.Update(globals)
- args := body[i].Operands()
-
- for j := range args {
- vis := NewVarVisitor().WithParams(SafetyCheckVisitorParams)
- vis.Walk(args[j])
- unsafe := vis.Vars().Diff(safe)
- for _, v := range unsafe.Sorted() {
- errs = append(errs, NewError(CompileErr, args[j].Loc(), "var %v is undeclared", v))
- }
- }
-
- if len(errs) > 0 {
- return false, errs
- }
-
- arr := NewArray()
-
- for j := range args {
- x := NewTerm(gen.Generate()).SetLocation(args[j].Loc())
- capture := Equality.Expr(x, args[j]).SetLocation(args[j].Loc())
- arr = arr.Append(SetComprehensionTerm(x, NewBody(capture)).SetLocation(args[j].Loc()))
- }
-
- body.Set(NewExpr([]*Term{
- NewTerm(InternalPrint.Ref()).SetLocation(body[i].Loc()),
- NewTerm(arr).SetLocation(body[i].Loc()),
- }).SetLocation(body[i].Loc()), i)
- }
-
- return modified, nil
-}
-
-func erasePrintCalls(node interface{}) bool {
- var modified bool
- NewGenericVisitor(func(x interface{}) bool {
- var modrec bool
- switch x := x.(type) {
- case *Rule:
- modrec, x.Body = erasePrintCallsInBody(x.Body)
- case *ArrayComprehension:
- modrec, x.Body = erasePrintCallsInBody(x.Body)
- case *SetComprehension:
- modrec, x.Body = erasePrintCallsInBody(x.Body)
- case *ObjectComprehension:
- modrec, x.Body = erasePrintCallsInBody(x.Body)
- case *Every:
- modrec, x.Body = erasePrintCallsInBody(x.Body)
- }
- if modrec {
- modified = true
- }
- return false
- }).Walk(node)
- return modified
-}
-
-func erasePrintCallsInBody(x Body) (bool, Body) {
-
- if !containsPrintCall(x) {
- return false, x
- }
-
- var cpy Body
-
- for i := range x {
-
- // Recursively visit any comprehensions contained in this expression.
- erasePrintCalls(x[i])
-
- if !isPrintCall(x[i]) {
- cpy.Append(x[i])
- }
- }
-
- if len(cpy) == 0 {
- term := BooleanTerm(true).SetLocation(x.Loc())
- expr := NewExpr(term).SetLocation(x.Loc())
- cpy.Append(expr)
- }
-
- return true, cpy
-}
-
-func containsPrintCall(x interface{}) bool {
- var found bool
- WalkExprs(x, func(expr *Expr) bool {
- if !found {
- if isPrintCall(expr) {
- found = true
- }
- }
- return found
- })
- return found
-}
-
-func isPrintCall(x *Expr) bool {
- return x.IsCall() && x.Operator().Equal(Print.Ref())
-}
-
-// rewriteRefsInHead will rewrite rules so that the head does not contain any
-// terms that require evaluation (e.g., refs or comprehensions). If the key or
-// value contains one or more of these terms, the key or value will be moved
-// into the body and assigned to a new variable. The new variable will replace
-// the key or value in the head.
-//
-// For instance, given the following rule:
-//
-// p[{"foo": data.foo[i]}] { i < 100 }
-//
-// The rule would be re-written as:
-//
-// p[__local0__] { i < 100; __local0__ = {"foo": data.foo[i]} }
-func (c *Compiler) rewriteRefsInHead() {
- f := newEqualityFactory(c.localvargen)
- for _, name := range c.sorted {
- mod := c.Modules[name]
- WalkRules(mod, func(rule *Rule) bool {
- if requiresEval(rule.Head.Key) {
- expr := f.Generate(rule.Head.Key)
- rule.Head.Key = expr.Operand(0)
- rule.Body.Append(expr)
- }
- if requiresEval(rule.Head.Value) {
- expr := f.Generate(rule.Head.Value)
- rule.Head.Value = expr.Operand(0)
- rule.Body.Append(expr)
- }
- for i := 0; i < len(rule.Head.Args); i++ {
- if requiresEval(rule.Head.Args[i]) {
- expr := f.Generate(rule.Head.Args[i])
- rule.Head.Args[i] = expr.Operand(0)
- rule.Body.Append(expr)
- }
- }
- return false
- })
- }
-}
-
-func (c *Compiler) rewriteEquals() {
- modified := false
- for _, name := range c.sorted {
- mod := c.Modules[name]
- modified = rewriteEquals(mod) || modified
- }
- if modified {
- c.Required.addBuiltinSorted(Equal)
- }
-}
-
-func (c *Compiler) rewriteDynamicTerms() {
- f := newEqualityFactory(c.localvargen)
- for _, name := range c.sorted {
- mod := c.Modules[name]
- WalkRules(mod, func(rule *Rule) bool {
- rule.Body = rewriteDynamics(f, rule.Body)
- return false
- })
- }
-}
-
-// rewriteTestRuleEqualities rewrites equality expressions in test rule bodies to create local vars for statements that would otherwise
-// not have their values captured through tracing, such as refs and comprehensions not unified/assigned to a local var.
-// For example, given the following module:
-//
-// package test
-//
-// p.q contains v if {
-// some v in numbers.range(1, 3)
-// }
-//
-// p.r := "foo"
-//
-// test_rule {
-// p == {
-// "q": {4, 5, 6}
-// }
-// }
-//
-// `p` in `test_rule` resolves to `data.test.p`, which won't be an entry in the virtual-cache and must therefore be calculated after-the-fact.
-// If `p` isn't captured in a local var, there is no trivial way to retrieve its value for test reporting.
-func (c *Compiler) rewriteTestRuleEqualities() {
- if !c.rewriteTestRulesForTracing {
- return
- }
-
- f := newEqualityFactory(c.localvargen)
- for _, name := range c.sorted {
- mod := c.Modules[name]
- WalkRules(mod, func(rule *Rule) bool {
- if strings.HasPrefix(string(rule.Head.Name), "test_") {
- rule.Body = rewriteTestEqualities(f, rule.Body)
- }
- return false
- })
- }
-}
-
-func (c *Compiler) parseMetadataBlocks() {
- // Only parse annotations if rego.metadata built-ins are called
- regoMetadataCalled := false
- for _, name := range c.sorted {
- mod := c.Modules[name]
- WalkExprs(mod, func(expr *Expr) bool {
- if isRegoMetadataChainCall(expr) || isRegoMetadataRuleCall(expr) {
- regoMetadataCalled = true
- }
- return regoMetadataCalled
- })
-
- if regoMetadataCalled {
- break
- }
- }
-
- if regoMetadataCalled {
- // NOTE: Possible optimization: only parse annotations for modules on the path of rego.metadata-calling module
- for _, name := range c.sorted {
- mod := c.Modules[name]
-
- if len(mod.Annotations) == 0 {
- var errs Errors
- mod.Annotations, errs = parseAnnotations(mod.Comments)
- errs = append(errs, attachAnnotationsNodes(mod)...)
- for _, err := range errs {
- c.err(err)
- }
-
- attachRuleAnnotations(mod)
- }
- }
- }
-}
-
-func (c *Compiler) rewriteRegoMetadataCalls() {
- eqFactory := newEqualityFactory(c.localvargen)
-
- _, chainFuncAllowed := c.builtins[RegoMetadataChain.Name]
- _, ruleFuncAllowed := c.builtins[RegoMetadataRule.Name]
-
- for _, name := range c.sorted {
- mod := c.Modules[name]
-
- WalkRules(mod, func(rule *Rule) bool {
- var firstChainCall *Expr
- var firstRuleCall *Expr
-
- WalkExprs(rule, func(expr *Expr) bool {
- if chainFuncAllowed && firstChainCall == nil && isRegoMetadataChainCall(expr) {
- firstChainCall = expr
- } else if ruleFuncAllowed && firstRuleCall == nil && isRegoMetadataRuleCall(expr) {
- firstRuleCall = expr
- }
- return firstChainCall != nil && firstRuleCall != nil
- })
-
- chainCalled := firstChainCall != nil
- ruleCalled := firstRuleCall != nil
-
- if chainCalled || ruleCalled {
- body := make(Body, 0, len(rule.Body)+2)
-
- var metadataChainVar Var
- if chainCalled {
- // Create and inject metadata chain for rule
-
- chain, err := createMetadataChain(c.annotationSet.Chain(rule))
- if err != nil {
- c.err(err)
- return false
- }
-
- chain.Location = firstChainCall.Location
- eq := eqFactory.Generate(chain)
- metadataChainVar = eq.Operands()[0].Value.(Var)
- body.Append(eq)
- }
-
- var metadataRuleVar Var
- if ruleCalled {
- // Create and inject metadata for rule
-
- var metadataRuleTerm *Term
-
- a := getPrimaryRuleAnnotations(c.annotationSet, rule)
- if a != nil {
- annotObj, err := a.toObject()
- if err != nil {
- c.err(err)
- return false
- }
- metadataRuleTerm = NewTerm(*annotObj)
- } else {
- // If rule has no annotations, assign an empty object
- metadataRuleTerm = ObjectTerm()
- }
-
- metadataRuleTerm.Location = firstRuleCall.Location
- eq := eqFactory.Generate(metadataRuleTerm)
- metadataRuleVar = eq.Operands()[0].Value.(Var)
- body.Append(eq)
- }
-
- for _, expr := range rule.Body {
- body.Append(expr)
- }
- rule.Body = body
-
- vis := func(b Body) bool {
- for _, err := range rewriteRegoMetadataCalls(&metadataChainVar, &metadataRuleVar, b, &c.RewrittenVars) {
- c.err(err)
- }
- return false
- }
- WalkBodies(rule.Head, vis)
- WalkBodies(rule.Body, vis)
- }
-
- return false
- })
- }
-}
-
-func getPrimaryRuleAnnotations(as *AnnotationSet, rule *Rule) *Annotations {
- annots := as.GetRuleScope(rule)
-
- if len(annots) == 0 {
- return nil
- }
-
- // Sort by annotation location; chain must start with annotations declared closest to rule, then going outward
- sort.SliceStable(annots, func(i, j int) bool {
- return annots[i].Location.Compare(annots[j].Location) > 0
- })
-
- return annots[0]
-}
-
-func rewriteRegoMetadataCalls(metadataChainVar *Var, metadataRuleVar *Var, body Body, rewrittenVars *map[Var]Var) Errors {
- var errs Errors
-
- WalkClosures(body, func(x interface{}) bool {
- switch x := x.(type) {
- case *ArrayComprehension:
- errs = rewriteRegoMetadataCalls(metadataChainVar, metadataRuleVar, x.Body, rewrittenVars)
- case *SetComprehension:
- errs = rewriteRegoMetadataCalls(metadataChainVar, metadataRuleVar, x.Body, rewrittenVars)
- case *ObjectComprehension:
- errs = rewriteRegoMetadataCalls(metadataChainVar, metadataRuleVar, x.Body, rewrittenVars)
- case *Every:
- errs = rewriteRegoMetadataCalls(metadataChainVar, metadataRuleVar, x.Body, rewrittenVars)
- }
- return true
- })
-
- for i := range body {
- expr := body[i]
- var metadataVar Var
-
- if metadataChainVar != nil && isRegoMetadataChainCall(expr) {
- metadataVar = *metadataChainVar
- } else if metadataRuleVar != nil && isRegoMetadataRuleCall(expr) {
- metadataVar = *metadataRuleVar
- } else {
- continue
- }
-
- // NOTE(johanfylling): An alternative strategy would be to walk the body and replace all operands[0]
- // usages with *metadataChainVar
- operands := expr.Operands()
- var newExpr *Expr
- if len(operands) > 0 { // There is an output var to rewrite
- rewrittenVar := operands[0]
- newExpr = Equality.Expr(rewrittenVar, NewTerm(metadataVar))
- } else { // No output var, just rewrite expr to metadataVar
- newExpr = NewExpr(NewTerm(metadataVar))
- }
-
- newExpr.Generated = true
- newExpr.Location = expr.Location
- body.Set(newExpr, i)
- }
-
- return errs
-}
-
-func isRegoMetadataChainCall(x *Expr) bool {
- return x.IsCall() && x.Operator().Equal(RegoMetadataChain.Ref())
-}
-
-func isRegoMetadataRuleCall(x *Expr) bool {
- return x.IsCall() && x.Operator().Equal(RegoMetadataRule.Ref())
-}
-
-func createMetadataChain(chain []*AnnotationsRef) (*Term, *Error) {
-
- metaArray := NewArray()
- for _, link := range chain {
- p := link.Path.toArray().
- Slice(1, -1) // Dropping leading 'data' element of path
- obj := NewObject(
- Item(StringTerm("path"), NewTerm(p)),
- )
- if link.Annotations != nil {
- annotObj, err := link.Annotations.toObject()
- if err != nil {
- return nil, err
- }
- obj.Insert(StringTerm("annotations"), NewTerm(*annotObj))
- }
- metaArray = metaArray.Append(NewTerm(obj))
- }
-
- return NewTerm(metaArray), nil
-}
-
-func (c *Compiler) rewriteLocalVars() {
-
- var assignment bool
-
- for _, name := range c.sorted {
- mod := c.Modules[name]
- gen := c.localvargen
-
- WalkRules(mod, func(rule *Rule) bool {
- argsStack := newLocalDeclaredVars()
-
- args := NewVarVisitor()
- if c.strict {
- args.Walk(rule.Head.Args)
- }
- unusedArgs := args.Vars()
-
- c.rewriteLocalArgVars(gen, argsStack, rule)
-
- // Rewrite local vars in each else-branch of the rule.
- // Note: this is done instead of a walk so that we can capture any unused function arguments
- // across else-branches.
- for rule := rule; rule != nil; rule = rule.Else {
- stack, errs := c.rewriteLocalVarsInRule(rule, unusedArgs, argsStack, gen)
- if stack.assignment {
- assignment = true
- }
-
- for arg := range unusedArgs {
- if stack.Count(arg) > 1 {
- delete(unusedArgs, arg)
- }
- }
-
- for _, err := range errs {
- c.err(err)
- }
- }
-
- if c.strict {
- // Report an error for each unused function argument
- for arg := range unusedArgs {
- if !arg.IsWildcard() {
- c.err(NewError(CompileErr, rule.Head.Location, "unused argument %v. (hint: use _ (wildcard variable) instead)", arg))
- }
- }
- }
-
- return true
- })
- }
-
- if assignment {
- c.Required.addBuiltinSorted(Assign)
- }
-}
-
-func (c *Compiler) rewriteLocalVarsInRule(rule *Rule, unusedArgs VarSet, argsStack *localDeclaredVars, gen *localVarGenerator) (*localDeclaredVars, Errors) {
- // Rewrite assignments contained in head of rule. Assignments can
- // occur in rule head if they're inside a comprehension. Note,
- // assigned vars in comprehensions in the head will be rewritten
- // first to preserve scoping rules. For example:
- //
- // p = [x | x := 1] { x := 2 } becomes p = [__local0__ | __local0__ = 1] { __local1__ = 2 }
- //
- // This behaviour is consistent scoping inside the body. For example:
- //
- // p = xs { x := 2; xs = [x | x := 1] } becomes p = xs { __local0__ = 2; xs = [__local1__ | __local1__ = 1] }
- nestedXform := &rewriteNestedHeadVarLocalTransform{
- gen: gen,
- RewrittenVars: c.RewrittenVars,
- strict: c.strict,
- }
-
- NewGenericVisitor(nestedXform.Visit).Walk(rule.Head)
-
- for _, err := range nestedXform.errs {
- c.err(err)
- }
-
- // Rewrite assignments in body.
- used := NewVarSet()
-
- for _, t := range rule.Head.Ref()[1:] {
- used.Update(t.Vars())
- }
-
- if rule.Head.Key != nil {
- used.Update(rule.Head.Key.Vars())
- }
-
- if rule.Head.Value != nil {
- valueVars := rule.Head.Value.Vars()
- used.Update(valueVars)
- for arg := range unusedArgs {
- if valueVars.Contains(arg) {
- delete(unusedArgs, arg)
- }
- }
- }
-
- stack := argsStack.Copy()
-
- body, declared, errs := rewriteLocalVars(gen, stack, used, rule.Body, c.strict)
-
- // For rewritten vars use the collection of all variables that
- // were in the stack at some point in time.
- for k, v := range stack.rewritten {
- c.RewrittenVars[k] = v
- }
-
- rule.Body = body
-
- // Rewrite vars in head that refer to locally declared vars in the body.
- localXform := rewriteHeadVarLocalTransform{declared: declared}
-
- for i := range rule.Head.Args {
- rule.Head.Args[i], _ = transformTerm(localXform, rule.Head.Args[i])
- }
-
- for i := 1; i < len(rule.Head.Ref()); i++ {
- rule.Head.Reference[i], _ = transformTerm(localXform, rule.Head.Ref()[i])
- }
- if rule.Head.Key != nil {
- rule.Head.Key, _ = transformTerm(localXform, rule.Head.Key)
- }
-
- if rule.Head.Value != nil {
- rule.Head.Value, _ = transformTerm(localXform, rule.Head.Value)
- }
- return stack, errs
-}
-
-type rewriteNestedHeadVarLocalTransform struct {
- gen *localVarGenerator
- errs Errors
- RewrittenVars map[Var]Var
- strict bool
-}
-
-func (xform *rewriteNestedHeadVarLocalTransform) Visit(x interface{}) bool {
-
- if term, ok := x.(*Term); ok {
-
- stop := false
- stack := newLocalDeclaredVars()
-
- switch x := term.Value.(type) {
- case *object:
- cpy, _ := x.Map(func(k, v *Term) (*Term, *Term, error) {
- kcpy := k.Copy()
- NewGenericVisitor(xform.Visit).Walk(kcpy)
- vcpy := v.Copy()
- NewGenericVisitor(xform.Visit).Walk(vcpy)
- return kcpy, vcpy, nil
- })
- term.Value = cpy
- stop = true
- case *set:
- cpy, _ := x.Map(func(v *Term) (*Term, error) {
- vcpy := v.Copy()
- NewGenericVisitor(xform.Visit).Walk(vcpy)
- return vcpy, nil
- })
- term.Value = cpy
- stop = true
- case *ArrayComprehension:
- xform.errs = rewriteDeclaredVarsInArrayComprehension(xform.gen, stack, x, xform.errs, xform.strict)
- stop = true
- case *SetComprehension:
- xform.errs = rewriteDeclaredVarsInSetComprehension(xform.gen, stack, x, xform.errs, xform.strict)
- stop = true
- case *ObjectComprehension:
- xform.errs = rewriteDeclaredVarsInObjectComprehension(xform.gen, stack, x, xform.errs, xform.strict)
- stop = true
- }
-
- for k, v := range stack.rewritten {
- xform.RewrittenVars[k] = v
- }
-
- return stop
- }
-
- return false
-}
-
-type rewriteHeadVarLocalTransform struct {
- declared map[Var]Var
-}
-
-func (xform rewriteHeadVarLocalTransform) Transform(x interface{}) (interface{}, error) {
- if v, ok := x.(Var); ok {
- if gv, ok := xform.declared[v]; ok {
- return gv, nil
- }
- }
- return x, nil
-}
-
-func (c *Compiler) rewriteLocalArgVars(gen *localVarGenerator, stack *localDeclaredVars, rule *Rule) {
-
- vis := &ruleArgLocalRewriter{
- stack: stack,
- gen: gen,
- }
-
- for i := range rule.Head.Args {
- Walk(vis, rule.Head.Args[i])
- }
-
- for i := range vis.errs {
- c.err(vis.errs[i])
- }
-}
-
-type ruleArgLocalRewriter struct {
- stack *localDeclaredVars
- gen *localVarGenerator
- errs []*Error
-}
-
-func (vis *ruleArgLocalRewriter) Visit(x interface{}) Visitor {
-
- t, ok := x.(*Term)
- if !ok {
- return vis
- }
-
- switch v := t.Value.(type) {
- case Var:
- gv, ok := vis.stack.Declared(v)
- if ok {
- vis.stack.Seen(v)
- } else {
- gv = vis.gen.Generate()
- vis.stack.Insert(v, gv, argVar)
- }
- t.Value = gv
- return nil
- case *object:
- if cpy, err := v.Map(func(k, v *Term) (*Term, *Term, error) {
- vcpy := v.Copy()
- Walk(vis, vcpy)
- return k, vcpy, nil
- }); err != nil {
- vis.errs = append(vis.errs, NewError(CompileErr, t.Location, err.Error()))
- } else {
- t.Value = cpy
- }
- return nil
- case Null, Boolean, Number, String, *ArrayComprehension, *SetComprehension, *ObjectComprehension, Set:
- // Scalars are no-ops. Comprehensions are handled above. Sets must not
- // contain variables.
- return nil
- case Call:
- vis.errs = append(vis.errs, NewError(CompileErr, t.Location, "rule arguments cannot contain calls"))
- return nil
- default:
- // Recurse on refs and arrays. Any embedded
- // variables can be rewritten.
- return vis
- }
-}
-
-func (c *Compiler) rewriteWithModifiers() {
- f := newEqualityFactory(c.localvargen)
- for _, name := range c.sorted {
- mod := c.Modules[name]
- t := NewGenericTransformer(func(x interface{}) (interface{}, error) {
- body, ok := x.(Body)
- if !ok {
- return x, nil
- }
- body, err := rewriteWithModifiersInBody(c, c.unsafeBuiltinsMap, f, body)
- if err != nil {
- c.err(err)
- }
-
- return body, nil
- })
- _, _ = Transform(t, mod) // ignore error
- }
-}
-
-func (c *Compiler) setModuleTree() {
- c.ModuleTree = NewModuleTree(c.Modules)
-}
-
-func (c *Compiler) setRuleTree() {
- c.RuleTree = NewRuleTree(c.ModuleTree)
-}
-
-func (c *Compiler) setGraph() {
- list := func(r Ref) []*Rule {
- return c.GetRulesDynamicWithOpts(r, RulesOptions{IncludeHiddenModules: true})
- }
- c.Graph = NewGraph(c.Modules, list)
-}
-
-type queryCompiler struct {
- compiler *Compiler
- qctx *QueryContext
- typeEnv *TypeEnv
- rewritten map[Var]Var
- after map[string][]QueryCompilerStageDefinition
- unsafeBuiltins map[string]struct{}
- comprehensionIndices map[*Term]*ComprehensionIndex
- enablePrintStatements bool
-}
-
-func newQueryCompiler(compiler *Compiler) QueryCompiler {
- qc := &queryCompiler{
- compiler: compiler,
- qctx: nil,
- after: map[string][]QueryCompilerStageDefinition{},
- comprehensionIndices: map[*Term]*ComprehensionIndex{},
- }
- return qc
-}
-
-func (qc *queryCompiler) WithStrict(strict bool) QueryCompiler {
- qc.compiler.WithStrict(strict)
- return qc
-}
-
-func (qc *queryCompiler) WithEnablePrintStatements(yes bool) QueryCompiler {
- qc.enablePrintStatements = yes
- return qc
-}
-
-func (qc *queryCompiler) WithContext(qctx *QueryContext) QueryCompiler {
- qc.qctx = qctx
- return qc
-}
-
-func (qc *queryCompiler) WithStageAfter(after string, stage QueryCompilerStageDefinition) QueryCompiler {
- qc.after[after] = append(qc.after[after], stage)
- return qc
-}
-
-func (qc *queryCompiler) WithUnsafeBuiltins(unsafe map[string]struct{}) QueryCompiler {
- qc.unsafeBuiltins = unsafe
- return qc
-}
-
-func (qc *queryCompiler) RewrittenVars() map[Var]Var {
- return qc.rewritten
-}
-
-func (qc *queryCompiler) ComprehensionIndex(term *Term) *ComprehensionIndex {
- if result, ok := qc.comprehensionIndices[term]; ok {
- return result
- } else if result, ok := qc.compiler.comprehensionIndices[term]; ok {
- return result
- }
- return nil
-}
-
-func (qc *queryCompiler) runStage(metricName string, qctx *QueryContext, query Body, s func(*QueryContext, Body) (Body, error)) (Body, error) {
- if qc.compiler.metrics != nil {
- qc.compiler.metrics.Timer(metricName).Start()
- defer qc.compiler.metrics.Timer(metricName).Stop()
- }
- return s(qctx, query)
-}
-
-func (qc *queryCompiler) runStageAfter(metricName string, query Body, s QueryCompilerStage) (Body, error) {
- if qc.compiler.metrics != nil {
- qc.compiler.metrics.Timer(metricName).Start()
- defer qc.compiler.metrics.Timer(metricName).Stop()
- }
- return s(qc, query)
-}
-
-type queryStage = struct {
- name string
- metricName string
- f func(*QueryContext, Body) (Body, error)
-}
-
-func (qc *queryCompiler) Compile(query Body) (Body, error) {
- if len(query) == 0 {
- return nil, Errors{NewError(CompileErr, nil, "empty query cannot be compiled")}
- }
-
- query = query.Copy()
-
- stages := []queryStage{
- {"CheckKeywordOverrides", "query_compile_stage_check_keyword_overrides", qc.checkKeywordOverrides},
- {"ResolveRefs", "query_compile_stage_resolve_refs", qc.resolveRefs},
- {"RewriteLocalVars", "query_compile_stage_rewrite_local_vars", qc.rewriteLocalVars},
- {"CheckVoidCalls", "query_compile_stage_check_void_calls", qc.checkVoidCalls},
- {"RewritePrintCalls", "query_compile_stage_rewrite_print_calls", qc.rewritePrintCalls},
- {"RewriteExprTerms", "query_compile_stage_rewrite_expr_terms", qc.rewriteExprTerms},
- {"RewriteComprehensionTerms", "query_compile_stage_rewrite_comprehension_terms", qc.rewriteComprehensionTerms},
- {"RewriteWithValues", "query_compile_stage_rewrite_with_values", qc.rewriteWithModifiers},
- {"CheckUndefinedFuncs", "query_compile_stage_check_undefined_funcs", qc.checkUndefinedFuncs},
- {"CheckSafety", "query_compile_stage_check_safety", qc.checkSafety},
- {"RewriteDynamicTerms", "query_compile_stage_rewrite_dynamic_terms", qc.rewriteDynamicTerms},
- {"CheckTypes", "query_compile_stage_check_types", qc.checkTypes},
- {"CheckUnsafeBuiltins", "query_compile_stage_check_unsafe_builtins", qc.checkUnsafeBuiltins},
- {"CheckDeprecatedBuiltins", "query_compile_stage_check_deprecated_builtins", qc.checkDeprecatedBuiltins},
- }
- if qc.compiler.evalMode == EvalModeTopdown {
- stages = append(stages, queryStage{"BuildComprehensionIndex", "query_compile_stage_build_comprehension_index", qc.buildComprehensionIndices})
- }
-
- qctx := qc.qctx.Copy()
-
- for _, s := range stages {
- var err error
- query, err = qc.runStage(s.metricName, qctx, query, s.f)
- if err != nil {
- return nil, qc.applyErrorLimit(err)
- }
- for _, s := range qc.after[s.name] {
- query, err = qc.runStageAfter(s.MetricName, query, s.Stage)
- if err != nil {
- return nil, qc.applyErrorLimit(err)
- }
- }
- }
-
- return query, nil
-}
-
-func (qc *queryCompiler) TypeEnv() *TypeEnv {
- return qc.typeEnv
-}
-
-func (qc *queryCompiler) applyErrorLimit(err error) error {
- var errs Errors
- if errors.As(err, &errs) {
- if qc.compiler.maxErrs > 0 && len(errs) > qc.compiler.maxErrs {
- err = append(errs[:qc.compiler.maxErrs], errLimitReached)
- }
- }
- return err
-}
-
-func (qc *queryCompiler) checkKeywordOverrides(_ *QueryContext, body Body) (Body, error) {
- if qc.compiler.strict {
- if errs := checkRootDocumentOverrides(body); len(errs) > 0 {
- return nil, errs
- }
- }
- return body, nil
-}
-
-func (qc *queryCompiler) resolveRefs(qctx *QueryContext, body Body) (Body, error) {
-
- var globals map[Var]*usedRef
-
- if qctx != nil {
- pkg := qctx.Package
- // Query compiler ought to generate a package if one was not provided and one or more imports were provided.
- // The generated package name could even be an empty string to avoid conflicts (it doesn't have to be valid syntactically)
- if pkg == nil && len(qctx.Imports) > 0 {
- pkg = &Package{Path: RefTerm(VarTerm("")).Value.(Ref)}
- }
- if pkg != nil {
- var ruleExports []Ref
- rules := qc.compiler.getExports()
- if exist, ok := rules.Get(pkg.Path); ok {
- ruleExports = exist.([]Ref)
- }
-
- globals = getGlobals(qctx.Package, ruleExports, qctx.Imports)
- qctx.Imports = nil
- }
- }
-
- ignore := &declaredVarStack{declaredVars(body)}
-
- return resolveRefsInBody(globals, ignore, body), nil
-}
-
-func (qc *queryCompiler) rewriteComprehensionTerms(_ *QueryContext, body Body) (Body, error) {
- gen := newLocalVarGenerator("q", body)
- f := newEqualityFactory(gen)
- node, err := rewriteComprehensionTerms(f, body)
- if err != nil {
- return nil, err
- }
- return node.(Body), nil
-}
-
-func (qc *queryCompiler) rewriteDynamicTerms(_ *QueryContext, body Body) (Body, error) {
- gen := newLocalVarGenerator("q", body)
- f := newEqualityFactory(gen)
- return rewriteDynamics(f, body), nil
-}
-
-func (qc *queryCompiler) rewriteExprTerms(_ *QueryContext, body Body) (Body, error) {
- gen := newLocalVarGenerator("q", body)
- return rewriteExprTermsInBody(gen, body), nil
-}
-
-func (qc *queryCompiler) rewriteLocalVars(_ *QueryContext, body Body) (Body, error) {
- gen := newLocalVarGenerator("q", body)
- stack := newLocalDeclaredVars()
- body, _, err := rewriteLocalVars(gen, stack, nil, body, qc.compiler.strict)
- if len(err) != 0 {
- return nil, err
- }
- qc.rewritten = make(map[Var]Var, len(stack.rewritten))
- for k, v := range stack.rewritten {
- // The vars returned during the rewrite will include all seen vars,
- // even if they're not declared with an assignment operation. We don't
- // want to include these inside the rewritten set though.
- qc.rewritten[k] = v
- }
- return body, nil
-}
-
-func (qc *queryCompiler) rewritePrintCalls(_ *QueryContext, body Body) (Body, error) {
- if !qc.enablePrintStatements {
- _, cpy := erasePrintCallsInBody(body)
- return cpy, nil
- }
- gen := newLocalVarGenerator("q", body)
- if _, errs := rewritePrintCalls(gen, qc.compiler.GetArity, ReservedVars, body); len(errs) > 0 {
- return nil, errs
- }
- return body, nil
-}
-
-func (qc *queryCompiler) checkVoidCalls(_ *QueryContext, body Body) (Body, error) {
- if errs := checkVoidCalls(qc.compiler.TypeEnv, body); len(errs) > 0 {
- return nil, errs
- }
- return body, nil
-}
-
-func (qc *queryCompiler) checkUndefinedFuncs(_ *QueryContext, body Body) (Body, error) {
- if errs := checkUndefinedFuncs(qc.compiler.TypeEnv, body, qc.compiler.GetArity, qc.rewritten); len(errs) > 0 {
- return nil, errs
- }
- return body, nil
-}
-
-func (qc *queryCompiler) checkSafety(_ *QueryContext, body Body) (Body, error) {
- safe := ReservedVars.Copy()
- reordered, unsafe := reorderBodyForSafety(qc.compiler.builtins, qc.compiler.GetArity, safe, body)
- if errs := safetyErrorSlice(unsafe, qc.RewrittenVars()); len(errs) > 0 {
- return nil, errs
- }
- return reordered, nil
-}
-
-func (qc *queryCompiler) checkTypes(_ *QueryContext, body Body) (Body, error) {
- var errs Errors
- checker := newTypeChecker().
- WithSchemaSet(qc.compiler.schemaSet).
- WithInputType(qc.compiler.inputType).
- WithVarRewriter(rewriteVarsInRef(qc.rewritten, qc.compiler.RewrittenVars))
- qc.typeEnv, errs = checker.CheckBody(qc.compiler.TypeEnv, body)
- if len(errs) > 0 {
- return nil, errs
- }
-
- return body, nil
-}
-
-func (qc *queryCompiler) checkUnsafeBuiltins(_ *QueryContext, body Body) (Body, error) {
- errs := checkUnsafeBuiltins(qc.unsafeBuiltinsMap(), body)
- if len(errs) > 0 {
- return nil, errs
- }
- return body, nil
-}
-
-func (qc *queryCompiler) unsafeBuiltinsMap() map[string]struct{} {
- if qc.unsafeBuiltins != nil {
- return qc.unsafeBuiltins
- }
- return qc.compiler.unsafeBuiltinsMap
-}
-
-func (qc *queryCompiler) checkDeprecatedBuiltins(_ *QueryContext, body Body) (Body, error) {
- if qc.compiler.strict {
- errs := checkDeprecatedBuiltins(qc.compiler.deprecatedBuiltinsMap, body)
- if len(errs) > 0 {
- return nil, errs
- }
- }
- return body, nil
-}
-
-func (qc *queryCompiler) rewriteWithModifiers(_ *QueryContext, body Body) (Body, error) {
- f := newEqualityFactory(newLocalVarGenerator("q", body))
- body, err := rewriteWithModifiersInBody(qc.compiler, qc.unsafeBuiltinsMap(), f, body)
- if err != nil {
- return nil, Errors{err}
- }
- return body, nil
-}
-
-func (qc *queryCompiler) buildComprehensionIndices(_ *QueryContext, body Body) (Body, error) {
- // NOTE(tsandall): The query compiler does not have a metrics object so we
- // cannot record index metrics currently.
- _ = buildComprehensionIndices(qc.compiler.debug, qc.compiler.GetArity, ReservedVars, qc.RewrittenVars(), body, qc.comprehensionIndices)
- return body, nil
-}
-
-// ComprehensionIndex specifies how the comprehension term can be indexed. The keys
-// tell the evaluator what variables to use for indexing. In the future, the index
-// could be expanded with more information that would allow the evaluator to index
-// a larger fragment of comprehensions (e.g., by closing over variables in the outer
-// query.)
-type ComprehensionIndex struct {
- Term *Term
- Keys []*Term
-}
-
-func (ci *ComprehensionIndex) String() string {
- if ci == nil {
- return ""
- }
- return fmt.Sprintf("", NewArray(ci.Keys...))
-}
-
-func buildComprehensionIndices(dbg debug.Debug, arity func(Ref) int, candidates VarSet, rwVars map[Var]Var, node interface{}, result map[*Term]*ComprehensionIndex) uint64 {
- var n uint64
- cpy := candidates.Copy()
- WalkBodies(node, func(b Body) bool {
- for _, expr := range b {
- index := getComprehensionIndex(dbg, arity, cpy, rwVars, expr)
- if index != nil {
- result[index.Term] = index
- n++
- }
- // Any variables appearing in the expressions leading up to the comprehension
- // are fair-game to be used as index keys.
- cpy.Update(expr.Vars(VarVisitorParams{SkipClosures: true, SkipRefCallHead: true}))
- }
- return false
- })
- return n
-}
-
-func getComprehensionIndex(dbg debug.Debug, arity func(Ref) int, candidates VarSet, rwVars map[Var]Var, expr *Expr) *ComprehensionIndex {
-
- // Ignore everything except = expressions. Extract
- // the comprehension term from the expression.
- if !expr.IsEquality() || expr.Negated || len(expr.With) > 0 {
- // No debug message, these are assumed to be known hinderances
- // to comprehension indexing.
- return nil
- }
-
- var term *Term
-
- lhs, rhs := expr.Operand(0), expr.Operand(1)
-
- if _, ok := lhs.Value.(Var); ok && IsComprehension(rhs.Value) {
- term = rhs
- } else if _, ok := rhs.Value.(Var); ok && IsComprehension(lhs.Value) {
- term = lhs
- }
-
- if term == nil {
- // no debug for this, it's the ordinary "nothing to do here" case
- return nil
- }
-
- // Ignore comprehensions that contain expressions that close over variables
- // in the outer body if those variables are not also output variables in the
- // comprehension body. In other words, ignore comprehensions that we cannot
- // safely evaluate without bindings from the outer body. For example:
- //
- // x = [1]
- // [true | data.y[z] = x] # safe to evaluate w/o outer body
- // [true | data.y[z] = x[0]] # NOT safe to evaluate because 'x' would be unsafe.
- //
- // By identifying output variables in the body we also know what to index on by
- // intersecting with candidate variables from the outer query.
- //
- // For example:
- //
- // x = data.foo[_]
- // _ = [y | data.bar[y] = x] # index on 'x'
- //
- // This query goes from O(data.foo*data.bar) to O(data.foo+data.bar).
- var body Body
-
- switch x := term.Value.(type) {
- case *ArrayComprehension:
- body = x.Body
- case *SetComprehension:
- body = x.Body
- case *ObjectComprehension:
- body = x.Body
- }
-
- outputs := outputVarsForBody(body, arity, ReservedVars)
- unsafe := body.Vars(SafetyCheckVisitorParams).Diff(outputs).Diff(ReservedVars)
-
- if len(unsafe) > 0 {
- dbg.Printf("%s: comprehension index: unsafe vars: %v", expr.Location, unsafe)
- return nil
- }
-
- // Similarly, ignore comprehensions that contain references with output variables
- // that intersect with the candidates. Indexing these comprehensions could worsen
- // performance.
- regressionVis := newComprehensionIndexRegressionCheckVisitor(candidates)
- regressionVis.Walk(body)
- if regressionVis.worse {
- dbg.Printf("%s: comprehension index: output vars intersect candidates", expr.Location)
- return nil
- }
-
- // Check if any nested comprehensions close over candidates. If any intersection is found
- // the comprehension cannot be cached because it would require closing over the candidates
- // which the evaluator does not support today.
- nestedVis := newComprehensionIndexNestedCandidateVisitor(candidates)
- nestedVis.Walk(body)
- if nestedVis.found {
- dbg.Printf("%s: comprehension index: nested comprehensions close over candidates", expr.Location)
- return nil
- }
-
- // Make a sorted set of variable names that will serve as the index key set.
- // Sort to ensure deterministic indexing. In future this could be relaxed
- // if we can decide that one ordering is better than another. If the set is
- // empty, there is no indexing to do.
- indexVars := candidates.Intersect(outputs)
- if len(indexVars) == 0 {
- dbg.Printf("%s: comprehension index: no index vars", expr.Location)
- return nil
- }
-
- result := make([]*Term, 0, len(indexVars))
-
- for v := range indexVars {
- result = append(result, NewTerm(v))
- }
-
- sort.Slice(result, func(i, j int) bool {
- return result[i].Value.Compare(result[j].Value) < 0
- })
-
- debugRes := make([]*Term, len(result))
- for i, r := range result {
- if o, ok := rwVars[r.Value.(Var)]; ok {
- debugRes[i] = NewTerm(o)
- } else {
- debugRes[i] = r
- }
- }
- dbg.Printf("%s: comprehension index: built with keys: %v", expr.Location, debugRes)
- return &ComprehensionIndex{Term: term, Keys: result}
-}
-
-type comprehensionIndexRegressionCheckVisitor struct {
- candidates VarSet
- seen VarSet
- worse bool
-}
-
-// TODO(tsandall): Improve this so that users can either supply this list explicitly
-// or the information is maintained on the built-in function declaration. What we really
-// need to know is whether the built-in function allows callers to push down output
-// values or not. It's unlikely that anything outside of OPA does this today so this
-// solution is fine for now.
-var comprehensionIndexBlacklist = map[string]int{
- WalkBuiltin.Name: len(WalkBuiltin.Decl.FuncArgs().Args),
-}
-
-func newComprehensionIndexRegressionCheckVisitor(candidates VarSet) *comprehensionIndexRegressionCheckVisitor {
- return &comprehensionIndexRegressionCheckVisitor{
- candidates: candidates,
- seen: NewVarSet(),
- }
-}
-
-func (vis *comprehensionIndexRegressionCheckVisitor) Walk(x interface{}) {
- NewGenericVisitor(vis.visit).Walk(x)
-}
-
-func (vis *comprehensionIndexRegressionCheckVisitor) visit(x interface{}) bool {
- if !vis.worse {
- switch x := x.(type) {
- case *Expr:
- operands := x.Operands()
- if pos := comprehensionIndexBlacklist[x.Operator().String()]; pos > 0 && pos < len(operands) {
- vis.assertEmptyIntersection(operands[pos].Vars())
- }
- case Ref:
- vis.assertEmptyIntersection(x.OutputVars())
- case Var:
- vis.seen.Add(x)
- // Always skip comprehensions. We do not have to visit their bodies here.
- case *ArrayComprehension, *SetComprehension, *ObjectComprehension:
- return true
- }
- }
- return vis.worse
-}
-
-func (vis *comprehensionIndexRegressionCheckVisitor) assertEmptyIntersection(vs VarSet) {
- for v := range vs {
- if vis.candidates.Contains(v) && !vis.seen.Contains(v) {
- vis.worse = true
- return
- }
- }
-}
-
-type comprehensionIndexNestedCandidateVisitor struct {
- candidates VarSet
- found bool
-}
-
-func newComprehensionIndexNestedCandidateVisitor(candidates VarSet) *comprehensionIndexNestedCandidateVisitor {
- return &comprehensionIndexNestedCandidateVisitor{
- candidates: candidates,
- }
-}
-
-func (vis *comprehensionIndexNestedCandidateVisitor) Walk(x interface{}) {
- NewGenericVisitor(vis.visit).Walk(x)
-}
-
-func (vis *comprehensionIndexNestedCandidateVisitor) visit(x interface{}) bool {
-
- if vis.found {
- return true
- }
-
- if v, ok := x.(Value); ok && IsComprehension(v) {
- varVis := NewVarVisitor().WithParams(VarVisitorParams{SkipRefHead: true})
- varVis.Walk(v)
- vis.found = len(varVis.Vars().Intersect(vis.candidates)) > 0
- return true
- }
-
- return false
-}
-
-// ModuleTreeNode represents a node in the module tree. The module
-// tree is keyed by the package path.
-type ModuleTreeNode struct {
- Key Value
- Modules []*Module
- Children map[Value]*ModuleTreeNode
- Hide bool
-}
-
-func (n *ModuleTreeNode) String() string {
- var rules []string
- for _, m := range n.Modules {
- for _, r := range m.Rules {
- rules = append(rules, r.Head.String())
- }
- }
- return fmt.Sprintf("", n.Key, n.Children, rules, n.Hide)
-}
-
-// NewModuleTree returns a new ModuleTreeNode that represents the root
-// of the module tree populated with the given modules.
-func NewModuleTree(mods map[string]*Module) *ModuleTreeNode {
- root := &ModuleTreeNode{
- Children: map[Value]*ModuleTreeNode{},
- }
- names := make([]string, 0, len(mods))
- for name := range mods {
- names = append(names, name)
- }
- sort.Strings(names)
- for _, name := range names {
- m := mods[name]
- node := root
- for i, x := range m.Package.Path {
- c, ok := node.Children[x.Value]
- if !ok {
- var hide bool
- if i == 1 && x.Value.Compare(SystemDocumentKey) == 0 {
- hide = true
- }
- c = &ModuleTreeNode{
- Key: x.Value,
- Children: map[Value]*ModuleTreeNode{},
- Hide: hide,
- }
- node.Children[x.Value] = c
- }
- node = c
- }
- node.Modules = append(node.Modules, m)
- }
- return root
-}
-
-// Size returns the number of modules in the tree.
-func (n *ModuleTreeNode) Size() int {
- s := len(n.Modules)
- for _, c := range n.Children {
- s += c.Size()
- }
- return s
-}
-
-// Child returns n's child with key k.
-func (n *ModuleTreeNode) child(k Value) *ModuleTreeNode {
- switch k.(type) {
- case String, Var:
- return n.Children[k]
- }
- return nil
-}
-
-// Find dereferences ref along the tree. ref[0] is converted to a String
-// for convenience.
-func (n *ModuleTreeNode) find(ref Ref) (*ModuleTreeNode, Ref) {
- if v, ok := ref[0].Value.(Var); ok {
- ref = Ref{StringTerm(string(v))}.Concat(ref[1:])
- }
- node := n
- for i, r := range ref {
- next := node.child(r.Value)
- if next == nil {
- tail := make(Ref, len(ref)-i)
- tail[0] = VarTerm(string(ref[i].Value.(String)))
- copy(tail[1:], ref[i+1:])
- return node, tail
- }
- node = next
- }
- return node, nil
-}
-
-// DepthFirst performs a depth-first traversal of the module tree rooted at n.
-// If f returns true, traversal will not continue to the children of n.
-func (n *ModuleTreeNode) DepthFirst(f func(*ModuleTreeNode) bool) {
- if f(n) {
- return
- }
- for _, node := range n.Children {
- node.DepthFirst(f)
- }
-}
-
-// TreeNode represents a node in the rule tree. The rule tree is keyed by
-// rule path.
-type TreeNode struct {
- Key Value
- Values []util.T
- Children map[Value]*TreeNode
- Sorted []Value
- Hide bool
-}
-
-func (n *TreeNode) String() string {
- return fmt.Sprintf("", n.Key, n.Values, n.Sorted, n.Hide)
-}
-
-// NewRuleTree returns a new TreeNode that represents the root
-// of the rule tree populated with the given rules.
-func NewRuleTree(mtree *ModuleTreeNode) *TreeNode {
- root := TreeNode{
- Key: mtree.Key,
- }
-
- mtree.DepthFirst(func(m *ModuleTreeNode) bool {
- for _, mod := range m.Modules {
- if len(mod.Rules) == 0 {
- root.add(mod.Package.Path, nil)
- }
- for _, rule := range mod.Rules {
- root.add(rule.Ref().GroundPrefix(), rule)
- }
- }
- return false
- })
-
- // ensure that data.system's TreeNode is hidden
- node, tail := root.find(DefaultRootRef.Append(NewTerm(SystemDocumentKey)))
- if len(tail) == 0 { // found
- node.Hide = true
- }
-
- root.DepthFirst(func(x *TreeNode) bool {
- x.sort()
- return false
- })
-
- return &root
-}
-
-func (n *TreeNode) add(path Ref, rule *Rule) {
- node, tail := n.find(path)
- if len(tail) > 0 {
- sub := treeNodeFromRef(tail, rule)
- if node.Children == nil {
- node.Children = make(map[Value]*TreeNode, 1)
- }
- node.Children[sub.Key] = sub
- node.Sorted = append(node.Sorted, sub.Key)
- } else {
- if rule != nil {
- node.Values = append(node.Values, rule)
- }
- }
-}
-
-// Size returns the number of rules in the tree.
-func (n *TreeNode) Size() int {
- s := len(n.Values)
- for _, c := range n.Children {
- s += c.Size()
- }
- return s
-}
-
-// Child returns n's child with key k.
-func (n *TreeNode) Child(k Value) *TreeNode {
- switch k.(type) {
- case Ref, Call:
- return nil
- default:
- return n.Children[k]
- }
-}
-
-// Find dereferences ref along the tree
-func (n *TreeNode) Find(ref Ref) *TreeNode {
- node := n
- for _, r := range ref {
- node = node.Child(r.Value)
- if node == nil {
- return nil
- }
- }
- return node
-}
-
-// Iteratively dereferences ref along the node's subtree.
-// - If matching fails immediately, the tail will contain the full ref.
-// - Partial matching will result in a tail of non-zero length.
-// - A complete match will result in a 0 length tail.
-func (n *TreeNode) find(ref Ref) (*TreeNode, Ref) {
- node := n
- for i := range ref {
- next := node.Child(ref[i].Value)
- if next == nil {
- tail := make(Ref, len(ref)-i)
- copy(tail, ref[i:])
- return node, tail
- }
- node = next
- }
- return node, nil
-}
-
-// DepthFirst performs a depth-first traversal of the rule tree rooted at n. If
-// f returns true, traversal will not continue to the children of n.
-func (n *TreeNode) DepthFirst(f func(*TreeNode) bool) {
- if f(n) {
- return
- }
- for _, node := range n.Children {
- node.DepthFirst(f)
- }
-}
-
-func (n *TreeNode) sort() {
- sort.Slice(n.Sorted, func(i, j int) bool {
- return n.Sorted[i].Compare(n.Sorted[j]) < 0
- })
-}
-
-func treeNodeFromRef(ref Ref, rule *Rule) *TreeNode {
- depth := len(ref) - 1
- key := ref[depth].Value
- node := &TreeNode{
- Key: key,
- Children: nil,
- }
- if rule != nil {
- node.Values = []util.T{rule}
- }
-
- for i := len(ref) - 2; i >= 0; i-- {
- key := ref[i].Value
- node = &TreeNode{
- Key: key,
- Children: map[Value]*TreeNode{ref[i+1].Value: node},
- Sorted: []Value{ref[i+1].Value},
- }
- }
- return node
-}
-
-// flattenChildren flattens all children's rule refs into a sorted array.
-func (n *TreeNode) flattenChildren() []Ref {
- ret := newRefSet()
- for _, sub := range n.Children { // we only want the children, so don't use n.DepthFirst() right away
- sub.DepthFirst(func(x *TreeNode) bool {
- for _, r := range x.Values {
- rule := r.(*Rule)
- ret.AddPrefix(rule.Ref())
- }
- return false
- })
- }
-
- sort.Slice(ret.s, func(i, j int) bool {
- return ret.s[i].Compare(ret.s[j]) < 0
- })
- return ret.s
-}
-
-// Graph represents the graph of dependencies between rules.
-type Graph struct {
- adj map[util.T]map[util.T]struct{}
- radj map[util.T]map[util.T]struct{}
- nodes map[util.T]struct{}
- sorted []util.T
-}
-
-// NewGraph returns a new Graph based on modules. The list function must return
-// the rules referred to directly by the ref.
-func NewGraph(modules map[string]*Module, list func(Ref) []*Rule) *Graph {
-
- graph := &Graph{
- adj: map[util.T]map[util.T]struct{}{},
- radj: map[util.T]map[util.T]struct{}{},
- nodes: map[util.T]struct{}{},
- sorted: nil,
- }
-
- // Create visitor to walk a rule AST and add edges to the rule graph for
- // each dependency.
- vis := func(a *Rule) *GenericVisitor {
- stop := false
- return NewGenericVisitor(func(x interface{}) bool {
- switch x := x.(type) {
- case Ref:
- for _, b := range list(x) {
- for node := b; node != nil; node = node.Else {
- graph.addDependency(a, node)
- }
- }
- case *Rule:
- if stop {
- // Do not recurse into else clauses (which will be handled
- // by the outer visitor.)
- return true
- }
- stop = true
- }
- return false
- })
- }
-
- // Walk over all rules, add them to graph, and build adjacency lists.
- for _, module := range modules {
- WalkRules(module, func(a *Rule) bool {
- graph.addNode(a)
- vis(a).Walk(a)
- return false
- })
- }
-
- return graph
-}
-
-// Dependencies returns the set of rules that x depends on.
-func (g *Graph) Dependencies(x util.T) map[util.T]struct{} {
- return g.adj[x]
-}
-
-// Dependents returns the set of rules that depend on x.
-func (g *Graph) Dependents(x util.T) map[util.T]struct{} {
- return g.radj[x]
-}
-
-// Sort returns a slice of rules sorted by dependencies. If a cycle is found,
-// ok is set to false.
-func (g *Graph) Sort() (sorted []util.T, ok bool) {
- if g.sorted != nil {
- return g.sorted, true
- }
-
- sorter := &graphSort{
- sorted: make([]util.T, 0, len(g.nodes)),
- deps: g.Dependencies,
- marked: map[util.T]struct{}{},
- temp: map[util.T]struct{}{},
- }
-
- for node := range g.nodes {
- if !sorter.Visit(node) {
- return nil, false
- }
- }
-
- g.sorted = sorter.sorted
- return g.sorted, true
-}
-
-func (g *Graph) addDependency(u util.T, v util.T) {
-
- if _, ok := g.nodes[u]; !ok {
- g.addNode(u)
- }
-
- if _, ok := g.nodes[v]; !ok {
- g.addNode(v)
- }
-
- edges, ok := g.adj[u]
- if !ok {
- edges = map[util.T]struct{}{}
- g.adj[u] = edges
- }
-
- edges[v] = struct{}{}
-
- edges, ok = g.radj[v]
- if !ok {
- edges = map[util.T]struct{}{}
- g.radj[v] = edges
- }
-
- edges[u] = struct{}{}
-}
-
-func (g *Graph) addNode(n util.T) {
- g.nodes[n] = struct{}{}
-}
-
-type graphSort struct {
- sorted []util.T
- deps func(util.T) map[util.T]struct{}
- marked map[util.T]struct{}
- temp map[util.T]struct{}
-}
-
-func (sort *graphSort) Marked(node util.T) bool {
- _, marked := sort.marked[node]
- return marked
-}
-
-func (sort *graphSort) Visit(node util.T) (ok bool) {
- if _, ok := sort.temp[node]; ok {
- return false
- }
- if sort.Marked(node) {
- return true
- }
- sort.temp[node] = struct{}{}
- for other := range sort.deps(node) {
- if !sort.Visit(other) {
- return false
- }
- }
- sort.marked[node] = struct{}{}
- delete(sort.temp, node)
- sort.sorted = append(sort.sorted, node)
- return true
-}
-
-// GraphTraversal is a Traversal that understands the dependency graph
-type GraphTraversal struct {
- graph *Graph
- visited map[util.T]struct{}
-}
-
-// NewGraphTraversal returns a Traversal for the dependency graph
-func NewGraphTraversal(graph *Graph) *GraphTraversal {
- return &GraphTraversal{
- graph: graph,
- visited: map[util.T]struct{}{},
- }
-}
-
-// Edges lists all dependency connections for a given node
-func (g *GraphTraversal) Edges(x util.T) []util.T {
- r := []util.T{}
- for v := range g.graph.Dependencies(x) {
- r = append(r, v)
- }
- return r
-}
-
-// Visited returns whether a node has been visited, setting a node to visited if not
-func (g *GraphTraversal) Visited(u util.T) bool {
- _, ok := g.visited[u]
- g.visited[u] = struct{}{}
- return ok
-}
-
-type unsafePair struct {
- Expr *Expr
- Vars VarSet
-}
-
-type unsafeVarLoc struct {
- Var Var
- Loc *Location
-}
-
-type unsafeVars map[*Expr]VarSet
-
-func (vs unsafeVars) Add(e *Expr, v Var) {
- if u, ok := vs[e]; ok {
- u[v] = struct{}{}
- } else {
- vs[e] = VarSet{v: struct{}{}}
- }
-}
-
-func (vs unsafeVars) Set(e *Expr, s VarSet) {
- vs[e] = s
-}
-
-func (vs unsafeVars) Update(o unsafeVars) {
- for k, v := range o {
- if _, ok := vs[k]; !ok {
- vs[k] = VarSet{}
- }
- vs[k].Update(v)
- }
-}
-
-func (vs unsafeVars) Vars() (result []unsafeVarLoc) {
-
- locs := map[Var]*Location{}
-
- // If var appears in multiple sets then pick first by location.
- for expr, vars := range vs {
- for v := range vars {
- if locs[v].Compare(expr.Location) > 0 {
- locs[v] = expr.Location
- }
- }
- }
-
- for v, loc := range locs {
- result = append(result, unsafeVarLoc{
- Var: v,
- Loc: loc,
- })
- }
-
- sort.Slice(result, func(i, j int) bool {
- return result[i].Loc.Compare(result[j].Loc) < 0
- })
-
- return result
-}
-
-func (vs unsafeVars) Slice() (result []unsafePair) {
- for expr, vs := range vs {
- result = append(result, unsafePair{
- Expr: expr,
- Vars: vs,
- })
- }
- return
-}
-
-// reorderBodyForSafety returns a copy of the body ordered such that
-// left to right evaluation of the body will not encounter unbound variables
-// in input positions or negated expressions.
-//
-// Expressions are added to the re-ordered body as soon as they are considered
-// safe. If multiple expressions become safe in the same pass, they are added
-// in their original order. This results in minimal re-ordering of the body.
-//
-// If the body cannot be reordered to ensure safety, the second return value
-// contains a mapping of expressions to unsafe variables in those expressions.
-func reorderBodyForSafety(builtins map[string]*Builtin, arity func(Ref) int, globals VarSet, body Body) (Body, unsafeVars) {
-
- bodyVars := body.Vars(SafetyCheckVisitorParams)
- reordered := make(Body, 0, len(body))
- safe := VarSet{}
- unsafe := unsafeVars{}
-
- for _, e := range body {
- for v := range e.Vars(SafetyCheckVisitorParams) {
- if globals.Contains(v) {
- safe.Add(v)
- } else {
- unsafe.Add(e, v)
- }
- }
- }
-
- for {
- n := len(reordered)
-
- for _, e := range body {
- if reordered.Contains(e) {
- continue
- }
-
- ovs := outputVarsForExpr(e, arity, safe)
-
- // check closures: is this expression closing over variables that
- // haven't been made safe by what's already included in `reordered`?
- vs := unsafeVarsInClosures(e)
- cv := vs.Intersect(bodyVars).Diff(globals)
- uv := cv.Diff(outputVarsForBody(reordered, arity, safe))
-
- if len(uv) > 0 {
- if uv.Equal(ovs) { // special case "closure-self"
- continue
- }
- unsafe.Set(e, uv)
- }
-
- for v := range unsafe[e] {
- if ovs.Contains(v) || safe.Contains(v) {
- delete(unsafe[e], v)
- }
- }
-
- if len(unsafe[e]) == 0 {
- delete(unsafe, e)
- reordered.Append(e)
- safe.Update(ovs) // this expression's outputs are safe
- }
- }
-
- if len(reordered) == n { // fixed point, could not add any expr of body
- break
- }
- }
-
- // Recursively visit closures and perform the safety checks on them.
- // Update the globals at each expression to include the variables that could
- // be closed over.
- g := globals.Copy()
- for i, e := range reordered {
- if i > 0 {
- g.Update(reordered[i-1].Vars(SafetyCheckVisitorParams))
- }
- xform := &bodySafetyTransformer{
- builtins: builtins,
- arity: arity,
- current: e,
- globals: g,
- unsafe: unsafe,
- }
- NewGenericVisitor(xform.Visit).Walk(e)
- }
-
- return reordered, unsafe
-}
-
-type bodySafetyTransformer struct {
- builtins map[string]*Builtin
- arity func(Ref) int
- current *Expr
- globals VarSet
- unsafe unsafeVars
-}
-
-func (xform *bodySafetyTransformer) Visit(x interface{}) bool {
- switch term := x.(type) {
- case *Term:
- switch x := term.Value.(type) {
- case *object:
- cpy, _ := x.Map(func(k, v *Term) (*Term, *Term, error) {
- kcpy := k.Copy()
- NewGenericVisitor(xform.Visit).Walk(kcpy)
- vcpy := v.Copy()
- NewGenericVisitor(xform.Visit).Walk(vcpy)
- return kcpy, vcpy, nil
- })
- term.Value = cpy
- return true
- case *set:
- cpy, _ := x.Map(func(v *Term) (*Term, error) {
- vcpy := v.Copy()
- NewGenericVisitor(xform.Visit).Walk(vcpy)
- return vcpy, nil
- })
- term.Value = cpy
- return true
- case *ArrayComprehension:
- xform.reorderArrayComprehensionSafety(x)
- return true
- case *ObjectComprehension:
- xform.reorderObjectComprehensionSafety(x)
- return true
- case *SetComprehension:
- xform.reorderSetComprehensionSafety(x)
- return true
- }
- case *Expr:
- if ev, ok := term.Terms.(*Every); ok {
- xform.globals.Update(ev.KeyValueVars())
- ev.Body = xform.reorderComprehensionSafety(NewVarSet(), ev.Body)
- return true
- }
- }
- return false
-}
-
-func (xform *bodySafetyTransformer) reorderComprehensionSafety(tv VarSet, body Body) Body {
- bv := body.Vars(SafetyCheckVisitorParams)
- bv.Update(xform.globals)
- uv := tv.Diff(bv)
- for v := range uv {
- xform.unsafe.Add(xform.current, v)
- }
-
- r, u := reorderBodyForSafety(xform.builtins, xform.arity, xform.globals, body)
- if len(u) == 0 {
- return r
- }
-
- xform.unsafe.Update(u)
- return body
-}
-
-func (xform *bodySafetyTransformer) reorderArrayComprehensionSafety(ac *ArrayComprehension) {
- ac.Body = xform.reorderComprehensionSafety(ac.Term.Vars(), ac.Body)
-}
-
-func (xform *bodySafetyTransformer) reorderObjectComprehensionSafety(oc *ObjectComprehension) {
- tv := oc.Key.Vars()
- tv.Update(oc.Value.Vars())
- oc.Body = xform.reorderComprehensionSafety(tv, oc.Body)
-}
-
-func (xform *bodySafetyTransformer) reorderSetComprehensionSafety(sc *SetComprehension) {
- sc.Body = xform.reorderComprehensionSafety(sc.Term.Vars(), sc.Body)
-}
-
-// unsafeVarsInClosures collects vars that are contained in closures within
-// this expression.
-func unsafeVarsInClosures(e *Expr) VarSet {
- vs := VarSet{}
- WalkClosures(e, func(x interface{}) bool {
- vis := &VarVisitor{vars: vs}
- if ev, ok := x.(*Every); ok {
- vis.Walk(ev.Body)
- return true
- }
- vis.Walk(x)
- return true
- })
- return vs
-}
-
-// OutputVarsFromBody returns all variables which are the "output" for
-// the given body. For safety checks this means that they would be
-// made safe by the body.
-func OutputVarsFromBody(c *Compiler, body Body, safe VarSet) VarSet {
- return outputVarsForBody(body, c.GetArity, safe)
-}
-
-func outputVarsForBody(body Body, arity func(Ref) int, safe VarSet) VarSet {
- o := safe.Copy()
- for _, e := range body {
- o.Update(outputVarsForExpr(e, arity, o))
- }
- return o.Diff(safe)
-}
-
-// OutputVarsFromExpr returns all variables which are the "output" for
-// the given expression. For safety checks this means that they would be
-// made safe by the expr.
-func OutputVarsFromExpr(c *Compiler, expr *Expr, safe VarSet) VarSet {
- return outputVarsForExpr(expr, c.GetArity, safe)
-}
-
-func outputVarsForExpr(expr *Expr, arity func(Ref) int, safe VarSet) VarSet {
-
- // Negated expressions must be safe.
- if expr.Negated {
- return VarSet{}
- }
-
- // With modifier inputs must be safe.
- for _, with := range expr.With {
- vis := NewVarVisitor().WithParams(SafetyCheckVisitorParams)
- vis.Walk(with)
- vars := vis.Vars()
- unsafe := vars.Diff(safe)
- if len(unsafe) > 0 {
- return VarSet{}
- }
- }
-
- switch terms := expr.Terms.(type) {
- case *Term:
- return outputVarsForTerms(expr, safe)
- case []*Term:
- if expr.IsEquality() {
- return outputVarsForExprEq(expr, safe)
- }
-
- operator, ok := terms[0].Value.(Ref)
- if !ok {
- return VarSet{}
- }
-
- ar := arity(operator)
- if ar < 0 {
- return VarSet{}
- }
-
- return outputVarsForExprCall(expr, ar, safe, terms)
- case *Every:
- return outputVarsForTerms(terms.Domain, safe)
- default:
- panic("illegal expression")
- }
-}
-
-func outputVarsForExprEq(expr *Expr, safe VarSet) VarSet {
-
- if !validEqAssignArgCount(expr) {
- return safe
- }
-
- output := outputVarsForTerms(expr, safe)
- output.Update(safe)
- output.Update(Unify(output, expr.Operand(0), expr.Operand(1)))
-
- return output.Diff(safe)
-}
-
-func outputVarsForExprCall(expr *Expr, arity int, safe VarSet, terms []*Term) VarSet {
-
- output := outputVarsForTerms(expr, safe)
-
- numInputTerms := arity + 1
- if numInputTerms >= len(terms) {
- return output
- }
-
- params := VarVisitorParams{
- SkipClosures: true,
- SkipSets: true,
- SkipObjectKeys: true,
- SkipRefHead: true,
- }
- vis := NewVarVisitor().WithParams(params)
- vis.Walk(Args(terms[:numInputTerms]))
- unsafe := vis.Vars().Diff(output).Diff(safe)
-
- if len(unsafe) > 0 {
- return VarSet{}
- }
-
- vis = NewVarVisitor().WithParams(params)
- vis.Walk(Args(terms[numInputTerms:]))
- output.Update(vis.vars)
- return output
-}
-
-func outputVarsForTerms(expr interface{}, safe VarSet) VarSet {
- output := VarSet{}
- WalkTerms(expr, func(x *Term) bool {
- switch r := x.Value.(type) {
- case *SetComprehension, *ArrayComprehension, *ObjectComprehension:
- return true
- case Ref:
- if !isRefSafe(r, safe) {
- return true
- }
- output.Update(r.OutputVars())
- return false
- }
- return false
- })
- return output
-}
-
-type equalityFactory struct {
- gen *localVarGenerator
-}
-
-func newEqualityFactory(gen *localVarGenerator) *equalityFactory {
- return &equalityFactory{gen}
-}
-
-func (f *equalityFactory) Generate(other *Term) *Expr {
- term := NewTerm(f.gen.Generate()).SetLocation(other.Location)
- expr := Equality.Expr(term, other)
- expr.Generated = true
- expr.Location = other.Location
- return expr
-}
-
-type localVarGenerator struct {
- exclude VarSet
- suffix string
- next int
-}
-
-func newLocalVarGeneratorForModuleSet(sorted []string, modules map[string]*Module) *localVarGenerator {
- exclude := NewVarSet()
- vis := &VarVisitor{vars: exclude}
- for _, key := range sorted {
- vis.Walk(modules[key])
- }
- return &localVarGenerator{exclude: exclude, next: 0}
-}
-
-func newLocalVarGenerator(suffix string, node interface{}) *localVarGenerator {
- exclude := NewVarSet()
- vis := &VarVisitor{vars: exclude}
- vis.Walk(node)
- return &localVarGenerator{exclude: exclude, suffix: suffix, next: 0}
-}
-
-func (l *localVarGenerator) Generate() Var {
- for {
- result := Var("__local" + l.suffix + strconv.Itoa(l.next) + "__")
- l.next++
- if !l.exclude.Contains(result) {
- return result
- }
- }
-}
-
-func getGlobals(pkg *Package, rules []Ref, imports []*Import) map[Var]*usedRef {
-
- globals := make(map[Var]*usedRef, len(rules)) // NB: might grow bigger with imports
-
- // Populate globals with exports within the package.
- for _, ref := range rules {
- v := ref[0].Value.(Var)
- globals[v] = &usedRef{ref: pkg.Path.Append(StringTerm(string(v)))}
- }
-
- // Populate globals with imports.
- for _, imp := range imports {
- path := imp.Path.Value.(Ref)
- if FutureRootDocument.Equal(path[0]) || RegoRootDocument.Equal(path[0]) {
- continue // ignore future and rego imports
- }
- globals[imp.Name()] = &usedRef{ref: path}
- }
-
- return globals
-}
-
-func requiresEval(x *Term) bool {
- if x == nil {
- return false
- }
- return ContainsRefs(x) || ContainsComprehensions(x)
-}
-
-func resolveRef(globals map[Var]*usedRef, ignore *declaredVarStack, ref Ref) Ref {
-
- r := Ref{}
- for i, x := range ref {
- switch v := x.Value.(type) {
- case Var:
- if g, ok := globals[v]; ok && !ignore.Contains(v) {
- cpy := g.ref.Copy()
- for i := range cpy {
- cpy[i].SetLocation(x.Location)
- }
- if i == 0 {
- r = cpy
- } else {
- r = append(r, NewTerm(cpy).SetLocation(x.Location))
- }
- g.used = true
- } else {
- r = append(r, x)
- }
- case Ref, *Array, Object, Set, *ArrayComprehension, *SetComprehension, *ObjectComprehension, Call:
- r = append(r, resolveRefsInTerm(globals, ignore, x))
- default:
- r = append(r, x)
- }
- }
-
- return r
-}
-
-type usedRef struct {
- ref Ref
- used bool
-}
-
-func resolveRefsInRule(globals map[Var]*usedRef, rule *Rule) error {
- ignore := &declaredVarStack{}
-
- vars := NewVarSet()
- var vis *GenericVisitor
- var err error
-
- // Walk args to collect vars and transform body so that callers can shadow
- // root documents.
- vis = NewGenericVisitor(func(x interface{}) bool {
- if err != nil {
- return true
- }
- switch x := x.(type) {
- case Var:
- vars.Add(x)
-
- // Object keys cannot be pattern matched so only walk values.
- case *object:
- x.Foreach(func(_, v *Term) {
- vis.Walk(v)
- })
-
- // Skip terms that could contain vars that cannot be pattern matched.
- case Set, *ArrayComprehension, *SetComprehension, *ObjectComprehension, Call:
- return true
-
- case *Term:
- if _, ok := x.Value.(Ref); ok {
- if RootDocumentRefs.Contains(x) {
- // We could support args named input, data, etc. however
- // this would require rewriting terms in the head and body.
- // Preventing root document shadowing is simpler, and
- // arguably, will prevent confusing names from being used.
- // NOTE: this check is also performed as part of strict-mode in
- // checkRootDocumentOverrides.
- err = fmt.Errorf("args must not shadow %v (use a different variable name)", x)
- return true
- }
- }
- }
- return false
- })
-
- vis.Walk(rule.Head.Args)
-
- if err != nil {
- return err
- }
-
- ignore.Push(vars)
- ignore.Push(declaredVars(rule.Body))
-
- ref := rule.Head.Ref()
- for i := 1; i < len(ref); i++ {
- ref[i] = resolveRefsInTerm(globals, ignore, ref[i])
- }
- if rule.Head.Key != nil {
- rule.Head.Key = resolveRefsInTerm(globals, ignore, rule.Head.Key)
- }
-
- if rule.Head.Value != nil {
- rule.Head.Value = resolveRefsInTerm(globals, ignore, rule.Head.Value)
- }
-
- rule.Body = resolveRefsInBody(globals, ignore, rule.Body)
- return nil
-}
-
-func resolveRefsInBody(globals map[Var]*usedRef, ignore *declaredVarStack, body Body) Body {
- r := make([]*Expr, 0, len(body))
- for _, expr := range body {
- r = append(r, resolveRefsInExpr(globals, ignore, expr))
- }
- return r
-}
-
-func resolveRefsInExpr(globals map[Var]*usedRef, ignore *declaredVarStack, expr *Expr) *Expr {
- cpy := *expr
- switch ts := expr.Terms.(type) {
- case *Term:
- cpy.Terms = resolveRefsInTerm(globals, ignore, ts)
- case []*Term:
- buf := make([]*Term, len(ts))
- for i := 0; i < len(ts); i++ {
- buf[i] = resolveRefsInTerm(globals, ignore, ts[i])
- }
- cpy.Terms = buf
- case *SomeDecl:
- if val, ok := ts.Symbols[0].Value.(Call); ok {
- cpy.Terms = &SomeDecl{Symbols: []*Term{CallTerm(resolveRefsInTermSlice(globals, ignore, val)...)}}
- }
- case *Every:
- locals := NewVarSet()
- if ts.Key != nil {
- locals.Update(ts.Key.Vars())
- }
- locals.Update(ts.Value.Vars())
- ignore.Push(locals)
- cpy.Terms = &Every{
- Key: ts.Key.Copy(), // TODO(sr): do more?
- Value: ts.Value.Copy(), // TODO(sr): do more?
- Domain: resolveRefsInTerm(globals, ignore, ts.Domain),
- Body: resolveRefsInBody(globals, ignore, ts.Body),
- }
- ignore.Pop()
- }
- for _, w := range cpy.With {
- w.Target = resolveRefsInTerm(globals, ignore, w.Target)
- w.Value = resolveRefsInTerm(globals, ignore, w.Value)
- }
- return &cpy
-}
-
-func resolveRefsInTerm(globals map[Var]*usedRef, ignore *declaredVarStack, term *Term) *Term {
- switch v := term.Value.(type) {
- case Var:
- if g, ok := globals[v]; ok && !ignore.Contains(v) {
- cpy := g.ref.Copy()
- for i := range cpy {
- cpy[i].SetLocation(term.Location)
- }
- g.used = true
- return NewTerm(cpy).SetLocation(term.Location)
- }
- return term
- case Ref:
- fqn := resolveRef(globals, ignore, v)
- cpy := *term
- cpy.Value = fqn
- return &cpy
- case *object:
- cpy := *term
- cpy.Value, _ = v.Map(func(k, v *Term) (*Term, *Term, error) {
- k = resolveRefsInTerm(globals, ignore, k)
- v = resolveRefsInTerm(globals, ignore, v)
- return k, v, nil
- })
- return &cpy
- case *Array:
- cpy := *term
- cpy.Value = NewArray(resolveRefsInTermArray(globals, ignore, v)...)
- return &cpy
- case Call:
- cpy := *term
- cpy.Value = Call(resolveRefsInTermSlice(globals, ignore, v))
- return &cpy
- case Set:
- s, _ := v.Map(func(e *Term) (*Term, error) {
- return resolveRefsInTerm(globals, ignore, e), nil
- })
- cpy := *term
- cpy.Value = s
- return &cpy
- case *ArrayComprehension:
- ac := &ArrayComprehension{}
- ignore.Push(declaredVars(v.Body))
- ac.Term = resolveRefsInTerm(globals, ignore, v.Term)
- ac.Body = resolveRefsInBody(globals, ignore, v.Body)
- cpy := *term
- cpy.Value = ac
- ignore.Pop()
- return &cpy
- case *ObjectComprehension:
- oc := &ObjectComprehension{}
- ignore.Push(declaredVars(v.Body))
- oc.Key = resolveRefsInTerm(globals, ignore, v.Key)
- oc.Value = resolveRefsInTerm(globals, ignore, v.Value)
- oc.Body = resolveRefsInBody(globals, ignore, v.Body)
- cpy := *term
- cpy.Value = oc
- ignore.Pop()
- return &cpy
- case *SetComprehension:
- sc := &SetComprehension{}
- ignore.Push(declaredVars(v.Body))
- sc.Term = resolveRefsInTerm(globals, ignore, v.Term)
- sc.Body = resolveRefsInBody(globals, ignore, v.Body)
- cpy := *term
- cpy.Value = sc
- ignore.Pop()
- return &cpy
- default:
- return term
- }
-}
-
-func resolveRefsInTermArray(globals map[Var]*usedRef, ignore *declaredVarStack, terms *Array) []*Term {
- cpy := make([]*Term, terms.Len())
- for i := 0; i < terms.Len(); i++ {
- cpy[i] = resolveRefsInTerm(globals, ignore, terms.Elem(i))
- }
- return cpy
-}
-
-func resolveRefsInTermSlice(globals map[Var]*usedRef, ignore *declaredVarStack, terms []*Term) []*Term {
- cpy := make([]*Term, len(terms))
- for i := 0; i < len(terms); i++ {
- cpy[i] = resolveRefsInTerm(globals, ignore, terms[i])
- }
- return cpy
-}
-
-type declaredVarStack []VarSet
-
-func (s declaredVarStack) Contains(v Var) bool {
- for i := len(s) - 1; i >= 0; i-- {
- if _, ok := s[i][v]; ok {
- return ok
- }
- }
- return false
-}
-
-func (s declaredVarStack) Add(v Var) {
- s[len(s)-1].Add(v)
-}
-
-func (s *declaredVarStack) Push(vs VarSet) {
- *s = append(*s, vs)
-}
-
-func (s *declaredVarStack) Pop() {
- curr := *s
- *s = curr[:len(curr)-1]
-}
-
-func declaredVars(x interface{}) VarSet {
- vars := NewVarSet()
- vis := NewGenericVisitor(func(x interface{}) bool {
- switch x := x.(type) {
- case *Expr:
- if x.IsAssignment() && validEqAssignArgCount(x) {
- WalkVars(x.Operand(0), func(v Var) bool {
- vars.Add(v)
- return false
- })
- } else if decl, ok := x.Terms.(*SomeDecl); ok {
- for i := range decl.Symbols {
- switch val := decl.Symbols[i].Value.(type) {
- case Var:
- vars.Add(val)
- case Call:
- args := val[1:]
- if len(args) == 3 { // some x, y in xs
- WalkVars(args[1], func(v Var) bool {
- vars.Add(v)
- return false
- })
- }
- // some x in xs
- WalkVars(args[0], func(v Var) bool {
- vars.Add(v)
- return false
- })
- }
- }
- }
- case *ArrayComprehension, *SetComprehension, *ObjectComprehension:
- return true
- }
- return false
- })
- vis.Walk(x)
- return vars
-}
-
-// rewriteComprehensionTerms will rewrite comprehensions so that the term part
-// is bound to a variable in the body. This allows any type of term to be used
-// in the term part (even if the term requires evaluation.)
-//
-// For instance, given the following comprehension:
-//
-// [x[0] | x = y[_]; y = [1,2,3]]
-//
-// The comprehension would be rewritten as:
-//
-// [__local0__ | x = y[_]; y = [1,2,3]; __local0__ = x[0]]
-func rewriteComprehensionTerms(f *equalityFactory, node interface{}) (interface{}, error) {
- return TransformComprehensions(node, func(x interface{}) (Value, error) {
- switch x := x.(type) {
- case *ArrayComprehension:
- if requiresEval(x.Term) {
- expr := f.Generate(x.Term)
- x.Term = expr.Operand(0)
- x.Body.Append(expr)
- }
- return x, nil
- case *SetComprehension:
- if requiresEval(x.Term) {
- expr := f.Generate(x.Term)
- x.Term = expr.Operand(0)
- x.Body.Append(expr)
- }
- return x, nil
- case *ObjectComprehension:
- if requiresEval(x.Key) {
- expr := f.Generate(x.Key)
- x.Key = expr.Operand(0)
- x.Body.Append(expr)
- }
- if requiresEval(x.Value) {
- expr := f.Generate(x.Value)
- x.Value = expr.Operand(0)
- x.Body.Append(expr)
- }
- return x, nil
- }
- panic("illegal type")
- })
-}
-
-// rewriteEquals will rewrite exprs under x as unification calls instead of ==
-// calls. For example:
-//
-// data.foo == data.bar is rewritten as data.foo = data.bar
-//
-// This stage should only run the safety check (since == is a built-in with no
-// outputs, so the inputs must not be marked as safe.)
-//
-// This stage is not executed by the query compiler by default because when
-// callers specify == instead of = they expect to receive a true/false/undefined
-// result back whereas with = the result is only ever true/undefined. For
-// partial evaluation cases we do want to rewrite == to = to simplify the
-// result.
-func rewriteEquals(x interface{}) (modified bool) {
- doubleEq := Equal.Ref()
- unifyOp := Equality.Ref()
- t := NewGenericTransformer(func(x interface{}) (interface{}, error) {
- if x, ok := x.(*Expr); ok && x.IsCall() {
- operator := x.Operator()
- if operator.Equal(doubleEq) && len(x.Operands()) == 2 {
- modified = true
- x.SetOperator(NewTerm(unifyOp))
- }
- }
- return x, nil
- })
- _, _ = Transform(t, x) // ignore error
- return modified
-}
-
-func rewriteTestEqualities(f *equalityFactory, body Body) Body {
- result := make(Body, 0, len(body))
- for _, expr := range body {
- // We can't rewrite negated expressions; if the extracted term is undefined, evaluation would fail before
- // reaching the negation check.
- if !expr.Negated && !expr.Generated {
- switch {
- case expr.IsEquality():
- terms := expr.Terms.([]*Term)
- result, terms[1] = rewriteDynamicsShallow(expr, f, terms[1], result)
- result, terms[2] = rewriteDynamicsShallow(expr, f, terms[2], result)
- case expr.IsEvery():
- // We rewrite equalities inside of every-bodies as a fail here will be the cause of the test-rule fail.
- // Failures inside other expressions with closures, such as comprehensions, won't cause the test-rule to fail, so we skip those.
- every := expr.Terms.(*Every)
- every.Body = rewriteTestEqualities(f, every.Body)
- }
- }
- result = appendExpr(result, expr)
- }
- return result
-}
-
-func rewriteDynamicsShallow(original *Expr, f *equalityFactory, term *Term, result Body) (Body, *Term) {
- switch term.Value.(type) {
- case Ref, *ArrayComprehension, *SetComprehension, *ObjectComprehension:
- generated := f.Generate(term)
- generated.With = original.With
- result.Append(generated)
- connectGeneratedExprs(original, generated)
- return result, result[len(result)-1].Operand(0)
- }
- return result, term
-}
-
-// rewriteDynamics will rewrite the body so that dynamic terms (i.e., refs and
-// comprehensions) are bound to vars earlier in the query. This translation
-// results in eager evaluation.
-//
-// For instance, given the following query:
-//
-// foo(data.bar) = 1
-//
-// The rewritten version will be:
-//
-// __local0__ = data.bar; foo(__local0__) = 1
-func rewriteDynamics(f *equalityFactory, body Body) Body {
- result := make(Body, 0, len(body))
- for _, expr := range body {
- switch {
- case expr.IsEquality():
- result = rewriteDynamicsEqExpr(f, expr, result)
- case expr.IsCall():
- result = rewriteDynamicsCallExpr(f, expr, result)
- case expr.IsEvery():
- result = rewriteDynamicsEveryExpr(f, expr, result)
- default:
- result = rewriteDynamicsTermExpr(f, expr, result)
- }
- }
- return result
-}
-
-func appendExpr(body Body, expr *Expr) Body {
- body.Append(expr)
- return body
-}
-
-func rewriteDynamicsEqExpr(f *equalityFactory, expr *Expr, result Body) Body {
- if !validEqAssignArgCount(expr) {
- return appendExpr(result, expr)
- }
- terms := expr.Terms.([]*Term)
- result, terms[1] = rewriteDynamicsInTerm(expr, f, terms[1], result)
- result, terms[2] = rewriteDynamicsInTerm(expr, f, terms[2], result)
- return appendExpr(result, expr)
-}
-
-func rewriteDynamicsCallExpr(f *equalityFactory, expr *Expr, result Body) Body {
- terms := expr.Terms.([]*Term)
- for i := 1; i < len(terms); i++ {
- result, terms[i] = rewriteDynamicsOne(expr, f, terms[i], result)
- }
- return appendExpr(result, expr)
-}
-
-func rewriteDynamicsEveryExpr(f *equalityFactory, expr *Expr, result Body) Body {
- ev := expr.Terms.(*Every)
- result, ev.Domain = rewriteDynamicsOne(expr, f, ev.Domain, result)
- ev.Body = rewriteDynamics(f, ev.Body)
- return appendExpr(result, expr)
-}
-
-func rewriteDynamicsTermExpr(f *equalityFactory, expr *Expr, result Body) Body {
- term := expr.Terms.(*Term)
- result, expr.Terms = rewriteDynamicsInTerm(expr, f, term, result)
- return appendExpr(result, expr)
-}
-
-func rewriteDynamicsInTerm(original *Expr, f *equalityFactory, term *Term, result Body) (Body, *Term) {
- switch v := term.Value.(type) {
- case Ref:
- for i := 1; i < len(v); i++ {
- result, v[i] = rewriteDynamicsOne(original, f, v[i], result)
- }
- case *ArrayComprehension:
- v.Body = rewriteDynamics(f, v.Body)
- case *SetComprehension:
- v.Body = rewriteDynamics(f, v.Body)
- case *ObjectComprehension:
- v.Body = rewriteDynamics(f, v.Body)
- default:
- result, term = rewriteDynamicsOne(original, f, term, result)
- }
- return result, term
-}
-
-func rewriteDynamicsOne(original *Expr, f *equalityFactory, term *Term, result Body) (Body, *Term) {
- switch v := term.Value.(type) {
- case Ref:
- for i := 1; i < len(v); i++ {
- result, v[i] = rewriteDynamicsOne(original, f, v[i], result)
- }
- generated := f.Generate(term)
- generated.With = original.With
- result.Append(generated)
- connectGeneratedExprs(original, generated)
- return result, result[len(result)-1].Operand(0)
- case *Array:
- for i := 0; i < v.Len(); i++ {
- var t *Term
- result, t = rewriteDynamicsOne(original, f, v.Elem(i), result)
- v.set(i, t)
- }
- return result, term
- case *object:
- cpy := NewObject()
- v.Foreach(func(key, value *Term) {
- result, key = rewriteDynamicsOne(original, f, key, result)
- result, value = rewriteDynamicsOne(original, f, value, result)
- cpy.Insert(key, value)
- })
- return result, NewTerm(cpy).SetLocation(term.Location)
- case Set:
- cpy := NewSet()
- for _, term := range v.Slice() {
- var rw *Term
- result, rw = rewriteDynamicsOne(original, f, term, result)
- cpy.Add(rw)
- }
- return result, NewTerm(cpy).SetLocation(term.Location)
- case *ArrayComprehension:
- var extra *Expr
- v.Body, extra = rewriteDynamicsComprehensionBody(original, f, v.Body, term)
- result.Append(extra)
- connectGeneratedExprs(original, extra)
- return result, result[len(result)-1].Operand(0)
- case *SetComprehension:
- var extra *Expr
- v.Body, extra = rewriteDynamicsComprehensionBody(original, f, v.Body, term)
- result.Append(extra)
- connectGeneratedExprs(original, extra)
- return result, result[len(result)-1].Operand(0)
- case *ObjectComprehension:
- var extra *Expr
- v.Body, extra = rewriteDynamicsComprehensionBody(original, f, v.Body, term)
- result.Append(extra)
- connectGeneratedExprs(original, extra)
- return result, result[len(result)-1].Operand(0)
- }
- return result, term
-}
-
-func rewriteDynamicsComprehensionBody(original *Expr, f *equalityFactory, body Body, term *Term) (Body, *Expr) {
- body = rewriteDynamics(f, body)
- generated := f.Generate(term)
- generated.With = original.With
- return body, generated
-}
-
-func rewriteExprTermsInHead(gen *localVarGenerator, rule *Rule) {
- for i := range rule.Head.Args {
- support, output := expandExprTerm(gen, rule.Head.Args[i])
- for j := range support {
- rule.Body.Append(support[j])
- }
- rule.Head.Args[i] = output
- }
- if rule.Head.Key != nil {
- support, output := expandExprTerm(gen, rule.Head.Key)
- for i := range support {
- rule.Body.Append(support[i])
- }
- rule.Head.Key = output
- }
- if rule.Head.Value != nil {
- support, output := expandExprTerm(gen, rule.Head.Value)
- for i := range support {
- rule.Body.Append(support[i])
- }
- rule.Head.Value = output
- }
-}
-
-func rewriteExprTermsInBody(gen *localVarGenerator, body Body) Body {
- cpy := make(Body, 0, len(body))
- for i := 0; i < len(body); i++ {
- for _, expr := range expandExpr(gen, body[i]) {
- cpy.Append(expr)
- }
- }
- return cpy
-}
-
-func expandExpr(gen *localVarGenerator, expr *Expr) (result []*Expr) {
- for i := range expr.With {
- extras, value := expandExprTerm(gen, expr.With[i].Value)
- expr.With[i].Value = value
- result = append(result, extras...)
- }
- switch terms := expr.Terms.(type) {
- case *Term:
- extras, term := expandExprTerm(gen, terms)
- if len(expr.With) > 0 {
- for i := range extras {
- extras[i].With = expr.With
- }
- }
- result = append(result, extras...)
- expr.Terms = term
- result = append(result, expr)
- case []*Term:
- for i := 1; i < len(terms); i++ {
- var extras []*Expr
- extras, terms[i] = expandExprTerm(gen, terms[i])
- connectGeneratedExprs(expr, extras...)
- if len(expr.With) > 0 {
- for i := range extras {
- extras[i].With = expr.With
- }
- }
- result = append(result, extras...)
- }
- result = append(result, expr)
- case *Every:
- var extras []*Expr
-
- term := NewTerm(gen.Generate()).SetLocation(terms.Domain.Location)
- eq := Equality.Expr(term, terms.Domain).SetLocation(terms.Domain.Location)
- eq.Generated = true
- eq.With = expr.With
- extras = expandExpr(gen, eq)
- terms.Domain = term
-
- terms.Body = rewriteExprTermsInBody(gen, terms.Body)
- result = append(result, extras...)
- result = append(result, expr)
- }
- return
-}
-
-func connectGeneratedExprs(parent *Expr, children ...*Expr) {
- for _, child := range children {
- child.generatedFrom = parent
- parent.generates = append(parent.generates, child)
- }
-}
-
-func expandExprTerm(gen *localVarGenerator, term *Term) (support []*Expr, output *Term) {
- output = term
- switch v := term.Value.(type) {
- case Call:
- for i := 1; i < len(v); i++ {
- var extras []*Expr
- extras, v[i] = expandExprTerm(gen, v[i])
- support = append(support, extras...)
- }
- output = NewTerm(gen.Generate()).SetLocation(term.Location)
- expr := v.MakeExpr(output).SetLocation(term.Location)
- expr.Generated = true
- support = append(support, expr)
- case Ref:
- support = expandExprRef(gen, v)
- case *Array:
- support = expandExprTermArray(gen, v)
- case *object:
- cpy, _ := v.Map(func(k, v *Term) (*Term, *Term, error) {
- extras1, expandedKey := expandExprTerm(gen, k)
- extras2, expandedValue := expandExprTerm(gen, v)
- support = append(support, extras1...)
- support = append(support, extras2...)
- return expandedKey, expandedValue, nil
- })
- output = NewTerm(cpy).SetLocation(term.Location)
- case Set:
- cpy, _ := v.Map(func(x *Term) (*Term, error) {
- extras, expanded := expandExprTerm(gen, x)
- support = append(support, extras...)
- return expanded, nil
- })
- output = NewTerm(cpy).SetLocation(term.Location)
- case *ArrayComprehension:
- support, term := expandExprTerm(gen, v.Term)
- for i := range support {
- v.Body.Append(support[i])
- }
- v.Term = term
- v.Body = rewriteExprTermsInBody(gen, v.Body)
- case *SetComprehension:
- support, term := expandExprTerm(gen, v.Term)
- for i := range support {
- v.Body.Append(support[i])
- }
- v.Term = term
- v.Body = rewriteExprTermsInBody(gen, v.Body)
- case *ObjectComprehension:
- support, key := expandExprTerm(gen, v.Key)
- for i := range support {
- v.Body.Append(support[i])
- }
- v.Key = key
- support, value := expandExprTerm(gen, v.Value)
- for i := range support {
- v.Body.Append(support[i])
- }
- v.Value = value
- v.Body = rewriteExprTermsInBody(gen, v.Body)
- }
- return
-}
-
-func expandExprRef(gen *localVarGenerator, v []*Term) (support []*Expr) {
- // Start by calling a normal expandExprTerm on all terms.
- support = expandExprTermSlice(gen, v)
-
- // Rewrite references in order to support indirect references. We rewrite
- // e.g.
- //
- // [1, 2, 3][i]
- //
- // to
- //
- // __local_var = [1, 2, 3]
- // __local_var[i]
- //
- // to support these. This only impacts the reference subject, i.e. the
- // first item in the slice.
- var subject = v[0]
- switch subject.Value.(type) {
- case *Array, Object, Set, *ArrayComprehension, *SetComprehension, *ObjectComprehension, Call:
- f := newEqualityFactory(gen)
- assignToLocal := f.Generate(subject)
- support = append(support, assignToLocal)
- v[0] = assignToLocal.Operand(0)
- }
- return
-}
-
-func expandExprTermArray(gen *localVarGenerator, arr *Array) (support []*Expr) {
- for i := 0; i < arr.Len(); i++ {
- extras, v := expandExprTerm(gen, arr.Elem(i))
- arr.set(i, v)
- support = append(support, extras...)
- }
- return
-}
-
-func expandExprTermSlice(gen *localVarGenerator, v []*Term) (support []*Expr) {
- for i := 0; i < len(v); i++ {
- var extras []*Expr
- extras, v[i] = expandExprTerm(gen, v[i])
- support = append(support, extras...)
- }
- return
-}
-
-type localDeclaredVars struct {
- vars []*declaredVarSet
-
- // rewritten contains a mapping of *all* user-defined variables
- // that have been rewritten whereas vars contains the state
- // from the current query (not any nested queries, and all vars
- // seen).
- rewritten map[Var]Var
-
- // indicates if an assignment (:= operator) has been seen *ever*
- assignment bool
-}
-
-type varOccurrence int
-
-const (
- newVar varOccurrence = iota
- argVar
- seenVar
- assignedVar
- declaredVar
-)
-
-type declaredVarSet struct {
- vs map[Var]Var
- reverse map[Var]Var
- occurrence map[Var]varOccurrence
- count map[Var]int
-}
-
-func newDeclaredVarSet() *declaredVarSet {
- return &declaredVarSet{
- vs: map[Var]Var{},
- reverse: map[Var]Var{},
- occurrence: map[Var]varOccurrence{},
- count: map[Var]int{},
- }
-}
-
-func newLocalDeclaredVars() *localDeclaredVars {
- return &localDeclaredVars{
- vars: []*declaredVarSet{newDeclaredVarSet()},
- rewritten: map[Var]Var{},
- }
-}
-
-func (s *localDeclaredVars) Copy() *localDeclaredVars {
- stack := &localDeclaredVars{
- vars: []*declaredVarSet{},
- rewritten: map[Var]Var{},
- }
-
- for i := range s.vars {
- stack.vars = append(stack.vars, newDeclaredVarSet())
- for k, v := range s.vars[i].vs {
- stack.vars[0].vs[k] = v
- }
- for k, v := range s.vars[i].reverse {
- stack.vars[0].reverse[k] = v
- }
- for k, v := range s.vars[i].count {
- stack.vars[0].count[k] = v
- }
- for k, v := range s.vars[i].occurrence {
- stack.vars[0].occurrence[k] = v
- }
- }
-
- for k, v := range s.rewritten {
- stack.rewritten[k] = v
- }
-
- return stack
-}
-
-func (s *localDeclaredVars) Push() {
- s.vars = append(s.vars, newDeclaredVarSet())
-}
-
-func (s *localDeclaredVars) Pop() *declaredVarSet {
- sl := s.vars
- curr := sl[len(sl)-1]
- s.vars = sl[:len(sl)-1]
- return curr
-}
-
-func (s localDeclaredVars) Peek() *declaredVarSet {
- return s.vars[len(s.vars)-1]
-}
-
-func (s localDeclaredVars) Insert(x, y Var, occurrence varOccurrence) {
- elem := s.vars[len(s.vars)-1]
- elem.vs[x] = y
- elem.reverse[y] = x
- elem.occurrence[x] = occurrence
-
- elem.count[x] = 1
-
- // If the variable has been rewritten (where x != y, with y being
- // the generated value), store it in the map of rewritten vars.
- // Assume that the generated values are unique for the compilation.
- if !x.Equal(y) {
- s.rewritten[y] = x
- }
-}
-
-func (s localDeclaredVars) Declared(x Var) (y Var, ok bool) {
- for i := len(s.vars) - 1; i >= 0; i-- {
- if y, ok = s.vars[i].vs[x]; ok {
- return
- }
- }
- return
-}
-
-// Occurrence returns a flag that indicates whether x has occurred in the
-// current scope.
-func (s localDeclaredVars) Occurrence(x Var) varOccurrence {
- return s.vars[len(s.vars)-1].occurrence[x]
-}
-
-// GlobalOccurrence returns a flag that indicates whether x has occurred in the
-// global scope.
-func (s localDeclaredVars) GlobalOccurrence(x Var) (varOccurrence, bool) {
- for i := len(s.vars) - 1; i >= 0; i-- {
- if occ, ok := s.vars[i].occurrence[x]; ok {
- return occ, true
- }
- }
- return newVar, false
-}
-
-// Seen marks x as seen by incrementing its counter
-func (s localDeclaredVars) Seen(x Var) {
- for i := len(s.vars) - 1; i >= 0; i-- {
- dvs := s.vars[i]
- if c, ok := dvs.count[x]; ok {
- dvs.count[x] = c + 1
- return
- }
- }
-
- s.vars[len(s.vars)-1].count[x] = 1
-}
-
-// Count returns how many times x has been seen
-func (s localDeclaredVars) Count(x Var) int {
- for i := len(s.vars) - 1; i >= 0; i-- {
- if c, ok := s.vars[i].count[x]; ok {
- return c
- }
- }
-
- return 0
-}
-
-// rewriteLocalVars rewrites bodies to remove assignment/declaration
-// expressions. For example:
-//
-// a := 1; p[a]
-//
-// Is rewritten to:
-//
-// __local0__ = 1; p[__local0__]
-//
-// During rewriting, assignees are validated to prevent use before declaration.
-func rewriteLocalVars(g *localVarGenerator, stack *localDeclaredVars, used VarSet, body Body, strict bool) (Body, map[Var]Var, Errors) {
- var errs Errors
- body, errs = rewriteDeclaredVarsInBody(g, stack, used, body, errs, strict)
- return body, stack.Peek().vs, errs
-}
-
-func rewriteDeclaredVarsInBody(g *localVarGenerator, stack *localDeclaredVars, used VarSet, body Body, errs Errors, strict bool) (Body, Errors) {
-
- var cpy Body
-
- for i := range body {
- var expr *Expr
- switch {
- case body[i].IsAssignment():
- stack.assignment = true
- expr, errs = rewriteDeclaredAssignment(g, stack, body[i], errs, strict)
- case body[i].IsSome():
- expr, errs = rewriteSomeDeclStatement(g, stack, body[i], errs, strict)
- case body[i].IsEvery():
- expr, errs = rewriteEveryStatement(g, stack, body[i], errs, strict)
- default:
- expr, errs = rewriteDeclaredVarsInExpr(g, stack, body[i], errs, strict)
- }
- if expr != nil {
- cpy.Append(expr)
- }
- }
-
- // If the body only contained a var statement it will be empty at this
- // point. Append true to the body to ensure that it's non-empty (zero length
- // bodies are not supported.)
- if len(cpy) == 0 {
- cpy.Append(NewExpr(BooleanTerm(true)))
- }
-
- errs = checkUnusedAssignedVars(body, stack, used, errs, strict)
- return cpy, checkUnusedDeclaredVars(body, stack, used, cpy, errs)
-}
-
-func checkUnusedAssignedVars(body Body, stack *localDeclaredVars, used VarSet, errs Errors, strict bool) Errors {
-
- if !strict || len(errs) > 0 {
- return errs
- }
-
- dvs := stack.Peek()
- unused := NewVarSet()
-
- for v, occ := range dvs.occurrence {
- // A var that was assigned in this scope must have been seen (used) more than once (the time of assignment) in
- // the same, or nested, scope to be counted as used.
- if !v.IsWildcard() && stack.Count(v) <= 1 && occ == assignedVar {
- unused.Add(dvs.vs[v])
- }
- }
-
- rewrittenUsed := NewVarSet()
- for v := range used {
- if gv, ok := stack.Declared(v); ok {
- rewrittenUsed.Add(gv)
- } else {
- rewrittenUsed.Add(v)
- }
- }
-
- unused = unused.Diff(rewrittenUsed)
-
- for _, gv := range unused.Sorted() {
- found := false
- for i := range body {
- if body[i].Vars(VarVisitorParams{}).Contains(gv) {
- errs = append(errs, NewError(CompileErr, body[i].Loc(), "assigned var %v unused", dvs.reverse[gv]))
- found = true
- break
- }
- }
- if !found {
- errs = append(errs, NewError(CompileErr, body[0].Loc(), "assigned var %v unused", dvs.reverse[gv]))
- }
- }
-
- return errs
-}
-
-func checkUnusedDeclaredVars(body Body, stack *localDeclaredVars, used VarSet, cpy Body, errs Errors) Errors {
-
- // NOTE(tsandall): Do not generate more errors if there are existing
- // declaration errors.
- if len(errs) > 0 {
- return errs
- }
-
- dvs := stack.Peek()
- declared := NewVarSet()
-
- for v, occ := range dvs.occurrence {
- if occ == declaredVar {
- declared.Add(dvs.vs[v])
- }
- }
-
- bodyvars := cpy.Vars(VarVisitorParams{})
-
- for v := range used {
- if gv, ok := stack.Declared(v); ok {
- bodyvars.Add(gv)
- } else {
- bodyvars.Add(v)
- }
- }
-
- unused := declared.Diff(bodyvars).Diff(used)
-
- for _, gv := range unused.Sorted() {
- rv := dvs.reverse[gv]
- if !rv.IsGenerated() {
- // Scan through body exprs, looking for a match between the
- // bad var's original name, and each expr's declared vars.
- foundUnusedVarByName := false
- for i := range body {
- varsDeclaredInExpr := declaredVars(body[i])
- if varsDeclaredInExpr.Contains(dvs.reverse[gv]) {
- // TODO(philipc): Clean up the offset logic here when the parser
- // reports more accurate locations.
- errs = append(errs, NewError(CompileErr, body[i].Loc(), "declared var %v unused", dvs.reverse[gv]))
- foundUnusedVarByName = true
- break
- }
- }
- // Default error location returned.
- if !foundUnusedVarByName {
- errs = append(errs, NewError(CompileErr, body[0].Loc(), "declared var %v unused", dvs.reverse[gv]))
- }
- }
- }
-
- return errs
-}
-
-func rewriteEveryStatement(g *localVarGenerator, stack *localDeclaredVars, expr *Expr, errs Errors, strict bool) (*Expr, Errors) {
- e := expr.Copy()
- every := e.Terms.(*Every)
-
- errs = rewriteDeclaredVarsInTermRecursive(g, stack, every.Domain, errs, strict)
-
- stack.Push()
- defer stack.Pop()
-
- // if the key exists, rewrite
- if every.Key != nil {
- if v := every.Key.Value.(Var); !v.IsWildcard() {
- gv, err := rewriteDeclaredVar(g, stack, v, declaredVar)
- if err != nil {
- return nil, append(errs, NewError(CompileErr, every.Loc(), err.Error()))
- }
- every.Key.Value = gv
- }
- } else { // if the key doesn't exist, add dummy local
- every.Key = NewTerm(g.Generate())
- }
-
- // value is always present
- if v := every.Value.Value.(Var); !v.IsWildcard() {
- gv, err := rewriteDeclaredVar(g, stack, v, declaredVar)
- if err != nil {
- return nil, append(errs, NewError(CompileErr, every.Loc(), err.Error()))
- }
- every.Value.Value = gv
- }
-
- used := NewVarSet()
- every.Body, errs = rewriteDeclaredVarsInBody(g, stack, used, every.Body, errs, strict)
-
- return rewriteDeclaredVarsInExpr(g, stack, e, errs, strict)
-}
-
-func rewriteSomeDeclStatement(g *localVarGenerator, stack *localDeclaredVars, expr *Expr, errs Errors, strict bool) (*Expr, Errors) {
- e := expr.Copy()
- decl := e.Terms.(*SomeDecl)
- for i := range decl.Symbols {
- switch v := decl.Symbols[i].Value.(type) {
- case Var:
- if _, err := rewriteDeclaredVar(g, stack, v, declaredVar); err != nil {
- return nil, append(errs, NewError(CompileErr, decl.Loc(), err.Error()))
- }
- case Call:
- var key, val, container *Term
- switch len(v) {
- case 4: // member3
- key = v[1]
- val = v[2]
- container = v[3]
- case 3: // member
- key = NewTerm(g.Generate())
- val = v[1]
- container = v[2]
- }
-
- var rhs *Term
- switch c := container.Value.(type) {
- case Ref:
- rhs = RefTerm(append(c, key)...)
- default:
- rhs = RefTerm(container, key)
- }
- e.Terms = []*Term{
- RefTerm(VarTerm(Equality.Name)), val, rhs,
- }
-
- for _, v0 := range outputVarsForExprEq(e, container.Vars()).Sorted() {
- if _, err := rewriteDeclaredVar(g, stack, v0, declaredVar); err != nil {
- return nil, append(errs, NewError(CompileErr, decl.Loc(), err.Error()))
- }
- }
- return rewriteDeclaredVarsInExpr(g, stack, e, errs, strict)
- }
- }
- return nil, errs
-}
-
-func rewriteDeclaredVarsInExpr(g *localVarGenerator, stack *localDeclaredVars, expr *Expr, errs Errors, strict bool) (*Expr, Errors) {
- vis := NewGenericVisitor(func(x interface{}) bool {
- var stop bool
- switch x := x.(type) {
- case *Term:
- stop, errs = rewriteDeclaredVarsInTerm(g, stack, x, errs, strict)
- case *With:
- stop, errs = true, rewriteDeclaredVarsInWithRecursive(g, stack, x, errs, strict)
- }
- return stop
- })
- vis.Walk(expr)
- return expr, errs
-}
-
-func rewriteDeclaredAssignment(g *localVarGenerator, stack *localDeclaredVars, expr *Expr, errs Errors, strict bool) (*Expr, Errors) {
-
- if expr.Negated {
- errs = append(errs, NewError(CompileErr, expr.Location, "cannot assign vars inside negated expression"))
- return expr, errs
- }
-
- numErrsBefore := len(errs)
-
- if !validEqAssignArgCount(expr) {
- return expr, errs
- }
-
- // Rewrite terms on right hand side capture seen vars and recursively
- // process comprehensions before left hand side is processed. Also
- // rewrite with modifier.
- errs = rewriteDeclaredVarsInTermRecursive(g, stack, expr.Operand(1), errs, strict)
-
- for _, w := range expr.With {
- errs = rewriteDeclaredVarsInTermRecursive(g, stack, w.Value, errs, strict)
- }
-
- // Rewrite vars on left hand side with unique names. Catch redeclaration
- // and invalid term types here.
- var vis func(t *Term) bool
-
- vis = func(t *Term) bool {
- switch v := t.Value.(type) {
- case Var:
- if gv, err := rewriteDeclaredVar(g, stack, v, assignedVar); err != nil {
- errs = append(errs, NewError(CompileErr, t.Location, err.Error()))
- } else {
- t.Value = gv
- }
- return true
- case *Array:
- return false
- case *object:
- v.Foreach(func(_, v *Term) {
- WalkTerms(v, vis)
- })
- return true
- case Ref:
- if RootDocumentRefs.Contains(t) {
- if gv, err := rewriteDeclaredVar(g, stack, v[0].Value.(Var), assignedVar); err != nil {
- errs = append(errs, NewError(CompileErr, t.Location, err.Error()))
- } else {
- t.Value = gv
- }
- return true
- }
- }
- errs = append(errs, NewError(CompileErr, t.Location, "cannot assign to %v", TypeName(t.Value)))
- return true
- }
-
- WalkTerms(expr.Operand(0), vis)
-
- if len(errs) == numErrsBefore {
- loc := expr.Operator()[0].Location
- expr.SetOperator(RefTerm(VarTerm(Equality.Name).SetLocation(loc)).SetLocation(loc))
- }
-
- return expr, errs
-}
-
-func rewriteDeclaredVarsInTerm(g *localVarGenerator, stack *localDeclaredVars, term *Term, errs Errors, strict bool) (bool, Errors) {
- switch v := term.Value.(type) {
- case Var:
- if gv, ok := stack.Declared(v); ok {
- term.Value = gv
- stack.Seen(v)
- } else if stack.Occurrence(v) == newVar {
- stack.Insert(v, v, seenVar)
- }
- case Ref:
- if RootDocumentRefs.Contains(term) {
- x := v[0].Value.(Var)
- if occ, ok := stack.GlobalOccurrence(x); ok && occ != seenVar {
- gv, _ := stack.Declared(x)
- term.Value = gv
- }
-
- return true, errs
- }
- return false, errs
- case Call:
- ref := v[0]
- WalkVars(ref, func(v Var) bool {
- if gv, ok := stack.Declared(v); ok && !gv.Equal(v) {
- // We will rewrite the ref of a function call, which is never ok since we don't have first-class functions.
- errs = append(errs, NewError(CompileErr, term.Location, "called function %s shadowed", ref))
- return true
- }
- return false
- })
- return false, errs
- case *object:
- cpy, _ := v.Map(func(k, v *Term) (*Term, *Term, error) {
- kcpy := k.Copy()
- errs = rewriteDeclaredVarsInTermRecursive(g, stack, kcpy, errs, strict)
- errs = rewriteDeclaredVarsInTermRecursive(g, stack, v, errs, strict)
- return kcpy, v, nil
- })
- term.Value = cpy
- case Set:
- cpy, _ := v.Map(func(elem *Term) (*Term, error) {
- elemcpy := elem.Copy()
- errs = rewriteDeclaredVarsInTermRecursive(g, stack, elemcpy, errs, strict)
- return elemcpy, nil
- })
- term.Value = cpy
- case *ArrayComprehension:
- errs = rewriteDeclaredVarsInArrayComprehension(g, stack, v, errs, strict)
- case *SetComprehension:
- errs = rewriteDeclaredVarsInSetComprehension(g, stack, v, errs, strict)
- case *ObjectComprehension:
- errs = rewriteDeclaredVarsInObjectComprehension(g, stack, v, errs, strict)
- default:
- return false, errs
- }
- return true, errs
-}
-
-func rewriteDeclaredVarsInTermRecursive(g *localVarGenerator, stack *localDeclaredVars, term *Term, errs Errors, strict bool) Errors {
- WalkTerms(term, func(t *Term) bool {
- var stop bool
- stop, errs = rewriteDeclaredVarsInTerm(g, stack, t, errs, strict)
- return stop
- })
- return errs
-}
-
-func rewriteDeclaredVarsInWithRecursive(g *localVarGenerator, stack *localDeclaredVars, w *With, errs Errors, strict bool) Errors {
- // NOTE(sr): `with input as` and `with input.a.b.c as` are deliberately skipped here: `input` could
- // have been shadowed by a local variable/argument but should NOT be replaced in the `with` target.
- //
- // We cannot drop `input` from the stack since it's conceivable to do `with input[input] as` where
- // the second input is meant to be the local var. It's a terrible idea, but when you're shadowing
- // `input` those might be your thing.
- errs = rewriteDeclaredVarsInTermRecursive(g, stack, w.Target, errs, strict)
- if sdwInput, ok := stack.Declared(InputRootDocument.Value.(Var)); ok { // Was "input" shadowed...
- switch value := w.Target.Value.(type) {
- case Var:
- if sdwInput.Equal(value) { // ...and replaced? If so, fix it
- w.Target.Value = InputRootRef
- }
- case Ref:
- if sdwInput.Equal(value[0].Value.(Var)) {
- w.Target.Value.(Ref)[0].Value = InputRootDocument.Value
- }
- }
- }
- // No special handling of the `with` value
- return rewriteDeclaredVarsInTermRecursive(g, stack, w.Value, errs, strict)
-}
-
-func rewriteDeclaredVarsInArrayComprehension(g *localVarGenerator, stack *localDeclaredVars, v *ArrayComprehension, errs Errors, strict bool) Errors {
- used := NewVarSet()
- used.Update(v.Term.Vars())
-
- stack.Push()
- v.Body, errs = rewriteDeclaredVarsInBody(g, stack, used, v.Body, errs, strict)
- errs = rewriteDeclaredVarsInTermRecursive(g, stack, v.Term, errs, strict)
- stack.Pop()
- return errs
-}
-
-func rewriteDeclaredVarsInSetComprehension(g *localVarGenerator, stack *localDeclaredVars, v *SetComprehension, errs Errors, strict bool) Errors {
- used := NewVarSet()
- used.Update(v.Term.Vars())
-
- stack.Push()
- v.Body, errs = rewriteDeclaredVarsInBody(g, stack, used, v.Body, errs, strict)
- errs = rewriteDeclaredVarsInTermRecursive(g, stack, v.Term, errs, strict)
- stack.Pop()
- return errs
-}
-
-func rewriteDeclaredVarsInObjectComprehension(g *localVarGenerator, stack *localDeclaredVars, v *ObjectComprehension, errs Errors, strict bool) Errors {
- used := NewVarSet()
- used.Update(v.Key.Vars())
- used.Update(v.Value.Vars())
-
- stack.Push()
- v.Body, errs = rewriteDeclaredVarsInBody(g, stack, used, v.Body, errs, strict)
- errs = rewriteDeclaredVarsInTermRecursive(g, stack, v.Key, errs, strict)
- errs = rewriteDeclaredVarsInTermRecursive(g, stack, v.Value, errs, strict)
- stack.Pop()
- return errs
-}
-
-func rewriteDeclaredVar(g *localVarGenerator, stack *localDeclaredVars, v Var, occ varOccurrence) (gv Var, err error) {
- switch stack.Occurrence(v) {
- case seenVar:
- return gv, fmt.Errorf("var %v referenced above", v)
- case assignedVar:
- return gv, fmt.Errorf("var %v assigned above", v)
- case declaredVar:
- return gv, fmt.Errorf("var %v declared above", v)
- case argVar:
- return gv, fmt.Errorf("arg %v redeclared", v)
- }
- gv = g.Generate()
- stack.Insert(v, gv, occ)
- return
-}
-
-// rewriteWithModifiersInBody will rewrite the body so that with modifiers do
-// not contain terms that require evaluation as values. If this function
-// encounters an invalid with modifier target then it will raise an error.
-func rewriteWithModifiersInBody(c *Compiler, unsafeBuiltinsMap map[string]struct{}, f *equalityFactory, body Body) (Body, *Error) {
- var result Body
- for i := range body {
- exprs, err := rewriteWithModifier(c, unsafeBuiltinsMap, f, body[i])
- if err != nil {
- return nil, err
- }
- if len(exprs) > 0 {
- for _, expr := range exprs {
- result.Append(expr)
- }
- } else {
- result.Append(body[i])
- }
- }
- return result, nil
-}
-
-func rewriteWithModifier(c *Compiler, unsafeBuiltinsMap map[string]struct{}, f *equalityFactory, expr *Expr) ([]*Expr, *Error) {
-
- var result []*Expr
- for i := range expr.With {
- eval, err := validateWith(c, unsafeBuiltinsMap, expr, i)
- if err != nil {
- return nil, err
- }
-
- if eval {
- eq := f.Generate(expr.With[i].Value)
- result = append(result, eq)
- expr.With[i].Value = eq.Operand(0)
- }
- }
-
- return append(result, expr), nil
-}
-
-func validateWith(c *Compiler, unsafeBuiltinsMap map[string]struct{}, expr *Expr, i int) (bool, *Error) {
- target, value := expr.With[i].Target, expr.With[i].Value
-
- // Ensure that values that are built-ins are rewritten to Ref (not Var)
- if v, ok := value.Value.(Var); ok {
- if _, ok := c.builtins[v.String()]; ok {
- value.Value = Ref([]*Term{NewTerm(v)})
- }
- }
- isBuiltinRefOrVar, err := isBuiltinRefOrVar(c.builtins, unsafeBuiltinsMap, target)
- if err != nil {
- return false, err
- }
-
- isAllowedUnknownFuncCall := false
- if c.allowUndefinedFuncCalls {
- switch target.Value.(type) {
- case Ref, Var:
- isAllowedUnknownFuncCall = true
- }
- }
-
- switch {
- case isDataRef(target):
- ref := target.Value.(Ref)
- targetNode := c.RuleTree
- for i := 0; i < len(ref)-1; i++ {
- child := targetNode.Child(ref[i].Value)
- if child == nil {
- break
- } else if len(child.Values) > 0 {
- return false, NewError(CompileErr, target.Loc(), "with keyword cannot partially replace virtual document(s)")
- }
- targetNode = child
- }
-
- if targetNode != nil {
- // NOTE(sr): at this point in the compiler stages, we don't have a fully-populated
- // TypeEnv yet -- so we have to make do with this check to see if the replacement
- // target is a function. It's probably wrong for arity-0 functions, but those are
- // and edge case anyways.
- if child := targetNode.Child(ref[len(ref)-1].Value); child != nil {
- for _, v := range child.Values {
- if len(v.(*Rule).Head.Args) > 0 {
- if ok, err := validateWithFunctionValue(c.builtins, unsafeBuiltinsMap, c.RuleTree, value); err != nil || ok {
- return false, err // err may be nil
- }
- }
- }
- }
- }
-
- // If the with-value is a ref to a function, but not a call, we can't rewrite it
- if r, ok := value.Value.(Ref); ok {
- // TODO: check that target ref doesn't exist?
- if valueNode := c.RuleTree.Find(r); valueNode != nil {
- for _, v := range valueNode.Values {
- if len(v.(*Rule).Head.Args) > 0 {
- return false, nil
- }
- }
- }
- }
- case isInputRef(target): // ok, valid
- case isBuiltinRefOrVar:
-
- // NOTE(sr): first we ensure that parsed Var builtins (`count`, `concat`, etc)
- // are rewritten to their proper Ref convention
- if v, ok := target.Value.(Var); ok {
- target.Value = Ref([]*Term{NewTerm(v)})
- }
-
- targetRef := target.Value.(Ref)
- bi := c.builtins[targetRef.String()] // safe because isBuiltinRefOrVar checked this
- if err := validateWithBuiltinTarget(bi, targetRef, target.Loc()); err != nil {
- return false, err
- }
-
- if ok, err := validateWithFunctionValue(c.builtins, unsafeBuiltinsMap, c.RuleTree, value); err != nil || ok {
- return false, err // err may be nil
- }
- case isAllowedUnknownFuncCall:
- // The target isn't a ref to the input doc, data doc, or a known built-in, but it might be a ref to an unknown built-in.
- return false, nil
- default:
- return false, NewError(TypeErr, target.Location, "with keyword target must reference existing %v, %v, or a function", InputRootDocument, DefaultRootDocument)
- }
- return requiresEval(value), nil
-}
-
-func validateWithBuiltinTarget(bi *Builtin, target Ref, loc *location.Location) *Error {
- switch bi.Name {
- case Equality.Name,
- RegoMetadataChain.Name,
- RegoMetadataRule.Name:
- return NewError(CompileErr, loc, "with keyword replacing built-in function: replacement of %q invalid", bi.Name)
- }
-
- switch {
- case target.HasPrefix(Ref([]*Term{VarTerm("internal")})):
- return NewError(CompileErr, loc, "with keyword replacing built-in function: replacement of internal function %q invalid", target)
-
- case bi.Relation:
- return NewError(CompileErr, loc, "with keyword replacing built-in function: target must not be a relation")
-
- case bi.Decl.Result() == nil:
- return NewError(CompileErr, loc, "with keyword replacing built-in function: target must not be a void function")
- }
- return nil
-}
-
-func validateWithFunctionValue(bs map[string]*Builtin, unsafeMap map[string]struct{}, ruleTree *TreeNode, value *Term) (bool, *Error) {
- if v, ok := value.Value.(Ref); ok {
- if ruleTree.Find(v) != nil { // ref exists in rule tree
- return true, nil
- }
- }
- return isBuiltinRefOrVar(bs, unsafeMap, value)
-}
-
-func isInputRef(term *Term) bool {
- if ref, ok := term.Value.(Ref); ok {
- if ref.HasPrefix(InputRootRef) {
- return true
- }
- }
- return false
-}
-
-func isDataRef(term *Term) bool {
- if ref, ok := term.Value.(Ref); ok {
- if ref.HasPrefix(DefaultRootRef) {
- return true
- }
- }
- return false
-}
-
-func isBuiltinRefOrVar(bs map[string]*Builtin, unsafeBuiltinsMap map[string]struct{}, term *Term) (bool, *Error) {
- switch v := term.Value.(type) {
- case Ref, Var:
- if _, ok := unsafeBuiltinsMap[v.String()]; ok {
- return false, NewError(CompileErr, term.Location, "with keyword replacing built-in function: target must not be unsafe: %q", v)
- }
- _, ok := bs[v.String()]
- return ok, nil
- }
- return false, nil
-}
-
-func isVirtual(node *TreeNode, ref Ref) bool {
- for i := range ref {
- child := node.Child(ref[i].Value)
- if child == nil {
- return false
- } else if len(child.Values) > 0 {
- return true
- }
- node = child
- }
- return true
-}
-
-func safetyErrorSlice(unsafe unsafeVars, rewritten map[Var]Var) (result Errors) {
-
- if len(unsafe) == 0 {
- return
- }
-
- for _, pair := range unsafe.Vars() {
- v := pair.Var
- if w, ok := rewritten[v]; ok {
- v = w
- }
- if !v.IsGenerated() {
- if _, ok := futureKeywords[string(v)]; ok {
- result = append(result, NewError(UnsafeVarErr, pair.Loc,
- "var %[1]v is unsafe (hint: `import future.keywords.%[1]v` to import a future keyword)", v))
- continue
- }
- result = append(result, NewError(UnsafeVarErr, pair.Loc, "var %v is unsafe", v))
- }
- }
-
- if len(result) > 0 {
- return
- }
-
- // If the expression contains unsafe generated variables, report which
- // expressions are unsafe instead of the variables that are unsafe (since
- // the latter are not meaningful to the user.)
- pairs := unsafe.Slice()
-
- sort.Slice(pairs, func(i, j int) bool {
- return pairs[i].Expr.Location.Compare(pairs[j].Expr.Location) < 0
- })
-
- // Report at most one error per generated variable.
- seen := NewVarSet()
-
- for _, expr := range pairs {
- before := len(seen)
- for v := range expr.Vars {
- if v.IsGenerated() {
- seen.Add(v)
- }
- }
- if len(seen) > before {
- result = append(result, NewError(UnsafeVarErr, expr.Expr.Location, "expression is unsafe"))
- }
- }
-
- return
-}
-
-func checkUnsafeBuiltins(unsafeBuiltinsMap map[string]struct{}, node interface{}) Errors {
- errs := make(Errors, 0)
- WalkExprs(node, func(x *Expr) bool {
- if x.IsCall() {
- operator := x.Operator().String()
- if _, ok := unsafeBuiltinsMap[operator]; ok {
- errs = append(errs, NewError(TypeErr, x.Loc(), "unsafe built-in function calls in expression: %v", operator))
- }
- }
- return false
- })
- return errs
-}
-
-func rewriteVarsInRef(vars ...map[Var]Var) varRewriter {
- return func(node Ref) Ref {
- i, _ := TransformVars(node, func(v Var) (Value, error) {
- for _, m := range vars {
- if u, ok := m[v]; ok {
- return u, nil
- }
- }
- return v, nil
- })
- return i.(Ref)
- }
-}
-
-// NOTE(sr): This is duplicated with compile/compile.go; but moving it into another location
-// would cause a circular dependency -- the refSet definition needs ast.Ref. If we make it
-// public in the ast package, the compile package could take it from there, but it would also
-// increase our public interface. Let's reconsider if we need it in a third place.
-type refSet struct {
- s []Ref
-}
-
-func newRefSet(x ...Ref) *refSet {
- result := &refSet{}
- for i := range x {
- result.AddPrefix(x[i])
- }
- return result
-}
-
-// ContainsPrefix returns true if r is prefixed by any of the existing refs in the set.
-func (rs *refSet) ContainsPrefix(r Ref) bool {
- for i := range rs.s {
- if r.HasPrefix(rs.s[i]) {
- return true
- }
- }
- return false
-}
-
-// AddPrefix inserts r into the set if r is not prefixed by any existing
-// refs in the set. If any existing refs are prefixed by r, those existing
-// refs are removed.
-func (rs *refSet) AddPrefix(r Ref) {
- if rs.ContainsPrefix(r) {
- return
- }
- cpy := []Ref{r}
- for i := range rs.s {
- if !rs.s[i].HasPrefix(r) {
- cpy = append(cpy, rs.s[i])
- }
- }
- rs.s = cpy
-}
-
-// Sorted returns a sorted slice of terms for refs in the set.
-func (rs *refSet) Sorted() []*Term {
- terms := make([]*Term, len(rs.s))
- for i := range rs.s {
- terms[i] = NewTerm(rs.s[i])
- }
- sort.Slice(terms, func(i, j int) bool {
- return terms[i].Value.Compare(terms[j].Value) < 0
- })
- return terms
+// OutputVarsFromExpr returns all variables which are the "output" for
+// the given expression. For safety checks this means that they would be
+// made safe by the expr.
+func OutputVarsFromExpr(c *Compiler, expr *Expr, safe VarSet) VarSet {
+ return v1.OutputVarsFromExpr(c, expr, safe)
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/compilehelper.go b/vendor/github.com/open-policy-agent/opa/ast/compilehelper.go
index dd48884f9d..37ede329ea 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/compilehelper.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/compilehelper.go
@@ -4,41 +4,29 @@
package ast
+import v1 "github.com/open-policy-agent/opa/v1/ast"
+
// CompileModules takes a set of Rego modules represented as strings and
// compiles them for evaluation. The keys of the map are used as filenames.
func CompileModules(modules map[string]string) (*Compiler, error) {
- return CompileModulesWithOpt(modules, CompileOpts{})
+ return CompileModulesWithOpt(modules, CompileOpts{
+ ParserOptions: ParserOptions{
+ RegoVersion: DefaultRegoVersion,
+ },
+ })
}
// CompileOpts defines a set of options for the compiler.
-type CompileOpts struct {
- EnablePrintStatements bool
- ParserOptions ParserOptions
-}
+type CompileOpts = v1.CompileOpts
// CompileModulesWithOpt takes a set of Rego modules represented as strings and
// compiles them for evaluation. The keys of the map are used as filenames.
func CompileModulesWithOpt(modules map[string]string, opts CompileOpts) (*Compiler, error) {
-
- parsed := make(map[string]*Module, len(modules))
-
- for f, module := range modules {
- var pm *Module
- var err error
- if pm, err = ParseModuleWithOpts(f, module, opts.ParserOptions); err != nil {
- return nil, err
- }
- parsed[f] = pm
- }
-
- compiler := NewCompiler().WithEnablePrintStatements(opts.EnablePrintStatements)
- compiler.Compile(parsed)
-
- if compiler.Failed() {
- return nil, compiler.Errors
+ if opts.ParserOptions.RegoVersion == RegoUndefined {
+ opts.ParserOptions.RegoVersion = DefaultRegoVersion
}
- return compiler, nil
+ return v1.CompileModulesWithOpt(modules, opts)
}
// MustCompileModules compiles a set of Rego modules represented as strings. If
diff --git a/vendor/github.com/open-policy-agent/opa/ast/conflicts.go b/vendor/github.com/open-policy-agent/opa/ast/conflicts.go
index c2713ad576..10edce382c 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/conflicts.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/conflicts.go
@@ -5,49 +5,11 @@
package ast
import (
- "strings"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
// CheckPathConflicts returns a set of errors indicating paths that
// are in conflict with the result of the provided callable.
func CheckPathConflicts(c *Compiler, exists func([]string) (bool, error)) Errors {
- var errs Errors
-
- root := c.RuleTree.Child(DefaultRootDocument.Value)
- if root == nil {
- return nil
- }
-
- for _, node := range root.Children {
- errs = append(errs, checkDocumentConflicts(node, exists, nil)...)
- }
-
- return errs
-}
-
-func checkDocumentConflicts(node *TreeNode, exists func([]string) (bool, error), path []string) Errors {
-
- switch key := node.Key.(type) {
- case String:
- path = append(path, string(key))
- default: // other key types cannot conflict with data
- return nil
- }
-
- if len(node.Values) > 0 {
- s := strings.Join(path, "/")
- if ok, err := exists(path); err != nil {
- return Errors{NewError(CompileErr, node.Values[0].(*Rule).Loc(), "conflict check for data path %v: %v", s, err.Error())}
- } else if ok {
- return Errors{NewError(CompileErr, node.Values[0].(*Rule).Loc(), "conflicting rule for data path %v found", s)}
- }
- }
-
- var errs Errors
-
- for _, child := range node.Children {
- errs = append(errs, checkDocumentConflicts(child, exists, path)...)
- }
-
- return errs
+ return v1.CheckPathConflicts(c, exists)
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/doc.go b/vendor/github.com/open-policy-agent/opa/ast/doc.go
index 62b04e301e..ba974e5ba6 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/doc.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/doc.go
@@ -1,36 +1,8 @@
-// Copyright 2016 The OPA Authors. All rights reserved.
+// Copyright 2024 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 declares Rego syntax tree types and also includes a parser and compiler for preparing policies for execution in the policy engine.
-//
-// Rego policies are defined using a relatively small set of types: modules, package and import declarations, rules, expressions, and terms. At their core, policies consist of rules that are defined by one or more expressions over documents available to the policy engine. The expressions are defined by intrinsic values (terms) such as strings, objects, variables, etc.
-//
-// Rego policies are typically defined in text files and then parsed and compiled by the policy engine at runtime. The parsing stage takes the text or string representation of the policy and converts it into an abstract syntax tree (AST) that consists of the types mentioned above. The AST is organized as follows:
-//
-// Module
-// |
-// +--- Package (Reference)
-// |
-// +--- Imports
-// | |
-// | +--- Import (Term)
-// |
-// +--- Rules
-// |
-// +--- Rule
-// |
-// +--- Head
-// | |
-// | +--- Name (Variable)
-// | |
-// | +--- Key (Term)
-// | |
-// | +--- Value (Term)
-// |
-// +--- Body
-// |
-// +--- Expression (Term | Terms | Variable Declaration)
-//
-// At query time, the policy engine expects policies to have been compiled. The compilation stage takes one or more modules and compiles them into a format that the policy engine supports.
+// Deprecated: This package is intended for older projects transitioning from OPA v0.x and will remain for the lifetime of OPA v1.x, but its use is not recommended.
+// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
+// See https://www.openpolicyagent.org/docs/latest/v0-compatibility/ for more information.
package ast
diff --git a/vendor/github.com/open-policy-agent/opa/ast/env.go b/vendor/github.com/open-policy-agent/opa/ast/env.go
index c767aafefb..ef0ccf89ce 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/env.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/env.go
@@ -5,522 +5,8 @@
package ast
import (
- "fmt"
- "strings"
-
- "github.com/open-policy-agent/opa/types"
- "github.com/open-policy-agent/opa/util"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
// TypeEnv contains type info for static analysis such as type checking.
-type TypeEnv struct {
- tree *typeTreeNode
- next *TypeEnv
- newChecker func() *typeChecker
-}
-
-// newTypeEnv returns an empty TypeEnv. The constructor is not exported because
-// type environments should only be created by the type checker.
-func newTypeEnv(f func() *typeChecker) *TypeEnv {
- return &TypeEnv{
- tree: newTypeTree(),
- newChecker: f,
- }
-}
-
-// Get returns the type of x.
-func (env *TypeEnv) Get(x interface{}) types.Type {
-
- if term, ok := x.(*Term); ok {
- x = term.Value
- }
-
- switch x := x.(type) {
-
- // Scalars.
- case Null:
- return types.NewNull()
- case Boolean:
- return types.NewBoolean()
- case Number:
- return types.NewNumber()
- case String:
- return types.NewString()
-
- // Composites.
- case *Array:
- static := make([]types.Type, x.Len())
- for i := range static {
- tpe := env.Get(x.Elem(i).Value)
- static[i] = tpe
- }
-
- var dynamic types.Type
- if len(static) == 0 {
- dynamic = types.A
- }
-
- return types.NewArray(static, dynamic)
-
- case *lazyObj:
- return env.Get(x.force())
- case *object:
- static := []*types.StaticProperty{}
- var dynamic *types.DynamicProperty
-
- x.Foreach(func(k, v *Term) {
- if IsConstant(k.Value) {
- kjson, err := JSON(k.Value)
- if err == nil {
- tpe := env.Get(v)
- static = append(static, types.NewStaticProperty(kjson, tpe))
- return
- }
- }
- // Can't handle it as a static property, fallback to dynamic
- typeK := env.Get(k.Value)
- typeV := env.Get(v.Value)
- dynamic = types.NewDynamicProperty(typeK, typeV)
- })
-
- if len(static) == 0 && dynamic == nil {
- dynamic = types.NewDynamicProperty(types.A, types.A)
- }
-
- return types.NewObject(static, dynamic)
-
- case Set:
- var tpe types.Type
- x.Foreach(func(elem *Term) {
- other := env.Get(elem.Value)
- tpe = types.Or(tpe, other)
- })
- if tpe == nil {
- tpe = types.A
- }
- return types.NewSet(tpe)
-
- // Comprehensions.
- case *ArrayComprehension:
- cpy, errs := env.newChecker().CheckBody(env, x.Body)
- if len(errs) == 0 {
- return types.NewArray(nil, cpy.Get(x.Term))
- }
- return nil
- case *ObjectComprehension:
- cpy, errs := env.newChecker().CheckBody(env, x.Body)
- if len(errs) == 0 {
- return types.NewObject(nil, types.NewDynamicProperty(cpy.Get(x.Key), cpy.Get(x.Value)))
- }
- return nil
- case *SetComprehension:
- cpy, errs := env.newChecker().CheckBody(env, x.Body)
- if len(errs) == 0 {
- return types.NewSet(cpy.Get(x.Term))
- }
- return nil
-
- // Refs.
- case Ref:
- return env.getRef(x)
-
- // Vars.
- case Var:
- if node := env.tree.Child(x); node != nil {
- return node.Value()
- }
- if env.next != nil {
- return env.next.Get(x)
- }
- return nil
-
- // Calls.
- case Call:
- return nil
-
- default:
- panic("unreachable")
- }
-}
-
-func (env *TypeEnv) getRef(ref Ref) types.Type {
-
- node := env.tree.Child(ref[0].Value)
- if node == nil {
- return env.getRefFallback(ref)
- }
-
- return env.getRefRec(node, ref, ref[1:])
-}
-
-func (env *TypeEnv) getRefFallback(ref Ref) types.Type {
-
- if env.next != nil {
- return env.next.Get(ref)
- }
-
- if RootDocumentNames.Contains(ref[0]) {
- return types.A
- }
-
- return nil
-}
-
-func (env *TypeEnv) getRefRec(node *typeTreeNode, ref, tail Ref) types.Type {
- if len(tail) == 0 {
- return env.getRefRecExtent(node)
- }
-
- if node.Leaf() {
- if node.children.Len() > 0 {
- if child := node.Child(tail[0].Value); child != nil {
- return env.getRefRec(child, ref, tail[1:])
- }
- }
- return selectRef(node.Value(), tail)
- }
-
- if !IsConstant(tail[0].Value) {
- return selectRef(env.getRefRecExtent(node), tail)
- }
-
- child := node.Child(tail[0].Value)
- if child == nil {
- return env.getRefFallback(ref)
- }
-
- return env.getRefRec(child, ref, tail[1:])
-}
-
-func (env *TypeEnv) getRefRecExtent(node *typeTreeNode) types.Type {
-
- if node.Leaf() {
- return node.Value()
- }
-
- children := []*types.StaticProperty{}
-
- node.Children().Iter(func(k, v util.T) bool {
- key := k.(Value)
- child := v.(*typeTreeNode)
-
- tpe := env.getRefRecExtent(child)
-
- // NOTE(sr): Converting to Golang-native types here is an extension of what we did
- // before -- only supporting strings. But since we cannot differentiate sets and arrays
- // that way, we could reconsider.
- switch key.(type) {
- case String, Number, Boolean: // skip anything else
- propKey, err := JSON(key)
- if err != nil {
- panic(fmt.Errorf("unreachable, ValueToInterface: %w", err))
- }
- children = append(children, types.NewStaticProperty(propKey, tpe))
- }
- return false
- })
-
- // TODO(tsandall): for now, these objects can have any dynamic properties
- // because we don't have schema for base docs. Once schemas are supported
- // we can improve this.
- return types.NewObject(children, types.NewDynamicProperty(types.S, types.A))
-}
-
-func (env *TypeEnv) wrap() *TypeEnv {
- cpy := *env
- cpy.next = env
- cpy.tree = newTypeTree()
- return &cpy
-}
-
-// typeTreeNode is used to store type information in a tree.
-type typeTreeNode struct {
- key Value
- value types.Type
- children *util.HashMap
-}
-
-func newTypeTree() *typeTreeNode {
- return &typeTreeNode{
- key: nil,
- value: nil,
- children: util.NewHashMap(valueEq, valueHash),
- }
-}
-
-func (n *typeTreeNode) Child(key Value) *typeTreeNode {
- value, ok := n.children.Get(key)
- if !ok {
- return nil
- }
- return value.(*typeTreeNode)
-}
-
-func (n *typeTreeNode) Children() *util.HashMap {
- return n.children
-}
-
-func (n *typeTreeNode) Get(path Ref) types.Type {
- curr := n
- for _, term := range path {
- child, ok := curr.children.Get(term.Value)
- if !ok {
- return nil
- }
- curr = child.(*typeTreeNode)
- }
- return curr.Value()
-}
-
-func (n *typeTreeNode) Leaf() bool {
- return n.value != nil
-}
-
-func (n *typeTreeNode) PutOne(key Value, tpe types.Type) {
- c, ok := n.children.Get(key)
-
- var child *typeTreeNode
- if !ok {
- child = newTypeTree()
- child.key = key
- n.children.Put(key, child)
- } else {
- child = c.(*typeTreeNode)
- }
-
- child.value = tpe
-}
-
-func (n *typeTreeNode) Put(path Ref, tpe types.Type) {
- curr := n
- for _, term := range path {
- c, ok := curr.children.Get(term.Value)
-
- var child *typeTreeNode
- if !ok {
- child = newTypeTree()
- child.key = term.Value
- curr.children.Put(child.key, child)
- } else {
- child = c.(*typeTreeNode)
- }
-
- curr = child
- }
- curr.value = tpe
-}
-
-// Insert inserts tpe at path in the tree, but also merges the value into any types.Object present along that path.
-// If a types.Object is inserted, any leafs already present further down the tree are merged into the inserted object.
-// path must be ground.
-func (n *typeTreeNode) Insert(path Ref, tpe types.Type, env *TypeEnv) {
- curr := n
- for i, term := range path {
- c, ok := curr.children.Get(term.Value)
-
- var child *typeTreeNode
- if !ok {
- child = newTypeTree()
- child.key = term.Value
- curr.children.Put(child.key, child)
- } else {
- child = c.(*typeTreeNode)
-
- if child.value != nil && i+1 < len(path) {
- // If child has an object value, merge the new value into it.
- if o, ok := child.value.(*types.Object); ok {
- var err error
- child.value, err = insertIntoObject(o, path[i+1:], tpe, env)
- if err != nil {
- panic(fmt.Errorf("unreachable, insertIntoObject: %w", err))
- }
- }
- }
- }
-
- curr = child
- }
-
- curr.value = mergeTypes(curr.value, tpe)
-
- if _, ok := tpe.(*types.Object); ok && curr.children.Len() > 0 {
- // merge all leafs into the inserted object
- leafs := curr.Leafs()
- for p, t := range leafs {
- var err error
- curr.value, err = insertIntoObject(curr.value.(*types.Object), *p, t, env)
- if err != nil {
- panic(fmt.Errorf("unreachable, insertIntoObject: %w", err))
- }
- }
- }
-}
-
-// mergeTypes merges the types of 'a' and 'b'. If both are sets, their 'of' types are joined with an types.Or.
-// If both are objects, the key types of their dynamic properties are joined with types.Or:s, and their value types
-// are recursively merged (using mergeTypes).
-// If 'a' and 'b' are both objects, and at least one of them have static properties, they are joined
-// with an types.Or, instead of being merged.
-// If 'a' is an Any containing an Object, and 'b' is an Object (or vice versa); AND both objects have no
-// static properties, they are merged.
-// If 'a' and 'b' are different types, they are joined with an types.Or.
-func mergeTypes(a, b types.Type) types.Type {
- if a == nil {
- return b
- }
-
- if b == nil {
- return a
- }
-
- switch a := a.(type) {
- case *types.Object:
- if bObj, ok := b.(*types.Object); ok && len(a.StaticProperties()) == 0 && len(bObj.StaticProperties()) == 0 {
- if len(a.StaticProperties()) > 0 || len(bObj.StaticProperties()) > 0 {
- return types.Or(a, bObj)
- }
-
- aDynProps := a.DynamicProperties()
- bDynProps := bObj.DynamicProperties()
- dynProps := types.NewDynamicProperty(
- types.Or(aDynProps.Key, bDynProps.Key),
- mergeTypes(aDynProps.Value, bDynProps.Value))
- return types.NewObject(nil, dynProps)
- } else if bAny, ok := b.(types.Any); ok && len(a.StaticProperties()) == 0 {
- // If a is an object type with no static components ...
- for _, t := range bAny {
- if tObj, ok := t.(*types.Object); ok && len(tObj.StaticProperties()) == 0 {
- // ... and b is a types.Any containing an object with no static components, we merge them.
- aDynProps := a.DynamicProperties()
- tDynProps := tObj.DynamicProperties()
- tDynProps.Key = types.Or(tDynProps.Key, aDynProps.Key)
- tDynProps.Value = types.Or(tDynProps.Value, aDynProps.Value)
- return bAny
- }
- }
- }
- case *types.Set:
- if bSet, ok := b.(*types.Set); ok {
- return types.NewSet(types.Or(a.Of(), bSet.Of()))
- }
- case types.Any:
- if _, ok := b.(types.Any); !ok {
- return mergeTypes(b, a)
- }
- }
-
- return types.Or(a, b)
-}
-
-func (n *typeTreeNode) String() string {
- b := strings.Builder{}
-
- if k := n.key; k != nil {
- b.WriteString(k.String())
- } else {
- b.WriteString("-")
- }
-
- if v := n.value; v != nil {
- b.WriteString(": ")
- b.WriteString(v.String())
- }
-
- n.children.Iter(func(_, v util.T) bool {
- if child, ok := v.(*typeTreeNode); ok {
- b.WriteString("\n\t+ ")
- s := child.String()
- s = strings.ReplaceAll(s, "\n", "\n\t")
- b.WriteString(s)
- }
- return false
- })
-
- return b.String()
-}
-
-func insertIntoObject(o *types.Object, path Ref, tpe types.Type, env *TypeEnv) (*types.Object, error) {
- if len(path) == 0 {
- return o, nil
- }
-
- key := env.Get(path[0].Value)
-
- if len(path) == 1 {
- var dynamicProps *types.DynamicProperty
- if dp := o.DynamicProperties(); dp != nil {
- dynamicProps = types.NewDynamicProperty(types.Or(o.DynamicProperties().Key, key), types.Or(o.DynamicProperties().Value, tpe))
- } else {
- dynamicProps = types.NewDynamicProperty(key, tpe)
- }
- return types.NewObject(o.StaticProperties(), dynamicProps), nil
- }
-
- child, err := insertIntoObject(types.NewObject(nil, nil), path[1:], tpe, env)
- if err != nil {
- return nil, err
- }
-
- var dynamicProps *types.DynamicProperty
- if dp := o.DynamicProperties(); dp != nil {
- dynamicProps = types.NewDynamicProperty(types.Or(o.DynamicProperties().Key, key), types.Or(o.DynamicProperties().Value, child))
- } else {
- dynamicProps = types.NewDynamicProperty(key, child)
- }
- return types.NewObject(o.StaticProperties(), dynamicProps), nil
-}
-
-func (n *typeTreeNode) Leafs() map[*Ref]types.Type {
- leafs := map[*Ref]types.Type{}
- n.children.Iter(func(_, v util.T) bool {
- collectLeafs(v.(*typeTreeNode), nil, leafs)
- return false
- })
- return leafs
-}
-
-func collectLeafs(n *typeTreeNode, path Ref, leafs map[*Ref]types.Type) {
- nPath := append(path, NewTerm(n.key))
- if n.Leaf() {
- leafs[&nPath] = n.Value()
- return
- }
- n.children.Iter(func(_, v util.T) bool {
- collectLeafs(v.(*typeTreeNode), nPath, leafs)
- return false
- })
-}
-
-func (n *typeTreeNode) Value() types.Type {
- return n.value
-}
-
-// selectConstant returns the attribute of the type referred to by the term. If
-// the attribute type cannot be determined, nil is returned.
-func selectConstant(tpe types.Type, term *Term) types.Type {
- x, err := JSON(term.Value)
- if err == nil {
- return types.Select(tpe, x)
- }
- return nil
-}
-
-// selectRef returns the type of the nested attribute referred to by ref. If
-// the attribute type cannot be determined, nil is returned. If the ref
-// contains vars or refs, then the returned type will be a union of the
-// possible types.
-func selectRef(tpe types.Type, ref Ref) types.Type {
-
- if tpe == nil || len(ref) == 0 {
- return tpe
- }
-
- head, tail := ref[0], ref[1:]
-
- switch head.Value.(type) {
- case Var, Ref, *Array, Object, Set:
- return selectRef(types.Values(tpe), tail)
- default:
- return selectRef(selectConstant(tpe, head), tail)
- }
-}
+type TypeEnv = v1.TypeEnv
diff --git a/vendor/github.com/open-policy-agent/opa/ast/errors.go b/vendor/github.com/open-policy-agent/opa/ast/errors.go
index 066dfcdd68..722cfc0fb7 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/errors.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/errors.go
@@ -5,119 +5,42 @@
package ast
import (
- "fmt"
- "sort"
- "strings"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
// Errors represents a series of errors encountered during parsing, compiling,
// etc.
-type Errors []*Error
-
-func (e Errors) Error() string {
-
- if len(e) == 0 {
- return "no error(s)"
- }
-
- if len(e) == 1 {
- return fmt.Sprintf("1 error occurred: %v", e[0].Error())
- }
-
- s := make([]string, len(e))
- for i, err := range e {
- s[i] = err.Error()
- }
-
- return fmt.Sprintf("%d errors occurred:\n%s", len(e), strings.Join(s, "\n"))
-}
-
-// Sort sorts the error slice by location. If the locations are equal then the
-// error message is compared.
-func (e Errors) Sort() {
- sort.Slice(e, func(i, j int) bool {
- a := e[i]
- b := e[j]
-
- if cmp := a.Location.Compare(b.Location); cmp != 0 {
- return cmp < 0
- }
-
- return a.Error() < b.Error()
- })
-}
+type Errors = v1.Errors
const (
// ParseErr indicates an unclassified parse error occurred.
- ParseErr = "rego_parse_error"
+ ParseErr = v1.ParseErr
// CompileErr indicates an unclassified compile error occurred.
- CompileErr = "rego_compile_error"
+ CompileErr = v1.CompileErr
// TypeErr indicates a type error was caught.
- TypeErr = "rego_type_error"
+ TypeErr = v1.TypeErr
// UnsafeVarErr indicates an unsafe variable was found during compilation.
- UnsafeVarErr = "rego_unsafe_var_error"
+ UnsafeVarErr = v1.UnsafeVarErr
// RecursionErr indicates recursion was found during compilation.
- RecursionErr = "rego_recursion_error"
+ RecursionErr = v1.RecursionErr
)
// IsError returns true if err is an AST error with code.
func IsError(code string, err error) bool {
- if err, ok := err.(*Error); ok {
- return err.Code == code
- }
- return false
+ return v1.IsError(code, err)
}
// ErrorDetails defines the interface for detailed error messages.
-type ErrorDetails interface {
- Lines() []string
-}
+type ErrorDetails = v1.ErrorDetails
// Error represents a single error caught during parsing, compiling, etc.
-type Error struct {
- Code string `json:"code"`
- Message string `json:"message"`
- Location *Location `json:"location,omitempty"`
- Details ErrorDetails `json:"details,omitempty"`
-}
-
-func (e *Error) Error() string {
-
- var prefix string
-
- if e.Location != nil {
-
- if len(e.Location.File) > 0 {
- prefix += e.Location.File + ":" + fmt.Sprint(e.Location.Row)
- } else {
- prefix += fmt.Sprint(e.Location.Row) + ":" + fmt.Sprint(e.Location.Col)
- }
- }
-
- msg := fmt.Sprintf("%v: %v", e.Code, e.Message)
-
- if len(prefix) > 0 {
- msg = prefix + ": " + msg
- }
-
- if e.Details != nil {
- for _, line := range e.Details.Lines() {
- msg += "\n\t" + line
- }
- }
-
- return msg
-}
+type Error = v1.Error
// NewError returns a new Error object.
-func NewError(code string, loc *Location, f string, a ...interface{}) *Error {
- return &Error{
- Code: code,
- Location: loc,
- Message: fmt.Sprintf(f, a...),
- }
+func NewError(code string, loc *Location, f string, a ...any) *Error {
+ return v1.NewError(code, loc, f, a...)
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/index.go b/vendor/github.com/open-policy-agent/opa/ast/index.go
index cb0cbea323..7e80bb7716 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/index.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/index.go
@@ -5,904 +5,16 @@
package ast
import (
- "fmt"
- "sort"
- "strings"
-
- "github.com/open-policy-agent/opa/util"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
// RuleIndex defines the interface for rule indices.
-type RuleIndex interface {
-
- // Build tries to construct an index for the given rules. If the index was
- // constructed, it returns true, otherwise false.
- Build(rules []*Rule) bool
-
- // Lookup searches the index for rules that will match the provided
- // resolver. If the resolver returns an error, it is returned via err.
- Lookup(resolver ValueResolver) (*IndexResult, error)
-
- // AllRules traverses the index and returns all rules that will match
- // the provided resolver without any optimizations (effectively with
- // indexing disabled). If the resolver returns an error, it is returned
- // via err.
- AllRules(resolver ValueResolver) (*IndexResult, error)
-}
+type RuleIndex v1.RuleIndex
// IndexResult contains the result of an index lookup.
-type IndexResult struct {
- Kind RuleKind
- Rules []*Rule
- Else map[*Rule][]*Rule
- Default *Rule
- EarlyExit bool
- OnlyGroundRefs bool
-}
+type IndexResult = v1.IndexResult
// NewIndexResult returns a new IndexResult object.
func NewIndexResult(kind RuleKind) *IndexResult {
- return &IndexResult{
- Kind: kind,
- Else: map[*Rule][]*Rule{},
- }
-}
-
-// Empty returns true if there are no rules to evaluate.
-func (ir *IndexResult) Empty() bool {
- return len(ir.Rules) == 0 && ir.Default == nil
-}
-
-type baseDocEqIndex struct {
- skipIndexing Set
- isVirtual func(Ref) bool
- root *trieNode
- defaultRule *Rule
- kind RuleKind
- onlyGroundRefs bool
-}
-
-func newBaseDocEqIndex(isVirtual func(Ref) bool) *baseDocEqIndex {
- return &baseDocEqIndex{
- skipIndexing: NewSet(NewTerm(InternalPrint.Ref())),
- isVirtual: isVirtual,
- root: newTrieNodeImpl(),
- onlyGroundRefs: true,
- }
-}
-
-func (i *baseDocEqIndex) Build(rules []*Rule) bool {
- if len(rules) == 0 {
- return false
- }
-
- i.kind = rules[0].Head.RuleKind()
- indices := newrefindices(i.isVirtual)
-
- // build indices for each rule.
- for idx := range rules {
- WalkRules(rules[idx], func(rule *Rule) bool {
- if rule.Default {
- i.defaultRule = rule
- return false
- }
- if i.onlyGroundRefs {
- i.onlyGroundRefs = rule.Head.Reference.IsGround()
- }
- var skip bool
- for _, expr := range rule.Body {
- if op := expr.OperatorTerm(); op != nil && i.skipIndexing.Contains(op) {
- skip = true
- break
- }
- }
- if !skip {
- for _, expr := range rule.Body {
- indices.Update(rule, expr)
- }
- }
- return false
- })
- }
-
- // build trie out of indices.
- for idx := range rules {
- var prio int
- WalkRules(rules[idx], func(rule *Rule) bool {
- if rule.Default {
- return false
- }
- node := i.root
- if indices.Indexed(rule) {
- for _, ref := range indices.Sorted() {
- node = node.Insert(ref, indices.Value(rule, ref), indices.Mapper(rule, ref))
- }
- }
- // Insert rule into trie with (insertion order, priority order)
- // tuple. Retaining the insertion order allows us to return rules
- // in the order they were passed to this function.
- node.append([...]int{idx, prio}, rule)
- prio++
- return false
- })
- }
- return true
-}
-
-func (i *baseDocEqIndex) Lookup(resolver ValueResolver) (*IndexResult, error) {
-
- tr := newTrieTraversalResult()
-
- err := i.root.Traverse(resolver, tr)
- if err != nil {
- return nil, err
- }
-
- result := NewIndexResult(i.kind)
- result.Default = i.defaultRule
- result.OnlyGroundRefs = i.onlyGroundRefs
- result.Rules = make([]*Rule, 0, len(tr.ordering))
-
- for _, pos := range tr.ordering {
- sort.Slice(tr.unordered[pos], func(i, j int) bool {
- return tr.unordered[pos][i].prio[1] < tr.unordered[pos][j].prio[1]
- })
- nodes := tr.unordered[pos]
- root := nodes[0].rule
-
- result.Rules = append(result.Rules, root)
- if len(nodes) > 1 {
- result.Else[root] = make([]*Rule, len(nodes)-1)
- for i := 1; i < len(nodes); i++ {
- result.Else[root][i-1] = nodes[i].rule
- }
- }
- }
-
- result.EarlyExit = tr.values.Len() == 1 && tr.values.Slice()[0].IsGround()
-
- return result, nil
-}
-
-func (i *baseDocEqIndex) AllRules(_ ValueResolver) (*IndexResult, error) {
- tr := newTrieTraversalResult()
-
- // Walk over the rule trie and accumulate _all_ rules
- rw := &ruleWalker{result: tr}
- i.root.Do(rw)
-
- result := NewIndexResult(i.kind)
- result.Default = i.defaultRule
- result.OnlyGroundRefs = i.onlyGroundRefs
- result.Rules = make([]*Rule, 0, len(tr.ordering))
-
- for _, pos := range tr.ordering {
- sort.Slice(tr.unordered[pos], func(i, j int) bool {
- return tr.unordered[pos][i].prio[1] < tr.unordered[pos][j].prio[1]
- })
- nodes := tr.unordered[pos]
- root := nodes[0].rule
- result.Rules = append(result.Rules, root)
- if len(nodes) > 1 {
- result.Else[root] = make([]*Rule, len(nodes)-1)
- for i := 1; i < len(nodes); i++ {
- result.Else[root][i-1] = nodes[i].rule
- }
- }
- }
-
- result.EarlyExit = tr.values.Len() == 1 && tr.values.Slice()[0].IsGround()
-
- return result, nil
-}
-
-type ruleWalker struct {
- result *trieTraversalResult
-}
-
-func (r *ruleWalker) Do(x interface{}) trieWalker {
- tn := x.(*trieNode)
- r.result.Add(tn)
- return r
-}
-
-type valueMapper struct {
- Key string
- MapValue func(Value) Value
-}
-
-type refindex struct {
- Ref Ref
- Value Value
- Mapper *valueMapper
-}
-
-type refindices struct {
- isVirtual func(Ref) bool
- rules map[*Rule][]*refindex
- frequency *util.HashMap
- sorted []Ref
-}
-
-func newrefindices(isVirtual func(Ref) bool) *refindices {
- return &refindices{
- isVirtual: isVirtual,
- rules: map[*Rule][]*refindex{},
- frequency: util.NewHashMap(func(a, b util.T) bool {
- r1, r2 := a.(Ref), b.(Ref)
- return r1.Equal(r2)
- }, func(x util.T) int {
- return x.(Ref).Hash()
- }),
- }
-}
-
-// Update attempts to update the refindices for the given expression in the
-// given rule. If the expression cannot be indexed the update does not affect
-// the indices.
-func (i *refindices) Update(rule *Rule, expr *Expr) {
-
- if expr.Negated {
- return
- }
-
- if len(expr.With) > 0 {
- // NOTE(tsandall): In the future, we may need to consider expressions
- // that have with statements applied to them.
- return
- }
-
- op := expr.Operator()
-
- switch {
- case op.Equal(Equality.Ref()):
- i.updateEq(rule, expr)
-
- case op.Equal(Equal.Ref()) && len(expr.Operands()) == 2:
- // NOTE(tsandall): if equal() is called with more than two arguments the
- // output value is being captured in which case the indexer cannot
- // exclude the rule if the equal() call would return false (because the
- // false value must still be produced.)
- i.updateEq(rule, expr)
-
- case op.Equal(GlobMatch.Ref()) && len(expr.Operands()) == 3:
- // NOTE(sr): Same as with equal() above -- 4 operands means the output
- // of `glob.match` is captured and the rule can thus not be excluded.
- i.updateGlobMatch(rule, expr)
- }
-}
-
-// Sorted returns a sorted list of references that the indices were built from.
-// References that appear more frequently in the indexed rules are ordered
-// before less frequently appearing references.
-func (i *refindices) Sorted() []Ref {
-
- if i.sorted == nil {
- counts := make([]int, 0, i.frequency.Len())
- i.sorted = make([]Ref, 0, i.frequency.Len())
-
- i.frequency.Iter(func(k, v util.T) bool {
- counts = append(counts, v.(int))
- i.sorted = append(i.sorted, k.(Ref))
- return false
- })
-
- sort.Slice(i.sorted, func(a, b int) bool {
- if counts[a] > counts[b] {
- return true
- } else if counts[b] > counts[a] {
- return false
- }
- return i.sorted[a][0].Loc().Compare(i.sorted[b][0].Loc()) < 0
- })
- }
-
- return i.sorted
-}
-
-func (i *refindices) Indexed(rule *Rule) bool {
- return len(i.rules[rule]) > 0
-}
-
-func (i *refindices) Value(rule *Rule, ref Ref) Value {
- if index := i.index(rule, ref); index != nil {
- return index.Value
- }
- return nil
-}
-
-func (i *refindices) Mapper(rule *Rule, ref Ref) *valueMapper {
- if index := i.index(rule, ref); index != nil {
- return index.Mapper
- }
- return nil
-}
-
-func (i *refindices) updateEq(rule *Rule, expr *Expr) {
- a, b := expr.Operand(0), expr.Operand(1)
- args := rule.Head.Args
- if idx, ok := eqOperandsToRefAndValue(i.isVirtual, args, a, b); ok {
- i.insert(rule, idx)
- return
- }
- if idx, ok := eqOperandsToRefAndValue(i.isVirtual, args, b, a); ok {
- i.insert(rule, idx)
- return
- }
-}
-
-func (i *refindices) updateGlobMatch(rule *Rule, expr *Expr) {
- args := rule.Head.Args
-
- delim, ok := globDelimiterToString(expr.Operand(1))
- if !ok {
- return
- }
-
- if arr := globPatternToArray(expr.Operand(0), delim); arr != nil {
- // The 3rd operand of glob.match is the value to match. We assume the
- // 3rd operand was a reference that has been rewritten and bound to a
- // variable earlier in the query OR a function argument variable.
- match := expr.Operand(2)
- if _, ok := match.Value.(Var); ok {
- var ref Ref
- for _, other := range i.rules[rule] {
- if _, ok := other.Value.(Var); ok && other.Value.Compare(match.Value) == 0 {
- ref = other.Ref
- }
- }
- if ref == nil {
- for j, arg := range args {
- if arg.Equal(match) {
- ref = Ref{FunctionArgRootDocument, IntNumberTerm(j)}
- }
- }
- }
- if ref != nil {
- i.insert(rule, &refindex{
- Ref: ref,
- Value: arr.Value,
- Mapper: &valueMapper{
- Key: delim,
- MapValue: func(v Value) Value {
- if s, ok := v.(String); ok {
- return stringSliceToArray(splitStringEscaped(string(s), delim))
- }
- return v
- },
- },
- })
- }
- }
- }
-}
-
-func (i *refindices) insert(rule *Rule, index *refindex) {
-
- count, ok := i.frequency.Get(index.Ref)
- if !ok {
- count = 0
- }
-
- i.frequency.Put(index.Ref, count.(int)+1)
-
- for pos, other := range i.rules[rule] {
- if other.Ref.Equal(index.Ref) {
- i.rules[rule][pos] = index
- return
- }
- }
-
- i.rules[rule] = append(i.rules[rule], index)
-}
-
-func (i *refindices) index(rule *Rule, ref Ref) *refindex {
- for _, index := range i.rules[rule] {
- if index.Ref.Equal(ref) {
- return index
- }
- }
- return nil
-}
-
-type trieWalker interface {
- Do(x interface{}) trieWalker
-}
-
-type trieTraversalResult struct {
- unordered map[int][]*ruleNode
- ordering []int
- values Set
-}
-
-func newTrieTraversalResult() *trieTraversalResult {
- return &trieTraversalResult{
- unordered: map[int][]*ruleNode{},
- values: NewSet(),
- }
-}
-
-func (tr *trieTraversalResult) Add(t *trieNode) {
- for _, node := range t.rules {
- root := node.prio[0]
- nodes, ok := tr.unordered[root]
- if !ok {
- tr.ordering = append(tr.ordering, root)
- }
- tr.unordered[root] = append(nodes, node)
- }
- if t.values != nil {
- t.values.Foreach(func(v *Term) { tr.values.Add(v) })
- }
-}
-
-type trieNode struct {
- ref Ref
- values Set
- mappers []*valueMapper
- next *trieNode
- any *trieNode
- undefined *trieNode
- scalars *util.HashMap
- array *trieNode
- rules []*ruleNode
-}
-
-func (node *trieNode) String() string {
- var flags []string
- flags = append(flags, fmt.Sprintf("self:%p", node))
- if len(node.ref) > 0 {
- flags = append(flags, node.ref.String())
- }
- if node.next != nil {
- flags = append(flags, fmt.Sprintf("next:%p", node.next))
- }
- if node.any != nil {
- flags = append(flags, fmt.Sprintf("any:%p", node.any))
- }
- if node.undefined != nil {
- flags = append(flags, fmt.Sprintf("undefined:%p", node.undefined))
- }
- if node.array != nil {
- flags = append(flags, fmt.Sprintf("array:%p", node.array))
- }
- if node.scalars.Len() > 0 {
- buf := make([]string, 0, node.scalars.Len())
- node.scalars.Iter(func(k, v util.T) bool {
- key := k.(Value)
- val := v.(*trieNode)
- buf = append(buf, fmt.Sprintf("scalar(%v):%p", key, val))
- return false
- })
- sort.Strings(buf)
- flags = append(flags, strings.Join(buf, " "))
- }
- if len(node.rules) > 0 {
- flags = append(flags, fmt.Sprintf("%d rule(s)", len(node.rules)))
- }
- if len(node.mappers) > 0 {
- flags = append(flags, fmt.Sprintf("%d mapper(s)", len(node.mappers)))
- }
- if node.values != nil {
- if l := node.values.Len(); l > 0 {
- flags = append(flags, fmt.Sprintf("%d value(s)", l))
- }
- }
- return strings.Join(flags, " ")
-}
-
-func (node *trieNode) append(prio [2]int, rule *Rule) {
- node.rules = append(node.rules, &ruleNode{prio, rule})
-
- if node.values != nil && rule.Head.Value != nil {
- node.values.Add(rule.Head.Value)
- return
- }
-
- if node.values == nil && rule.Head.DocKind() == CompleteDoc {
- node.values = NewSet(rule.Head.Value)
- }
-}
-
-type ruleNode struct {
- prio [2]int
- rule *Rule
-}
-
-func newTrieNodeImpl() *trieNode {
- return &trieNode{
- scalars: util.NewHashMap(valueEq, valueHash),
- }
-}
-
-func (node *trieNode) Do(walker trieWalker) {
- next := walker.Do(node)
- if next == nil {
- return
- }
- if node.any != nil {
- node.any.Do(next)
- }
- if node.undefined != nil {
- node.undefined.Do(next)
- }
-
- node.scalars.Iter(func(_, v util.T) bool {
- child := v.(*trieNode)
- child.Do(next)
- return false
- })
-
- if node.array != nil {
- node.array.Do(next)
- }
- if node.next != nil {
- node.next.Do(next)
- }
-}
-
-func (node *trieNode) Insert(ref Ref, value Value, mapper *valueMapper) *trieNode {
-
- if node.next == nil {
- node.next = newTrieNodeImpl()
- node.next.ref = ref
- }
-
- if mapper != nil {
- node.next.addMapper(mapper)
- }
-
- return node.next.insertValue(value)
-}
-
-func (node *trieNode) Traverse(resolver ValueResolver, tr *trieTraversalResult) error {
-
- if node == nil {
- return nil
- }
-
- tr.Add(node)
-
- return node.next.traverse(resolver, tr)
-}
-
-func (node *trieNode) addMapper(mapper *valueMapper) {
- for i := range node.mappers {
- if node.mappers[i].Key == mapper.Key {
- return
- }
- }
- node.mappers = append(node.mappers, mapper)
-}
-
-func (node *trieNode) insertValue(value Value) *trieNode {
-
- switch value := value.(type) {
- case nil:
- if node.undefined == nil {
- node.undefined = newTrieNodeImpl()
- }
- return node.undefined
- case Var:
- if node.any == nil {
- node.any = newTrieNodeImpl()
- }
- return node.any
- case Null, Boolean, Number, String:
- child, ok := node.scalars.Get(value)
- if !ok {
- child = newTrieNodeImpl()
- node.scalars.Put(value, child)
- }
- return child.(*trieNode)
- case *Array:
- if node.array == nil {
- node.array = newTrieNodeImpl()
- }
- return node.array.insertArray(value)
- }
-
- panic("illegal value")
-}
-
-func (node *trieNode) insertArray(arr *Array) *trieNode {
-
- if arr.Len() == 0 {
- return node
- }
-
- switch head := arr.Elem(0).Value.(type) {
- case Var:
- if node.any == nil {
- node.any = newTrieNodeImpl()
- }
- return node.any.insertArray(arr.Slice(1, -1))
- case Null, Boolean, Number, String:
- child, ok := node.scalars.Get(head)
- if !ok {
- child = newTrieNodeImpl()
- node.scalars.Put(head, child)
- }
- return child.(*trieNode).insertArray(arr.Slice(1, -1))
- }
-
- panic("illegal value")
-}
-
-func (node *trieNode) traverse(resolver ValueResolver, tr *trieTraversalResult) error {
-
- if node == nil {
- return nil
- }
-
- v, err := resolver.Resolve(node.ref)
- if err != nil {
- if IsUnknownValueErr(err) {
- return node.traverseUnknown(resolver, tr)
- }
- return err
- }
-
- if node.undefined != nil {
- err = node.undefined.Traverse(resolver, tr)
- if err != nil {
- return err
- }
- }
-
- if v == nil {
- return nil
- }
-
- if node.any != nil {
- err = node.any.Traverse(resolver, tr)
- if err != nil {
- return err
- }
- }
-
- if err := node.traverseValue(resolver, tr, v); err != nil {
- return err
- }
-
- for i := range node.mappers {
- if err := node.traverseValue(resolver, tr, node.mappers[i].MapValue(v)); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func (node *trieNode) traverseValue(resolver ValueResolver, tr *trieTraversalResult, value Value) error {
-
- switch value := value.(type) {
- case *Array:
- if node.array == nil {
- return nil
- }
- return node.array.traverseArray(resolver, tr, value)
-
- case Null, Boolean, Number, String:
- child, ok := node.scalars.Get(value)
- if !ok {
- return nil
- }
- return child.(*trieNode).Traverse(resolver, tr)
- }
-
- return nil
-}
-
-func (node *trieNode) traverseArray(resolver ValueResolver, tr *trieTraversalResult, arr *Array) error {
-
- if arr.Len() == 0 {
- return node.Traverse(resolver, tr)
- }
-
- if node.any != nil {
- err := node.any.traverseArray(resolver, tr, arr.Slice(1, -1))
- if err != nil {
- return err
- }
- }
-
- head := arr.Elem(0).Value
-
- if !IsScalar(head) {
- return nil
- }
-
- child, ok := node.scalars.Get(head)
- if !ok {
- return nil
- }
- return child.(*trieNode).traverseArray(resolver, tr, arr.Slice(1, -1))
-}
-
-func (node *trieNode) traverseUnknown(resolver ValueResolver, tr *trieTraversalResult) error {
-
- if node == nil {
- return nil
- }
-
- if err := node.Traverse(resolver, tr); err != nil {
- return err
- }
-
- if err := node.undefined.traverseUnknown(resolver, tr); err != nil {
- return err
- }
-
- if err := node.any.traverseUnknown(resolver, tr); err != nil {
- return err
- }
-
- if err := node.array.traverseUnknown(resolver, tr); err != nil {
- return err
- }
-
- var iterErr error
- node.scalars.Iter(func(_, v util.T) bool {
- child := v.(*trieNode)
- if iterErr = child.traverseUnknown(resolver, tr); iterErr != nil {
- return true
- }
- return false
- })
-
- return iterErr
-}
-
-// If term `a` is one of the function's operands, we store a Ref: `args[0]`
-// for the argument number. So for `f(x, y) { x = 10; y = 12 }`, we'll
-// bind `args[0]` and `args[1]` to this rule when called for (x=10) and
-// (y=12) respectively.
-func eqOperandsToRefAndValue(isVirtual func(Ref) bool, args []*Term, a, b *Term) (*refindex, bool) {
- switch v := a.Value.(type) {
- case Var:
- for i, arg := range args {
- if arg.Value.Compare(v) == 0 {
- if bval, ok := indexValue(b); ok {
- return &refindex{Ref: Ref{FunctionArgRootDocument, IntNumberTerm(i)}, Value: bval}, true
- }
- }
- }
- case Ref:
- if !RootDocumentNames.Contains(v[0]) {
- return nil, false
- }
- if isVirtual(v) {
- return nil, false
- }
- if v.IsNested() || !v.IsGround() {
- return nil, false
- }
- if bval, ok := indexValue(b); ok {
- return &refindex{Ref: v, Value: bval}, true
- }
- }
- return nil, false
-}
-
-func indexValue(b *Term) (Value, bool) {
- switch b := b.Value.(type) {
- case Null, Boolean, Number, String, Var:
- return b, true
- case *Array:
- stop := false
- first := true
- vis := NewGenericVisitor(func(x interface{}) bool {
- if first {
- first = false
- return false
- }
- switch x.(type) {
- // No nested structures or values that require evaluation (other than var).
- case *Array, Object, Set, *ArrayComprehension, *ObjectComprehension, *SetComprehension, Ref:
- stop = true
- }
- return stop
- })
- vis.Walk(b)
- if !stop {
- return b, true
- }
- }
-
- return nil, false
-}
-
-func globDelimiterToString(delim *Term) (string, bool) {
-
- arr, ok := delim.Value.(*Array)
- if !ok {
- return "", false
- }
-
- var result string
-
- if arr.Len() == 0 {
- result = "."
- } else {
- for i := 0; i < arr.Len(); i++ {
- term := arr.Elem(i)
- s, ok := term.Value.(String)
- if !ok {
- return "", false
- }
- result += string(s)
- }
- }
-
- return result, true
-}
-
-func globPatternToArray(pattern *Term, delim string) *Term {
-
- s, ok := pattern.Value.(String)
- if !ok {
- return nil
- }
-
- parts := splitStringEscaped(string(s), delim)
- arr := make([]*Term, len(parts))
-
- for i := range parts {
- if parts[i] == "*" {
- arr[i] = VarTerm("$globwildcard")
- } else {
- var escaped bool
- for _, c := range parts[i] {
- if c == '\\' {
- escaped = !escaped
- continue
- }
- if !escaped {
- switch c {
- case '[', '?', '{', '*':
- // TODO(tsandall): super glob and character pattern
- // matching not supported yet.
- return nil
- }
- }
- escaped = false
- }
- arr[i] = StringTerm(parts[i])
- }
- }
-
- return NewTerm(NewArray(arr...))
-}
-
-// splits s on characters in delim except if delim characters have been escaped
-// with reverse solidus.
-func splitStringEscaped(s string, delim string) []string {
-
- var last, curr int
- var escaped bool
- var result []string
-
- for ; curr < len(s); curr++ {
- if s[curr] == '\\' || escaped {
- escaped = !escaped
- continue
- }
- if strings.ContainsRune(delim, rune(s[curr])) {
- result = append(result, s[last:curr])
- last = curr + 1
- }
- }
-
- result = append(result, s[last:])
-
- return result
-}
-
-func stringSliceToArray(s []string) *Array {
- arr := make([]*Term, len(s))
- for i, v := range s {
- arr[i] = StringTerm(v)
- }
- return NewArray(arr...)
+ return v1.NewIndexResult(kind)
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/internal/scanner/scanner.go b/vendor/github.com/open-policy-agent/opa/ast/internal/scanner/scanner.go
deleted file mode 100644
index a0200ac18d..0000000000
--- a/vendor/github.com/open-policy-agent/opa/ast/internal/scanner/scanner.go
+++ /dev/null
@@ -1,455 +0,0 @@
-// Copyright 2020 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 scanner
-
-import (
- "fmt"
- "io"
- "unicode"
- "unicode/utf8"
-
- "github.com/open-policy-agent/opa/ast/internal/tokens"
-)
-
-const bom = 0xFEFF
-
-// Scanner is used to tokenize an input stream of
-// Rego source code.
-type Scanner struct {
- offset int
- row int
- col int
- bs []byte
- curr rune
- width int
- errors []Error
- keywords map[string]tokens.Token
- tabs []int
- regoV1Compatible bool
-}
-
-// Error represents a scanner error.
-type Error struct {
- Pos Position
- Message string
-}
-
-// Position represents a point in the scanned source code.
-type Position struct {
- Offset int // start offset in bytes
- End int // end offset in bytes
- Row int // line number computed in bytes
- Col int // column number computed in bytes
- Tabs []int // positions of any tabs preceding Col
-}
-
-// New returns an initialized scanner that will scan
-// through the source code provided by the io.Reader.
-func New(r io.Reader) (*Scanner, error) {
-
- bs, err := io.ReadAll(r)
- if err != nil {
- return nil, err
- }
-
- s := &Scanner{
- offset: 0,
- row: 1,
- col: 0,
- bs: bs,
- curr: -1,
- width: 0,
- keywords: tokens.Keywords(),
- tabs: []int{},
- }
-
- s.next()
-
- if s.curr == bom {
- s.next()
- }
-
- return s, nil
-}
-
-// Bytes returns the raw bytes for the full source
-// which the scanner has read in.
-func (s *Scanner) Bytes() []byte {
- return s.bs
-}
-
-// String returns a human readable string of the current scanner state.
-func (s *Scanner) String() string {
- return fmt.Sprintf("", s.curr, s.offset, len(s.bs))
-}
-
-// Keyword will return a token for the passed in
-// literal value. If the value is a Rego keyword
-// then the appropriate token is returned. Everything
-// else is an Ident.
-func (s *Scanner) Keyword(lit string) tokens.Token {
- if tok, ok := s.keywords[lit]; ok {
- return tok
- }
- return tokens.Ident
-}
-
-// AddKeyword adds a string -> token mapping to this Scanner instance.
-func (s *Scanner) AddKeyword(kw string, tok tokens.Token) {
- s.keywords[kw] = tok
-
- switch tok {
- case tokens.Every: // importing 'every' means also importing 'in'
- s.keywords["in"] = tokens.In
- }
-}
-
-func (s *Scanner) HasKeyword(keywords map[string]tokens.Token) bool {
- for kw := range s.keywords {
- if _, ok := keywords[kw]; ok {
- return true
- }
- }
- return false
-}
-
-func (s *Scanner) SetRegoV1Compatible() {
- s.regoV1Compatible = true
-}
-
-func (s *Scanner) RegoV1Compatible() bool {
- return s.regoV1Compatible
-}
-
-// WithKeywords returns a new copy of the Scanner struct `s`, with the set
-// of known keywords being that of `s` with `kws` added.
-func (s *Scanner) WithKeywords(kws map[string]tokens.Token) *Scanner {
- cpy := *s
- cpy.keywords = make(map[string]tokens.Token, len(s.keywords)+len(kws))
- for kw, tok := range s.keywords {
- cpy.AddKeyword(kw, tok)
- }
- for k, t := range kws {
- cpy.AddKeyword(k, t)
- }
- return &cpy
-}
-
-// WithoutKeywords returns a new copy of the Scanner struct `s`, with the
-// set of known keywords being that of `s` with `kws` removed.
-// The previously known keywords are returned for a convenient reset.
-func (s *Scanner) WithoutKeywords(kws map[string]tokens.Token) (*Scanner, map[string]tokens.Token) {
- cpy := *s
- kw := s.keywords
- cpy.keywords = make(map[string]tokens.Token, len(s.keywords)-len(kws))
- for kw, tok := range s.keywords {
- if _, ok := kws[kw]; !ok {
- cpy.AddKeyword(kw, tok)
- }
- }
- return &cpy, kw
-}
-
-// Scan will increment the scanners position in the source
-// code until the next token is found. The token, starting position
-// of the token, string literal, and any errors encountered are
-// returned. A token will always be returned, the caller must check
-// for any errors before using the other values.
-func (s *Scanner) Scan() (tokens.Token, Position, string, []Error) {
-
- pos := Position{Offset: s.offset - s.width, Row: s.row, Col: s.col, Tabs: s.tabs}
- var tok tokens.Token
- var lit string
-
- if s.isWhitespace() {
- lit = string(s.curr)
- s.next()
- tok = tokens.Whitespace
- } else if isLetter(s.curr) {
- lit = s.scanIdentifier()
- tok = s.Keyword(lit)
- } else if isDecimal(s.curr) {
- lit = s.scanNumber()
- tok = tokens.Number
- } else {
- ch := s.curr
- s.next()
- switch ch {
- case -1:
- tok = tokens.EOF
- case '#':
- lit = s.scanComment()
- tok = tokens.Comment
- case '"':
- lit = s.scanString()
- tok = tokens.String
- case '`':
- lit = s.scanRawString()
- tok = tokens.String
- case '[':
- tok = tokens.LBrack
- case ']':
- tok = tokens.RBrack
- case '{':
- tok = tokens.LBrace
- case '}':
- tok = tokens.RBrace
- case '(':
- tok = tokens.LParen
- case ')':
- tok = tokens.RParen
- case ',':
- tok = tokens.Comma
- case ':':
- if s.curr == '=' {
- s.next()
- tok = tokens.Assign
- } else {
- tok = tokens.Colon
- }
- case '+':
- tok = tokens.Add
- case '-':
- tok = tokens.Sub
- case '*':
- tok = tokens.Mul
- case '/':
- tok = tokens.Quo
- case '%':
- tok = tokens.Rem
- case '&':
- tok = tokens.And
- case '|':
- tok = tokens.Or
- case '=':
- if s.curr == '=' {
- s.next()
- tok = tokens.Equal
- } else {
- tok = tokens.Unify
- }
- case '>':
- if s.curr == '=' {
- s.next()
- tok = tokens.Gte
- } else {
- tok = tokens.Gt
- }
- case '<':
- if s.curr == '=' {
- s.next()
- tok = tokens.Lte
- } else {
- tok = tokens.Lt
- }
- case '!':
- if s.curr == '=' {
- s.next()
- tok = tokens.Neq
- } else {
- s.error("illegal ! character")
- }
- case ';':
- tok = tokens.Semicolon
- case '.':
- tok = tokens.Dot
- }
- }
-
- pos.End = s.offset - s.width
- errs := s.errors
- s.errors = nil
-
- return tok, pos, lit, errs
-}
-
-func (s *Scanner) scanIdentifier() string {
- start := s.offset - 1
- for isLetter(s.curr) || isDigit(s.curr) {
- s.next()
- }
- return string(s.bs[start : s.offset-1])
-}
-
-func (s *Scanner) scanNumber() string {
-
- start := s.offset - 1
-
- if s.curr != '.' {
- for isDecimal(s.curr) {
- s.next()
- }
- }
-
- if s.curr == '.' {
- s.next()
- var found bool
- for isDecimal(s.curr) {
- s.next()
- found = true
- }
- if !found {
- s.error("expected fraction")
- }
- }
-
- if lower(s.curr) == 'e' {
- s.next()
- if s.curr == '+' || s.curr == '-' {
- s.next()
- }
- var found bool
- for isDecimal(s.curr) {
- s.next()
- found = true
- }
- if !found {
- s.error("expected exponent")
- }
- }
-
- // Scan any digits following the decimals to get the
- // entire invalid number/identifier.
- // Example: 0a2b should be a single invalid number "0a2b"
- // rather than a number "0", followed by identifier "a2b".
- if isLetter(s.curr) {
- s.error("illegal number format")
- for isLetter(s.curr) || isDigit(s.curr) {
- s.next()
- }
- }
-
- return string(s.bs[start : s.offset-1])
-}
-
-func (s *Scanner) scanString() string {
- start := s.literalStart()
- for {
- ch := s.curr
-
- if ch == '\n' || ch < 0 {
- s.error("non-terminated string")
- break
- }
-
- s.next()
-
- if ch == '"' {
- break
- }
-
- if ch == '\\' {
- switch s.curr {
- case '\\', '"', '/', 'b', 'f', 'n', 'r', 't':
- s.next()
- case 'u':
- s.next()
- s.next()
- s.next()
- s.next()
- default:
- s.error("illegal escape sequence")
- }
- }
- }
-
- return string(s.bs[start : s.offset-1])
-}
-
-func (s *Scanner) scanRawString() string {
- start := s.literalStart()
- for {
- ch := s.curr
- s.next()
- if ch == '`' {
- break
- } else if ch < 0 {
- s.error("non-terminated string")
- break
- }
- }
- return string(s.bs[start : s.offset-1])
-}
-
-func (s *Scanner) scanComment() string {
- start := s.literalStart()
- for s.curr != '\n' && s.curr != -1 {
- s.next()
- }
- end := s.offset - 1
- // Trim carriage returns that precede the newline
- if s.offset > 1 && s.bs[s.offset-2] == '\r' {
- end = end - 1
- }
- return string(s.bs[start:end])
-}
-
-func (s *Scanner) next() {
-
- if s.offset >= len(s.bs) {
- s.curr = -1
- s.offset = len(s.bs) + 1
- return
- }
-
- s.curr = rune(s.bs[s.offset])
- s.width = 1
-
- if s.curr == 0 {
- s.error("illegal null character")
- } else if s.curr >= utf8.RuneSelf {
- s.curr, s.width = utf8.DecodeRune(s.bs[s.offset:])
- if s.curr == utf8.RuneError && s.width == 1 {
- s.error("illegal utf-8 character")
- } else if s.curr == bom && s.offset > 0 {
- s.error("illegal byte-order mark")
- }
- }
-
- s.offset += s.width
-
- if s.curr == '\n' {
- s.row++
- s.col = 0
- s.tabs = []int{}
- } else {
- s.col++
- if s.curr == '\t' {
- s.tabs = append(s.tabs, s.col)
- }
- }
-}
-
-func (s *Scanner) literalStart() int {
- // The current offset is at the first character past the literal delimiter (#, ", `, etc.)
- // Need to subtract width of first character (plus one for the delimiter).
- return s.offset - (s.width + 1)
-}
-
-// From the Go scanner (src/go/scanner/scanner.go)
-
-func isLetter(ch rune) bool {
- return 'a' <= lower(ch) && lower(ch) <= 'z' || ch == '_'
-}
-
-func isDigit(ch rune) bool {
- return isDecimal(ch) || ch >= utf8.RuneSelf && unicode.IsDigit(ch)
-}
-
-func isDecimal(ch rune) bool { return '0' <= ch && ch <= '9' }
-
-func lower(ch rune) rune { return ('a' - 'A') | ch } // returns lower-case ch iff ch is ASCII letter
-
-func (s *Scanner) isWhitespace() bool {
- return s.curr == ' ' || s.curr == '\t' || s.curr == '\n' || s.curr == '\r'
-}
-
-func (s *Scanner) error(reason string) {
- s.errors = append(s.errors, Error{Pos: Position{
- Offset: s.offset,
- Row: s.row,
- Col: s.col,
- }, Message: reason})
-}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/internal/tokens/tokens.go b/vendor/github.com/open-policy-agent/opa/ast/internal/tokens/tokens.go
deleted file mode 100644
index 623ed7ed21..0000000000
--- a/vendor/github.com/open-policy-agent/opa/ast/internal/tokens/tokens.go
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright 2020 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 tokens
-
-// Token represents a single Rego source code token
-// for use by the Parser.
-type Token int
-
-func (t Token) String() string {
- if t < 0 || int(t) >= len(strings) {
- return "unknown"
- }
- return strings[t]
-}
-
-// All tokens must be defined here
-const (
- Illegal Token = iota
- EOF
- Whitespace
- Ident
- Comment
-
- Package
- Import
- As
- Default
- Else
- Not
- Some
- With
- Null
- True
- False
-
- Number
- String
-
- LBrack
- RBrack
- LBrace
- RBrace
- LParen
- RParen
- Comma
- Colon
-
- Add
- Sub
- Mul
- Quo
- Rem
- And
- Or
- Unify
- Equal
- Assign
- In
- Neq
- Gt
- Lt
- Gte
- Lte
- Dot
- Semicolon
-
- Every
- Contains
- If
-)
-
-var strings = [...]string{
- Illegal: "illegal",
- EOF: "eof",
- Whitespace: "whitespace",
- Comment: "comment",
- Ident: "identifier",
- Package: "package",
- Import: "import",
- As: "as",
- Default: "default",
- Else: "else",
- Not: "not",
- Some: "some",
- With: "with",
- Null: "null",
- True: "true",
- False: "false",
- Number: "number",
- String: "string",
- LBrack: "[",
- RBrack: "]",
- LBrace: "{",
- RBrace: "}",
- LParen: "(",
- RParen: ")",
- Comma: ",",
- Colon: ":",
- Add: "plus",
- Sub: "minus",
- Mul: "mul",
- Quo: "div",
- Rem: "rem",
- And: "and",
- Or: "or",
- Unify: "eq",
- Equal: "equal",
- Assign: "assign",
- In: "in",
- Neq: "neq",
- Gt: "gt",
- Lt: "lt",
- Gte: "gte",
- Lte: "lte",
- Dot: ".",
- Semicolon: ";",
- Every: "every",
- Contains: "contains",
- If: "if",
-}
-
-var keywords = map[string]Token{
- "package": Package,
- "import": Import,
- "as": As,
- "default": Default,
- "else": Else,
- "not": Not,
- "some": Some,
- "with": With,
- "null": Null,
- "true": True,
- "false": False,
-}
-
-// Keywords returns a copy of the default string -> Token keyword map.
-func Keywords() map[string]Token {
- cpy := make(map[string]Token, len(keywords))
- for k, v := range keywords {
- cpy[k] = v
- }
- return cpy
-}
-
-// IsKeyword returns if a token is a keyword
-func IsKeyword(tok Token) bool {
- _, ok := keywords[strings[tok]]
- return ok
-}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/interning.go b/vendor/github.com/open-policy-agent/opa/ast/interning.go
new file mode 100644
index 0000000000..29231006aa
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/ast/interning.go
@@ -0,0 +1,24 @@
+// Copyright 2024 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 (
+ v1 "github.com/open-policy-agent/opa/v1/ast"
+)
+
+func InternedBooleanTerm(b bool) *Term {
+ return v1.InternedTerm(b)
+}
+
+// InternedIntNumberTerm returns a term with the given integer value. The term is
+// cached between -1 to 512, and for values outside of that range, this function
+// is equivalent to ast.IntNumberTerm.
+func InternedIntNumberTerm(i int) *Term {
+ return v1.InternedTerm(i)
+}
+
+func HasInternedIntNumberTerm(i int) bool {
+ return v1.HasInternedIntNumberTerm(i)
+}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/json/doc.go b/vendor/github.com/open-policy-agent/opa/ast/json/doc.go
new file mode 100644
index 0000000000..26aee9b994
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/ast/json/doc.go
@@ -0,0 +1,8 @@
+// Copyright 2024 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.
+
+// Deprecated: This package is intended for older projects transitioning from OPA v0.x and will remain for the lifetime of OPA v1.x, but its use is not recommended.
+// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
+// See https://www.openpolicyagent.org/docs/latest/v0-compatibility/ for more information.
+package json
diff --git a/vendor/github.com/open-policy-agent/opa/ast/json/json.go b/vendor/github.com/open-policy-agent/opa/ast/json/json.go
index 565017d58e..8a3a36bb9b 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/json/json.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/json/json.go
@@ -1,36 +1,15 @@
package json
+import v1 "github.com/open-policy-agent/opa/v1/ast/json"
+
// Options defines the options for JSON operations,
// currently only marshaling can be configured
-type Options struct {
- MarshalOptions MarshalOptions
-}
+type Options = v1.Options
// MarshalOptions defines the options for JSON marshaling,
// currently only toggling the marshaling of location information is supported
-type MarshalOptions struct {
- // IncludeLocation toggles the marshaling of location information
- IncludeLocation NodeToggle
- // IncludeLocationText additionally/optionally includes the text of the location
- IncludeLocationText bool
- // ExcludeLocationFile additionally/optionally excludes the file of the location
- // Note that this is inverted (i.e. not "include" as the default needs to remain false)
- ExcludeLocationFile bool
-}
+type MarshalOptions = v1.MarshalOptions
// NodeToggle is a generic struct to allow the toggling of
// settings for different ast node types
-type NodeToggle struct {
- Term bool
- Package bool
- Comment bool
- Import bool
- Rule bool
- Head bool
- Expr bool
- SomeDecl bool
- Every bool
- With bool
- Annotations bool
- AnnotationsRef bool
-}
+type NodeToggle = v1.NodeToggle
diff --git a/vendor/github.com/open-policy-agent/opa/ast/location/location.go b/vendor/github.com/open-policy-agent/opa/ast/location/location.go
deleted file mode 100644
index 92226df3f0..0000000000
--- a/vendor/github.com/open-policy-agent/opa/ast/location/location.go
+++ /dev/null
@@ -1,134 +0,0 @@
-// Package location defines locations in Rego source code.
-package location
-
-import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
-
- astJSON "github.com/open-policy-agent/opa/ast/json"
-)
-
-// Location records a position in source code
-type Location struct {
- Text []byte `json:"-"` // The original text fragment from the source.
- File string `json:"file"` // The name of the source file (which may be empty).
- Row int `json:"row"` // The line in the source.
- Col int `json:"col"` // The column in the row.
- Offset int `json:"-"` // The byte offset for the location in the source.
-
- // JSONOptions specifies options for marshaling and unmarshalling of locations
- JSONOptions astJSON.Options
-
- Tabs []int `json:"-"` // The column offsets of tabs in the source.
-}
-
-// NewLocation returns a new Location object.
-func NewLocation(text []byte, file string, row int, col int) *Location {
- return &Location{Text: text, File: file, Row: row, Col: col}
-}
-
-// Equal checks if two locations are equal to each other.
-func (loc *Location) Equal(other *Location) bool {
- return bytes.Equal(loc.Text, other.Text) &&
- loc.File == other.File &&
- loc.Row == other.Row &&
- loc.Col == other.Col
-}
-
-// Errorf returns a new error value with a message formatted to include the location
-// info (e.g., line, column, filename, etc.)
-func (loc *Location) Errorf(f string, a ...interface{}) error {
- return errors.New(loc.Format(f, a...))
-}
-
-// Wrapf returns a new error value that wraps an existing error with a message formatted
-// to include the location info (e.g., line, column, filename, etc.)
-func (loc *Location) Wrapf(err error, f string, a ...interface{}) error {
- return fmt.Errorf(loc.Format(f, a...)+": %w", err)
-}
-
-// Format returns a formatted string prefixed with the location information.
-func (loc *Location) Format(f string, a ...interface{}) string {
- if len(loc.File) > 0 {
- f = fmt.Sprintf("%v:%v: %v", loc.File, loc.Row, f)
- } else {
- f = fmt.Sprintf("%v:%v: %v", loc.Row, loc.Col, f)
- }
- return fmt.Sprintf(f, a...)
-}
-
-func (loc *Location) String() string {
- if len(loc.File) > 0 {
- return fmt.Sprintf("%v:%v", loc.File, loc.Row)
- }
- if len(loc.Text) > 0 {
- return string(loc.Text)
- }
- return fmt.Sprintf("%v:%v", loc.Row, loc.Col)
-}
-
-// Compare returns -1, 0, or 1 to indicate if this loc is less than, equal to,
-// or greater than the other. Comparison is performed on the file, row, and
-// column of the Location (but not on the text.) Nil locations are greater than
-// non-nil locations.
-func (loc *Location) Compare(other *Location) int {
- if loc == nil && other == nil {
- return 0
- } else if loc == nil {
- return 1
- } else if other == nil {
- return -1
- } else if loc.File < other.File {
- return -1
- } else if loc.File > other.File {
- return 1
- } else if loc.Row < other.Row {
- return -1
- } else if loc.Row > other.Row {
- return 1
- } else if loc.Col < other.Col {
- return -1
- } else if loc.Col > other.Col {
- return 1
- }
- return 0
-}
-
-func (loc *Location) MarshalJSON() ([]byte, error) {
- // structs are used here to preserve the field ordering of the original Location struct
- if loc.JSONOptions.MarshalOptions.ExcludeLocationFile {
- data := struct {
- Row int `json:"row"`
- Col int `json:"col"`
- Text []byte `json:"text,omitempty"`
- }{
- Row: loc.Row,
- Col: loc.Col,
- }
-
- if loc.JSONOptions.MarshalOptions.IncludeLocationText {
- data.Text = loc.Text
- }
-
- return json.Marshal(data)
- }
-
- data := struct {
- File string `json:"file"`
- Row int `json:"row"`
- Col int `json:"col"`
- Text []byte `json:"text,omitempty"`
- }{
- Row: loc.Row,
- Col: loc.Col,
- File: loc.File,
- }
-
- if loc.JSONOptions.MarshalOptions.IncludeLocationText {
- data.Text = loc.Text
- }
-
- return json.Marshal(data)
-}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/map.go b/vendor/github.com/open-policy-agent/opa/ast/map.go
index b0cc9eb60f..070ad3e5de 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/map.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/map.go
@@ -5,129 +5,14 @@
package ast
import (
- "encoding/json"
-
- "github.com/open-policy-agent/opa/util"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
// ValueMap represents a key/value map between AST term values. Any type of term
// can be used as a key in the map.
-type ValueMap struct {
- hashMap *util.HashMap
-}
+type ValueMap = v1.ValueMap
// NewValueMap returns a new ValueMap.
func NewValueMap() *ValueMap {
- vs := &ValueMap{
- hashMap: util.NewHashMap(valueEq, valueHash),
- }
- return vs
-}
-
-// MarshalJSON provides a custom marshaller for the ValueMap which
-// will include the key, value, and value type.
-func (vs *ValueMap) MarshalJSON() ([]byte, error) {
- var tmp []map[string]interface{}
- vs.Iter(func(k Value, v Value) bool {
- tmp = append(tmp, map[string]interface{}{
- "name": k.String(),
- "type": TypeName(v),
- "value": v,
- })
- return false
- })
- return json.Marshal(tmp)
-}
-
-// Copy returns a shallow copy of the ValueMap.
-func (vs *ValueMap) Copy() *ValueMap {
- if vs == nil {
- return nil
- }
- cpy := NewValueMap()
- cpy.hashMap = vs.hashMap.Copy()
- return cpy
-}
-
-// Equal returns true if this ValueMap equals the other.
-func (vs *ValueMap) Equal(other *ValueMap) bool {
- if vs == nil {
- return other == nil || other.Len() == 0
- }
- if other == nil {
- return vs == nil || vs.Len() == 0
- }
- return vs.hashMap.Equal(other.hashMap)
-}
-
-// Len returns the number of elements in the map.
-func (vs *ValueMap) Len() int {
- if vs == nil {
- return 0
- }
- return vs.hashMap.Len()
-}
-
-// Get returns the value in the map for k.
-func (vs *ValueMap) Get(k Value) Value {
- if vs != nil {
- if v, ok := vs.hashMap.Get(k); ok {
- return v.(Value)
- }
- }
- return nil
-}
-
-// Hash returns a hash code for this ValueMap.
-func (vs *ValueMap) Hash() int {
- if vs == nil {
- return 0
- }
- return vs.hashMap.Hash()
-}
-
-// Iter calls the iter function for each key/value pair in the map. If the iter
-// function returns true, iteration stops.
-func (vs *ValueMap) Iter(iter func(Value, Value) bool) bool {
- if vs == nil {
- return false
- }
- return vs.hashMap.Iter(func(kt, vt util.T) bool {
- k := kt.(Value)
- v := vt.(Value)
- return iter(k, v)
- })
-}
-
-// Put inserts a key k into the map with value v.
-func (vs *ValueMap) Put(k, v Value) {
- if vs == nil {
- panic("put on nil value map")
- }
- vs.hashMap.Put(k, v)
-}
-
-// Delete removes a key k from the map.
-func (vs *ValueMap) Delete(k Value) {
- if vs == nil {
- return
- }
- vs.hashMap.Delete(k)
-}
-
-func (vs *ValueMap) String() string {
- if vs == nil {
- return "{}"
- }
- return vs.hashMap.String()
-}
-
-func valueHash(v util.T) int {
- return v.(Value).Hash()
-}
-
-func valueEq(a, b util.T) bool {
- av := a.(Value)
- bv := b.(Value)
- return av.Compare(bv) == 0
+ return v1.NewValueMap()
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/marshal.go b/vendor/github.com/open-policy-agent/opa/ast/marshal.go
deleted file mode 100644
index 53fb112044..0000000000
--- a/vendor/github.com/open-policy-agent/opa/ast/marshal.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package ast
-
-import (
- astJSON "github.com/open-policy-agent/opa/ast/json"
-)
-
-// customJSON is an interface that can be implemented by AST nodes that
-// allows the parser to set options for JSON operations on that node.
-type customJSON interface {
- setJSONOptions(astJSON.Options)
-}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/parser.go b/vendor/github.com/open-policy-agent/opa/ast/parser.go
index 09ede2baec..45cd4da06e 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/parser.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/parser.go
@@ -1,2733 +1,49 @@
-// Copyright 2020 The OPA Authors. All rights reserved.
+// Copyright 2024 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 (
- "bytes"
- "encoding/json"
- "fmt"
- "io"
- "math/big"
- "net/url"
- "regexp"
- "sort"
- "strconv"
- "strings"
- "unicode/utf8"
-
- "gopkg.in/yaml.v3"
-
- "github.com/open-policy-agent/opa/ast/internal/scanner"
- "github.com/open-policy-agent/opa/ast/internal/tokens"
- astJSON "github.com/open-policy-agent/opa/ast/json"
- "github.com/open-policy-agent/opa/ast/location"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
-var RegoV1CompatibleRef = Ref{VarTerm("rego"), StringTerm("v1")}
+var RegoV1CompatibleRef = v1.RegoV1CompatibleRef
// RegoVersion defines the Rego syntax requirements for a module.
-type RegoVersion int
+type RegoVersion = v1.RegoVersion
-const DefaultRegoVersion = RegoVersion(0)
+const DefaultRegoVersion = RegoV0
const (
+ RegoUndefined = v1.RegoUndefined
// RegoV0 is the default, original Rego syntax.
- RegoV0 RegoVersion = iota
+ RegoV0 = v1.RegoV0
// RegoV0CompatV1 requires modules to comply with both the RegoV0 and RegoV1 syntax (as when 'rego.v1' is imported in a module).
// Shortly, RegoV1 compatibility is required, but 'rego.v1' or 'future.keywords' must also be imported.
- RegoV0CompatV1
+ RegoV0CompatV1 = v1.RegoV0CompatV1
// RegoV1 is the Rego syntax enforced by OPA 1.0; e.g.:
// future.keywords part of default keyword set, and don't require imports;
// 'if' and 'contains' required in rule heads;
// (some) strict checks on by default.
- RegoV1
+ RegoV1 = v1.RegoV1
)
-func (v RegoVersion) Int() int {
- if v == RegoV1 {
- return 1
- }
- return 0
-}
-
-func (v RegoVersion) String() string {
- switch v {
- case RegoV0:
- return "v0"
- case RegoV1:
- return "v1"
- case RegoV0CompatV1:
- return "v0v1"
- default:
- return "unknown"
- }
-}
-
func RegoVersionFromInt(i int) RegoVersion {
- if i == 1 {
- return RegoV1
- }
- return RegoV0
-}
-
-// Note: This state is kept isolated from the parser so that we
-// can do efficient shallow copies of these values when doing a
-// save() and restore().
-type state struct {
- s *scanner.Scanner
- lastEnd int
- skippedNL bool
- tok tokens.Token
- tokEnd int
- lit string
- loc Location
- errors Errors
- hints []string
- comments []*Comment
- wildcard int
-}
-
-func (s *state) String() string {
- return fmt.Sprintf("", s.s, s.tok, s.lit, s.loc, len(s.errors), len(s.comments))
-}
-
-func (s *state) Loc() *location.Location {
- cpy := s.loc
- return &cpy
-}
-
-func (s *state) Text(offset, end int) []byte {
- bs := s.s.Bytes()
- if offset >= 0 && offset < len(bs) {
- if end >= offset && end <= len(bs) {
- return bs[offset:end]
- }
- }
- return nil
+ return v1.RegoVersionFromInt(i)
}
// Parser is used to parse Rego statements.
-type Parser struct {
- r io.Reader
- s *state
- po ParserOptions
- cache parsedTermCache
-}
-
-type parsedTermCacheItem struct {
- t *Term
- post *state // post is the post-state that's restored on a cache-hit
- offset int
- next *parsedTermCacheItem
-}
-
-type parsedTermCache struct {
- m *parsedTermCacheItem
-}
-
-func (c parsedTermCache) String() string {
- s := strings.Builder{}
- s.WriteRune('{')
- var e *parsedTermCacheItem
- for e = c.m; e != nil; e = e.next {
- s.WriteString(fmt.Sprintf("%v", e))
- }
- s.WriteRune('}')
- return s.String()
-}
-
-func (e *parsedTermCacheItem) String() string {
- return fmt.Sprintf("<%d:%v>", e.offset, e.t)
-}
+type Parser = v1.Parser
// ParserOptions defines the options for parsing Rego statements.
-type ParserOptions struct {
- Capabilities *Capabilities
- ProcessAnnotation bool
- AllFutureKeywords bool
- FutureKeywords []string
- SkipRules bool
- JSONOptions *astJSON.Options
- // RegoVersion is the version of Rego to parse for.
- RegoVersion RegoVersion
- unreleasedKeywords bool // TODO(sr): cleanup
-}
-
-// EffectiveRegoVersion returns the effective RegoVersion to use for parsing.
-// Deprecated: Use RegoVersion instead.
-func (po *ParserOptions) EffectiveRegoVersion() RegoVersion {
- return po.RegoVersion
-}
+type ParserOptions = v1.ParserOptions
// NewParser creates and initializes a Parser.
func NewParser() *Parser {
- p := &Parser{
- s: &state{},
- po: ParserOptions{},
- }
- return p
-}
-
-// WithFilename provides the filename for Location details
-// on parsed statements.
-func (p *Parser) WithFilename(filename string) *Parser {
- p.s.loc.File = filename
- return p
-}
-
-// WithReader provides the io.Reader that the parser will
-// use as its source.
-func (p *Parser) WithReader(r io.Reader) *Parser {
- p.r = r
- return p
-}
-
-// WithProcessAnnotation enables or disables the processing of
-// annotations by the Parser
-func (p *Parser) WithProcessAnnotation(processAnnotation bool) *Parser {
- p.po.ProcessAnnotation = processAnnotation
- return p
-}
-
-// WithFutureKeywords enables "future" keywords, i.e., keywords that can
-// be imported via
-//
-// import future.keywords.kw
-// import future.keywords.other
-//
-// but in a more direct way. The equivalent of this import would be
-//
-// WithFutureKeywords("kw", "other")
-func (p *Parser) WithFutureKeywords(kws ...string) *Parser {
- p.po.FutureKeywords = kws
- return p
-}
-
-// WithAllFutureKeywords enables all "future" keywords, i.e., the
-// ParserOption equivalent of
-//
-// import future.keywords
-func (p *Parser) WithAllFutureKeywords(yes bool) *Parser {
- p.po.AllFutureKeywords = yes
- return p
-}
-
-// withUnreleasedKeywords allows using keywords that haven't surfaced
-// as future keywords (see above) yet, but have tests that require
-// them to be parsed
-func (p *Parser) withUnreleasedKeywords(yes bool) *Parser {
- p.po.unreleasedKeywords = yes
- return p
-}
-
-// WithCapabilities sets the capabilities structure on the parser.
-func (p *Parser) WithCapabilities(c *Capabilities) *Parser {
- p.po.Capabilities = c
- return p
-}
-
-// WithSkipRules instructs the parser not to attempt to parse Rule statements.
-func (p *Parser) WithSkipRules(skip bool) *Parser {
- p.po.SkipRules = skip
- return p
-}
-
-// WithJSONOptions sets the Options which will be set on nodes to configure
-// their JSON marshaling behavior.
-func (p *Parser) WithJSONOptions(jsonOptions *astJSON.Options) *Parser {
- p.po.JSONOptions = jsonOptions
- return p
-}
-
-func (p *Parser) WithRegoVersion(version RegoVersion) *Parser {
- p.po.RegoVersion = version
- return p
-}
-
-func (p *Parser) parsedTermCacheLookup() (*Term, *state) {
- l := p.s.loc.Offset
- // stop comparing once the cached offsets are lower than l
- for h := p.cache.m; h != nil && h.offset >= l; h = h.next {
- if h.offset == l {
- return h.t, h.post
- }
- }
- return nil, nil
-}
-
-func (p *Parser) parsedTermCachePush(t *Term, s0 *state) {
- s1 := p.save()
- o0 := s0.loc.Offset
- entry := parsedTermCacheItem{t: t, post: s1, offset: o0}
-
- // find the first one whose offset is smaller than ours
- var e *parsedTermCacheItem
- for e = p.cache.m; e != nil; e = e.next {
- if e.offset < o0 {
- break
- }
- }
- entry.next = e
- p.cache.m = &entry
-}
-
-// futureParser returns a shallow copy of `p` with an empty
-// cache, and a scanner that knows all future keywords.
-// It's used to present hints in errors, when statements would
-// only parse successfully if some future keyword is enabled.
-func (p *Parser) futureParser() *Parser {
- q := *p
- q.s = p.save()
- q.s.s = p.s.s.WithKeywords(futureKeywords)
- q.cache = parsedTermCache{}
- return &q
-}
-
-// presentParser returns a shallow copy of `p` with an empty
-// cache, and a scanner that knows none of the future keywords.
-// It is used to successfully parse keyword imports, like
-//
-// import future.keywords.in
-//
-// even when the parser has already been informed about the
-// future keyword "in". This parser won't error out because
-// "in" is an identifier.
-func (p *Parser) presentParser() (*Parser, map[string]tokens.Token) {
- var cpy map[string]tokens.Token
- q := *p
- q.s = p.save()
- q.s.s, cpy = p.s.s.WithoutKeywords(futureKeywords)
- q.cache = parsedTermCache{}
- return &q, cpy
-}
-
-// Parse will read the Rego source and parse statements and
-// comments as they are found. Any errors encountered while
-// parsing will be accumulated and returned as a list of Errors.
-func (p *Parser) Parse() ([]Statement, []*Comment, Errors) {
-
- if p.po.Capabilities == nil {
- p.po.Capabilities = CapabilitiesForThisVersion()
- }
-
- allowedFutureKeywords := map[string]tokens.Token{}
-
- if p.po.RegoVersion == RegoV1 {
- // RegoV1 includes all future keywords in the default language definition
- for k, v := range futureKeywords {
- allowedFutureKeywords[k] = v
- }
-
- // For sake of error reporting, we still need to check that keywords in capabilities are known,
- for _, kw := range p.po.Capabilities.FutureKeywords {
- if _, ok := futureKeywords[kw]; !ok {
- return nil, nil, Errors{
- &Error{
- Code: ParseErr,
- Message: fmt.Sprintf("illegal capabilities: unknown keyword: %v", kw),
- Location: nil,
- },
- }
- }
- }
- // and that explicitly requested future keywords are known.
- for _, kw := range p.po.FutureKeywords {
- if _, ok := allowedFutureKeywords[kw]; !ok {
- return nil, nil, Errors{
- &Error{
- Code: ParseErr,
- Message: fmt.Sprintf("unknown future keyword: %v", kw),
- Location: nil,
- },
- }
- }
- }
- } else {
- for _, kw := range p.po.Capabilities.FutureKeywords {
- var ok bool
- allowedFutureKeywords[kw], ok = futureKeywords[kw]
- if !ok {
- return nil, nil, Errors{
- &Error{
- Code: ParseErr,
- Message: fmt.Sprintf("illegal capabilities: unknown keyword: %v", kw),
- Location: nil,
- },
- }
- }
- }
- }
-
- var err error
- p.s.s, err = scanner.New(p.r)
- if err != nil {
- return nil, nil, Errors{
- &Error{
- Code: ParseErr,
- Message: err.Error(),
- Location: nil,
- },
- }
- }
-
- selected := map[string]tokens.Token{}
- if p.po.AllFutureKeywords || p.po.RegoVersion == RegoV1 {
- for kw, tok := range allowedFutureKeywords {
- selected[kw] = tok
- }
- } else {
- for _, kw := range p.po.FutureKeywords {
- tok, ok := allowedFutureKeywords[kw]
- if !ok {
- return nil, nil, Errors{
- &Error{
- Code: ParseErr,
- Message: fmt.Sprintf("unknown future keyword: %v", kw),
- Location: nil,
- },
- }
- }
- selected[kw] = tok
- }
- }
- p.s.s = p.s.s.WithKeywords(selected)
-
- if p.po.RegoVersion == RegoV1 {
- for kw, tok := range allowedFutureKeywords {
- p.s.s.AddKeyword(kw, tok)
- }
- }
-
- // read the first token to initialize the parser
- p.scan()
-
- var stmts []Statement
-
- // Read from the scanner until the last token is reached or no statements
- // can be parsed. Attempt to parse package statements, import statements,
- // rule statements, and then body/query statements (in that order). If a
- // statement cannot be parsed, restore the parser state before trying the
- // next type of statement. If a statement can be parsed, continue from that
- // point trying to parse packages, imports, etc. in the same order.
- for p.s.tok != tokens.EOF {
-
- s := p.save()
-
- if pkg := p.parsePackage(); pkg != nil {
- stmts = append(stmts, pkg)
- continue
- } else if len(p.s.errors) > 0 {
- break
- }
-
- p.restore(s)
- s = p.save()
-
- if imp := p.parseImport(); imp != nil {
- if RegoRootDocument.Equal(imp.Path.Value.(Ref)[0]) {
- p.regoV1Import(imp)
- }
-
- if FutureRootDocument.Equal(imp.Path.Value.(Ref)[0]) {
- p.futureImport(imp, allowedFutureKeywords)
- }
-
- stmts = append(stmts, imp)
- continue
- } else if len(p.s.errors) > 0 {
- break
- }
-
- p.restore(s)
-
- if !p.po.SkipRules {
- s = p.save()
-
- if rules := p.parseRules(); rules != nil {
- for i := range rules {
- stmts = append(stmts, rules[i])
- }
- continue
- } else if len(p.s.errors) > 0 {
- break
- }
-
- p.restore(s)
- }
-
- if body := p.parseQuery(true, tokens.EOF); body != nil {
- stmts = append(stmts, body)
- continue
- }
-
- break
- }
-
- if p.po.ProcessAnnotation {
- stmts = p.parseAnnotations(stmts)
- }
-
- if p.po.JSONOptions != nil {
- for i := range stmts {
- vis := NewGenericVisitor(func(x interface{}) bool {
- if x, ok := x.(customJSON); ok {
- x.setJSONOptions(*p.po.JSONOptions)
- }
- return false
- })
-
- vis.Walk(stmts[i])
- }
- }
-
- return stmts, p.s.comments, p.s.errors
-}
-
-func (p *Parser) parseAnnotations(stmts []Statement) []Statement {
-
- annotStmts, errs := parseAnnotations(p.s.comments)
- for _, err := range errs {
- p.error(err.Location, err.Message)
- }
-
- for _, annotStmt := range annotStmts {
- stmts = append(stmts, annotStmt)
- }
-
- return stmts
-}
-
-func parseAnnotations(comments []*Comment) ([]*Annotations, Errors) {
-
- var hint = []byte("METADATA")
- var curr *metadataParser
- var blocks []*metadataParser
-
- for i := 0; i < len(comments); i++ {
- if curr != nil {
- if comments[i].Location.Row == comments[i-1].Location.Row+1 && comments[i].Location.Col == 1 {
- curr.Append(comments[i])
- continue
- }
- curr = nil
- }
- if bytes.HasPrefix(bytes.TrimSpace(comments[i].Text), hint) {
- curr = newMetadataParser(comments[i].Location)
- blocks = append(blocks, curr)
- }
- }
-
- var stmts []*Annotations
- var errs Errors
- for _, b := range blocks {
- a, err := b.Parse()
- if err != nil {
- errs = append(errs, &Error{
- Code: ParseErr,
- Message: err.Error(),
- Location: b.loc,
- })
- } else {
- stmts = append(stmts, a)
- }
- }
-
- return stmts, errs
-}
-
-func (p *Parser) parsePackage() *Package {
-
- var pkg Package
- pkg.SetLoc(p.s.Loc())
-
- if p.s.tok != tokens.Package {
- return nil
- }
-
- p.scan()
- if p.s.tok != tokens.Ident {
- p.illegalToken()
- return nil
- }
-
- term := p.parseTerm()
-
- if term != nil {
- switch v := term.Value.(type) {
- case Var:
- pkg.Path = Ref{
- DefaultRootDocument.Copy().SetLocation(term.Location),
- StringTerm(string(v)).SetLocation(term.Location),
- }
- case Ref:
- pkg.Path = make(Ref, len(v)+1)
- pkg.Path[0] = DefaultRootDocument.Copy().SetLocation(v[0].Location)
- first, ok := v[0].Value.(Var)
- if !ok {
- p.errorf(v[0].Location, "unexpected %v token: expecting var", TypeName(v[0].Value))
- return nil
- }
- pkg.Path[1] = StringTerm(string(first)).SetLocation(v[0].Location)
- for i := 2; i < len(pkg.Path); i++ {
- switch v[i-1].Value.(type) {
- case String:
- pkg.Path[i] = v[i-1]
- default:
- p.errorf(v[i-1].Location, "unexpected %v token: expecting string", TypeName(v[i-1].Value))
- return nil
- }
- }
- default:
- p.illegalToken()
- return nil
- }
- }
-
- if pkg.Path == nil {
- if len(p.s.errors) == 0 {
- p.error(p.s.Loc(), "expected path")
- }
- return nil
- }
-
- return &pkg
-}
-
-func (p *Parser) parseImport() *Import {
-
- var imp Import
- imp.SetLoc(p.s.Loc())
-
- if p.s.tok != tokens.Import {
- return nil
- }
-
- p.scan()
- if p.s.tok != tokens.Ident {
- p.error(p.s.Loc(), "expected ident")
- return nil
- }
- q, prev := p.presentParser()
- term := q.parseTerm()
- if term != nil {
- switch v := term.Value.(type) {
- case Var:
- imp.Path = RefTerm(term).SetLocation(term.Location)
- case Ref:
- for i := 1; i < len(v); i++ {
- if _, ok := v[i].Value.(String); !ok {
- p.errorf(v[i].Location, "unexpected %v token: expecting string", TypeName(v[i].Value))
- return nil
- }
- }
- imp.Path = term
- }
- }
- // keep advanced parser state, reset known keywords
- p.s = q.s
- p.s.s = q.s.s.WithKeywords(prev)
-
- if imp.Path == nil {
- p.error(p.s.Loc(), "expected path")
- return nil
- }
-
- path := imp.Path.Value.(Ref)
-
- switch {
- case RootDocumentNames.Contains(path[0]):
- case FutureRootDocument.Equal(path[0]):
- case RegoRootDocument.Equal(path[0]):
- default:
- p.hint("if this is unexpected, try updating OPA")
- p.errorf(imp.Path.Location, "unexpected import path, must begin with one of: %v, got: %v",
- RootDocumentNames.Union(NewSet(FutureRootDocument, RegoRootDocument)),
- path[0])
- return nil
- }
-
- if p.s.tok == tokens.As {
- p.scan()
-
- if p.s.tok != tokens.Ident {
- p.illegal("expected var")
- return nil
- }
-
- if alias := p.parseTerm(); alias != nil {
- v, ok := alias.Value.(Var)
- if ok {
- imp.Alias = v
- return &imp
- }
- }
- p.illegal("expected var")
- return nil
- }
-
- return &imp
-}
-
-func (p *Parser) parseRules() []*Rule {
-
- var rule Rule
- rule.SetLoc(p.s.Loc())
-
- if p.s.tok == tokens.Default {
- p.scan()
- rule.Default = true
- }
-
- if p.s.tok != tokens.Ident {
- return nil
- }
-
- usesContains := false
- if rule.Head, usesContains = p.parseHead(rule.Default); rule.Head == nil {
- return nil
- }
-
- if usesContains {
- rule.Head.keywords = append(rule.Head.keywords, tokens.Contains)
- }
-
- if rule.Default {
- if !p.validateDefaultRuleValue(&rule) {
- return nil
- }
-
- if len(rule.Head.Args) > 0 {
- if !p.validateDefaultRuleArgs(&rule) {
- return nil
- }
- }
-
- rule.Body = NewBody(NewExpr(BooleanTerm(true).SetLocation(rule.Location)).SetLocation(rule.Location))
- return []*Rule{&rule}
- }
-
- // back-compat with `p[x] { ... }``
- hasIf := p.s.tok == tokens.If
-
- // p[x] if ... becomes a single-value rule p[x]
- if hasIf && !usesContains && len(rule.Head.Ref()) == 2 {
- if !rule.Head.Ref()[1].IsGround() && len(rule.Head.Args) == 0 {
- rule.Head.Key = rule.Head.Ref()[1]
- }
-
- if rule.Head.Value == nil {
- rule.Head.generatedValue = true
- rule.Head.Value = BooleanTerm(true).SetLocation(rule.Head.Location)
- } else {
- // p[x] = y if becomes a single-value rule p[x] with value y, but needs name for compat
- v, ok := rule.Head.Ref()[0].Value.(Var)
- if !ok {
- return nil
- }
- rule.Head.Name = v
- }
- }
-
- // p[x] becomes a multi-value rule p
- if !hasIf && !usesContains &&
- len(rule.Head.Args) == 0 && // not a function
- len(rule.Head.Ref()) == 2 { // ref like 'p[x]'
- v, ok := rule.Head.Ref()[0].Value.(Var)
- if !ok {
- return nil
- }
- rule.Head.Name = v
- rule.Head.Key = rule.Head.Ref()[1]
- if rule.Head.Value == nil {
- rule.Head.SetRef(rule.Head.Ref()[:len(rule.Head.Ref())-1])
- }
- }
-
- switch {
- case hasIf:
- rule.Head.keywords = append(rule.Head.keywords, tokens.If)
- p.scan()
- s := p.save()
- if expr := p.parseLiteral(); expr != nil {
- // NOTE(sr): set literals are never false or undefined, so parsing this as
- // p if { true }
- // ^^^^^^^^ set of one element, `true`
- // isn't valid.
- isSetLiteral := false
- if t, ok := expr.Terms.(*Term); ok {
- _, isSetLiteral = t.Value.(Set)
- }
- // expr.Term is []*Term or Every
- if !isSetLiteral {
- rule.Body.Append(expr)
- break
- }
- }
-
- // parsing as literal didn't work out, expect '{ BODY }'
- p.restore(s)
- fallthrough
-
- case p.s.tok == tokens.LBrace:
- p.scan()
- if rule.Body = p.parseBody(tokens.RBrace); rule.Body == nil {
- return nil
- }
- p.scan()
-
- case usesContains:
- rule.Body = NewBody(NewExpr(BooleanTerm(true).SetLocation(rule.Location)).SetLocation(rule.Location))
- rule.generatedBody = true
- rule.Location = rule.Head.Location
-
- return []*Rule{&rule}
-
- default:
- return nil
- }
-
- if p.s.tok == tokens.Else {
- if r := rule.Head.Ref(); len(r) > 1 && !r.IsGround() {
- p.error(p.s.Loc(), "else keyword cannot be used on rules with variables in head")
- return nil
- }
- if rule.Head.Key != nil {
- p.error(p.s.Loc(), "else keyword cannot be used on multi-value rules")
- return nil
- }
-
- if rule.Else = p.parseElse(rule.Head); rule.Else == nil {
- return nil
- }
- }
-
- rule.Location.Text = p.s.Text(rule.Location.Offset, p.s.lastEnd)
-
- rules := []*Rule{&rule}
-
- for p.s.tok == tokens.LBrace {
-
- if rule.Else != nil {
- p.error(p.s.Loc(), "expected else keyword")
- return nil
- }
-
- loc := p.s.Loc()
-
- p.scan()
- var next Rule
-
- if next.Body = p.parseBody(tokens.RBrace); next.Body == nil {
- return nil
- }
- p.scan()
-
- loc.Text = p.s.Text(loc.Offset, p.s.lastEnd)
- next.SetLoc(loc)
-
- // Chained rule head's keep the original
- // rule's head AST but have their location
- // set to the rule body.
- next.Head = rule.Head.Copy()
- next.Head.keywords = rule.Head.keywords
- for i := range next.Head.Args {
- if v, ok := next.Head.Args[i].Value.(Var); ok && v.IsWildcard() {
- next.Head.Args[i].Value = Var(p.genwildcard())
- }
- }
- setLocRecursive(next.Head, loc)
-
- rules = append(rules, &next)
- }
-
- return rules
-}
-
-func (p *Parser) parseElse(head *Head) *Rule {
-
- var rule Rule
- rule.SetLoc(p.s.Loc())
-
- rule.Head = head.Copy()
- rule.Head.generatedValue = false
- for i := range rule.Head.Args {
- if v, ok := rule.Head.Args[i].Value.(Var); ok && v.IsWildcard() {
- rule.Head.Args[i].Value = Var(p.genwildcard())
- }
- }
- rule.Head.SetLoc(p.s.Loc())
-
- defer func() {
- rule.Location.Text = p.s.Text(rule.Location.Offset, p.s.lastEnd)
- }()
-
- p.scan()
-
- switch p.s.tok {
- case tokens.LBrace, tokens.If: // no value, but a body follows directly
- rule.Head.generatedValue = true
- rule.Head.Value = BooleanTerm(true)
- case tokens.Assign, tokens.Unify:
- rule.Head.Assign = tokens.Assign == p.s.tok
- p.scan()
- rule.Head.Value = p.parseTermInfixCall()
- if rule.Head.Value == nil {
- return nil
- }
- rule.Head.Location.Text = p.s.Text(rule.Head.Location.Offset, p.s.lastEnd)
- default:
- p.illegal("expected else value term or rule body")
- return nil
- }
-
- hasIf := p.s.tok == tokens.If
- hasLBrace := p.s.tok == tokens.LBrace
-
- if !hasIf && !hasLBrace {
- rule.Body = NewBody(NewExpr(BooleanTerm(true)))
- rule.generatedBody = true
- setLocRecursive(rule.Body, rule.Location)
- return &rule
- }
-
- if hasIf {
- rule.Head.keywords = append(rule.Head.keywords, tokens.If)
- p.scan()
- }
-
- if p.s.tok == tokens.LBrace {
- p.scan()
- if rule.Body = p.parseBody(tokens.RBrace); rule.Body == nil {
- return nil
- }
- p.scan()
- } else if p.s.tok != tokens.EOF {
- expr := p.parseLiteral()
- if expr == nil {
- return nil
- }
- rule.Body.Append(expr)
- setLocRecursive(rule.Body, rule.Location)
- } else {
- p.illegal("rule body expected")
- return nil
- }
-
- if p.s.tok == tokens.Else {
- if rule.Else = p.parseElse(head); rule.Else == nil {
- return nil
- }
- }
- return &rule
-}
-
-func (p *Parser) parseHead(defaultRule bool) (*Head, bool) {
- head := &Head{}
- loc := p.s.Loc()
- defer func() {
- if head != nil {
- head.SetLoc(loc)
- head.Location.Text = p.s.Text(head.Location.Offset, p.s.lastEnd)
- }
- }()
-
- term := p.parseVar()
- if term == nil {
- return nil, false
- }
-
- ref := p.parseTermFinish(term, true)
- if ref == nil {
- p.illegal("expected rule head name")
- return nil, false
- }
-
- switch x := ref.Value.(type) {
- case Var:
- // Modify the code to add the location to the head ref
- // and set the head ref's jsonOptions.
- head = VarHead(x, ref.Location, p.po.JSONOptions)
- case Ref:
- head = RefHead(x)
- case Call:
- op, args := x[0], x[1:]
- var ref Ref
- switch y := op.Value.(type) {
- case Var:
- ref = Ref{op}
- case Ref:
- if _, ok := y[0].Value.(Var); !ok {
- p.illegal("rule head ref %v invalid", y)
- return nil, false
- }
- ref = y
- }
- head = RefHead(ref)
- head.Args = append([]*Term{}, args...)
-
- default:
- return nil, false
- }
-
- name := head.Ref().String()
-
- switch p.s.tok {
- case tokens.Contains: // NOTE: no Value for `contains` heads, we return here
- // Catch error case of using 'contains' with a function definition rule head.
- if head.Args != nil {
- p.illegal("the contains keyword can only be used with multi-value rule definitions (e.g., %s contains { ... })", name)
- }
- p.scan()
- head.Key = p.parseTermInfixCall()
- if head.Key == nil {
- p.illegal("expected rule key term (e.g., %s contains { ... })", name)
- }
- return head, true
-
- case tokens.Unify:
- p.scan()
- head.Value = p.parseTermInfixCall()
- if head.Value == nil {
- // FIX HEAD.String()
- p.illegal("expected rule value term (e.g., %s[%s] = { ... })", name, head.Key)
- }
- case tokens.Assign:
- p.scan()
- head.Assign = true
- head.Value = p.parseTermInfixCall()
- if head.Value == nil {
- switch {
- case len(head.Args) > 0:
- p.illegal("expected function value term (e.g., %s(...) := { ... })", name)
- case head.Key != nil:
- p.illegal("expected partial rule value term (e.g., %s[...] := { ... })", name)
- case defaultRule:
- p.illegal("expected default rule value term (e.g., default %s := )", name)
- default:
- p.illegal("expected rule value term (e.g., %s := { ... })", name)
- }
- }
- }
-
- if head.Value == nil && head.Key == nil {
- if len(head.Ref()) != 2 || len(head.Args) > 0 {
- head.generatedValue = true
- head.Value = BooleanTerm(true).SetLocation(head.Location)
- }
- }
- return head, false
-}
-
-func (p *Parser) parseBody(end tokens.Token) Body {
- return p.parseQuery(false, end)
-}
-
-func (p *Parser) parseQuery(requireSemi bool, end tokens.Token) Body {
- body := Body{}
-
- if p.s.tok == end {
- p.error(p.s.Loc(), "found empty body")
- return nil
- }
-
- for {
- expr := p.parseLiteral()
- if expr == nil {
- return nil
- }
-
- body.Append(expr)
-
- if p.s.tok == tokens.Semicolon {
- p.scan()
- continue
- }
-
- if p.s.tok == end || requireSemi {
- return body
- }
-
- if !p.s.skippedNL {
- // If there was already an error then don't pile this one on
- if len(p.s.errors) == 0 {
- p.illegal(`expected \n or %s or %s`, tokens.Semicolon, end)
- }
- return nil
- }
- }
-}
-
-func (p *Parser) parseLiteral() (expr *Expr) {
-
- offset := p.s.loc.Offset
- loc := p.s.Loc()
-
- defer func() {
- if expr != nil {
- loc.Text = p.s.Text(offset, p.s.lastEnd)
- expr.SetLoc(loc)
- }
- }()
-
- var negated bool
- if p.s.tok == tokens.Not {
- p.scan()
- negated = true
- }
-
- switch p.s.tok {
- case tokens.Some:
- if negated {
- p.illegal("illegal negation of 'some'")
- return nil
- }
- return p.parseSome()
- case tokens.Every:
- if negated {
- p.illegal("illegal negation of 'every'")
- return nil
- }
- return p.parseEvery()
- default:
- s := p.save()
- expr := p.parseExpr()
- if expr != nil {
- expr.Negated = negated
- if p.s.tok == tokens.With {
- if expr.With = p.parseWith(); expr.With == nil {
- return nil
- }
- }
- // If we find a plain `every` identifier, attempt to parse an every expression,
- // add hint if it succeeds.
- if term, ok := expr.Terms.(*Term); ok && Var("every").Equal(term.Value) {
- var hint bool
- t := p.save()
- p.restore(s)
- if expr := p.futureParser().parseEvery(); expr != nil {
- _, hint = expr.Terms.(*Every)
- }
- p.restore(t)
- if hint {
- p.hint("`import future.keywords.every` for `every x in xs { ... }` expressions")
- }
- }
- return expr
- }
- return nil
- }
-}
-
-func (p *Parser) parseWith() []*With {
-
- withs := []*With{}
-
- for {
-
- with := With{
- Location: p.s.Loc(),
- }
- p.scan()
-
- if p.s.tok != tokens.Ident {
- p.illegal("expected ident")
- return nil
- }
-
- with.Target = p.parseTerm()
- if with.Target == nil {
- return nil
- }
-
- switch with.Target.Value.(type) {
- case Ref, Var:
- break
- default:
- p.illegal("expected with target path")
- }
-
- if p.s.tok != tokens.As {
- p.illegal("expected as keyword")
- return nil
- }
-
- p.scan()
-
- if with.Value = p.parseTermInfixCall(); with.Value == nil {
- return nil
- }
-
- with.Location.Text = p.s.Text(with.Location.Offset, p.s.lastEnd)
-
- withs = append(withs, &with)
-
- if p.s.tok != tokens.With {
- break
- }
- }
-
- return withs
-}
-
-func (p *Parser) parseSome() *Expr {
-
- decl := &SomeDecl{}
- decl.SetLoc(p.s.Loc())
-
- // Attempt to parse "some x in xs", which will end up in
- // SomeDecl{Symbols: ["member(x, xs)"]}
- s := p.save()
- p.scan()
- if term := p.parseTermInfixCall(); term != nil {
- if call, ok := term.Value.(Call); ok {
- switch call[0].String() {
- case Member.Name:
- if len(call) != 3 {
- p.illegal("illegal domain")
- return nil
- }
- case MemberWithKey.Name:
- if len(call) != 4 {
- p.illegal("illegal domain")
- return nil
- }
- default:
- p.illegal("expected `x in xs` or `x, y in xs` expression")
- return nil
- }
-
- decl.Symbols = []*Term{term}
- expr := NewExpr(decl).SetLocation(decl.Location)
- if p.s.tok == tokens.With {
- if expr.With = p.parseWith(); expr.With == nil {
- return nil
- }
- }
- return expr
- }
- }
-
- p.restore(s)
- s = p.save() // new copy for later
- var hint bool
- p.scan()
- if term := p.futureParser().parseTermInfixCall(); term != nil {
- if call, ok := term.Value.(Call); ok {
- switch call[0].String() {
- case Member.Name, MemberWithKey.Name:
- hint = true
- }
- }
- }
-
- // go on as before, it's `some x[...]` or illegal
- p.restore(s)
- if hint {
- p.hint("`import future.keywords.in` for `some x in xs` expressions")
- }
-
- for { // collecting var args
-
- p.scan()
-
- if p.s.tok != tokens.Ident {
- p.illegal("expected var")
- return nil
- }
-
- decl.Symbols = append(decl.Symbols, p.parseVar())
-
- p.scan()
-
- if p.s.tok != tokens.Comma {
- break
- }
- }
-
- return NewExpr(decl).SetLocation(decl.Location)
-}
-
-func (p *Parser) parseEvery() *Expr {
- qb := &Every{}
- qb.SetLoc(p.s.Loc())
-
- // TODO(sr): We'd get more accurate error messages if we didn't rely on
- // parseTermInfixCall here, but parsed "var [, var] in term" manually.
- p.scan()
- term := p.parseTermInfixCall()
- if term == nil {
- return nil
- }
- call, ok := term.Value.(Call)
- if !ok {
- p.illegal("expected `x[, y] in xs { ... }` expression")
- return nil
- }
- switch call[0].String() {
- case Member.Name: // x in xs
- if len(call) != 3 {
- p.illegal("illegal domain")
- return nil
- }
- qb.Value = call[1]
- qb.Domain = call[2]
- case MemberWithKey.Name: // k, v in xs
- if len(call) != 4 {
- p.illegal("illegal domain")
- return nil
- }
- qb.Key = call[1]
- qb.Value = call[2]
- qb.Domain = call[3]
- if _, ok := qb.Key.Value.(Var); !ok {
- p.illegal("expected key to be a variable")
- return nil
- }
- default:
- p.illegal("expected `x[, y] in xs { ... }` expression")
- return nil
- }
- if _, ok := qb.Value.Value.(Var); !ok {
- p.illegal("expected value to be a variable")
- return nil
- }
- if p.s.tok == tokens.LBrace { // every x in xs { ... }
- p.scan()
- body := p.parseBody(tokens.RBrace)
- if body == nil {
- return nil
- }
- p.scan()
- qb.Body = body
- expr := NewExpr(qb).SetLocation(qb.Location)
-
- if p.s.tok == tokens.With {
- if expr.With = p.parseWith(); expr.With == nil {
- return nil
- }
- }
- return expr
- }
-
- p.illegal("missing body")
- return nil
-}
-
-func (p *Parser) parseExpr() *Expr {
-
- lhs := p.parseTermInfixCall()
- if lhs == nil {
- return nil
- }
-
- if op := p.parseTermOp(tokens.Assign, tokens.Unify); op != nil {
- if rhs := p.parseTermInfixCall(); rhs != nil {
- return NewExpr([]*Term{op, lhs, rhs})
- }
- return nil
- }
-
- // NOTE(tsandall): the top-level call term is converted to an expr because
- // the evaluator does not support the call term type (nested calls are
- // rewritten by the compiler.)
- if call, ok := lhs.Value.(Call); ok {
- return NewExpr([]*Term(call))
- }
-
- return NewExpr(lhs)
-}
-
-// parseTermInfixCall consumes the next term from the input and returns it. If a
-// term cannot be parsed the return value is nil and error will be recorded. The
-// scanner will be advanced to the next token before returning.
-// By starting out with infix relations (==, !=, <, etc) and further calling the
-// other binary operators (|, &, arithmetics), it constitutes the binding
-// precedence.
-func (p *Parser) parseTermInfixCall() *Term {
- return p.parseTermIn(nil, true, p.s.loc.Offset)
-}
-
-func (p *Parser) parseTermInfixCallInList() *Term {
- return p.parseTermIn(nil, false, p.s.loc.Offset)
-}
-
-func (p *Parser) parseTermIn(lhs *Term, keyVal bool, offset int) *Term {
- // NOTE(sr): `in` is a bit special: besides `lhs in rhs`, it also
- // supports `key, val in rhs`, so it can have an optional second lhs.
- // `keyVal` triggers if we attempt to parse a second lhs argument (`mhs`).
- if lhs == nil {
- lhs = p.parseTermRelation(nil, offset)
- }
- if lhs != nil {
- if keyVal && p.s.tok == tokens.Comma { // second "lhs", or "middle hand side"
- s := p.save()
- p.scan()
- if mhs := p.parseTermRelation(nil, offset); mhs != nil {
- if op := p.parseTermOpName(MemberWithKey.Ref(), tokens.In); op != nil {
- if rhs := p.parseTermRelation(nil, p.s.loc.Offset); rhs != nil {
- call := p.setLoc(CallTerm(op, lhs, mhs, rhs), lhs.Location, offset, p.s.lastEnd)
- switch p.s.tok {
- case tokens.In:
- return p.parseTermIn(call, keyVal, offset)
- default:
- return call
- }
- }
- }
- }
- p.restore(s)
- }
- if op := p.parseTermOpName(Member.Ref(), tokens.In); op != nil {
- if rhs := p.parseTermRelation(nil, p.s.loc.Offset); rhs != nil {
- call := p.setLoc(CallTerm(op, lhs, rhs), lhs.Location, offset, p.s.lastEnd)
- switch p.s.tok {
- case tokens.In:
- return p.parseTermIn(call, keyVal, offset)
- default:
- return call
- }
- }
- }
- }
- return lhs
-}
-
-func (p *Parser) parseTermRelation(lhs *Term, offset int) *Term {
- if lhs == nil {
- lhs = p.parseTermOr(nil, offset)
- }
- if lhs != nil {
- if op := p.parseTermOp(tokens.Equal, tokens.Neq, tokens.Lt, tokens.Gt, tokens.Lte, tokens.Gte); op != nil {
- if rhs := p.parseTermOr(nil, p.s.loc.Offset); rhs != nil {
- call := p.setLoc(CallTerm(op, lhs, rhs), lhs.Location, offset, p.s.lastEnd)
- switch p.s.tok {
- case tokens.Equal, tokens.Neq, tokens.Lt, tokens.Gt, tokens.Lte, tokens.Gte:
- return p.parseTermRelation(call, offset)
- default:
- return call
- }
- }
- }
- }
- return lhs
-}
-
-func (p *Parser) parseTermOr(lhs *Term, offset int) *Term {
- if lhs == nil {
- lhs = p.parseTermAnd(nil, offset)
- }
- if lhs != nil {
- if op := p.parseTermOp(tokens.Or); op != nil {
- if rhs := p.parseTermAnd(nil, p.s.loc.Offset); rhs != nil {
- call := p.setLoc(CallTerm(op, lhs, rhs), lhs.Location, offset, p.s.lastEnd)
- switch p.s.tok {
- case tokens.Or:
- return p.parseTermOr(call, offset)
- default:
- return call
- }
- }
- }
- return lhs
- }
- return nil
-}
-
-func (p *Parser) parseTermAnd(lhs *Term, offset int) *Term {
- if lhs == nil {
- lhs = p.parseTermArith(nil, offset)
- }
- if lhs != nil {
- if op := p.parseTermOp(tokens.And); op != nil {
- if rhs := p.parseTermArith(nil, p.s.loc.Offset); rhs != nil {
- call := p.setLoc(CallTerm(op, lhs, rhs), lhs.Location, offset, p.s.lastEnd)
- switch p.s.tok {
- case tokens.And:
- return p.parseTermAnd(call, offset)
- default:
- return call
- }
- }
- }
- return lhs
- }
- return nil
-}
-
-func (p *Parser) parseTermArith(lhs *Term, offset int) *Term {
- if lhs == nil {
- lhs = p.parseTermFactor(nil, offset)
- }
- if lhs != nil {
- if op := p.parseTermOp(tokens.Add, tokens.Sub); op != nil {
- if rhs := p.parseTermFactor(nil, p.s.loc.Offset); rhs != nil {
- call := p.setLoc(CallTerm(op, lhs, rhs), lhs.Location, offset, p.s.lastEnd)
- switch p.s.tok {
- case tokens.Add, tokens.Sub:
- return p.parseTermArith(call, offset)
- default:
- return call
- }
- }
- }
- }
- return lhs
-}
-
-func (p *Parser) parseTermFactor(lhs *Term, offset int) *Term {
- if lhs == nil {
- lhs = p.parseTerm()
- }
- if lhs != nil {
- if op := p.parseTermOp(tokens.Mul, tokens.Quo, tokens.Rem); op != nil {
- if rhs := p.parseTerm(); rhs != nil {
- call := p.setLoc(CallTerm(op, lhs, rhs), lhs.Location, offset, p.s.lastEnd)
- switch p.s.tok {
- case tokens.Mul, tokens.Quo, tokens.Rem:
- return p.parseTermFactor(call, offset)
- default:
- return call
- }
- }
- }
- }
- return lhs
-}
-
-func (p *Parser) parseTerm() *Term {
- if term, s := p.parsedTermCacheLookup(); s != nil {
- p.restore(s)
- return term
- }
- s0 := p.save()
-
- var term *Term
- switch p.s.tok {
- case tokens.Null:
- term = NullTerm().SetLocation(p.s.Loc())
- case tokens.True:
- term = BooleanTerm(true).SetLocation(p.s.Loc())
- case tokens.False:
- term = BooleanTerm(false).SetLocation(p.s.Loc())
- case tokens.Sub, tokens.Dot, tokens.Number:
- term = p.parseNumber()
- case tokens.String:
- term = p.parseString()
- case tokens.Ident, tokens.Contains: // NOTE(sr): contains anywhere BUT in rule heads gets no special treatment
- term = p.parseVar()
- case tokens.LBrack:
- term = p.parseArray()
- case tokens.LBrace:
- term = p.parseSetOrObject()
- case tokens.LParen:
- offset := p.s.loc.Offset
- p.scan()
- if r := p.parseTermInfixCall(); r != nil {
- if p.s.tok == tokens.RParen {
- r.Location.Text = p.s.Text(offset, p.s.tokEnd)
- term = r
- } else {
- p.error(p.s.Loc(), "non-terminated expression")
- }
- }
- default:
- p.illegalToken()
- }
-
- term = p.parseTermFinish(term, false)
- p.parsedTermCachePush(term, s0)
- return term
-}
-
-func (p *Parser) parseTermFinish(head *Term, skipws bool) *Term {
- if head == nil {
- return nil
- }
- offset := p.s.loc.Offset
- p.doScan(skipws)
-
- switch p.s.tok {
- case tokens.LParen, tokens.Dot, tokens.LBrack:
- return p.parseRef(head, offset)
- case tokens.Whitespace:
- p.scan()
- fallthrough
- default:
- 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()
- if p.s.tok == tokens.Sub {
- prefix = "-"
- p.scan()
- switch p.s.tok {
- case tokens.Number, tokens.Dot:
- break
- default:
- p.illegal("expected number")
- return nil
- }
- }
- if p.s.tok == tokens.Dot {
- prefix += "."
- p.scan()
- if p.s.tok != tokens.Number {
- p.illegal("expected number")
- return nil
- }
- }
-
- // Check for multiple leading 0's, parsed by math/big.Float.Parse as decimal 0:
- // https://golang.org/pkg/math/big/#Float.Parse
- if ((len(prefix) != 0 && prefix[0] == '-') || len(prefix) == 0) &&
- len(p.s.lit) > 1 && p.s.lit[0] == '0' && p.s.lit[1] == '0' {
- p.illegal("expected number")
- return nil
- }
-
- // Ensure that the number is valid
- s := prefix + p.s.lit
- f, ok := new(big.Float).SetString(s)
- if !ok {
- p.illegal("invalid float")
- return nil
- }
-
- // Put limit on size of exponent to prevent non-linear cost of String()
- // function on big.Float from causing denial of service: https://github.com/golang/go/issues/11068
- //
- // n == sign * mantissa * 2^exp
- // 0.5 <= mantissa < 1.0
- //
- // The limit is arbitrary.
- exp := f.MantExp(nil)
- if exp > 1e5 || exp < -1e5 || f.IsInf() { // +/- inf, exp is 0
- p.error(p.s.Loc(), "number too big")
- return nil
- }
-
- // Note: Use the original string, do *not* round trip from
- // the big.Float as it can cause precision loss.
- r := NumberTerm(json.Number(s)).SetLocation(loc)
- return r
-}
-
-func (p *Parser) parseString() *Term {
- if p.s.lit[0] == '"' {
- var s string
- err := json.Unmarshal([]byte(p.s.lit), &s)
- if 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 p.parseRawString()
-}
-
-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
-}
-
-// this is the name to use for instantiating an empty set, e.g., `set()`.
-var setConstructor = RefTerm(VarTerm("set"))
-
-func (p *Parser) parseCall(operator *Term, offset int) (term *Term) {
-
- loc := operator.Location
- var end int
-
- defer func() {
- p.setLoc(term, loc, offset, end)
- }()
-
- p.scan() // steps over '('
-
- if p.s.tok == tokens.RParen { // no args, i.e. set() or any.func()
- end = p.s.tokEnd
- p.scanWS()
- if operator.Equal(setConstructor) {
- return SetTerm()
- }
- return CallTerm(operator)
- }
-
- if r := p.parseTermList(tokens.RParen, []*Term{operator}); r != nil {
- end = p.s.tokEnd
- p.scanWS()
- return CallTerm(r...)
- }
-
- return nil
-}
-
-func (p *Parser) parseRef(head *Term, offset int) (term *Term) {
-
- loc := head.Location
- var end int
-
- defer func() {
- p.setLoc(term, loc, offset, end)
- }()
-
- switch h := head.Value.(type) {
- case Var, *Array, Object, Set, *ArrayComprehension, *ObjectComprehension, *SetComprehension, Call:
- // ok
- default:
- p.errorf(loc, "illegal ref (head cannot be %v)", TypeName(h))
- }
-
- ref := []*Term{head}
-
- for {
- switch p.s.tok {
- case tokens.Dot:
- p.scanWS()
- if p.s.tok != tokens.Ident {
- p.illegal("expected %v", tokens.Ident)
- return nil
- }
- ref = append(ref, StringTerm(p.s.lit).SetLocation(p.s.Loc()))
- p.scanWS()
- case tokens.LParen:
- term = p.parseCall(p.setLoc(RefTerm(ref...), loc, offset, p.s.loc.Offset), offset)
- if term != nil {
- switch p.s.tok {
- case tokens.Whitespace:
- p.scan()
- end = p.s.lastEnd
- return term
- case tokens.Dot, tokens.LBrack:
- term = p.parseRef(term, offset)
- }
- }
- end = p.s.tokEnd
- return term
- case tokens.LBrack:
- p.scan()
- if term := p.parseTermInfixCall(); term != nil {
- if p.s.tok != tokens.RBrack {
- p.illegal("expected %v", tokens.LBrack)
- return nil
- }
- ref = append(ref, term)
- p.scanWS()
- } else {
- return nil
- }
- case tokens.Whitespace:
- end = p.s.lastEnd
- p.scan()
- return RefTerm(ref...)
- default:
- end = p.s.lastEnd
- return RefTerm(ref...)
- }
- }
-}
-
-func (p *Parser) parseArray() (term *Term) {
-
- loc := p.s.Loc()
- offset := p.s.loc.Offset
-
- defer func() {
- p.setLoc(term, loc, offset, p.s.tokEnd)
- }()
-
- p.scan()
-
- if p.s.tok == tokens.RBrack {
- return ArrayTerm()
- }
-
- potentialComprehension := true
-
- // Skip leading commas, eg [, x, y]
- // Supported for backwards compatibility. In the future
- // we should make this a parse error.
- if p.s.tok == tokens.Comma {
- potentialComprehension = false
- p.scan()
- }
-
- s := p.save()
-
- // NOTE(tsandall): The parser cannot attempt a relational term here because
- // of ambiguity around comprehensions. For example, given:
- //
- // {1 | 1}
- //
- // Does this represent a set comprehension or a set containing binary OR
- // call? We resolve the ambiguity by prioritizing comprehensions.
- head := p.parseTerm()
-
- if head == nil {
- return nil
- }
-
- switch p.s.tok {
- case tokens.RBrack:
- return ArrayTerm(head)
- case tokens.Comma:
- p.scan()
- if terms := p.parseTermList(tokens.RBrack, []*Term{head}); terms != nil {
- return NewTerm(NewArray(terms...))
- }
- return nil
- case tokens.Or:
- if potentialComprehension {
- // Try to parse as if it is an array comprehension
- p.scan()
- if body := p.parseBody(tokens.RBrack); body != nil {
- return ArrayComprehensionTerm(head, body)
- }
- if p.s.tok != tokens.Comma {
- return nil
- }
- }
- // fall back to parsing as a normal array definition
- }
-
- p.restore(s)
-
- if terms := p.parseTermList(tokens.RBrack, nil); terms != nil {
- return NewTerm(NewArray(terms...))
- }
- return nil
-}
-
-func (p *Parser) parseSetOrObject() (term *Term) {
- loc := p.s.Loc()
- offset := p.s.loc.Offset
-
- defer func() {
- p.setLoc(term, loc, offset, p.s.tokEnd)
- }()
-
- p.scan()
-
- if p.s.tok == tokens.RBrace {
- return ObjectTerm()
- }
-
- potentialComprehension := true
-
- // Skip leading commas, eg {, x, y}
- // Supported for backwards compatibility. In the future
- // we should make this a parse error.
- if p.s.tok == tokens.Comma {
- potentialComprehension = false
- p.scan()
- }
-
- s := p.save()
-
- // Try parsing just a single term first to give comprehensions higher
- // priority to "or" calls in ambiguous situations. Eg: { a | b }
- // will be a set comprehension.
- //
- // Note: We don't know yet if it is a set or object being defined.
- head := p.parseTerm()
- if head == nil {
- return nil
- }
-
- switch p.s.tok {
- case tokens.Or:
- if potentialComprehension {
- return p.parseSet(s, head, potentialComprehension)
- }
- case tokens.RBrace, tokens.Comma:
- return p.parseSet(s, head, potentialComprehension)
- case tokens.Colon:
- return p.parseObject(head, potentialComprehension)
- }
-
- p.restore(s)
-
- head = p.parseTermInfixCallInList()
- if head == nil {
- return nil
- }
-
- switch p.s.tok {
- case tokens.RBrace, tokens.Comma:
- return p.parseSet(s, head, false)
- case tokens.Colon:
- // It still might be an object comprehension, eg { a+1: b | ... }
- return p.parseObject(head, potentialComprehension)
- }
-
- p.illegal("non-terminated set")
- return nil
-}
-
-func (p *Parser) parseSet(s *state, head *Term, potentialComprehension bool) *Term {
- switch p.s.tok {
- case tokens.RBrace:
- return SetTerm(head)
- case tokens.Comma:
- p.scan()
- if terms := p.parseTermList(tokens.RBrace, []*Term{head}); terms != nil {
- return SetTerm(terms...)
- }
- case tokens.Or:
- if potentialComprehension {
- // Try to parse as if it is a set comprehension
- p.scan()
- if body := p.parseBody(tokens.RBrace); body != nil {
- return SetComprehensionTerm(head, body)
- }
- if p.s.tok != tokens.Comma {
- return nil
- }
- }
- // Fall back to parsing as normal set definition
- p.restore(s)
- if terms := p.parseTermList(tokens.RBrace, nil); terms != nil {
- return SetTerm(terms...)
- }
- }
- return nil
-}
-
-func (p *Parser) parseObject(k *Term, potentialComprehension bool) *Term {
- // NOTE(tsandall): Assumption: this function is called after parsing the key
- // of the head element and then receiving a colon token from the scanner.
- // Advance beyond the colon and attempt to parse an object.
- if p.s.tok != tokens.Colon {
- panic("expected colon")
- }
- p.scan()
-
- s := p.save()
-
- // NOTE(sr): We first try to parse the value as a term (`v`), and see
- // if we can parse `{ x: v | ...}` as a comprehension.
- // However, if we encounter either a Comma or an RBace, it cannot be
- // parsed as a comprehension -- so we save double work further down
- // where `parseObjectFinish(k, v, false)` would only exercise the
- // same code paths once more.
- v := p.parseTerm()
- if v == nil {
- return nil
- }
-
- potentialRelation := true
- if potentialComprehension {
- switch p.s.tok {
- case tokens.RBrace, tokens.Comma:
- potentialRelation = false
- fallthrough
- case tokens.Or:
- if term := p.parseObjectFinish(k, v, true); term != nil {
- return term
- }
- }
- }
-
- p.restore(s)
-
- if potentialRelation {
- v := p.parseTermInfixCallInList()
- if v == nil {
- return nil
- }
-
- switch p.s.tok {
- case tokens.RBrace, tokens.Comma:
- return p.parseObjectFinish(k, v, false)
- }
- }
-
- p.illegal("non-terminated object")
- return nil
-}
-
-func (p *Parser) parseObjectFinish(key, val *Term, potentialComprehension bool) *Term {
- switch p.s.tok {
- case tokens.RBrace:
- return ObjectTerm([2]*Term{key, val})
- case tokens.Or:
- if potentialComprehension {
- p.scan()
- if body := p.parseBody(tokens.RBrace); body != nil {
- return ObjectComprehensionTerm(key, val, body)
- }
- } else {
- p.illegal("non-terminated object")
- }
- case tokens.Comma:
- p.scan()
- if r := p.parseTermPairList(tokens.RBrace, [][2]*Term{{key, val}}); r != nil {
- return ObjectTerm(r...)
- }
- }
- return nil
-}
-
-func (p *Parser) parseTermList(end tokens.Token, r []*Term) []*Term {
- if p.s.tok == end {
- return r
- }
- for {
- term := p.parseTermInfixCallInList()
- if term != nil {
- r = append(r, term)
- switch p.s.tok {
- case end:
- return r
- case tokens.Comma:
- p.scan()
- if p.s.tok == end {
- return r
- }
- continue
- default:
- p.illegal(fmt.Sprintf("expected %q or %q", tokens.Comma, end))
- return nil
- }
- }
- return nil
- }
-}
-
-func (p *Parser) parseTermPairList(end tokens.Token, r [][2]*Term) [][2]*Term {
- if p.s.tok == end {
- return r
- }
- for {
- key := p.parseTermInfixCallInList()
- if key != nil {
- switch p.s.tok {
- case tokens.Colon:
- p.scan()
- if val := p.parseTermInfixCallInList(); val != nil {
- r = append(r, [2]*Term{key, val})
- switch p.s.tok {
- case end:
- return r
- case tokens.Comma:
- p.scan()
- if p.s.tok == end {
- return r
- }
- continue
- default:
- p.illegal(fmt.Sprintf("expected %q or %q", tokens.Comma, end))
- return nil
- }
- }
- default:
- p.illegal(fmt.Sprintf("expected %q", tokens.Colon))
- return nil
- }
- }
- return nil
- }
-}
-
-func (p *Parser) parseTermOp(values ...tokens.Token) *Term {
- for i := range values {
- if p.s.tok == values[i] {
- r := RefTerm(VarTerm(fmt.Sprint(p.s.tok)).SetLocation(p.s.Loc())).SetLocation(p.s.Loc())
- p.scan()
- return r
- }
- }
- return nil
-}
-
-func (p *Parser) parseTermOpName(ref Ref, values ...tokens.Token) *Term {
- for i := range values {
- if p.s.tok == values[i] {
- for _, r := range ref {
- r.SetLocation(p.s.Loc())
- }
- t := RefTerm(ref...)
- t.SetLocation(p.s.Loc())
- p.scan()
- return t
- }
- }
- return nil
-}
-
-func (p *Parser) parseVar() *Term {
-
- s := p.s.lit
-
- term := VarTerm(s).SetLocation(p.s.Loc())
-
- // Update wildcard values with unique identifiers
- if term.Equal(Wildcard) {
- term.Value = Var(p.genwildcard())
- }
-
- return term
-}
-
-func (p *Parser) genwildcard() string {
- c := p.s.wildcard
- p.s.wildcard++
- return fmt.Sprintf("%v%d", WildcardPrefix, c)
-}
-
-func (p *Parser) error(loc *location.Location, reason string) {
- p.errorf(loc, reason)
-}
-
-func (p *Parser) errorf(loc *location.Location, f string, a ...interface{}) {
- msg := strings.Builder{}
- msg.WriteString(fmt.Sprintf(f, a...))
-
- switch len(p.s.hints) {
- case 0: // nothing to do
- case 1:
- msg.WriteString(" (hint: ")
- msg.WriteString(p.s.hints[0])
- msg.WriteRune(')')
- default:
- msg.WriteString(" (hints: ")
- for i, h := range p.s.hints {
- if i > 0 {
- msg.WriteString(", ")
- }
- msg.WriteString(h)
- }
- msg.WriteRune(')')
- }
-
- p.s.errors = append(p.s.errors, &Error{
- Code: ParseErr,
- Message: msg.String(),
- Location: loc,
- Details: newParserErrorDetail(p.s.s.Bytes(), loc.Offset),
- })
- p.s.hints = nil
-}
-
-func (p *Parser) hint(f string, a ...interface{}) {
- p.s.hints = append(p.s.hints, fmt.Sprintf(f, a...))
-}
-
-func (p *Parser) illegal(note string, a ...interface{}) {
- tok := p.s.tok.String()
-
- if p.s.tok == tokens.Illegal {
- p.errorf(p.s.Loc(), "illegal token")
- return
- }
-
- tokType := "token"
- if tokens.IsKeyword(p.s.tok) {
- tokType = "keyword"
- }
- if _, ok := futureKeywords[p.s.tok.String()]; ok {
- tokType = "keyword"
- }
-
- note = fmt.Sprintf(note, a...)
- if len(note) > 0 {
- p.errorf(p.s.Loc(), "unexpected %s %s: %s", tok, tokType, note)
- } else {
- p.errorf(p.s.Loc(), "unexpected %s %s", tok, tokType)
- }
-}
-
-func (p *Parser) illegalToken() {
- p.illegal("")
-}
-
-func (p *Parser) scan() {
- p.doScan(true)
-}
-
-func (p *Parser) scanWS() {
- p.doScan(false)
-}
-
-func (p *Parser) doScan(skipws bool) {
-
- // NOTE(tsandall): the last position is used to compute the "text" field for
- // complex AST nodes. Whitespace never affects the last position of an AST
- // node so do not update it when scanning.
- if p.s.tok != tokens.Whitespace {
- p.s.lastEnd = p.s.tokEnd
- p.s.skippedNL = false
- }
-
- var errs []scanner.Error
- for {
- var pos scanner.Position
- p.s.tok, pos, p.s.lit, errs = p.s.s.Scan()
-
- p.s.tokEnd = pos.End
- p.s.loc.Row = pos.Row
- p.s.loc.Col = pos.Col
- p.s.loc.Offset = pos.Offset
- p.s.loc.Text = p.s.Text(pos.Offset, pos.End)
- p.s.loc.Tabs = pos.Tabs
-
- for _, err := range errs {
- p.error(p.s.Loc(), err.Message)
- }
-
- if len(errs) > 0 {
- p.s.tok = tokens.Illegal
- }
-
- if p.s.tok == tokens.Whitespace {
- if p.s.lit == "\n" {
- p.s.skippedNL = true
- }
- if skipws {
- continue
- }
- }
-
- if p.s.tok != tokens.Comment {
- break
- }
-
- // For backwards compatibility leave a nil
- // Text value if there is no text rather than
- // an empty string.
- var commentText []byte
- if len(p.s.lit) > 1 {
- commentText = []byte(p.s.lit[1:])
- }
- comment := NewComment(commentText)
- comment.SetLoc(p.s.Loc())
- p.s.comments = append(p.s.comments, comment)
- }
-}
-
-func (p *Parser) save() *state {
- cpy := *p.s
- s := *cpy.s
- cpy.s = &s
- return &cpy
-}
-
-func (p *Parser) restore(s *state) {
- p.s = s
-}
-
-func setLocRecursive(x interface{}, loc *location.Location) {
- NewGenericVisitor(func(x interface{}) bool {
- if node, ok := x.(Node); ok {
- node.SetLoc(loc)
- }
- return false
- }).Walk(x)
-}
-
-func (p *Parser) setLoc(term *Term, loc *location.Location, offset, end int) *Term {
- if term != nil {
- cpy := *loc
- term.Location = &cpy
- term.Location.Text = p.s.Text(offset, end)
- }
- return term
-}
-
-func (p *Parser) validateDefaultRuleValue(rule *Rule) bool {
- if rule.Head.Value == nil {
- p.error(rule.Loc(), "illegal default rule (must have a value)")
- return false
- }
-
- valid := true
- vis := NewGenericVisitor(func(x interface{}) bool {
- switch x.(type) {
- case *ArrayComprehension, *ObjectComprehension, *SetComprehension: // skip closures
- return true
- case Ref, Var, Call:
- p.error(rule.Loc(), fmt.Sprintf("illegal default rule (value cannot contain %v)", TypeName(x)))
- valid = false
- return true
- }
- return false
- })
-
- vis.Walk(rule.Head.Value.Value)
- return valid
-}
-
-func (p *Parser) validateDefaultRuleArgs(rule *Rule) bool {
-
- valid := true
- vars := NewVarSet()
-
- vis := NewGenericVisitor(func(x interface{}) bool {
- switch x := x.(type) {
- case Var:
- if vars.Contains(x) {
- p.error(rule.Loc(), fmt.Sprintf("illegal default rule (arguments cannot be repeated %v)", x))
- valid = false
- return true
- }
- vars.Add(x)
-
- case *Term:
- switch v := x.Value.(type) {
- case Var: // do nothing
- default:
- p.error(rule.Loc(), fmt.Sprintf("illegal default rule (arguments cannot contain %v)", TypeName(v)))
- valid = false
- return true
- }
- }
-
- return false
- })
-
- vis.Walk(rule.Head.Args)
- return valid
-}
-
-// We explicitly use yaml unmarshalling, to accommodate for the '_' in 'related_resources',
-// which isn't handled properly by json for some reason.
-type rawAnnotation struct {
- Scope string `yaml:"scope"`
- Title string `yaml:"title"`
- Entrypoint bool `yaml:"entrypoint"`
- Description string `yaml:"description"`
- Organizations []string `yaml:"organizations"`
- RelatedResources []interface{} `yaml:"related_resources"`
- Authors []interface{} `yaml:"authors"`
- Schemas []map[string]any `yaml:"schemas"`
- Custom map[string]interface{} `yaml:"custom"`
-}
-
-type metadataParser struct {
- buf *bytes.Buffer
- comments []*Comment
- loc *location.Location
-}
-
-func newMetadataParser(loc *Location) *metadataParser {
- return &metadataParser{loc: loc, buf: bytes.NewBuffer(nil)}
-}
-
-func (b *metadataParser) Append(c *Comment) {
- b.buf.Write(bytes.TrimPrefix(c.Text, []byte(" ")))
- b.buf.WriteByte('\n')
- b.comments = append(b.comments, c)
-}
-
-var yamlLineErrRegex = regexp.MustCompile(`^yaml:(?: unmarshal errors:[\n\s]*)? line ([[:digit:]]+):`)
-
-func (b *metadataParser) Parse() (*Annotations, error) {
-
- var raw rawAnnotation
-
- if len(bytes.TrimSpace(b.buf.Bytes())) == 0 {
- return nil, fmt.Errorf("expected METADATA block, found whitespace")
- }
-
- if err := yaml.Unmarshal(b.buf.Bytes(), &raw); err != nil {
- var comment *Comment
- match := yamlLineErrRegex.FindStringSubmatch(err.Error())
- if len(match) == 2 {
- index, err2 := strconv.Atoi(match[1])
- if err2 == nil {
- if index >= len(b.comments) {
- comment = b.comments[len(b.comments)-1]
- } else {
- comment = b.comments[index]
- }
- b.loc = comment.Location
- }
- }
-
- if match == nil && len(b.comments) > 0 {
- b.loc = b.comments[0].Location
- }
-
- return nil, augmentYamlError(err, b.comments)
- }
-
- var result Annotations
- result.comments = b.comments
- result.Scope = raw.Scope
- result.Entrypoint = raw.Entrypoint
- result.Title = raw.Title
- result.Description = raw.Description
- result.Organizations = raw.Organizations
-
- for _, v := range raw.RelatedResources {
- rr, err := parseRelatedResource(v)
- if err != nil {
- return nil, fmt.Errorf("invalid related-resource definition %s: %w", v, err)
- }
- result.RelatedResources = append(result.RelatedResources, rr)
- }
-
- for _, pair := range raw.Schemas {
- k, v := unwrapPair(pair)
-
- var a SchemaAnnotation
- var err error
-
- a.Path, err = ParseRef(k)
- if err != nil {
- return nil, fmt.Errorf("invalid document reference")
- }
-
- switch v := v.(type) {
- case string:
- a.Schema, err = parseSchemaRef(v)
- if err != nil {
- return nil, err
- }
- case map[string]any:
- w, err := convertYAMLMapKeyTypes(v, nil)
- if err != nil {
- return nil, fmt.Errorf("invalid schema definition: %w", err)
- }
- a.Definition = &w
- default:
- return nil, fmt.Errorf("invalid schema declaration for path %q", k)
- }
-
- result.Schemas = append(result.Schemas, &a)
- }
-
- for _, v := range raw.Authors {
- author, err := parseAuthor(v)
- if err != nil {
- return nil, fmt.Errorf("invalid author definition %s: %w", v, err)
- }
- result.Authors = append(result.Authors, author)
- }
-
- result.Custom = make(map[string]interface{})
- for k, v := range raw.Custom {
- val, err := convertYAMLMapKeyTypes(v, nil)
- if err != nil {
- return nil, err
- }
- result.Custom[k] = val
- }
-
- result.Location = b.loc
-
- // recreate original text of entire metadata block for location text attribute
- sb := strings.Builder{}
- sb.WriteString("# METADATA\n")
-
- lines := bytes.Split(b.buf.Bytes(), []byte{'\n'})
-
- for _, line := range lines[:len(lines)-1] {
- sb.WriteString("# ")
- sb.Write(line)
- sb.WriteByte('\n')
- }
-
- result.Location.Text = []byte(strings.TrimSuffix(sb.String(), "\n"))
-
- return &result, nil
-}
-
-// augmentYamlError augments a YAML error with hints intended to help the user figure out the cause of an otherwise
-// cryptic error. These are hints, instead of proper errors, because they are educated guesses, and aren't guaranteed
-// to be correct.
-func augmentYamlError(err error, comments []*Comment) error {
- // Adding hints for when key/value ':' separator isn't suffixed with a legal YAML space symbol
- for _, comment := range comments {
- txt := string(comment.Text)
- parts := strings.Split(txt, ":")
- if len(parts) > 1 {
- parts = parts[1:]
- var invalidSpaces []string
- for partIndex, part := range parts {
- if len(part) == 0 && partIndex == len(parts)-1 {
- invalidSpaces = []string{}
- break
- }
-
- r, _ := utf8.DecodeRuneInString(part)
- if r == ' ' || r == '\t' {
- invalidSpaces = []string{}
- break
- }
-
- invalidSpaces = append(invalidSpaces, fmt.Sprintf("%+q", r))
- }
- if len(invalidSpaces) > 0 {
- err = fmt.Errorf(
- "%s\n Hint: on line %d, symbol(s) %v immediately following a key/value separator ':' is not a legal yaml space character",
- err.Error(), comment.Location.Row, invalidSpaces)
- }
- }
- }
- return err
-}
-
-func unwrapPair(pair map[string]interface{}) (string, interface{}) {
- for k, v := range pair {
- return k, v
- }
- return "", nil
-}
-
-var errInvalidSchemaRef = fmt.Errorf("invalid schema reference")
-
-// NOTE(tsandall): 'schema' is not registered as a root because it's not
-// supported by the compiler or evaluator today. Once we fix that, we can remove
-// this function.
-func parseSchemaRef(s string) (Ref, error) {
-
- term, err := ParseTerm(s)
- if err == nil {
- switch v := term.Value.(type) {
- case Var:
- if term.Equal(SchemaRootDocument) {
- return SchemaRootRef.Copy(), nil
- }
- case Ref:
- if v.HasPrefix(SchemaRootRef) {
- return v, nil
- }
- }
- }
-
- return nil, errInvalidSchemaRef
-}
-
-func parseRelatedResource(rr interface{}) (*RelatedResourceAnnotation, error) {
- rr, err := convertYAMLMapKeyTypes(rr, nil)
- if err != nil {
- return nil, err
- }
-
- switch rr := rr.(type) {
- case string:
- if len(rr) > 0 {
- u, err := url.Parse(rr)
- if err != nil {
- return nil, err
- }
- return &RelatedResourceAnnotation{Ref: *u}, nil
- }
- return nil, fmt.Errorf("ref URL may not be empty string")
- case map[string]interface{}:
- description := strings.TrimSpace(getSafeString(rr, "description"))
- ref := strings.TrimSpace(getSafeString(rr, "ref"))
- if len(ref) > 0 {
- u, err := url.Parse(ref)
- if err != nil {
- return nil, err
- }
- return &RelatedResourceAnnotation{Description: description, Ref: *u}, nil
- }
- return nil, fmt.Errorf("'ref' value required in object")
- }
-
- return nil, fmt.Errorf("invalid value type, must be string or map")
-}
-
-func parseAuthor(a interface{}) (*AuthorAnnotation, error) {
- a, err := convertYAMLMapKeyTypes(a, nil)
- if err != nil {
- return nil, err
- }
-
- switch a := a.(type) {
- case string:
- return parseAuthorString(a)
- case map[string]interface{}:
- name := strings.TrimSpace(getSafeString(a, "name"))
- email := strings.TrimSpace(getSafeString(a, "email"))
- if len(name) > 0 || len(email) > 0 {
- return &AuthorAnnotation{name, email}, nil
- }
- return nil, fmt.Errorf("'name' and/or 'email' values required in object")
- }
-
- return nil, fmt.Errorf("invalid value type, must be string or map")
-}
-
-func getSafeString(m map[string]interface{}, k string) string {
- if v, found := m[k]; found {
- if s, ok := v.(string); ok {
- return s
- }
- }
- return ""
-}
-
-const emailPrefix = "<"
-const emailSuffix = ">"
-
-// parseAuthor parses a string into an AuthorAnnotation. If the last word of the input string is enclosed within <>,
-// it is extracted as the author's email. The email may not contain whitelines, as it then will be interpreted as
-// multiple words.
-func parseAuthorString(s string) (*AuthorAnnotation, error) {
- parts := strings.Fields(s)
-
- if len(parts) == 0 {
- return nil, fmt.Errorf("author is an empty string")
- }
-
- namePartCount := len(parts)
- trailing := parts[namePartCount-1]
- var email string
- if len(trailing) >= len(emailPrefix)+len(emailSuffix) && strings.HasPrefix(trailing, emailPrefix) &&
- strings.HasSuffix(trailing, emailSuffix) {
- email = trailing[len(emailPrefix):]
- email = email[0 : len(email)-len(emailSuffix)]
- namePartCount = namePartCount - 1
- }
-
- name := strings.Join(parts[0:namePartCount], " ")
-
- return &AuthorAnnotation{Name: name, Email: email}, nil
-}
-
-func convertYAMLMapKeyTypes(x any, path []string) (any, error) {
- var err error
- switch x := x.(type) {
- case map[any]any:
- result := make(map[string]any, len(x))
- for k, v := range x {
- str, ok := k.(string)
- if !ok {
- return nil, fmt.Errorf("invalid map key type(s): %v", strings.Join(path, "/"))
- }
- result[str], err = convertYAMLMapKeyTypes(v, append(path, str))
- if err != nil {
- return nil, err
- }
- }
- return result, nil
- case []any:
- for i := range x {
- x[i], err = convertYAMLMapKeyTypes(x[i], append(path, fmt.Sprintf("%d", i)))
- if err != nil {
- return nil, err
- }
- }
- return x, nil
- default:
- return x, nil
- }
-}
-
-// futureKeywords is the source of truth for future keywords that will
-// eventually become standard keywords inside of Rego.
-var futureKeywords = map[string]tokens.Token{
- "in": tokens.In,
- "every": tokens.Every,
- "contains": tokens.Contains,
- "if": tokens.If,
+ return v1.NewParser().WithRegoVersion(DefaultRegoVersion)
}
func IsFutureKeyword(s string) bool {
- _, ok := futureKeywords[s]
- return ok
-}
-
-func (p *Parser) futureImport(imp *Import, allowedFutureKeywords map[string]tokens.Token) {
- path := imp.Path.Value.(Ref)
-
- if len(path) == 1 || !path[1].Equal(StringTerm("keywords")) {
- p.errorf(imp.Path.Location, "invalid import, must be `future.keywords`")
- return
- }
-
- if imp.Alias != "" {
- p.errorf(imp.Path.Location, "`future` imports cannot be aliased")
- return
- }
-
- if p.s.s.RegoV1Compatible() {
- p.errorf(imp.Path.Location, "the `%s` import implies `future.keywords`, these are therefore mutually exclusive", RegoV1CompatibleRef)
- return
- }
-
- kwds := make([]string, 0, len(allowedFutureKeywords))
- for k := range allowedFutureKeywords {
- kwds = append(kwds, k)
- }
-
- switch len(path) {
- case 2: // all keywords imported, nothing to do
- case 3: // one keyword imported
- kw, ok := path[2].Value.(String)
- if !ok {
- p.errorf(imp.Path.Location, "invalid import, must be `future.keywords.x`, e.g. `import future.keywords.in`")
- return
- }
- keyword := string(kw)
- _, ok = allowedFutureKeywords[keyword]
- if !ok {
- sort.Strings(kwds) // so the error message is stable
- p.errorf(imp.Path.Location, "unexpected keyword, must be one of %v", kwds)
- return
- }
-
- kwds = []string{keyword} // overwrite
- }
- for _, kw := range kwds {
- p.s.s.AddKeyword(kw, allowedFutureKeywords[kw])
- }
-}
-
-func (p *Parser) regoV1Import(imp *Import) {
- if !p.po.Capabilities.ContainsFeature(FeatureRegoV1Import) {
- p.errorf(imp.Path.Location, "invalid import, `%s` is not supported by current capabilities", RegoV1CompatibleRef)
- return
- }
-
- path := imp.Path.Value.(Ref)
-
- // v1 is only valid option
- if len(path) == 1 || !path[1].Equal(RegoV1CompatibleRef[1]) || len(path) > 2 {
- p.errorf(imp.Path.Location, "invalid import `%s`, must be `%s`", path, RegoV1CompatibleRef)
- return
- }
-
- if p.po.RegoVersion == RegoV1 {
- // We're parsing for Rego v1, where the 'rego.v1' import is a no-op.
- return
- }
-
- if imp.Alias != "" {
- p.errorf(imp.Path.Location, "`rego` imports cannot be aliased")
- return
- }
-
- // import all future keywords with the rego.v1 import
- kwds := make([]string, 0, len(futureKeywords))
- for k := range futureKeywords {
- kwds = append(kwds, k)
- }
-
- if p.s.s.HasKeyword(futureKeywords) && !p.s.s.RegoV1Compatible() {
- // We have imported future keywords, but they didn't come from another `rego.v1` import.
- p.errorf(imp.Path.Location, "the `%s` import implies `future.keywords`, these are therefore mutually exclusive", RegoV1CompatibleRef)
- return
- }
-
- p.s.s.SetRegoV1Compatible()
- for _, kw := range kwds {
- p.s.s.AddKeyword(kw, futureKeywords[kw])
- }
+ return v1.IsFutureKeywordForRegoVersion(s, RegoV0)
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/parser_ext.go b/vendor/github.com/open-policy-agent/opa/ast/parser_ext.go
index 83c87e47b1..2d59616932 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/parser_ext.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/parser_ext.go
@@ -1,24 +1,14 @@
-// Copyright 2016 The OPA Authors. All rights reserved.
+// Copyright 2024 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.
-// This file contains extra functions for parsing Rego.
-// Most of the parsing is handled by the code in parser.go,
-// however, there are additional utilities that are
-// helpful for dealing with Rego source inputs (e.g., REPL
-// statements, source files, etc.)
-
package ast
import (
- "bytes"
"errors"
"fmt"
- "strings"
- "unicode"
- "github.com/open-policy-agent/opa/ast/internal/tokens"
- astJSON "github.com/open-policy-agent/opa/ast/json"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
// MustParseBody returns a parsed body.
@@ -30,11 +20,7 @@ func MustParseBody(input string) Body {
// MustParseBodyWithOpts returns a parsed body.
// If an error occurs during parsing, panic.
func MustParseBodyWithOpts(input string, opts ParserOptions) Body {
- parsed, err := ParseBodyWithOpts(input, opts)
- if err != nil {
- panic(err)
- }
- return parsed
+ return v1.MustParseBodyWithOpts(input, setDefaultRegoVersion(opts))
}
// MustParseExpr returns a parsed expression.
@@ -66,11 +52,7 @@ func MustParseModule(input string) *Module {
// MustParseModuleWithOpts returns a parsed module.
// If an error occurs during parsing, panic.
func MustParseModuleWithOpts(input string, opts ParserOptions) *Module {
- parsed, err := ParseModuleWithOpts("", input, opts)
- if err != nil {
- panic(err)
- }
- return parsed
+ return v1.MustParseModuleWithOpts(input, setDefaultRegoVersion(opts))
}
// MustParsePackage returns a Package.
@@ -104,11 +86,7 @@ func MustParseStatement(input string) Statement {
}
func MustParseStatementWithOpts(input string, popts ParserOptions) Statement {
- parsed, err := ParseStatementWithOpts(input, popts)
- if err != nil {
- panic(err)
- }
- return parsed
+ return v1.MustParseStatementWithOpts(input, setDefaultRegoVersion(popts))
}
// MustParseRef returns a parsed reference.
@@ -134,11 +112,7 @@ func MustParseRule(input string) *Rule {
// MustParseRuleWithOpts returns a parsed rule.
// If an error occurs during parsing, panic.
func MustParseRuleWithOpts(input string, opts ParserOptions) *Rule {
- parsed, err := ParseRuleWithOpts(input, opts)
- if err != nil {
- panic(err)
- }
- return parsed
+ return v1.MustParseRuleWithOpts(input, setDefaultRegoVersion(opts))
}
// MustParseTerm returns a parsed term.
@@ -154,331 +128,59 @@ func MustParseTerm(input string) *Term {
// ParseRuleFromBody returns a rule if the body can be interpreted as a rule
// definition. Otherwise, an error is returned.
func ParseRuleFromBody(module *Module, body Body) (*Rule, error) {
-
- if len(body) != 1 {
- return nil, fmt.Errorf("multiple expressions cannot be used for rule head")
- }
-
- return ParseRuleFromExpr(module, body[0])
+ return v1.ParseRuleFromBody(module, body)
}
// ParseRuleFromExpr returns a rule if the expression can be interpreted as a
// rule definition.
func ParseRuleFromExpr(module *Module, expr *Expr) (*Rule, error) {
-
- if len(expr.With) > 0 {
- return nil, fmt.Errorf("expressions using with keyword cannot be used for rule head")
- }
-
- if expr.Negated {
- return nil, fmt.Errorf("negated expressions cannot be used for rule head")
- }
-
- if _, ok := expr.Terms.(*SomeDecl); ok {
- return nil, errors.New("'some' declarations cannot be used for rule head")
- }
-
- if term, ok := expr.Terms.(*Term); ok {
- switch v := term.Value.(type) {
- case Ref:
- if len(v) > 2 { // 2+ dots
- return ParseCompleteDocRuleWithDotsFromTerm(module, term)
- }
- return ParsePartialSetDocRuleFromTerm(module, term)
- default:
- return nil, fmt.Errorf("%v cannot be used for rule name", TypeName(v))
- }
- }
-
- if _, ok := expr.Terms.([]*Term); !ok {
- // This is a defensive check in case other kinds of expression terms are
- // introduced in the future.
- return nil, errors.New("expression cannot be used for rule head")
- }
-
- if expr.IsEquality() {
- return parseCompleteRuleFromEq(module, expr)
- } else if expr.IsAssignment() {
- rule, err := parseCompleteRuleFromEq(module, expr)
- if err != nil {
- return nil, err
- }
- rule.Head.Assign = true
- return rule, nil
- }
-
- if _, ok := BuiltinMap[expr.Operator().String()]; ok {
- return nil, fmt.Errorf("rule name conflicts with built-in function")
- }
-
- return ParseRuleFromCallExpr(module, expr.Terms.([]*Term))
-}
-
-func parseCompleteRuleFromEq(module *Module, expr *Expr) (rule *Rule, err error) {
-
- // ensure the rule location is set to the expr location
- // the helper functions called below try to set the location based
- // on the terms they've been provided but that is not as accurate.
- defer func() {
- if rule != nil {
- rule.Location = expr.Location
- rule.Head.Location = expr.Location
- }
- }()
-
- lhs, rhs := expr.Operand(0), expr.Operand(1)
- if lhs == nil || rhs == nil {
- return nil, errors.New("assignment requires two operands")
- }
-
- rule, err = ParseRuleFromCallEqExpr(module, lhs, rhs)
- if err == nil {
- return rule, nil
- }
-
- rule, err = ParsePartialObjectDocRuleFromEqExpr(module, lhs, rhs)
- if err == nil {
- return rule, nil
- }
-
- return ParseCompleteDocRuleFromEqExpr(module, lhs, rhs)
+ return v1.ParseRuleFromExpr(module, expr)
}
// ParseCompleteDocRuleFromAssignmentExpr returns a rule if the expression can
// be interpreted as a complete document definition declared with the assignment
// operator.
func ParseCompleteDocRuleFromAssignmentExpr(module *Module, lhs, rhs *Term) (*Rule, error) {
-
- rule, err := ParseCompleteDocRuleFromEqExpr(module, lhs, rhs)
- if err != nil {
- return nil, err
- }
-
- rule.Head.Assign = true
-
- return rule, nil
+ return v1.ParseCompleteDocRuleFromAssignmentExpr(module, lhs, rhs)
}
// ParseCompleteDocRuleFromEqExpr returns a rule if the expression can be
// interpreted as a complete document definition.
func ParseCompleteDocRuleFromEqExpr(module *Module, lhs, rhs *Term) (*Rule, error) {
- var head *Head
-
- if v, ok := lhs.Value.(Var); ok {
- // Modify the code to add the location to the head ref
- // and set the head ref's jsonOptions.
- head = VarHead(v, lhs.Location, &lhs.jsonOptions)
- } else if r, ok := lhs.Value.(Ref); ok { // groundness ?
- if _, ok := r[0].Value.(Var); !ok {
- return nil, fmt.Errorf("invalid rule head: %v", r)
- }
- head = RefHead(r)
- if len(r) > 1 && !r[len(r)-1].IsGround() {
- return nil, fmt.Errorf("ref not ground")
- }
- } else {
- return nil, fmt.Errorf("%v cannot be used for rule name", TypeName(lhs.Value))
- }
- head.Value = rhs
- head.Location = lhs.Location
- head.setJSONOptions(lhs.jsonOptions)
-
- body := NewBody(NewExpr(BooleanTerm(true).SetLocation(rhs.Location)).SetLocation(rhs.Location))
- setJSONOptions(body, &rhs.jsonOptions)
-
- return &Rule{
- Location: lhs.Location,
- Head: head,
- Body: body,
- Module: module,
- jsonOptions: lhs.jsonOptions,
- generatedBody: true,
- }, nil
+ return v1.ParseCompleteDocRuleFromEqExpr(module, lhs, rhs)
}
func ParseCompleteDocRuleWithDotsFromTerm(module *Module, term *Term) (*Rule, error) {
- ref, ok := term.Value.(Ref)
- if !ok {
- return nil, fmt.Errorf("%v cannot be used for rule name", TypeName(term.Value))
- }
-
- if _, ok := ref[0].Value.(Var); !ok {
- return nil, fmt.Errorf("invalid rule head: %v", ref)
- }
- head := RefHead(ref, BooleanTerm(true).SetLocation(term.Location))
- head.generatedValue = true
- head.Location = term.Location
- head.jsonOptions = term.jsonOptions
-
- body := NewBody(NewExpr(BooleanTerm(true).SetLocation(term.Location)).SetLocation(term.Location))
- setJSONOptions(body, &term.jsonOptions)
-
- return &Rule{
- Location: term.Location,
- Head: head,
- Body: body,
- Module: module,
-
- jsonOptions: term.jsonOptions,
- }, nil
+ return v1.ParseCompleteDocRuleWithDotsFromTerm(module, term)
}
// ParsePartialObjectDocRuleFromEqExpr returns a rule if the expression can be
// interpreted as a partial object document definition.
func ParsePartialObjectDocRuleFromEqExpr(module *Module, lhs, rhs *Term) (*Rule, error) {
- ref, ok := lhs.Value.(Ref)
- if !ok {
- return nil, fmt.Errorf("%v cannot be used as rule name", TypeName(lhs.Value))
- }
-
- if _, ok := ref[0].Value.(Var); !ok {
- return nil, fmt.Errorf("invalid rule head: %v", ref)
- }
-
- head := RefHead(ref, rhs)
- if len(ref) == 2 { // backcompat for naked `foo.bar = "baz"` statements
- head.Name = ref[0].Value.(Var)
- head.Key = ref[1]
- }
- head.Location = rhs.Location
- head.jsonOptions = rhs.jsonOptions
-
- body := NewBody(NewExpr(BooleanTerm(true).SetLocation(rhs.Location)).SetLocation(rhs.Location))
- setJSONOptions(body, &rhs.jsonOptions)
-
- rule := &Rule{
- Location: rhs.Location,
- Head: head,
- Body: body,
- Module: module,
- jsonOptions: rhs.jsonOptions,
- }
-
- return rule, nil
+ return v1.ParsePartialObjectDocRuleFromEqExpr(module, lhs, rhs)
}
// ParsePartialSetDocRuleFromTerm returns a rule if the term can be interpreted
// as a partial set document definition.
func ParsePartialSetDocRuleFromTerm(module *Module, term *Term) (*Rule, error) {
-
- ref, ok := term.Value.(Ref)
- if !ok || len(ref) == 1 {
- return nil, fmt.Errorf("%vs cannot be used for rule head", TypeName(term.Value))
- }
- if _, ok := ref[0].Value.(Var); !ok {
- return nil, fmt.Errorf("invalid rule head: %v", ref)
- }
-
- head := RefHead(ref)
- if len(ref) == 2 {
- v, ok := ref[0].Value.(Var)
- if !ok {
- return nil, fmt.Errorf("%vs cannot be used for rule head", TypeName(term.Value))
- }
- // Modify the code to add the location to the head ref
- // and set the head ref's jsonOptions.
- head = VarHead(v, ref[0].Location, &ref[0].jsonOptions)
- head.Key = ref[1]
- }
- head.Location = term.Location
- head.jsonOptions = term.jsonOptions
-
- body := NewBody(NewExpr(BooleanTerm(true).SetLocation(term.Location)).SetLocation(term.Location))
- setJSONOptions(body, &term.jsonOptions)
-
- rule := &Rule{
- Location: term.Location,
- Head: head,
- Body: body,
- Module: module,
- jsonOptions: term.jsonOptions,
- }
-
- return rule, nil
+ return v1.ParsePartialSetDocRuleFromTerm(module, term)
}
// ParseRuleFromCallEqExpr returns a rule if the term can be interpreted as a
// function definition (e.g., f(x) = y => f(x) = y { true }).
func ParseRuleFromCallEqExpr(module *Module, lhs, rhs *Term) (*Rule, error) {
-
- call, ok := lhs.Value.(Call)
- if !ok {
- return nil, fmt.Errorf("must be call")
- }
-
- ref, ok := call[0].Value.(Ref)
- if !ok {
- return nil, fmt.Errorf("%vs cannot be used in function signature", TypeName(call[0].Value))
- }
- if _, ok := ref[0].Value.(Var); !ok {
- return nil, fmt.Errorf("invalid rule head: %v", ref)
- }
-
- head := RefHead(ref, rhs)
- head.Location = lhs.Location
- head.Args = Args(call[1:])
- head.jsonOptions = lhs.jsonOptions
-
- body := NewBody(NewExpr(BooleanTerm(true).SetLocation(rhs.Location)).SetLocation(rhs.Location))
- setJSONOptions(body, &rhs.jsonOptions)
-
- rule := &Rule{
- Location: lhs.Location,
- Head: head,
- Body: body,
- Module: module,
- jsonOptions: lhs.jsonOptions,
- }
-
- return rule, nil
+ return v1.ParseRuleFromCallEqExpr(module, lhs, rhs)
}
// ParseRuleFromCallExpr returns a rule if the terms can be interpreted as a
// function returning true or some value (e.g., f(x) => f(x) = true { true }).
func ParseRuleFromCallExpr(module *Module, terms []*Term) (*Rule, error) {
-
- if len(terms) <= 1 {
- return nil, fmt.Errorf("rule argument list must take at least one argument")
- }
-
- loc := terms[0].Location
- ref := terms[0].Value.(Ref)
- if _, ok := ref[0].Value.(Var); !ok {
- return nil, fmt.Errorf("invalid rule head: %v", ref)
- }
- head := RefHead(ref, BooleanTerm(true).SetLocation(loc))
- head.Location = loc
- head.Args = terms[1:]
- head.jsonOptions = terms[0].jsonOptions
-
- body := NewBody(NewExpr(BooleanTerm(true).SetLocation(loc)).SetLocation(loc))
- setJSONOptions(body, &terms[0].jsonOptions)
-
- rule := &Rule{
- Location: loc,
- Head: head,
- Module: module,
- Body: body,
- jsonOptions: terms[0].jsonOptions,
- }
- return rule, nil
+ return v1.ParseRuleFromCallExpr(module, terms)
}
// ParseImports returns a slice of Import objects.
func ParseImports(input string) ([]*Import, error) {
- stmts, _, err := ParseStatements("", input)
- if err != nil {
- return nil, err
- }
- result := []*Import{}
- for _, stmt := range stmts {
- if imp, ok := stmt.(*Import); ok {
- result = append(result, imp)
- } else {
- return nil, fmt.Errorf("expected import but got %T", stmt)
- }
- }
- return result, nil
+ return v1.ParseImports(input)
}
// ParseModule returns a parsed Module object.
@@ -492,11 +194,7 @@ func ParseModule(filename, input string) (*Module, error) {
// For details on Module objects and their fields, see policy.go.
// Empty input will return nil, nil.
func ParseModuleWithOpts(filename, input string, popts ParserOptions) (*Module, error) {
- stmts, comments, err := ParseStatementsWithOpts(filename, input, popts)
- if err != nil {
- return nil, err
- }
- return parseModule(filename, stmts, comments, popts.RegoVersion)
+ return v1.ParseModuleWithOpts(filename, input, setDefaultRegoVersion(popts))
}
// ParseBody returns exactly one body.
@@ -508,28 +206,7 @@ func ParseBody(input string) (Body, error) {
// ParseBodyWithOpts returns exactly one body. It does _not_ set SkipRules: true on its own,
// but respects whatever ParserOptions it's been given.
func ParseBodyWithOpts(input string, popts ParserOptions) (Body, error) {
-
- stmts, _, err := ParseStatementsWithOpts("", input, popts)
- if err != nil {
- return nil, err
- }
-
- result := Body{}
-
- for _, stmt := range stmts {
- switch stmt := stmt.(type) {
- case Body:
- for i := range stmt {
- result.Append(stmt[i])
- }
- case *Comment:
- // skip
- default:
- return nil, fmt.Errorf("expected body but got %T", stmt)
- }
- }
-
- return result, nil
+ return v1.ParseBodyWithOpts(input, setDefaultRegoVersion(popts))
}
// ParseExpr returns exactly one expression.
@@ -548,15 +225,7 @@ func ParseExpr(input string) (*Expr, error) {
// ParsePackage returns exactly one Package.
// If multiple statements are parsed, an error is returned.
func ParsePackage(input string) (*Package, error) {
- stmt, err := ParseStatement(input)
- if err != nil {
- return nil, err
- }
- pkg, ok := stmt.(*Package)
- if !ok {
- return nil, fmt.Errorf("expected package but got %T", stmt)
- }
- return pkg, nil
+ return v1.ParsePackage(input)
}
// ParseTerm returns exactly one term.
@@ -592,18 +261,7 @@ func ParseRef(input string) (Ref, error) {
// ParseRuleWithOpts returns exactly one rule.
// If multiple rules are parsed, an error is returned.
func ParseRuleWithOpts(input string, opts ParserOptions) (*Rule, error) {
- stmts, _, err := ParseStatementsWithOpts("", input, opts)
- if err != nil {
- return nil, err
- }
- if len(stmts) != 1 {
- return nil, fmt.Errorf("expected exactly one statement (rule), got %v = %T, %T", stmts, stmts[0], stmts[1])
- }
- rule, ok := stmts[0].(*Rule)
- if !ok {
- return nil, fmt.Errorf("expected rule but got %T", stmts[0])
- }
- return rule, nil
+ return v1.ParseRuleWithOpts(input, setDefaultRegoVersion(opts))
}
// ParseRule returns exactly one rule.
@@ -622,20 +280,13 @@ func ParseStatement(input string) (Statement, error) {
return nil, err
}
if len(stmts) != 1 {
- return nil, fmt.Errorf("expected exactly one statement")
+ return nil, errors.New("expected exactly one statement")
}
return stmts[0], nil
}
func ParseStatementWithOpts(input string, popts ParserOptions) (Statement, error) {
- stmts, _, err := ParseStatementsWithOpts("", input, popts)
- if err != nil {
- return nil, err
- }
- if len(stmts) != 1 {
- return nil, fmt.Errorf("expected exactly one statement")
- }
- return stmts[0], nil
+ return v1.ParseStatementWithOpts(input, setDefaultRegoVersion(popts))
}
// ParseStatements is deprecated. Use ParseStatementWithOpts instead.
@@ -646,204 +297,15 @@ func ParseStatements(filename, input string) ([]Statement, []*Comment, error) {
// ParseStatementsWithOpts returns a slice of parsed statements. This is the
// default return value from the parser.
func ParseStatementsWithOpts(filename, input string, popts ParserOptions) ([]Statement, []*Comment, error) {
-
- parser := NewParser().
- WithFilename(filename).
- WithReader(bytes.NewBufferString(input)).
- WithProcessAnnotation(popts.ProcessAnnotation).
- WithFutureKeywords(popts.FutureKeywords...).
- WithAllFutureKeywords(popts.AllFutureKeywords).
- WithCapabilities(popts.Capabilities).
- WithSkipRules(popts.SkipRules).
- WithJSONOptions(popts.JSONOptions).
- WithRegoVersion(popts.RegoVersion).
- withUnreleasedKeywords(popts.unreleasedKeywords)
-
- stmts, comments, errs := parser.Parse()
-
- if len(errs) > 0 {
- return nil, nil, errs
- }
-
- return stmts, comments, nil
-}
-
-func parseModule(filename string, stmts []Statement, comments []*Comment, regoCompatibilityMode RegoVersion) (*Module, error) {
-
- if len(stmts) == 0 {
- return nil, NewError(ParseErr, &Location{File: filename}, "empty module")
- }
-
- var errs Errors
-
- pkg, ok := stmts[0].(*Package)
- if !ok {
- loc := stmts[0].Loc()
- errs = append(errs, NewError(ParseErr, loc, "package expected"))
- }
-
- mod := &Module{
- Package: pkg,
- stmts: stmts,
- }
-
- // The comments slice only holds comments that were not their own statements.
- mod.Comments = append(mod.Comments, comments...)
- mod.regoVersion = regoCompatibilityMode
-
- for i, stmt := range stmts[1:] {
- switch stmt := stmt.(type) {
- case *Import:
- mod.Imports = append(mod.Imports, stmt)
- if mod.regoVersion == RegoV0 && Compare(stmt.Path.Value, RegoV1CompatibleRef) == 0 {
- mod.regoVersion = RegoV0CompatV1
- }
- case *Rule:
- setRuleModule(stmt, mod)
- mod.Rules = append(mod.Rules, stmt)
- case Body:
- rule, err := ParseRuleFromBody(mod, stmt)
- if err != nil {
- errs = append(errs, NewError(ParseErr, stmt[0].Location, err.Error()))
- continue
- }
- rule.generatedBody = true
- mod.Rules = append(mod.Rules, rule)
-
- // NOTE(tsandall): the statement should now be interpreted as a
- // rule so update the statement list. This is important for the
- // logic below that associates annotations with statements.
- stmts[i+1] = rule
- case *Package:
- errs = append(errs, NewError(ParseErr, stmt.Loc(), "unexpected package"))
- case *Annotations:
- mod.Annotations = append(mod.Annotations, stmt)
- case *Comment:
- // Ignore comments, they're handled above.
- default:
- panic("illegal value") // Indicates grammar is out-of-sync with code.
- }
- }
-
- if mod.regoVersion == RegoV0CompatV1 || mod.regoVersion == RegoV1 {
- for _, rule := range mod.Rules {
- for r := rule; r != nil; r = r.Else {
- errs = append(errs, CheckRegoV1(r)...)
- }
- }
- }
-
- if len(errs) > 0 {
- return nil, errs
- }
-
- errs = append(errs, attachAnnotationsNodes(mod)...)
-
- if len(errs) > 0 {
- return nil, errs
- }
-
- attachRuleAnnotations(mod)
-
- return mod, nil
-}
-
-func ruleDeclarationHasKeyword(rule *Rule, keyword tokens.Token) bool {
- for _, kw := range rule.Head.keywords {
- if kw == keyword {
- return true
- }
- }
- return false
-}
-
-func newScopeAttachmentErr(a *Annotations, want string) *Error {
- var have string
- if a.node != nil {
- have = fmt.Sprintf(" (have %v)", TypeName(a.node))
- }
- return NewError(ParseErr, a.Loc(), "annotation scope '%v' must be applied to %v%v", a.Scope, want, have)
-}
-
-func setRuleModule(rule *Rule, module *Module) {
- rule.Module = module
- if rule.Else != nil {
- setRuleModule(rule.Else, module)
- }
-}
-
-func setJSONOptions(x interface{}, jsonOptions *astJSON.Options) {
- vis := NewGenericVisitor(func(x interface{}) bool {
- if x, ok := x.(customJSON); ok {
- x.setJSONOptions(*jsonOptions)
- }
- return false
- })
- vis.Walk(x)
+ return v1.ParseStatementsWithOpts(filename, input, setDefaultRegoVersion(popts))
}
// ParserErrorDetail holds additional details for parser errors.
-type ParserErrorDetail struct {
- Line string `json:"line"`
- Idx int `json:"idx"`
-}
-
-func newParserErrorDetail(bs []byte, offset int) *ParserErrorDetail {
-
- // Find first non-space character at or before offset position.
- if offset >= len(bs) {
- offset = len(bs) - 1
- } else if offset < 0 {
- offset = 0
- }
-
- for offset > 0 && unicode.IsSpace(rune(bs[offset])) {
- offset--
- }
-
- // Find beginning of line containing offset.
- begin := offset
-
- for begin > 0 && !isNewLineChar(bs[begin]) {
- begin--
- }
+type ParserErrorDetail = v1.ParserErrorDetail
- if isNewLineChar(bs[begin]) {
- begin++
+func setDefaultRegoVersion(opts ParserOptions) ParserOptions {
+ if opts.RegoVersion == RegoUndefined {
+ opts.RegoVersion = DefaultRegoVersion
}
-
- // Find end of line containing offset.
- end := offset
-
- for end < len(bs) && !isNewLineChar(bs[end]) {
- end++
- }
-
- if begin > end {
- begin = end
- }
-
- // Extract line and compute index of offset byte in line.
- line := bs[begin:end]
- index := offset - begin
-
- return &ParserErrorDetail{
- Line: string(line),
- Idx: index,
- }
-}
-
-// Lines returns the pretty formatted line output for the error details.
-func (d ParserErrorDetail) Lines() []string {
- line := strings.TrimLeft(d.Line, "\t") // remove leading tabs
- tabCount := len(d.Line) - len(line)
- indent := d.Idx - tabCount
- if indent < 0 {
- indent = 0
- }
- return []string{line, strings.Repeat(" ", indent) + "^"}
-}
-
-func isNewLineChar(b byte) bool {
- return b == '\r' || b == '\n'
+ return opts
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/policy.go b/vendor/github.com/open-policy-agent/opa/ast/policy.go
index 43e9bba4a3..5055e8f23f 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/policy.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/policy.go
@@ -1,196 +1,113 @@
-// Copyright 2016 The OPA Authors. All rights reserved.
+// Copyright 2024 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 (
- "bytes"
- "encoding/json"
- "fmt"
- "math/rand"
- "strings"
- "time"
-
- "github.com/open-policy-agent/opa/ast/internal/tokens"
astJSON "github.com/open-policy-agent/opa/ast/json"
- "github.com/open-policy-agent/opa/util"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
-// Initialize seed for term hashing. This is intentionally placed before the
-// root document sets are constructed to ensure they use the same hash seed as
-// subsequent lookups. If the hash seeds are out of sync, lookups will fail.
-var hashSeed = rand.New(rand.NewSource(time.Now().UnixNano()))
-var hashSeed0 = (uint64(hashSeed.Uint32()) << 32) | uint64(hashSeed.Uint32())
-
// DefaultRootDocument is the default root document.
//
// All package directives inside source files are implicitly prefixed with the
// DefaultRootDocument value.
-var DefaultRootDocument = VarTerm("data")
+var DefaultRootDocument = v1.DefaultRootDocument
// InputRootDocument names the document containing query arguments.
-var InputRootDocument = VarTerm("input")
+var InputRootDocument = v1.InputRootDocument
// SchemaRootDocument names the document containing external data schemas.
-var SchemaRootDocument = VarTerm("schema")
+var SchemaRootDocument = v1.SchemaRootDocument
// FunctionArgRootDocument names the document containing function arguments.
// It's only for internal usage, for referencing function arguments between
// the index and topdown.
-var FunctionArgRootDocument = VarTerm("args")
+var FunctionArgRootDocument = v1.FunctionArgRootDocument
// FutureRootDocument names the document containing new, to-become-default,
// features.
-var FutureRootDocument = VarTerm("future")
+var FutureRootDocument = v1.FutureRootDocument
// RegoRootDocument names the document containing new, to-become-default,
// features in a future versioned release.
-var RegoRootDocument = VarTerm("rego")
+var RegoRootDocument = v1.RegoRootDocument
// RootDocumentNames contains the names of top-level documents that can be
// referred to in modules and queries.
//
// Note, the schema document is not currently implemented in the evaluator so it
// is not registered as a root document name (yet).
-var RootDocumentNames = NewSet(
- DefaultRootDocument,
- InputRootDocument,
-)
+var RootDocumentNames = v1.RootDocumentNames
// DefaultRootRef is a reference to the root of the default document.
//
// All refs to data in the policy engine's storage layer are prefixed with this ref.
-var DefaultRootRef = Ref{DefaultRootDocument}
+var DefaultRootRef = v1.DefaultRootRef
// InputRootRef is a reference to the root of the input document.
//
// All refs to query arguments are prefixed with this ref.
-var InputRootRef = Ref{InputRootDocument}
+var InputRootRef = v1.InputRootRef
// SchemaRootRef is a reference to the root of the schema document.
//
// All refs to schema documents are prefixed with this ref. Note, the schema
// document is not currently implemented in the evaluator so it is not
// registered as a root document ref (yet).
-var SchemaRootRef = Ref{SchemaRootDocument}
+var SchemaRootRef = v1.SchemaRootRef
// RootDocumentRefs contains the prefixes of top-level documents that all
// non-local references start with.
-var RootDocumentRefs = NewSet(
- NewTerm(DefaultRootRef),
- NewTerm(InputRootRef),
-)
+var RootDocumentRefs = v1.RootDocumentRefs
// SystemDocumentKey is the name of the top-level key that identifies the system
// document.
-var SystemDocumentKey = String("system")
+const SystemDocumentKey = v1.SystemDocumentKey
// ReservedVars is the set of names that refer to implicitly ground vars.
-var ReservedVars = NewVarSet(
- DefaultRootDocument.Value.(Var),
- InputRootDocument.Value.(Var),
-)
+var ReservedVars = v1.ReservedVars
// Wildcard represents the wildcard variable as defined in the language.
-var Wildcard = &Term{Value: Var("_")}
+var Wildcard = v1.Wildcard
// WildcardPrefix is the special character that all wildcard variables are
// prefixed with when the statement they are contained in is parsed.
-var WildcardPrefix = "$"
+const WildcardPrefix = v1.WildcardPrefix
// Keywords contains strings that map to language keywords.
-var Keywords = KeywordsForRegoVersion(DefaultRegoVersion)
+var Keywords = v1.Keywords
-var KeywordsV0 = [...]string{
- "not",
- "package",
- "import",
- "as",
- "default",
- "else",
- "with",
- "null",
- "true",
- "false",
- "some",
-}
+var KeywordsV0 = v1.KeywordsV0
-var KeywordsV1 = [...]string{
- "not",
- "package",
- "import",
- "as",
- "default",
- "else",
- "with",
- "null",
- "true",
- "false",
- "some",
- "if",
- "contains",
- "in",
- "every",
-}
+var KeywordsV1 = v1.KeywordsV1
func KeywordsForRegoVersion(v RegoVersion) []string {
- switch v {
- case RegoV0:
- return KeywordsV0[:]
- case RegoV1, RegoV0CompatV1:
- return KeywordsV1[:]
- }
- return nil
+ return v1.KeywordsForRegoVersion(v)
}
// IsKeyword returns true if s is a language keyword.
func IsKeyword(s string) bool {
- return IsInKeywords(s, Keywords)
+ return v1.IsKeyword(s)
}
func IsInKeywords(s string, keywords []string) bool {
- for _, x := range keywords {
- if x == s {
- return true
- }
- }
- return false
+ return v1.IsInKeywords(s, keywords)
}
// IsKeywordInRegoVersion returns true if s is a language keyword.
func IsKeywordInRegoVersion(s string, regoVersion RegoVersion) bool {
- switch regoVersion {
- case RegoV0:
- for _, x := range KeywordsV0 {
- if x == s {
- return true
- }
- }
- case RegoV1, RegoV0CompatV1:
- for _, x := range KeywordsV1 {
- if x == s {
- return true
- }
- }
- }
-
- return false
+ return v1.IsKeywordInRegoVersion(s, regoVersion)
}
type (
// Node represents a node in an AST. Nodes may be statements in a policy module
// or elements of an ad-hoc query, expression, etc.
- Node interface {
- fmt.Stringer
- Loc() *Location
- SetLoc(*Location)
- }
+ Node = v1.Node
// Statement represents a single statement in a policy module.
- Statement interface {
- Node
- }
+ Statement = v1.Statement
)
type (
@@ -198,1894 +115,121 @@ type (
// Module represents a collection of policies (defined by rules)
// within a namespace (defined by the package) and optional
// dependencies on external documents (defined by imports).
- Module struct {
- Package *Package `json:"package"`
- Imports []*Import `json:"imports,omitempty"`
- Annotations []*Annotations `json:"annotations,omitempty"`
- Rules []*Rule `json:"rules,omitempty"`
- Comments []*Comment `json:"comments,omitempty"`
- stmts []Statement
- regoVersion RegoVersion
- }
+ Module = v1.Module
// Comment contains the raw text from the comment in the definition.
- Comment struct {
- // TODO: these fields have inconsistent JSON keys with other structs in this package.
- Text []byte
- Location *Location
-
- jsonOptions astJSON.Options
- }
+ Comment = v1.Comment
// Package represents the namespace of the documents produced
// by rules inside the module.
- Package struct {
- Path Ref `json:"path"`
- Location *Location `json:"location,omitempty"`
-
- jsonOptions astJSON.Options
- }
+ Package = v1.Package
// Import represents a dependency on a document outside of the policy
// namespace. Imports are optional.
- Import struct {
- Path *Term `json:"path"`
- Alias Var `json:"alias,omitempty"`
- Location *Location `json:"location,omitempty"`
-
- jsonOptions astJSON.Options
- }
+ Import = v1.Import
// Rule represents a rule as defined in the language. Rules define the
// content of documents that represent policy decisions.
- Rule struct {
- Default bool `json:"default,omitempty"`
- Head *Head `json:"head"`
- Body Body `json:"body"`
- Else *Rule `json:"else,omitempty"`
- Location *Location `json:"location,omitempty"`
- Annotations []*Annotations `json:"annotations,omitempty"`
-
- // Module is a pointer to the module containing this rule. If the rule
- // was NOT created while parsing/constructing a module, this should be
- // left unset. The pointer is not included in any standard operations
- // on the rule (e.g., printing, comparison, visiting, etc.)
- Module *Module `json:"-"`
-
- generatedBody bool
- jsonOptions astJSON.Options
- }
+ Rule = v1.Rule
// Head represents the head of a rule.
- Head struct {
- Name Var `json:"name,omitempty"`
- Reference Ref `json:"ref,omitempty"`
- Args Args `json:"args,omitempty"`
- Key *Term `json:"key,omitempty"`
- Value *Term `json:"value,omitempty"`
- Assign bool `json:"assign,omitempty"`
- Location *Location `json:"location,omitempty"`
-
- keywords []tokens.Token
- generatedValue bool
- jsonOptions astJSON.Options
- }
+ Head = v1.Head
// Args represents zero or more arguments to a rule.
- Args []*Term
+ Args = v1.Args
// Body represents one or more expressions contained inside a rule or user
// function.
- Body []*Expr
+ Body = v1.Body
// Expr represents a single expression contained inside the body of a rule.
- Expr struct {
- With []*With `json:"with,omitempty"`
- Terms interface{} `json:"terms"`
- Index int `json:"index"`
- Generated bool `json:"generated,omitempty"`
- Negated bool `json:"negated,omitempty"`
- Location *Location `json:"location,omitempty"`
-
- jsonOptions astJSON.Options
- generatedFrom *Expr
- generates []*Expr
- }
+ Expr = v1.Expr
// SomeDecl represents a variable declaration statement. The symbols are variables.
- SomeDecl struct {
- Symbols []*Term `json:"symbols"`
- Location *Location `json:"location,omitempty"`
+ SomeDecl = v1.SomeDecl
- jsonOptions astJSON.Options
- }
-
- Every struct {
- Key *Term `json:"key"`
- Value *Term `json:"value"`
- Domain *Term `json:"domain"`
- Body Body `json:"body"`
- Location *Location `json:"location,omitempty"`
-
- jsonOptions astJSON.Options
- }
+ Every = v1.Every
// With represents a modifier on an expression.
- With struct {
- Target *Term `json:"target"`
- Value *Term `json:"value"`
- Location *Location `json:"location,omitempty"`
-
- jsonOptions astJSON.Options
- }
+ With = v1.With
)
-// Compare returns an integer indicating whether mod is less than, equal to,
-// or greater than other.
-func (mod *Module) Compare(other *Module) int {
- if mod == nil {
- if other == nil {
- return 0
- }
- return -1
- } else if other == nil {
- return 1
- }
- if cmp := mod.Package.Compare(other.Package); cmp != 0 {
- return cmp
- }
- if cmp := importsCompare(mod.Imports, other.Imports); cmp != 0 {
- return cmp
- }
- if cmp := annotationsCompare(mod.Annotations, other.Annotations); cmp != 0 {
- return cmp
- }
- return rulesCompare(mod.Rules, other.Rules)
-}
-
-// Copy returns a deep copy of mod.
-func (mod *Module) Copy() *Module {
- cpy := *mod
- cpy.Rules = make([]*Rule, len(mod.Rules))
-
- nodes := make(map[Node]Node, len(mod.Rules)+len(mod.Imports)+1 /* package */)
-
- for i := range mod.Rules {
- cpy.Rules[i] = mod.Rules[i].Copy()
- cpy.Rules[i].Module = &cpy
- nodes[mod.Rules[i]] = cpy.Rules[i]
- }
-
- cpy.Imports = make([]*Import, len(mod.Imports))
- for i := range mod.Imports {
- cpy.Imports[i] = mod.Imports[i].Copy()
- nodes[mod.Imports[i]] = cpy.Imports[i]
- }
-
- cpy.Package = mod.Package.Copy()
- nodes[mod.Package] = cpy.Package
-
- cpy.Annotations = make([]*Annotations, len(mod.Annotations))
- for i, a := range mod.Annotations {
- cpy.Annotations[i] = a.Copy(nodes[a.node])
- }
-
- cpy.Comments = make([]*Comment, len(mod.Comments))
- for i := range mod.Comments {
- cpy.Comments[i] = mod.Comments[i].Copy()
- }
-
- cpy.stmts = make([]Statement, len(mod.stmts))
- for i := range mod.stmts {
- cpy.stmts[i] = nodes[mod.stmts[i]]
- }
-
- return &cpy
-}
-
-// Equal returns true if mod equals other.
-func (mod *Module) Equal(other *Module) bool {
- return mod.Compare(other) == 0
-}
-
-func (mod *Module) String() string {
- byNode := map[Node][]*Annotations{}
- for _, a := range mod.Annotations {
- byNode[a.node] = append(byNode[a.node], a)
- }
-
- appendAnnotationStrings := func(buf []string, node Node) []string {
- if as, ok := byNode[node]; ok {
- for i := range as {
- buf = append(buf, "# METADATA")
- buf = append(buf, "# "+as[i].String())
- }
- }
- return buf
- }
-
- buf := []string{}
- buf = appendAnnotationStrings(buf, mod.Package)
- buf = append(buf, mod.Package.String())
-
- if len(mod.Imports) > 0 {
- buf = append(buf, "")
- for _, imp := range mod.Imports {
- buf = appendAnnotationStrings(buf, imp)
- buf = append(buf, imp.String())
- }
- }
- if len(mod.Rules) > 0 {
- buf = append(buf, "")
- for _, rule := range mod.Rules {
- buf = appendAnnotationStrings(buf, rule)
- buf = append(buf, rule.stringWithOpts(toStringOpts{regoVersion: mod.regoVersion}))
- }
- }
- return strings.Join(buf, "\n")
-}
-
-// RuleSet returns a RuleSet containing named rules in the mod.
-func (mod *Module) RuleSet(name Var) RuleSet {
- rs := NewRuleSet()
- for _, rule := range mod.Rules {
- if rule.Head.Name.Equal(name) {
- rs.Add(rule)
- }
- }
- return rs
-}
-
-// UnmarshalJSON parses bs and stores the result in mod. The rules in the module
-// will have their module pointer set to mod.
-func (mod *Module) UnmarshalJSON(bs []byte) error {
-
- // Declare a new type and use a type conversion to avoid recursively calling
- // Module#UnmarshalJSON.
- type module Module
-
- if err := util.UnmarshalJSON(bs, (*module)(mod)); err != nil {
- return err
- }
-
- WalkRules(mod, func(rule *Rule) bool {
- rule.Module = mod
- return false
- })
-
- return nil
-}
-
-func (mod *Module) regoV1Compatible() bool {
- return mod.regoVersion == RegoV1 || mod.regoVersion == RegoV0CompatV1
-}
-
-func (mod *Module) RegoVersion() RegoVersion {
- return mod.regoVersion
-}
-
-// SetRegoVersion sets the RegoVersion for the module.
-// Note: Setting a rego-version that does not match the module's rego-version might have unintended consequences.
-func (mod *Module) SetRegoVersion(v RegoVersion) {
- mod.regoVersion = v
-}
-
// NewComment returns a new Comment object.
func NewComment(text []byte) *Comment {
- return &Comment{
- Text: text,
- }
-}
-
-// Loc returns the location of the comment in the definition.
-func (c *Comment) Loc() *Location {
- if c == nil {
- return nil
- }
- return c.Location
-}
-
-// SetLoc sets the location on c.
-func (c *Comment) SetLoc(loc *Location) {
- c.Location = loc
-}
-
-func (c *Comment) String() string {
- return "#" + string(c.Text)
-}
-
-// Copy returns a deep copy of c.
-func (c *Comment) Copy() *Comment {
- cpy := *c
- cpy.Text = make([]byte, len(c.Text))
- copy(cpy.Text, c.Text)
- return &cpy
-}
-
-// Equal returns true if this comment equals the other comment.
-// Unlike other equality checks on AST nodes, comment equality
-// depends on location.
-func (c *Comment) Equal(other *Comment) bool {
- return c.Location.Equal(other.Location) && bytes.Equal(c.Text, other.Text)
-}
-
-func (c *Comment) setJSONOptions(opts astJSON.Options) {
- // Note: this is not used for location since Comments use default JSON marshaling
- // behavior with struct field names in JSON.
- c.jsonOptions = opts
- if c.Location != nil {
- c.Location.JSONOptions = opts
- }
-}
-
-// Compare returns an integer indicating whether pkg is less than, equal to,
-// or greater than other.
-func (pkg *Package) Compare(other *Package) int {
- return Compare(pkg.Path, other.Path)
-}
-
-// Copy returns a deep copy of pkg.
-func (pkg *Package) Copy() *Package {
- cpy := *pkg
- cpy.Path = pkg.Path.Copy()
- return &cpy
-}
-
-// Equal returns true if pkg is equal to other.
-func (pkg *Package) Equal(other *Package) bool {
- return pkg.Compare(other) == 0
-}
-
-// Loc returns the location of the Package in the definition.
-func (pkg *Package) Loc() *Location {
- if pkg == nil {
- return nil
- }
- return pkg.Location
-}
-
-// SetLoc sets the location on pkg.
-func (pkg *Package) SetLoc(loc *Location) {
- pkg.Location = loc
-}
-
-func (pkg *Package) String() string {
- if pkg == nil {
- return ""
- } else if len(pkg.Path) <= 1 {
- return fmt.Sprintf("package ", pkg.Path)
- }
- // Omit head as all packages have the DefaultRootDocument prepended at parse time.
- path := make(Ref, len(pkg.Path)-1)
- path[0] = VarTerm(string(pkg.Path[1].Value.(String)))
- copy(path[1:], pkg.Path[2:])
- return fmt.Sprintf("package %v", path)
-}
-
-func (pkg *Package) setJSONOptions(opts astJSON.Options) {
- pkg.jsonOptions = opts
- if pkg.Location != nil {
- pkg.Location.JSONOptions = opts
- }
-}
-
-func (pkg *Package) MarshalJSON() ([]byte, error) {
- data := map[string]interface{}{
- "path": pkg.Path,
- }
-
- if pkg.jsonOptions.MarshalOptions.IncludeLocation.Package {
- if pkg.Location != nil {
- data["location"] = pkg.Location
- }
- }
-
- return json.Marshal(data)
+ return v1.NewComment(text)
}
// IsValidImportPath returns an error indicating if the import path is invalid.
// If the import path is valid, err is nil.
func IsValidImportPath(v Value) (err error) {
- switch v := v.(type) {
- case Var:
- if !v.Equal(DefaultRootDocument.Value) && !v.Equal(InputRootDocument.Value) {
- return fmt.Errorf("invalid path %v: path must begin with input or data", v)
- }
- case Ref:
- if err := IsValidImportPath(v[0].Value); err != nil {
- return fmt.Errorf("invalid path %v: path must begin with input or data", v)
- }
- for _, e := range v[1:] {
- if _, ok := e.Value.(String); !ok {
- return fmt.Errorf("invalid path %v: path elements must be strings", v)
- }
- }
- default:
- return fmt.Errorf("invalid path %v: path must be ref or var", v)
- }
- return nil
-}
-
-// Compare returns an integer indicating whether imp is less than, equal to,
-// or greater than other.
-func (imp *Import) Compare(other *Import) int {
- if imp == nil {
- if other == nil {
- return 0
- }
- return -1
- } else if other == nil {
- return 1
- }
- if cmp := Compare(imp.Path, other.Path); cmp != 0 {
- return cmp
- }
- return Compare(imp.Alias, other.Alias)
-}
-
-// Copy returns a deep copy of imp.
-func (imp *Import) Copy() *Import {
- cpy := *imp
- cpy.Path = imp.Path.Copy()
- return &cpy
-}
-
-// Equal returns true if imp is equal to other.
-func (imp *Import) Equal(other *Import) bool {
- return imp.Compare(other) == 0
-}
-
-// Loc returns the location of the Import in the definition.
-func (imp *Import) Loc() *Location {
- if imp == nil {
- return nil
- }
- return imp.Location
-}
-
-// SetLoc sets the location on imp.
-func (imp *Import) SetLoc(loc *Location) {
- imp.Location = loc
-}
-
-// Name returns the variable that is used to refer to the imported virtual
-// document. This is the alias if defined otherwise the last element in the
-// path.
-func (imp *Import) Name() Var {
- if len(imp.Alias) != 0 {
- return imp.Alias
- }
- switch v := imp.Path.Value.(type) {
- case Var:
- return v
- case Ref:
- if len(v) == 1 {
- return v[0].Value.(Var)
- }
- return Var(v[len(v)-1].Value.(String))
- }
- panic("illegal import")
-}
-
-func (imp *Import) String() string {
- buf := []string{"import", imp.Path.String()}
- if len(imp.Alias) > 0 {
- buf = append(buf, "as "+imp.Alias.String())
- }
- return strings.Join(buf, " ")
-}
-
-func (imp *Import) setJSONOptions(opts astJSON.Options) {
- imp.jsonOptions = opts
- if imp.Location != nil {
- imp.Location.JSONOptions = opts
- }
-}
-
-func (imp *Import) MarshalJSON() ([]byte, error) {
- data := map[string]interface{}{
- "path": imp.Path,
- }
-
- if len(imp.Alias) != 0 {
- data["alias"] = imp.Alias
- }
-
- if imp.jsonOptions.MarshalOptions.IncludeLocation.Import {
- if imp.Location != nil {
- data["location"] = imp.Location
- }
- }
-
- return json.Marshal(data)
-}
-
-// Compare returns an integer indicating whether rule is less than, equal to,
-// or greater than other.
-func (rule *Rule) Compare(other *Rule) int {
- if rule == nil {
- if other == nil {
- return 0
- }
- return -1
- } else if other == nil {
- return 1
- }
- if cmp := rule.Head.Compare(other.Head); cmp != 0 {
- return cmp
- }
- if cmp := util.Compare(rule.Default, other.Default); cmp != 0 {
- return cmp
- }
- if cmp := rule.Body.Compare(other.Body); cmp != 0 {
- return cmp
- }
-
- if cmp := annotationsCompare(rule.Annotations, other.Annotations); cmp != 0 {
- return cmp
- }
-
- return rule.Else.Compare(other.Else)
-}
-
-// Copy returns a deep copy of rule.
-func (rule *Rule) Copy() *Rule {
- cpy := *rule
- cpy.Head = rule.Head.Copy()
- cpy.Body = rule.Body.Copy()
-
- cpy.Annotations = make([]*Annotations, len(rule.Annotations))
- for i, a := range rule.Annotations {
- cpy.Annotations[i] = a.Copy(&cpy)
- }
-
- if cpy.Else != nil {
- cpy.Else = rule.Else.Copy()
- }
- return &cpy
-}
-
-// Equal returns true if rule is equal to other.
-func (rule *Rule) Equal(other *Rule) bool {
- return rule.Compare(other) == 0
-}
-
-// Loc returns the location of the Rule in the definition.
-func (rule *Rule) Loc() *Location {
- if rule == nil {
- return nil
- }
- return rule.Location
-}
-
-// SetLoc sets the location on rule.
-func (rule *Rule) SetLoc(loc *Location) {
- rule.Location = loc
-}
-
-// Path returns a ref referring to the document produced by this rule. If rule
-// is not contained in a module, this function panics.
-// Deprecated: Poor handling of ref rules. Use `(*Rule).Ref()` instead.
-func (rule *Rule) Path() Ref {
- if rule.Module == nil {
- panic("assertion failed")
- }
- return rule.Module.Package.Path.Extend(rule.Head.Ref().GroundPrefix())
-}
-
-// Ref returns a ref referring to the document produced by this rule. If rule
-// is not contained in a module, this function panics. The returned ref may
-// contain variables in the last position.
-func (rule *Rule) Ref() Ref {
- if rule.Module == nil {
- panic("assertion failed")
- }
- return rule.Module.Package.Path.Extend(rule.Head.Ref())
-}
-
-func (rule *Rule) String() string {
- return rule.stringWithOpts(toStringOpts{})
-}
-
-type toStringOpts struct {
- regoVersion RegoVersion
-}
-
-func (rule *Rule) stringWithOpts(opts toStringOpts) string {
- buf := []string{}
- if rule.Default {
- buf = append(buf, "default")
- }
- buf = append(buf, rule.Head.stringWithOpts(opts))
- if !rule.Default {
- switch opts.regoVersion {
- case RegoV1, RegoV0CompatV1:
- buf = append(buf, "if")
- }
- buf = append(buf, "{")
- buf = append(buf, rule.Body.String())
- buf = append(buf, "}")
- }
- if rule.Else != nil {
- buf = append(buf, rule.Else.elseString(opts))
- }
- return strings.Join(buf, " ")
-}
-
-func (rule *Rule) isFunction() bool {
- return len(rule.Head.Args) > 0
-}
-
-func (rule *Rule) setJSONOptions(opts astJSON.Options) {
- rule.jsonOptions = opts
- if rule.Location != nil {
- rule.Location.JSONOptions = opts
- }
-}
-
-func (rule *Rule) MarshalJSON() ([]byte, error) {
- data := map[string]interface{}{
- "head": rule.Head,
- "body": rule.Body,
- }
-
- if rule.Default {
- data["default"] = true
- }
-
- if rule.Else != nil {
- data["else"] = rule.Else
- }
-
- if rule.jsonOptions.MarshalOptions.IncludeLocation.Rule {
- if rule.Location != nil {
- data["location"] = rule.Location
- }
- }
-
- if len(rule.Annotations) != 0 {
- data["annotations"] = rule.Annotations
- }
-
- return json.Marshal(data)
-}
-
-func (rule *Rule) elseString(opts toStringOpts) string {
- var buf []string
-
- buf = append(buf, "else")
-
- value := rule.Head.Value
- if value != nil {
- buf = append(buf, "=")
- buf = append(buf, value.String())
- }
-
- switch opts.regoVersion {
- case RegoV1, RegoV0CompatV1:
- buf = append(buf, "if")
- }
-
- buf = append(buf, "{")
- buf = append(buf, rule.Body.String())
- buf = append(buf, "}")
-
- if rule.Else != nil {
- buf = append(buf, rule.Else.elseString(opts))
- }
-
- return strings.Join(buf, " ")
+ return v1.IsValidImportPath(v)
}
// NewHead returns a new Head object. If args are provided, the first will be
// used for the key and the second will be used for the value.
func NewHead(name Var, args ...*Term) *Head {
- head := &Head{
- Name: name, // backcompat
- Reference: []*Term{NewTerm(name)},
- }
- if len(args) == 0 {
- return head
- }
- head.Key = args[0]
- if len(args) == 1 {
- return head
- }
- head.Value = args[1]
- if head.Key != nil && head.Value != nil {
- head.Reference = head.Reference.Append(args[0])
- }
- return head
+ return v1.NewHead(name, args...)
}
// VarHead creates a head object, initializes its Name, Location, and Options,
// and returns the new head.
func VarHead(name Var, location *Location, jsonOpts *astJSON.Options) *Head {
- h := NewHead(name)
- h.Reference[0].Location = location
- if jsonOpts != nil {
- h.Reference[0].setJSONOptions(*jsonOpts)
- }
- return h
+ return v1.VarHead(name, location, jsonOpts)
}
// RefHead returns a new Head object with the passed Ref. If args are provided,
// the first will be used for the value.
func RefHead(ref Ref, args ...*Term) *Head {
- head := &Head{}
- head.SetRef(ref)
- if len(ref) < 2 {
- head.Name = ref[0].Value.(Var)
- }
- if len(args) >= 1 {
- head.Value = args[0]
- }
- return head
+ return v1.RefHead(ref, args...)
}
// DocKind represents the collection of document types that can be produced by rules.
-type DocKind int
+type DocKind = v1.DocKind
const (
// CompleteDoc represents a document that is completely defined by the rule.
- CompleteDoc = iota
+ CompleteDoc = v1.CompleteDoc
// PartialSetDoc represents a set document that is partially defined by the rule.
- PartialSetDoc
+ PartialSetDoc = v1.PartialSetDoc
// PartialObjectDoc represents an object document that is partially defined by the rule.
- PartialObjectDoc
-) // TODO(sr): Deprecate?
-
-// DocKind returns the type of document produced by this rule.
-func (head *Head) DocKind() DocKind {
- if head.Key != nil {
- if head.Value != nil {
- return PartialObjectDoc
- }
- return PartialSetDoc
- }
- return CompleteDoc
-}
+ PartialObjectDoc = v1.PartialObjectDoc
+)
-type RuleKind int
+type RuleKind = v1.RuleKind
const (
- SingleValue = iota
- MultiValue
+ SingleValue = v1.SingleValue
+ MultiValue = v1.MultiValue
)
-// RuleKind returns the type of rule this is
-func (head *Head) RuleKind() RuleKind {
- // NOTE(sr): This is bit verbose, since the key is irrelevant for single vs
- // multi value, but as good a spot as to assert the invariant.
- switch {
- case head.Value != nil:
- return SingleValue
- case head.Key != nil:
- return MultiValue
- default:
- panic("unreachable")
- }
-}
-
-// Ref returns the Ref of the rule. If it doesn't have one, it's filled in
-// via the Head's Name.
-func (head *Head) Ref() Ref {
- if len(head.Reference) > 0 {
- return head.Reference
- }
- return Ref{&Term{Value: head.Name}}
-}
-
-// SetRef can be used to set a rule head's Reference
-func (head *Head) SetRef(r Ref) {
- head.Reference = r
-}
-
-// Compare returns an integer indicating whether head is less than, equal to,
-// or greater than other.
-func (head *Head) Compare(other *Head) int {
- if head == nil {
- if other == nil {
- return 0
- }
- return -1
- } else if other == nil {
- return 1
- }
- if head.Assign && !other.Assign {
- return -1
- } else if !head.Assign && other.Assign {
- return 1
- }
- if cmp := Compare(head.Args, other.Args); cmp != 0 {
- return cmp
- }
- if cmp := Compare(head.Reference, other.Reference); cmp != 0 {
- return cmp
- }
- if cmp := Compare(head.Name, other.Name); cmp != 0 {
- return cmp
- }
- if cmp := Compare(head.Key, other.Key); cmp != 0 {
- return cmp
- }
- return Compare(head.Value, other.Value)
-}
-
-// Copy returns a deep copy of head.
-func (head *Head) Copy() *Head {
- cpy := *head
- cpy.Reference = head.Reference.Copy()
- cpy.Args = head.Args.Copy()
- cpy.Key = head.Key.Copy()
- cpy.Value = head.Value.Copy()
- cpy.keywords = nil
- return &cpy
-}
-
-// Equal returns true if this head equals other.
-func (head *Head) Equal(other *Head) bool {
- return head.Compare(other) == 0
-}
-
-func (head *Head) String() string {
- return head.stringWithOpts(toStringOpts{})
-}
-
-func (head *Head) stringWithOpts(opts toStringOpts) string {
- buf := strings.Builder{}
- buf.WriteString(head.Ref().String())
- containsAdded := false
-
- switch {
- case len(head.Args) != 0:
- buf.WriteString(head.Args.String())
- case len(head.Reference) == 1 && head.Key != nil:
- switch opts.regoVersion {
- case RegoV0:
- buf.WriteRune('[')
- buf.WriteString(head.Key.String())
- buf.WriteRune(']')
- default:
- containsAdded = true
- buf.WriteString(" contains ")
- buf.WriteString(head.Key.String())
- }
- }
- if head.Value != nil {
- if head.Assign {
- buf.WriteString(" := ")
- } else {
- buf.WriteString(" = ")
- }
- buf.WriteString(head.Value.String())
- } else if !containsAdded && head.Name == "" && head.Key != nil {
- buf.WriteString(" contains ")
- buf.WriteString(head.Key.String())
- }
- return buf.String()
-}
-
-func (head *Head) setJSONOptions(opts astJSON.Options) {
- head.jsonOptions = opts
- if head.Location != nil {
- head.Location.JSONOptions = opts
- }
-}
-
-func (head *Head) MarshalJSON() ([]byte, error) {
- var loc *Location
- includeLoc := head.jsonOptions.MarshalOptions.IncludeLocation
- if includeLoc.Head {
- if head.Location != nil {
- loc = head.Location
- }
-
- for _, term := range head.Reference {
- if term.Location != nil {
- term.jsonOptions.MarshalOptions.IncludeLocation.Term = includeLoc.Term
- }
- }
- }
-
- // NOTE(sr): we do this to override the rendering of `head.Reference`.
- // It's still what'll be used via the default means of encoding/json
- // for unmarshaling a json object into a Head struct!
- type h Head
- return json.Marshal(struct {
- h
- Ref Ref `json:"ref"`
- Location *Location `json:"location,omitempty"`
- }{
- h: h(*head),
- Ref: head.Ref(),
- Location: loc,
- })
-}
-
-// Vars returns a set of vars found in the head.
-func (head *Head) Vars() VarSet {
- vis := &VarVisitor{vars: VarSet{}}
- // TODO: improve test coverage for this.
- if head.Args != nil {
- vis.Walk(head.Args)
- }
- if head.Key != nil {
- vis.Walk(head.Key)
- }
- if head.Value != nil {
- vis.Walk(head.Value)
- }
- if len(head.Reference) > 0 {
- vis.Walk(head.Reference[1:])
- }
- return vis.vars
-}
-
-// Loc returns the Location of head.
-func (head *Head) Loc() *Location {
- if head == nil {
- return nil
- }
- return head.Location
-}
-
-// SetLoc sets the location on head.
-func (head *Head) SetLoc(loc *Location) {
- head.Location = loc
-}
-
-func (head *Head) HasDynamicRef() bool {
- pos := head.Reference.Dynamic()
- // Ref is dynamic if it has one non-constant term that isn't the first or last term or if it's a partial set rule.
- return pos > 0 && (pos < len(head.Reference)-1 || head.RuleKind() == MultiValue)
-}
-
-// Copy returns a deep copy of a.
-func (a Args) Copy() Args {
- cpy := Args{}
- for _, t := range a {
- cpy = append(cpy, t.Copy())
- }
- return cpy
-}
-
-func (a Args) String() string {
- buf := make([]string, 0, len(a))
- for _, t := range a {
- buf = append(buf, t.String())
- }
- return "(" + strings.Join(buf, ", ") + ")"
-}
-
-// Loc returns the Location of a.
-func (a Args) Loc() *Location {
- if len(a) == 0 {
- return nil
- }
- return a[0].Location
-}
-
-// SetLoc sets the location on a.
-func (a Args) SetLoc(loc *Location) {
- if len(a) != 0 {
- a[0].SetLocation(loc)
- }
-}
-
-// Vars returns a set of vars that appear in a.
-func (a Args) Vars() VarSet {
- vis := &VarVisitor{vars: VarSet{}}
- vis.Walk(a)
- return vis.vars
-}
-
// NewBody returns a new Body containing the given expressions. The indices of
// the immediate expressions will be reset.
func NewBody(exprs ...*Expr) Body {
- for i, expr := range exprs {
- expr.Index = i
- }
- return Body(exprs)
-}
-
-// MarshalJSON returns JSON encoded bytes representing body.
-func (body Body) MarshalJSON() ([]byte, error) {
- // Serialize empty Body to empty array. This handles both the empty case and the
- // nil case (whereas by default the result would be null if body was nil.)
- if len(body) == 0 {
- return []byte(`[]`), nil
- }
- ret, err := json.Marshal([]*Expr(body))
- return ret, err
-}
-
-// Append adds the expr to the body and updates the expr's index accordingly.
-func (body *Body) Append(expr *Expr) {
- n := len(*body)
- expr.Index = n
- *body = append(*body, expr)
-}
-
-// Set sets the expr in the body at the specified position and updates the
-// expr's index accordingly.
-func (body Body) Set(expr *Expr, pos int) {
- body[pos] = expr
- expr.Index = pos
-}
-
-// Compare returns an integer indicating whether body is less than, equal to,
-// or greater than other.
-//
-// If body is a subset of other, it is considered less than (and vice versa).
-func (body Body) Compare(other Body) int {
- minLen := len(body)
- if len(other) < minLen {
- minLen = len(other)
- }
- for i := 0; i < minLen; i++ {
- if cmp := body[i].Compare(other[i]); cmp != 0 {
- return cmp
- }
- }
- if len(body) < len(other) {
- return -1
- }
- if len(other) < len(body) {
- return 1
- }
- return 0
-}
-
-// Copy returns a deep copy of body.
-func (body Body) Copy() Body {
- cpy := make(Body, len(body))
- for i := range body {
- cpy[i] = body[i].Copy()
- }
- return cpy
-}
-
-// Contains returns true if this body contains the given expression.
-func (body Body) Contains(x *Expr) bool {
- for _, e := range body {
- if e.Equal(x) {
- return true
- }
- }
- return false
-}
-
-// Equal returns true if this Body is equal to the other Body.
-func (body Body) Equal(other Body) bool {
- return body.Compare(other) == 0
-}
-
-// Hash returns the hash code for the Body.
-func (body Body) Hash() int {
- s := 0
- for _, e := range body {
- s += e.Hash()
- }
- return s
-}
-
-// IsGround returns true if all of the expressions in the Body are ground.
-func (body Body) IsGround() bool {
- for _, e := range body {
- if !e.IsGround() {
- return false
- }
- }
- return true
-}
-
-// Loc returns the location of the Body in the definition.
-func (body Body) Loc() *Location {
- if len(body) == 0 {
- return nil
- }
- return body[0].Location
-}
-
-// SetLoc sets the location on body.
-func (body Body) SetLoc(loc *Location) {
- if len(body) != 0 {
- body[0].SetLocation(loc)
- }
-}
-
-func (body Body) String() string {
- buf := make([]string, 0, len(body))
- for _, v := range body {
- buf = append(buf, v.String())
- }
- return strings.Join(buf, "; ")
-}
-
-// Vars returns a VarSet containing variables in body. The params can be set to
-// control which vars are included.
-func (body Body) Vars(params VarVisitorParams) VarSet {
- vis := NewVarVisitor().WithParams(params)
- vis.Walk(body)
- return vis.Vars()
+ return v1.NewBody(exprs...)
}
// NewExpr returns a new Expr object.
-func NewExpr(terms interface{}) *Expr {
- switch terms.(type) {
- case *SomeDecl, *Every, *Term, []*Term: // ok
- default:
- panic("unreachable")
- }
- return &Expr{
- Negated: false,
- Terms: terms,
- Index: 0,
- With: nil,
- }
-}
-
-// Complement returns a copy of this expression with the negation flag flipped.
-func (expr *Expr) Complement() *Expr {
- cpy := *expr
- cpy.Negated = !cpy.Negated
- return &cpy
-}
-
-// Equal returns true if this Expr equals the other Expr.
-func (expr *Expr) Equal(other *Expr) bool {
- return expr.Compare(other) == 0
-}
-
-// Compare returns an integer indicating whether expr is less than, equal to,
-// or greater than other.
-//
-// Expressions are compared as follows:
-//
-// 1. Declarations are always less than other expressions.
-// 2. Preceding expression (by Index) is always less than the other expression.
-// 3. Non-negated expressions are always less than negated expressions.
-// 4. Single term expressions are always less than built-in expressions.
-//
-// Otherwise, the expression terms are compared normally. If both expressions
-// have the same terms, the modifiers are compared.
-func (expr *Expr) Compare(other *Expr) int {
-
- if expr == nil {
- if other == nil {
- return 0
- }
- return -1
- } else if other == nil {
- return 1
- }
-
- o1 := expr.sortOrder()
- o2 := other.sortOrder()
- if o1 < o2 {
- return -1
- } else if o2 < o1 {
- return 1
- }
-
- switch {
- case expr.Index < other.Index:
- return -1
- case expr.Index > other.Index:
- return 1
- }
-
- switch {
- case expr.Negated && !other.Negated:
- return 1
- case !expr.Negated && other.Negated:
- return -1
- }
-
- switch t := expr.Terms.(type) {
- case *Term:
- if cmp := Compare(t.Value, other.Terms.(*Term).Value); cmp != 0 {
- return cmp
- }
- case []*Term:
- if cmp := termSliceCompare(t, other.Terms.([]*Term)); cmp != 0 {
- return cmp
- }
- case *SomeDecl:
- if cmp := Compare(t, other.Terms.(*SomeDecl)); cmp != 0 {
- return cmp
- }
- case *Every:
- if cmp := Compare(t, other.Terms.(*Every)); cmp != 0 {
- return cmp
- }
- }
-
- return withSliceCompare(expr.With, other.With)
-}
-
-func (expr *Expr) sortOrder() int {
- switch expr.Terms.(type) {
- case *SomeDecl:
- return 0
- case *Term:
- return 1
- case []*Term:
- return 2
- case *Every:
- return 3
- }
- return -1
-}
-
-// CopyWithoutTerms returns a deep copy of expr without its Terms
-func (expr *Expr) CopyWithoutTerms() *Expr {
- cpy := *expr
-
- cpy.With = make([]*With, len(expr.With))
- for i := range expr.With {
- cpy.With[i] = expr.With[i].Copy()
- }
-
- return &cpy
-}
-
-// Copy returns a deep copy of expr.
-func (expr *Expr) Copy() *Expr {
-
- cpy := expr.CopyWithoutTerms()
-
- switch ts := expr.Terms.(type) {
- case *SomeDecl:
- cpy.Terms = ts.Copy()
- case []*Term:
- cpyTs := make([]*Term, len(ts))
- for i := range ts {
- cpyTs[i] = ts[i].Copy()
- }
- cpy.Terms = cpyTs
- case *Term:
- cpy.Terms = ts.Copy()
- case *Every:
- cpy.Terms = ts.Copy()
- }
-
- return cpy
-}
-
-// Hash returns the hash code of the Expr.
-func (expr *Expr) Hash() int {
- s := expr.Index
- switch ts := expr.Terms.(type) {
- case *SomeDecl:
- s += ts.Hash()
- case []*Term:
- for _, t := range ts {
- s += t.Value.Hash()
- }
- case *Term:
- s += ts.Value.Hash()
- }
- if expr.Negated {
- s++
- }
- for _, w := range expr.With {
- s += w.Hash()
- }
- return s
-}
-
-// IncludeWith returns a copy of expr with the with modifier appended.
-func (expr *Expr) IncludeWith(target *Term, value *Term) *Expr {
- cpy := *expr
- cpy.With = append(cpy.With, &With{Target: target, Value: value})
- return &cpy
-}
-
-// NoWith returns a copy of expr where the with modifier has been removed.
-func (expr *Expr) NoWith() *Expr {
- cpy := *expr
- cpy.With = nil
- return &cpy
-}
-
-// IsEquality returns true if this is an equality expression.
-func (expr *Expr) IsEquality() bool {
- return isGlobalBuiltin(expr, Var(Equality.Name))
-}
-
-// IsAssignment returns true if this an assignment expression.
-func (expr *Expr) IsAssignment() bool {
- return isGlobalBuiltin(expr, Var(Assign.Name))
-}
-
-// IsCall returns true if this expression calls a function.
-func (expr *Expr) IsCall() bool {
- _, ok := expr.Terms.([]*Term)
- return ok
-}
-
-// IsEvery returns true if this expression is an 'every' expression.
-func (expr *Expr) IsEvery() bool {
- _, ok := expr.Terms.(*Every)
- return ok
-}
-
-// IsSome returns true if this expression is a 'some' expression.
-func (expr *Expr) IsSome() bool {
- _, ok := expr.Terms.(*SomeDecl)
- return ok
-}
-
-// Operator returns the name of the function or built-in this expression refers
-// to. If this expression is not a function call, returns nil.
-func (expr *Expr) Operator() Ref {
- op := expr.OperatorTerm()
- if op == nil {
- return nil
- }
- return op.Value.(Ref)
-}
-
-// OperatorTerm returns the name of the function or built-in this expression
-// refers to. If this expression is not a function call, returns nil.
-func (expr *Expr) OperatorTerm() *Term {
- terms, ok := expr.Terms.([]*Term)
- if !ok || len(terms) == 0 {
- return nil
- }
- return terms[0]
-}
-
-// Operand returns the term at the zero-based pos. If the expr does not include
-// at least pos+1 terms, this function returns nil.
-func (expr *Expr) Operand(pos int) *Term {
- terms, ok := expr.Terms.([]*Term)
- if !ok {
- return nil
- }
- idx := pos + 1
- if idx < len(terms) {
- return terms[idx]
- }
- return nil
-}
-
-// Operands returns the built-in function operands.
-func (expr *Expr) Operands() []*Term {
- terms, ok := expr.Terms.([]*Term)
- if !ok {
- return nil
- }
- return terms[1:]
-}
-
-// IsGround returns true if all of the expression terms are ground.
-func (expr *Expr) IsGround() bool {
- switch ts := expr.Terms.(type) {
- case []*Term:
- for _, t := range ts[1:] {
- if !t.IsGround() {
- return false
- }
- }
- case *Term:
- return ts.IsGround()
- }
- return true
-}
-
-// SetOperator sets the expr's operator and returns the expr itself. If expr is
-// not a call expr, this function will panic.
-func (expr *Expr) SetOperator(term *Term) *Expr {
- expr.Terms.([]*Term)[0] = term
- return expr
-}
-
-// SetLocation sets the expr's location and returns the expr itself.
-func (expr *Expr) SetLocation(loc *Location) *Expr {
- expr.Location = loc
- return expr
-}
-
-// Loc returns the Location of expr.
-func (expr *Expr) Loc() *Location {
- if expr == nil {
- return nil
- }
- return expr.Location
-}
-
-// SetLoc sets the location on expr.
-func (expr *Expr) SetLoc(loc *Location) {
- expr.SetLocation(loc)
-}
-
-func (expr *Expr) String() string {
- buf := make([]string, 0, 2+len(expr.With))
- if expr.Negated {
- buf = append(buf, "not")
- }
- switch t := expr.Terms.(type) {
- case []*Term:
- if expr.IsEquality() && validEqAssignArgCount(expr) {
- buf = append(buf, fmt.Sprintf("%v %v %v", t[1], Equality.Infix, t[2]))
- } else {
- buf = append(buf, Call(t).String())
- }
- case fmt.Stringer:
- buf = append(buf, t.String())
- }
-
- for i := range expr.With {
- buf = append(buf, expr.With[i].String())
- }
-
- return strings.Join(buf, " ")
-}
-
-func (expr *Expr) setJSONOptions(opts astJSON.Options) {
- expr.jsonOptions = opts
- if expr.Location != nil {
- expr.Location.JSONOptions = opts
- }
-}
-
-func (expr *Expr) MarshalJSON() ([]byte, error) {
- data := map[string]interface{}{
- "terms": expr.Terms,
- "index": expr.Index,
- }
-
- if len(expr.With) > 0 {
- data["with"] = expr.With
- }
-
- if expr.Generated {
- data["generated"] = true
- }
-
- if expr.Negated {
- data["negated"] = true
- }
-
- if expr.jsonOptions.MarshalOptions.IncludeLocation.Expr {
- if expr.Location != nil {
- data["location"] = expr.Location
- }
- }
-
- return json.Marshal(data)
-}
-
-// UnmarshalJSON parses the byte array and stores the result in expr.
-func (expr *Expr) UnmarshalJSON(bs []byte) error {
- v := map[string]interface{}{}
- if err := util.UnmarshalJSON(bs, &v); err != nil {
- return err
- }
- return unmarshalExpr(expr, v)
-}
-
-// Vars returns a VarSet containing variables in expr. The params can be set to
-// control which vars are included.
-func (expr *Expr) Vars(params VarVisitorParams) VarSet {
- vis := NewVarVisitor().WithParams(params)
- vis.Walk(expr)
- return vis.Vars()
+func NewExpr(terms any) *Expr {
+ return v1.NewExpr(terms)
}
// NewBuiltinExpr creates a new Expr object with the supplied terms.
// The builtin operator must be the first term.
func NewBuiltinExpr(terms ...*Term) *Expr {
- return &Expr{Terms: terms}
-}
-
-func (expr *Expr) CogeneratedExprs() []*Expr {
- visited := map[*Expr]struct{}{}
- visitCogeneratedExprs(expr, func(e *Expr) bool {
- if expr.Equal(e) {
- return true
- }
- if _, ok := visited[e]; ok {
- return true
- }
- visited[e] = struct{}{}
- return false
- })
-
- result := make([]*Expr, 0, len(visited))
- for e := range visited {
- result = append(result, e)
- }
- return result
-}
-
-func (expr *Expr) BaseCogeneratedExpr() *Expr {
- if expr.generatedFrom == nil {
- return expr
- }
- return expr.generatedFrom.BaseCogeneratedExpr()
-}
-
-func visitCogeneratedExprs(expr *Expr, f func(*Expr) bool) {
- if parent := expr.generatedFrom; parent != nil {
- if stop := f(parent); !stop {
- visitCogeneratedExprs(parent, f)
- }
- }
- for _, child := range expr.generates {
- if stop := f(child); !stop {
- visitCogeneratedExprs(child, f)
- }
- }
-}
-
-func (d *SomeDecl) String() string {
- if call, ok := d.Symbols[0].Value.(Call); ok {
- if len(call) == 4 {
- return "some " + call[1].String() + ", " + call[2].String() + " in " + call[3].String()
- }
- return "some " + call[1].String() + " in " + call[2].String()
- }
- buf := make([]string, len(d.Symbols))
- for i := range buf {
- buf[i] = d.Symbols[i].String()
- }
- return "some " + strings.Join(buf, ", ")
-}
-
-// SetLoc sets the Location on d.
-func (d *SomeDecl) SetLoc(loc *Location) {
- d.Location = loc
-}
-
-// Loc returns the Location of d.
-func (d *SomeDecl) Loc() *Location {
- return d.Location
-}
-
-// Copy returns a deep copy of d.
-func (d *SomeDecl) Copy() *SomeDecl {
- cpy := *d
- cpy.Symbols = termSliceCopy(d.Symbols)
- return &cpy
-}
-
-// Compare returns an integer indicating whether d is less than, equal to, or
-// greater than other.
-func (d *SomeDecl) Compare(other *SomeDecl) int {
- return termSliceCompare(d.Symbols, other.Symbols)
-}
-
-// Hash returns a hash code of d.
-func (d *SomeDecl) Hash() int {
- return termSliceHash(d.Symbols)
-}
-
-func (d *SomeDecl) setJSONOptions(opts astJSON.Options) {
- d.jsonOptions = opts
- if d.Location != nil {
- d.Location.JSONOptions = opts
- }
-}
-
-func (d *SomeDecl) MarshalJSON() ([]byte, error) {
- data := map[string]interface{}{
- "symbols": d.Symbols,
- }
-
- if d.jsonOptions.MarshalOptions.IncludeLocation.SomeDecl {
- if d.Location != nil {
- data["location"] = d.Location
- }
- }
-
- return json.Marshal(data)
-}
-
-func (q *Every) String() string {
- if q.Key != nil {
- return fmt.Sprintf("every %s, %s in %s { %s }",
- q.Key,
- q.Value,
- q.Domain,
- q.Body)
- }
- return fmt.Sprintf("every %s in %s { %s }",
- q.Value,
- q.Domain,
- q.Body)
-}
-
-func (q *Every) Loc() *Location {
- return q.Location
-}
-
-func (q *Every) SetLoc(l *Location) {
- q.Location = l
-}
-
-// Copy returns a deep copy of d.
-func (q *Every) Copy() *Every {
- cpy := *q
- cpy.Key = q.Key.Copy()
- cpy.Value = q.Value.Copy()
- cpy.Domain = q.Domain.Copy()
- cpy.Body = q.Body.Copy()
- return &cpy
-}
-
-func (q *Every) Compare(other *Every) int {
- for _, terms := range [][2]*Term{
- {q.Key, other.Key},
- {q.Value, other.Value},
- {q.Domain, other.Domain},
- } {
- if d := Compare(terms[0], terms[1]); d != 0 {
- return d
- }
- }
- return q.Body.Compare(other.Body)
-}
-
-// KeyValueVars returns the key and val arguments of an `every`
-// expression, if they are non-nil and not wildcards.
-func (q *Every) KeyValueVars() VarSet {
- vis := &VarVisitor{vars: VarSet{}}
- if q.Key != nil {
- vis.Walk(q.Key)
- }
- vis.Walk(q.Value)
- return vis.vars
-}
-
-func (q *Every) setJSONOptions(opts astJSON.Options) {
- q.jsonOptions = opts
- if q.Location != nil {
- q.Location.JSONOptions = opts
- }
-}
-
-func (q *Every) MarshalJSON() ([]byte, error) {
- data := map[string]interface{}{
- "key": q.Key,
- "value": q.Value,
- "domain": q.Domain,
- "body": q.Body,
- }
-
- if q.jsonOptions.MarshalOptions.IncludeLocation.Every {
- if q.Location != nil {
- data["location"] = q.Location
- }
- }
-
- return json.Marshal(data)
-}
-
-func (w *With) String() string {
- return "with " + w.Target.String() + " as " + w.Value.String()
-}
-
-// Equal returns true if this With is equals the other With.
-func (w *With) Equal(other *With) bool {
- return Compare(w, other) == 0
-}
-
-// Compare returns an integer indicating whether w is less than, equal to, or
-// greater than other.
-func (w *With) Compare(other *With) int {
- if w == nil {
- if other == nil {
- return 0
- }
- return -1
- } else if other == nil {
- return 1
- }
- if cmp := Compare(w.Target, other.Target); cmp != 0 {
- return cmp
- }
- return Compare(w.Value, other.Value)
-}
-
-// Copy returns a deep copy of w.
-func (w *With) Copy() *With {
- cpy := *w
- cpy.Value = w.Value.Copy()
- cpy.Target = w.Target.Copy()
- return &cpy
-}
-
-// Hash returns the hash code of the With.
-func (w With) Hash() int {
- return w.Target.Hash() + w.Value.Hash()
-}
-
-// SetLocation sets the location on w.
-func (w *With) SetLocation(loc *Location) *With {
- w.Location = loc
- return w
-}
-
-// Loc returns the Location of w.
-func (w *With) Loc() *Location {
- if w == nil {
- return nil
- }
- return w.Location
-}
-
-// SetLoc sets the location on w.
-func (w *With) SetLoc(loc *Location) {
- w.Location = loc
-}
-
-func (w *With) setJSONOptions(opts astJSON.Options) {
- w.jsonOptions = opts
- if w.Location != nil {
- w.Location.JSONOptions = opts
- }
-}
-
-func (w *With) MarshalJSON() ([]byte, error) {
- data := map[string]interface{}{
- "target": w.Target,
- "value": w.Value,
- }
-
- if w.jsonOptions.MarshalOptions.IncludeLocation.With {
- if w.Location != nil {
- data["location"] = w.Location
- }
- }
-
- return json.Marshal(data)
+ return v1.NewBuiltinExpr(terms...)
}
// Copy returns a deep copy of the AST node x. If x is not an AST node, x is returned unmodified.
-func Copy(x interface{}) interface{} {
- switch x := x.(type) {
- case *Module:
- return x.Copy()
- case *Package:
- return x.Copy()
- case *Import:
- return x.Copy()
- case *Rule:
- return x.Copy()
- case *Head:
- return x.Copy()
- case Args:
- return x.Copy()
- case Body:
- return x.Copy()
- case *Expr:
- return x.Copy()
- case *With:
- return x.Copy()
- case *SomeDecl:
- return x.Copy()
- case *Every:
- return x.Copy()
- case *Term:
- return x.Copy()
- case *ArrayComprehension:
- return x.Copy()
- case *SetComprehension:
- return x.Copy()
- case *ObjectComprehension:
- return x.Copy()
- case Set:
- return x.Copy()
- case *object:
- return x.Copy()
- case *Array:
- return x.Copy()
- case Ref:
- return x.Copy()
- case Call:
- return x.Copy()
- case *Comment:
- return x.Copy()
- }
- return x
+func Copy(x any) any {
+ return v1.Copy(x)
}
// RuleSet represents a collection of rules that produce a virtual document.
-type RuleSet []*Rule
+type RuleSet = v1.RuleSet
// NewRuleSet returns a new RuleSet containing the given rules.
func NewRuleSet(rules ...*Rule) RuleSet {
- rs := make(RuleSet, 0, len(rules))
- for _, rule := range rules {
- rs.Add(rule)
- }
- return rs
-}
-
-// Add inserts the rule into rs.
-func (rs *RuleSet) Add(rule *Rule) {
- for _, exist := range *rs {
- if exist.Equal(rule) {
- return
- }
- }
- *rs = append(*rs, rule)
-}
-
-// Contains returns true if rs contains rule.
-func (rs RuleSet) Contains(rule *Rule) bool {
- for i := range rs {
- if rs[i].Equal(rule) {
- return true
- }
- }
- return false
-}
-
-// Diff returns a new RuleSet containing rules in rs that are not in other.
-func (rs RuleSet) Diff(other RuleSet) RuleSet {
- result := NewRuleSet()
- for i := range rs {
- if !other.Contains(rs[i]) {
- result.Add(rs[i])
- }
- }
- return result
-}
-
-// Equal returns true if rs equals other.
-func (rs RuleSet) Equal(other RuleSet) bool {
- return len(rs.Diff(other)) == 0 && len(other.Diff(rs)) == 0
-}
-
-// Merge returns a ruleset containing the union of rules from rs an other.
-func (rs RuleSet) Merge(other RuleSet) RuleSet {
- result := NewRuleSet()
- for i := range rs {
- result.Add(rs[i])
- }
- for i := range other {
- result.Add(other[i])
- }
- return result
-}
-
-func (rs RuleSet) String() string {
- buf := make([]string, 0, len(rs))
- for _, rule := range rs {
- buf = append(buf, rule.String())
- }
- return "{" + strings.Join(buf, ", ") + "}"
-}
-
-// Returns true if the equality or assignment expression referred to by expr
-// has a valid number of arguments.
-func validEqAssignArgCount(expr *Expr) bool {
- return len(expr.Operands()) == 2
-}
-
-// this function checks if the expr refers to a non-namespaced (global) built-in
-// function like eq, gt, plus, etc.
-func isGlobalBuiltin(expr *Expr, name Var) bool {
- terms, ok := expr.Terms.([]*Term)
- if !ok {
- return false
- }
-
- // NOTE(tsandall): do not use Term#Equal or Value#Compare to avoid
- // allocation here.
- ref, ok := terms[0].Value.(Ref)
- if !ok || len(ref) != 1 {
- return false
- }
- if head, ok := ref[0].Value.(Var); ok {
- return head.Equal(name)
- }
- return false
+ return v1.NewRuleSet(rules...)
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/pretty.go b/vendor/github.com/open-policy-agent/opa/ast/pretty.go
index b4f05ad501..84e42f9aec 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/pretty.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/pretty.go
@@ -5,78 +5,14 @@
package ast
import (
- "fmt"
"io"
- "strings"
+
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
// Pretty writes a pretty representation of the AST rooted at x to w.
//
// This is function is intended for debug purposes when inspecting ASTs.
-func Pretty(w io.Writer, x interface{}) {
- pp := &prettyPrinter{
- depth: -1,
- w: w,
- }
- NewBeforeAfterVisitor(pp.Before, pp.After).Walk(x)
-}
-
-type prettyPrinter struct {
- depth int
- w io.Writer
-}
-
-func (pp *prettyPrinter) Before(x interface{}) bool {
- switch x.(type) {
- case *Term:
- default:
- pp.depth++
- }
-
- switch x := x.(type) {
- case *Term:
- return false
- case Args:
- if len(x) == 0 {
- return false
- }
- pp.writeType(x)
- case *Expr:
- extras := []string{}
- if x.Negated {
- extras = append(extras, "negated")
- }
- extras = append(extras, fmt.Sprintf("index=%d", x.Index))
- pp.writeIndent("%v %v", TypeName(x), strings.Join(extras, " "))
- case Null, Boolean, Number, String, Var:
- pp.writeValue(x)
- default:
- pp.writeType(x)
- }
- return false
-}
-
-func (pp *prettyPrinter) After(x interface{}) {
- switch x.(type) {
- case *Term:
- default:
- pp.depth--
- }
-}
-
-func (pp *prettyPrinter) writeValue(x interface{}) {
- pp.writeIndent(fmt.Sprint(x))
-}
-
-func (pp *prettyPrinter) writeType(x interface{}) {
- pp.writeIndent(TypeName(x))
-}
-
-func (pp *prettyPrinter) writeIndent(f string, a ...interface{}) {
- pad := strings.Repeat(" ", pp.depth)
- pp.write(pad+f, a...)
-}
-
-func (pp *prettyPrinter) write(f string, a ...interface{}) {
- fmt.Fprintf(pp.w, f+"\n", a...)
+func Pretty(w io.Writer, x any) {
+ v1.Pretty(w, x)
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/schema.go b/vendor/github.com/open-policy-agent/opa/ast/schema.go
index 8c96ac624e..979958a3c0 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/schema.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/schema.go
@@ -5,59 +5,13 @@
package ast
import (
- "fmt"
-
- "github.com/open-policy-agent/opa/types"
- "github.com/open-policy-agent/opa/util"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
// SchemaSet holds a map from a path to a schema.
-type SchemaSet struct {
- m *util.HashMap
-}
+type SchemaSet = v1.SchemaSet
// NewSchemaSet returns an empty SchemaSet.
func NewSchemaSet() *SchemaSet {
-
- eqFunc := func(a, b util.T) bool {
- return a.(Ref).Equal(b.(Ref))
- }
-
- hashFunc := func(x util.T) int { return x.(Ref).Hash() }
-
- return &SchemaSet{
- m: util.NewHashMap(eqFunc, hashFunc),
- }
-}
-
-// Put inserts a raw schema into the set.
-func (ss *SchemaSet) Put(path Ref, raw interface{}) {
- ss.m.Put(path, raw)
-}
-
-// Get returns the raw schema identified by the path.
-func (ss *SchemaSet) Get(path Ref) interface{} {
- if ss == nil {
- return nil
- }
- x, ok := ss.m.Get(path)
- if !ok {
- return nil
- }
- return x
-}
-
-func loadSchema(raw interface{}, allowNet []string) (types.Type, error) {
-
- jsonSchema, err := compileSchema(raw, allowNet)
- if err != nil {
- return nil, err
- }
-
- tpe, err := newSchemaParser().parseSchema(jsonSchema.RootSchema)
- if err != nil {
- return nil, fmt.Errorf("type checking: %w", err)
- }
-
- return tpe, nil
+ return v1.NewSchemaSet()
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/strings.go b/vendor/github.com/open-policy-agent/opa/ast/strings.go
index e489f6977c..c2c81de8b7 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/strings.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/strings.go
@@ -5,14 +5,10 @@
package ast
import (
- "reflect"
- "strings"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
// TypeName returns a human readable name for the AST element type.
-func TypeName(x interface{}) string {
- if _, ok := x.(*lazyObj); ok {
- return "object"
- }
- return strings.ToLower(reflect.Indirect(reflect.ValueOf(x)).Type().Name())
+func TypeName(x any) string {
+ return v1.TypeName(x)
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/term.go b/vendor/github.com/open-policy-agent/opa/ast/term.go
index ce8ee4853d..202355070f 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/term.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/term.go
@@ -1,40 +1,22 @@
-// Copyright 2016 The OPA Authors. All rights reserved.
+// Copyright 2024 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.
-// nolint: deadcode // Public API.
package ast
import (
- "bytes"
"encoding/json"
- "errors"
- "fmt"
"io"
- "math"
- "math/big"
- "net/url"
- "regexp"
- "sort"
- "strconv"
- "strings"
- "sync"
-
- "github.com/OneOfOne/xxhash"
-
- astJSON "github.com/open-policy-agent/opa/ast/json"
- "github.com/open-policy-agent/opa/ast/location"
- "github.com/open-policy-agent/opa/util"
-)
-var errFindNotFound = fmt.Errorf("find: not found")
+ v1 "github.com/open-policy-agent/opa/v1/ast"
+)
// Location records a position in source code.
-type Location = location.Location
+type Location = v1.Location
// NewLocation returns a new Location object.
func NewLocation(text []byte, file string, row int, col int) *Location {
- return location.NewLocation(text, file, row, col)
+ return v1.NewLocation(text, file, row, col)
}
// Value declares the common interface for all Term values. Every kind of Term value
@@ -45,3230 +27,280 @@ func NewLocation(text []byte, file string, row int, col int) *Location {
// - Variables, References
// - Array, Set, and Object Comprehensions
// - Calls
-type Value interface {
- Compare(other Value) int // Compare returns <0, 0, or >0 if this Value is less than, equal to, or greater than other, respectively.
- Find(path Ref) (Value, error) // Find returns value referred to by path or an error if path is not found.
- Hash() int // Returns hash code of the value.
- IsGround() bool // IsGround returns true if this value is not a variable or contains no variables.
- String() string // String returns a human readable string representation of the value.
-}
+type Value = v1.Value
// InterfaceToValue converts a native Go value x to a Value.
-func InterfaceToValue(x interface{}) (Value, error) {
- switch x := x.(type) {
- case nil:
- return Null{}, nil
- case bool:
- return Boolean(x), nil
- case json.Number:
- return Number(x), nil
- case int64:
- return int64Number(x), nil
- case uint64:
- return uint64Number(x), nil
- case float64:
- return floatNumber(x), nil
- case int:
- return intNumber(x), nil
- case string:
- return String(x), nil
- case []interface{}:
- r := make([]*Term, len(x))
- for i, e := range x {
- e, err := InterfaceToValue(e)
- if err != nil {
- return nil, err
- }
- r[i] = &Term{Value: e}
- }
- return NewArray(r...), nil
- case map[string]interface{}:
- r := newobject(len(x))
- for k, v := range x {
- k, err := InterfaceToValue(k)
- if err != nil {
- return nil, err
- }
- v, err := InterfaceToValue(v)
- if err != nil {
- return nil, err
- }
- r.Insert(NewTerm(k), NewTerm(v))
- }
- return r, nil
- case map[string]string:
- r := newobject(len(x))
- for k, v := range x {
- k, err := InterfaceToValue(k)
- if err != nil {
- return nil, err
- }
- v, err := InterfaceToValue(v)
- if err != nil {
- return nil, err
- }
- r.Insert(NewTerm(k), NewTerm(v))
- }
- return r, nil
- default:
- ptr := util.Reference(x)
- if err := util.RoundTrip(ptr); err != nil {
- return nil, fmt.Errorf("ast: interface conversion: %w", err)
- }
- return InterfaceToValue(*ptr)
- }
+func InterfaceToValue(x any) (Value, error) {
+ return v1.InterfaceToValue(x)
}
// ValueFromReader returns an AST value from a JSON serialized value in the reader.
func ValueFromReader(r io.Reader) (Value, error) {
- var x interface{}
- if err := util.NewJSONDecoder(r).Decode(&x); err != nil {
- return nil, err
- }
- return InterfaceToValue(x)
+ return v1.ValueFromReader(r)
}
// As converts v into a Go native type referred to by x.
-func As(v Value, x interface{}) error {
- return util.NewJSONDecoder(bytes.NewBufferString(v.String())).Decode(x)
+func As(v Value, x any) error {
+ return v1.As(v, x)
}
// Resolver defines the interface for resolving references to native Go values.
-type Resolver interface {
- Resolve(Ref) (interface{}, error)
-}
+type Resolver = v1.Resolver
// ValueResolver defines the interface for resolving references to AST values.
-type ValueResolver interface {
- Resolve(Ref) (Value, error)
-}
+type ValueResolver = v1.ValueResolver
// UnknownValueErr indicates a ValueResolver was unable to resolve a reference
// because the reference refers to an unknown value.
-type UnknownValueErr struct{}
-
-func (UnknownValueErr) Error() string {
- return "unknown value"
-}
+type UnknownValueErr = v1.UnknownValueErr
// IsUnknownValueErr returns true if the err is an UnknownValueErr.
func IsUnknownValueErr(err error) bool {
- _, ok := err.(UnknownValueErr)
- return ok
-}
-
-type illegalResolver struct{}
-
-func (illegalResolver) Resolve(ref Ref) (interface{}, error) {
- return nil, fmt.Errorf("illegal value: %v", ref)
+ return v1.IsUnknownValueErr(err)
}
// ValueToInterface returns the Go representation of an AST value. The AST
// value should not contain any values that require evaluation (e.g., vars,
// comprehensions, etc.)
-func ValueToInterface(v Value, resolver Resolver) (interface{}, error) {
- return valueToInterface(v, resolver, JSONOpt{})
-}
-
-func valueToInterface(v Value, resolver Resolver, opt JSONOpt) (interface{}, error) {
- switch v := v.(type) {
- case Null:
- return nil, nil
- case Boolean:
- return bool(v), nil
- case Number:
- return json.Number(v), nil
- case String:
- return string(v), nil
- case *Array:
- buf := []interface{}{}
- for i := 0; i < v.Len(); i++ {
- x1, err := valueToInterface(v.Elem(i).Value, resolver, opt)
- if err != nil {
- return nil, err
- }
- buf = append(buf, x1)
- }
- return buf, nil
- case *object:
- buf := make(map[string]interface{}, v.Len())
- err := v.Iter(func(k, v *Term) error {
- ki, err := valueToInterface(k.Value, resolver, opt)
- if err != nil {
- return err
- }
- var str string
- var ok bool
- if str, ok = ki.(string); !ok {
- var buf bytes.Buffer
- if err := json.NewEncoder(&buf).Encode(ki); err != nil {
- return err
- }
- str = strings.TrimSpace(buf.String())
- }
- vi, err := valueToInterface(v.Value, resolver, opt)
- if err != nil {
- return err
- }
- buf[str] = vi
- return nil
- })
- if err != nil {
- return nil, err
- }
- return buf, nil
- case *lazyObj:
- if opt.CopyMaps {
- return valueToInterface(v.force(), resolver, opt)
- }
- return v.native, nil
- case Set:
- buf := []interface{}{}
- iter := func(x *Term) error {
- x1, err := valueToInterface(x.Value, resolver, opt)
- if err != nil {
- return err
- }
- buf = append(buf, x1)
- return nil
- }
- var err error
- if opt.SortSets {
- err = v.Sorted().Iter(iter)
- } else {
- err = v.Iter(iter)
- }
- if err != nil {
- return nil, err
- }
- return buf, nil
- case Ref:
- return resolver.Resolve(v)
- default:
- return nil, fmt.Errorf("%v requires evaluation", TypeName(v))
- }
+func ValueToInterface(v Value, resolver Resolver) (any, error) {
+ return v1.ValueToInterface(v, resolver)
}
// JSON returns the JSON representation of v. The value must not contain any
// refs or terms that require evaluation (e.g., vars, comprehensions, etc.)
-func JSON(v Value) (interface{}, error) {
- return JSONWithOpt(v, JSONOpt{})
+func JSON(v Value) (any, error) {
+ return v1.JSON(v)
}
// JSONOpt defines parameters for AST to JSON conversion.
-type JSONOpt struct {
- SortSets bool // sort sets before serializing (this makes conversion more expensive)
- CopyMaps bool // enforces copying of map[string]interface{} read from the store
-}
+type JSONOpt = v1.JSONOpt
// JSONWithOpt returns the JSON representation of v. The value must not contain any
// refs or terms that require evaluation (e.g., vars, comprehensions, etc.)
-func JSONWithOpt(v Value, opt JSONOpt) (interface{}, error) {
- return valueToInterface(v, illegalResolver{}, opt)
+func JSONWithOpt(v Value, opt JSONOpt) (any, error) {
+ return v1.JSONWithOpt(v, opt)
}
// MustJSON returns the JSON representation of v. The value must not contain any
// refs or terms that require evaluation (e.g., vars, comprehensions, etc.) If
// the conversion fails, this function will panic. This function is mostly for
// test purposes.
-func MustJSON(v Value) interface{} {
- r, err := JSON(v)
- if err != nil {
- panic(err)
- }
- return r
+func MustJSON(v Value) any {
+ return v1.MustJSON(v)
}
// MustInterfaceToValue converts a native Go value x to a Value. If the
// conversion fails, this function will panic. This function is mostly for test
// purposes.
-func MustInterfaceToValue(x interface{}) Value {
- v, err := InterfaceToValue(x)
- if err != nil {
- panic(err)
- }
- return v
+func MustInterfaceToValue(x any) Value {
+ return v1.MustInterfaceToValue(x)
}
// Term is an argument to a function.
-type Term struct {
- Value Value `json:"value"` // the value of the Term as represented in Go
- Location *Location `json:"location,omitempty"` // the location of the Term in the source
-
- jsonOptions astJSON.Options
-}
+type Term = v1.Term
// NewTerm returns a new Term object.
func NewTerm(v Value) *Term {
- return &Term{
- Value: v,
- }
-}
-
-// SetLocation updates the term's Location and returns the term itself.
-func (term *Term) SetLocation(loc *Location) *Term {
- term.Location = loc
- return term
-}
-
-// Loc returns the Location of term.
-func (term *Term) Loc() *Location {
- if term == nil {
- return nil
- }
- return term.Location
-}
-
-// SetLoc sets the location on term.
-func (term *Term) SetLoc(loc *Location) {
- term.SetLocation(loc)
-}
-
-// Copy returns a deep copy of term.
-func (term *Term) Copy() *Term {
-
- if term == nil {
- return nil
- }
-
- cpy := *term
-
- switch v := term.Value.(type) {
- case Null, Boolean, Number, String, Var:
- cpy.Value = v
- case Ref:
- cpy.Value = v.Copy()
- case *Array:
- cpy.Value = v.Copy()
- case Set:
- cpy.Value = v.Copy()
- case *object:
- cpy.Value = v.Copy()
- case *ArrayComprehension:
- cpy.Value = v.Copy()
- case *ObjectComprehension:
- cpy.Value = v.Copy()
- case *SetComprehension:
- cpy.Value = v.Copy()
- case Call:
- cpy.Value = v.Copy()
- }
-
- return &cpy
-}
-
-// Equal returns true if this term equals the other term. Equality is
-// defined for each kind of term.
-func (term *Term) Equal(other *Term) bool {
- if term == nil && other != nil {
- return false
- }
- if term != nil && other == nil {
- return false
- }
- if term == other {
- return true
- }
-
- // TODO(tsandall): This early-exit avoids allocations for types that have
- // Equal() functions that just use == underneath. We should revisit the
- // other types and implement Equal() functions that do not require
- // allocations.
- switch v := term.Value.(type) {
- case Null:
- return v.Equal(other.Value)
- case Boolean:
- return v.Equal(other.Value)
- case Number:
- return v.Equal(other.Value)
- case String:
- return v.Equal(other.Value)
- case Var:
- return v.Equal(other.Value)
- }
-
- return term.Value.Compare(other.Value) == 0
-}
-
-// Get returns a value referred to by name from the term.
-func (term *Term) Get(name *Term) *Term {
- switch v := term.Value.(type) {
- case *object:
- return v.Get(name)
- case *Array:
- return v.Get(name)
- case interface {
- Get(*Term) *Term
- }:
- return v.Get(name)
- case Set:
- if v.Contains(name) {
- return name
- }
- }
- return nil
-}
-
-// Hash returns the hash code of the Term's Value. Its Location
-// is ignored.
-func (term *Term) Hash() int {
- return term.Value.Hash()
-}
-
-// IsGround returns true if this term's Value is ground.
-func (term *Term) IsGround() bool {
- return term.Value.IsGround()
-}
-
-func (term *Term) setJSONOptions(opts astJSON.Options) {
- term.jsonOptions = opts
- if term.Location != nil {
- term.Location.JSONOptions = opts
- }
-}
-
-// MarshalJSON returns the JSON encoding of the term.
-//
-// Specialized marshalling logic is required to include a type hint for Value.
-func (term *Term) MarshalJSON() ([]byte, error) {
- d := map[string]interface{}{
- "type": TypeName(term.Value),
- "value": term.Value,
- }
- if term.jsonOptions.MarshalOptions.IncludeLocation.Term {
- if term.Location != nil {
- d["location"] = term.Location
- }
- }
- return json.Marshal(d)
-}
-
-func (term *Term) String() string {
- return term.Value.String()
-}
-
-// UnmarshalJSON parses the byte array and stores the result in term.
-// Specialized unmarshalling is required to handle Value and Location.
-func (term *Term) UnmarshalJSON(bs []byte) error {
- v := map[string]interface{}{}
- if err := util.UnmarshalJSON(bs, &v); err != nil {
- return err
- }
- val, err := unmarshalValue(v)
- if err != nil {
- return err
- }
- term.Value = val
-
- if loc, ok := v["location"].(map[string]interface{}); ok {
- term.Location = &Location{}
- err := unmarshalLocation(term.Location, loc)
- if err != nil {
- return err
- }
- }
- return nil
-}
-
-// Vars returns a VarSet with variables contained in this term.
-func (term *Term) Vars() VarSet {
- vis := &VarVisitor{vars: VarSet{}}
- vis.Walk(term)
- return vis.vars
+ return v1.NewTerm(v)
}
// IsConstant returns true if the AST value is constant.
func IsConstant(v Value) bool {
- found := false
- vis := GenericVisitor{
- func(x interface{}) bool {
- switch x.(type) {
- case Var, Ref, *ArrayComprehension, *ObjectComprehension, *SetComprehension, Call:
- found = true
- return true
- }
- return false
- },
- }
- vis.Walk(v)
- return !found
+ return v1.IsConstant(v)
}
// IsComprehension returns true if the supplied value is a comprehension.
func IsComprehension(x Value) bool {
- switch x.(type) {
- case *ArrayComprehension, *ObjectComprehension, *SetComprehension:
- return true
- }
- return false
+ return v1.IsComprehension(x)
}
// ContainsRefs returns true if the Value v contains refs.
-func ContainsRefs(v interface{}) bool {
- found := false
- WalkRefs(v, func(Ref) bool {
- found = true
- return found
- })
- return found
+func ContainsRefs(v any) bool {
+ return v1.ContainsRefs(v)
}
// ContainsComprehensions returns true if the Value v contains comprehensions.
-func ContainsComprehensions(v interface{}) bool {
- found := false
- WalkClosures(v, func(x interface{}) bool {
- switch x.(type) {
- case *ArrayComprehension, *ObjectComprehension, *SetComprehension:
- found = true
- return found
- }
- return found
- })
- return found
+func ContainsComprehensions(v any) bool {
+ return v1.ContainsComprehensions(v)
}
// ContainsClosures returns true if the Value v contains closures.
-func ContainsClosures(v interface{}) bool {
- found := false
- WalkClosures(v, func(x interface{}) bool {
- switch x.(type) {
- case *ArrayComprehension, *ObjectComprehension, *SetComprehension, *Every:
- found = true
- return found
- }
- return found
- })
- return found
+func ContainsClosures(v any) bool {
+ return v1.ContainsClosures(v)
}
// IsScalar returns true if the AST value is a scalar.
func IsScalar(v Value) bool {
- switch v.(type) {
- case String:
- return true
- case Number:
- return true
- case Boolean:
- return true
- case Null:
- return true
- }
- return false
+ return v1.IsScalar(v)
}
// Null represents the null value defined by JSON.
-type Null struct{}
+type Null = v1.Null
// NullTerm creates a new Term with a Null value.
func NullTerm() *Term {
- return &Term{Value: Null{}}
-}
-
-// Equal returns true if the other term Value is also Null.
-func (null Null) Equal(other Value) bool {
- switch other.(type) {
- case Null:
- return true
- default:
- return false
- }
-}
-
-// Compare compares null to other, return <0, 0, or >0 if it is less than, equal to,
-// or greater than other.
-func (null Null) Compare(other Value) int {
- return Compare(null, other)
-}
-
-// Find returns the current value or a not found error.
-func (null Null) Find(path Ref) (Value, error) {
- if len(path) == 0 {
- return null, nil
- }
- return nil, errFindNotFound
-}
-
-// Hash returns the hash code for the Value.
-func (null Null) Hash() int {
- return 0
-}
-
-// IsGround always returns true.
-func (Null) IsGround() bool {
- return true
-}
-
-func (null Null) String() string {
- return "null"
+ return v1.NullTerm()
}
// Boolean represents a boolean value defined by JSON.
-type Boolean bool
+type Boolean = v1.Boolean
// BooleanTerm creates a new Term with a Boolean value.
func BooleanTerm(b bool) *Term {
- return &Term{Value: Boolean(b)}
-}
-
-// Equal returns true if the other Value is a Boolean and is equal.
-func (bol Boolean) Equal(other Value) bool {
- switch other := other.(type) {
- case Boolean:
- return bol == other
- default:
- return false
- }
-}
-
-// Compare compares bol to other, return <0, 0, or >0 if it is less than, equal to,
-// or greater than other.
-func (bol Boolean) Compare(other Value) int {
- return Compare(bol, other)
-}
-
-// Find returns the current value or a not found error.
-func (bol Boolean) Find(path Ref) (Value, error) {
- if len(path) == 0 {
- return bol, nil
- }
- return nil, errFindNotFound
-}
-
-// Hash returns the hash code for the Value.
-func (bol Boolean) Hash() int {
- if bol {
- return 1
- }
- return 0
-}
-
-// IsGround always returns true.
-func (Boolean) IsGround() bool {
- return true
-}
-
-func (bol Boolean) String() string {
- return strconv.FormatBool(bool(bol))
+ return v1.BooleanTerm(b)
}
// Number represents a numeric value as defined by JSON.
-type Number json.Number
+type Number = v1.Number
// NumberTerm creates a new Term with a Number value.
func NumberTerm(n json.Number) *Term {
- return &Term{Value: Number(n)}
+ return v1.NumberTerm(n)
}
// IntNumberTerm creates a new Term with an integer Number value.
func IntNumberTerm(i int) *Term {
- return &Term{Value: Number(strconv.Itoa(i))}
+ return v1.IntNumberTerm(i)
}
// UIntNumberTerm creates a new Term with an unsigned integer Number value.
func UIntNumberTerm(u uint64) *Term {
- return &Term{Value: uint64Number(u)}
+ return v1.UIntNumberTerm(u)
}
// FloatNumberTerm creates a new Term with a floating point Number value.
func FloatNumberTerm(f float64) *Term {
- s := strconv.FormatFloat(f, 'g', -1, 64)
- return &Term{Value: Number(s)}
-}
-
-// 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:
- return Compare(num, other) == 0
- default:
- return false
- }
-}
-
-// Compare compares num to other, return <0, 0, or >0 if it is less than, equal to,
-// or greater than other.
-func (num Number) Compare(other Value) int {
- return Compare(num, other)
-}
-
-// Find returns the current value or a not found error.
-func (num Number) Find(path Ref) (Value, error) {
- if len(path) == 0 {
- return num, nil
- }
- return nil, errFindNotFound
-}
-
-// Hash returns the hash code for the Value.
-func (num Number) Hash() int {
- f, err := json.Number(num).Float64()
- if err != nil {
- bs := []byte(num)
- h := xxhash.Checksum64(bs)
- return int(h)
- }
- return int(f)
-}
-
-// Int returns the int representation of num if possible.
-func (num Number) Int() (int, bool) {
- i64, ok := num.Int64()
- return int(i64), ok
-}
-
-// Int64 returns the int64 representation of num if possible.
-func (num Number) Int64() (int64, bool) {
- i, err := json.Number(num).Int64()
- if err != nil {
- return 0, false
- }
- return i, true
-}
-
-// Float64 returns the float64 representation of num if possible.
-func (num Number) Float64() (float64, bool) {
- f, err := json.Number(num).Float64()
- if err != nil {
- return 0, false
- }
- return f, true
-}
-
-// IsGround always returns true.
-func (Number) IsGround() bool {
- return true
-}
-
-// MarshalJSON returns JSON encoded bytes representing num.
-func (num Number) MarshalJSON() ([]byte, error) {
- return json.Marshal(json.Number(num))
-}
-
-func (num Number) String() string {
- return string(num)
-}
-
-func intNumber(i int) Number {
- return Number(strconv.Itoa(i))
-}
-
-func int64Number(i int64) Number {
- return Number(strconv.FormatInt(i, 10))
-}
-
-func uint64Number(u uint64) Number {
- return Number(strconv.FormatUint(u, 10))
-}
-
-func floatNumber(f float64) Number {
- return Number(strconv.FormatFloat(f, 'g', -1, 64))
+ return v1.FloatNumberTerm(f)
}
// String represents a string value as defined by JSON.
-type String string
+type String = v1.String
// StringTerm creates a new Term with a String value.
func StringTerm(s string) *Term {
- return &Term{Value: String(s)}
-}
-
-// Equal returns true if the other Value is a String and is equal.
-func (str String) Equal(other Value) bool {
- switch other := other.(type) {
- case String:
- return str == other
- default:
- return false
- }
-}
-
-// Compare compares str to other, return <0, 0, or >0 if it is less than, equal to,
-// or greater than other.
-func (str String) Compare(other Value) int {
- return Compare(str, other)
-}
-
-// Find returns the current value or a not found error.
-func (str String) Find(path Ref) (Value, error) {
- if len(path) == 0 {
- return str, nil
- }
- return nil, errFindNotFound
-}
-
-// IsGround always returns true.
-func (String) IsGround() bool {
- return true
-}
-
-func (str String) String() string {
- return strconv.Quote(string(str))
-}
-
-// Hash returns the hash code for the Value.
-func (str String) Hash() int {
- h := xxhash.ChecksumString64S(string(str), hashSeed0)
- return int(h)
+ return v1.StringTerm(s)
}
// Var represents a variable as defined by the language.
-type Var string
+type Var = v1.Var
// VarTerm creates a new Term with a Variable value.
func VarTerm(v string) *Term {
- return &Term{Value: Var(v)}
-}
-
-// Equal returns true if the other Value is a Variable and has the same value
-// (name).
-func (v Var) Equal(other Value) bool {
- switch other := other.(type) {
- case Var:
- return v == other
- default:
- return false
- }
-}
-
-// Compare compares v to other, return <0, 0, or >0 if it is less than, equal to,
-// or greater than other.
-func (v Var) Compare(other Value) int {
- return Compare(v, other)
-}
-
-// Find returns the current value or a not found error.
-func (v Var) Find(path Ref) (Value, error) {
- if len(path) == 0 {
- return v, nil
- }
- return nil, errFindNotFound
-}
-
-// Hash returns the hash code for the Value.
-func (v Var) Hash() int {
- h := xxhash.ChecksumString64S(string(v), hashSeed0)
- return int(h)
-}
-
-// IsGround always returns false.
-func (Var) IsGround() bool {
- return false
-}
-
-// IsWildcard returns true if this is a wildcard variable.
-func (v Var) IsWildcard() bool {
- return strings.HasPrefix(string(v), WildcardPrefix)
-}
-
-// IsGenerated returns true if this variable was generated during compilation.
-func (v Var) IsGenerated() bool {
- return strings.HasPrefix(string(v), "__local")
-}
-
-func (v Var) String() string {
- // Special case for wildcard so that string representation is parseable. The
- // parser mangles wildcard variables to make their names unique and uses an
- // illegal variable name character (WildcardPrefix) to avoid conflicts. When
- // we serialize the variable here, we need to make sure it's parseable.
- if v.IsWildcard() {
- return Wildcard.String()
- }
- return string(v)
+ return v1.VarTerm(v)
}
// Ref represents a reference as defined by the language.
-type Ref []*Term
+type Ref = v1.Ref
// EmptyRef returns a new, empty reference.
func EmptyRef() Ref {
- return Ref([]*Term{})
+ return v1.EmptyRef()
}
// PtrRef returns a new reference against the head for the pointer
// s. Path components in the pointer are unescaped.
func PtrRef(head *Term, s string) (Ref, error) {
- s = strings.Trim(s, "/")
- if s == "" {
- return Ref{head}, nil
- }
- parts := strings.Split(s, "/")
- if maxLen := math.MaxInt32; len(parts) >= maxLen {
- return nil, fmt.Errorf("path too long: %s, %d > %d (max)", s, len(parts), maxLen)
- }
- ref := make(Ref, uint(len(parts))+1)
- ref[0] = head
- for i := 0; i < len(parts); i++ {
- var err error
- parts[i], err = url.PathUnescape(parts[i])
- if err != nil {
- return nil, err
- }
- ref[i+1] = StringTerm(parts[i])
- }
- return ref, nil
+ return v1.PtrRef(head, s)
}
// RefTerm creates a new Term with a Ref value.
func RefTerm(r ...*Term) *Term {
- return &Term{Value: Ref(r)}
-}
-
-// Append returns a copy of ref with the term appended to the end.
-func (ref Ref) Append(term *Term) Ref {
- n := len(ref)
- dst := make(Ref, n+1)
- copy(dst, ref)
- dst[n] = term
- return dst
-}
-
-// Insert returns a copy of the ref with x inserted at pos. If pos < len(ref),
-// existing elements are shifted to the right. If pos > len(ref)+1 this
-// function panics.
-func (ref Ref) Insert(x *Term, pos int) Ref {
- switch {
- case pos == len(ref):
- return ref.Append(x)
- case pos > len(ref)+1:
- panic("illegal index")
- }
- cpy := make(Ref, len(ref)+1)
- copy(cpy, ref[:pos])
- cpy[pos] = x
- copy(cpy[pos+1:], ref[pos:])
- return cpy
-}
-
-// Extend returns a copy of ref with the terms from other appended. The head of
-// other will be converted to a string.
-func (ref Ref) Extend(other Ref) Ref {
- dst := make(Ref, len(ref)+len(other))
- copy(dst, ref)
-
- head := other[0].Copy()
- head.Value = String(head.Value.(Var))
- offset := len(ref)
- dst[offset] = head
-
- copy(dst[offset+1:], other[1:])
- return dst
-}
-
-// Concat returns a ref with the terms appended.
-func (ref Ref) Concat(terms []*Term) Ref {
- if len(terms) == 0 {
- return ref
- }
- cpy := make(Ref, len(ref)+len(terms))
- copy(cpy, ref)
- copy(cpy[len(ref):], terms)
- return cpy
-}
-
-// Dynamic returns the offset of the first non-constant operand of ref.
-func (ref Ref) Dynamic() int {
- switch ref[0].Value.(type) {
- case Call:
- return 0
- }
- for i := 1; i < len(ref); i++ {
- if !IsConstant(ref[i].Value) {
- return i
- }
- }
- return -1
-}
-
-// Copy returns a deep copy of ref.
-func (ref Ref) Copy() Ref {
- return termSliceCopy(ref)
-}
-
-// Equal returns true if ref is equal to other.
-func (ref Ref) Equal(other Value) bool {
- return Compare(ref, other) == 0
-}
-
-// Compare compares ref to other, return <0, 0, or >0 if it is less than, equal to,
-// or greater than other.
-func (ref Ref) Compare(other Value) int {
- return Compare(ref, other)
-}
-
-// Find returns the current value or a "not found" error.
-func (ref Ref) Find(path Ref) (Value, error) {
- if len(path) == 0 {
- return ref, nil
- }
- return nil, errFindNotFound
-}
-
-// Hash returns the hash code for the Value.
-func (ref Ref) Hash() int {
- return termSliceHash(ref)
-}
-
-// HasPrefix returns true if the other ref is a prefix of this ref.
-func (ref Ref) HasPrefix(other Ref) bool {
- if len(other) > len(ref) {
- return false
- }
- for i := range other {
- if !ref[i].Equal(other[i]) {
- return false
- }
- }
- return true
-}
-
-// ConstantPrefix returns the constant portion of the ref starting from the head.
-func (ref Ref) ConstantPrefix() Ref {
- ref = ref.Copy()
-
- i := ref.Dynamic()
- if i < 0 {
- return ref
- }
- return ref[:i]
-}
-
-func (ref Ref) StringPrefix() Ref {
- r := ref.Copy()
-
- for i := 1; i < len(ref); i++ {
- switch r[i].Value.(type) {
- case String: // pass
- default: // cut off
- return r[:i]
- }
- }
-
- return r
-}
-
-// GroundPrefix returns the ground portion of the ref starting from the head. By
-// definition, the head of the reference is always ground.
-func (ref Ref) GroundPrefix() Ref {
- prefix := make(Ref, 0, len(ref))
-
- for i, x := range ref {
- if i > 0 && !x.IsGround() {
- break
- }
- prefix = append(prefix, x)
- }
-
- return prefix
-}
-
-func (ref Ref) DynamicSuffix() Ref {
- i := ref.Dynamic()
- if i < 0 {
- return nil
- }
- return ref[i:]
-}
-
-// IsGround returns true if all of the parts of the Ref are ground.
-func (ref Ref) IsGround() bool {
- if len(ref) == 0 {
- return true
- }
- return termSliceIsGround(ref[1:])
-}
-
-// IsNested returns true if this ref contains other Refs.
-func (ref Ref) IsNested() bool {
- for _, x := range ref {
- if _, ok := x.Value.(Ref); ok {
- return true
- }
- }
- return false
-}
-
-// Ptr returns a slash-separated path string for this ref. If the ref
-// contains non-string terms this function returns an error. Path
-// components are escaped.
-func (ref Ref) Ptr() (string, error) {
- parts := make([]string, 0, len(ref)-1)
- for _, term := range ref[1:] {
- if str, ok := term.Value.(String); ok {
- parts = append(parts, url.PathEscape(string(str)))
- } else {
- return "", fmt.Errorf("invalid path value type")
- }
- }
- return strings.Join(parts, "/"), nil
+ return v1.RefTerm(r...)
}
-var varRegexp = regexp.MustCompile("^[[:alpha:]_][[:alpha:][:digit:]_]*$")
-
func IsVarCompatibleString(s string) bool {
- return varRegexp.MatchString(s)
-}
-
-func (ref Ref) String() string {
- if len(ref) == 0 {
- return ""
- }
- buf := []string{ref[0].Value.String()}
- path := ref[1:]
- for _, p := range path {
- switch p := p.Value.(type) {
- case String:
- str := string(p)
- if varRegexp.MatchString(str) && len(buf) > 0 && !IsKeyword(str) {
- buf = append(buf, "."+str)
- } else {
- buf = append(buf, "["+p.String()+"]")
- }
- default:
- buf = append(buf, "["+p.String()+"]")
- }
- }
- return strings.Join(buf, "")
-}
-
-// OutputVars returns a VarSet containing variables that would be bound by evaluating
-// this expression in isolation.
-func (ref Ref) OutputVars() VarSet {
- vis := NewVarVisitor().WithParams(VarVisitorParams{SkipRefHead: true})
- vis.Walk(ref)
- return vis.Vars()
-}
-
-func (ref Ref) toArray() *Array {
- a := NewArray()
- for _, term := range ref {
- if _, ok := term.Value.(String); ok {
- a = a.Append(term)
- } else {
- a = a.Append(StringTerm(term.Value.String()))
- }
- }
- return a
+ return v1.IsVarCompatibleString(s)
}
// QueryIterator defines the interface for querying AST documents with references.
-type QueryIterator func(map[Var]Value, Value) error
+type QueryIterator = v1.QueryIterator
// ArrayTerm creates a new Term with an Array value.
func ArrayTerm(a ...*Term) *Term {
- return NewTerm(NewArray(a...))
+ return v1.ArrayTerm(a...)
}
// NewArray creates an Array with the terms provided. The array will
// use the provided term slice.
func NewArray(a ...*Term) *Array {
- hs := make([]int, len(a))
- for i, e := range a {
- hs[i] = e.Value.Hash()
- }
- arr := &Array{elems: a, hashs: hs, ground: termSliceIsGround(a)}
- arr.rehash()
- return arr
+ return v1.NewArray(a...)
}
// Array represents an array as defined by the language. Arrays are similar to the
// same types as defined by JSON with the exception that they can contain Vars
// and References.
-type Array struct {
- elems []*Term
- hashs []int // element hashes
- hash int
- ground bool
-}
-
-// Copy returns a deep copy of arr.
-func (arr *Array) Copy() *Array {
- cpy := make([]int, len(arr.elems))
- copy(cpy, arr.hashs)
- return &Array{
- elems: termSliceCopy(arr.elems),
- hashs: cpy,
- hash: arr.hash,
- ground: arr.IsGround()}
-}
-
-// Equal returns true if arr is equal to other.
-func (arr *Array) Equal(other Value) bool {
- return Compare(arr, other) == 0
-}
-
-// Compare compares arr to other, return <0, 0, or >0 if it is less than, equal to,
-// or greater than other.
-func (arr *Array) Compare(other Value) int {
- return Compare(arr, other)
-}
-
-// Find returns the value at the index or an out-of-range error.
-func (arr *Array) Find(path Ref) (Value, error) {
- if len(path) == 0 {
- return arr, nil
- }
- num, ok := path[0].Value.(Number)
- if !ok {
- return nil, errFindNotFound
- }
- i, ok := num.Int()
- if !ok {
- return nil, errFindNotFound
- }
- if i < 0 || i >= arr.Len() {
- return nil, errFindNotFound
- }
- return arr.Elem(i).Value.Find(path[1:])
-}
-
-// Get returns the element at pos or nil if not possible.
-func (arr *Array) Get(pos *Term) *Term {
- num, ok := pos.Value.(Number)
- if !ok {
- return nil
- }
-
- i, ok := num.Int()
- if !ok {
- return nil
- }
-
- if i >= 0 && i < len(arr.elems) {
- return arr.elems[i]
- }
-
- return nil
-}
-
-// Sorted returns a new Array that contains the sorted elements of arr.
-func (arr *Array) Sorted() *Array {
- cpy := make([]*Term, len(arr.elems))
- for i := range cpy {
- cpy[i] = arr.elems[i]
- }
- sort.Sort(termSlice(cpy))
- a := NewArray(cpy...)
- a.hashs = arr.hashs
- return a
-}
-
-// Hash returns the hash code for the Value.
-func (arr *Array) Hash() int {
- return arr.hash
-}
-
-// IsGround returns true if all of the Array elements are ground.
-func (arr *Array) IsGround() bool {
- return arr.ground
-}
-
-// MarshalJSON returns JSON encoded bytes representing arr.
-func (arr *Array) MarshalJSON() ([]byte, error) {
- if len(arr.elems) == 0 {
- return []byte(`[]`), nil
- }
- return json.Marshal(arr.elems)
-}
-
-func (arr *Array) String() string {
- var b strings.Builder
- b.WriteRune('[')
- for i, e := range arr.elems {
- if i > 0 {
- b.WriteString(", ")
- }
- b.WriteString(e.String())
- }
- b.WriteRune(']')
- return b.String()
-}
-
-// Len returns the number of elements in the array.
-func (arr *Array) Len() int {
- return len(arr.elems)
-}
-
-// Elem returns the element i of arr.
-func (arr *Array) Elem(i int) *Term {
- return arr.elems[i]
-}
-
-// Set sets the element i of arr.
-func (arr *Array) Set(i int, v *Term) {
- arr.set(i, v)
-}
-
-// rehash updates the cached hash of arr.
-func (arr *Array) rehash() {
- arr.hash = 0
- for _, h := range arr.hashs {
- arr.hash += h
- }
-}
-
-// set sets the element i of arr.
-func (arr *Array) set(i int, v *Term) {
- arr.ground = arr.ground && v.IsGround()
- arr.elems[i] = v
- arr.hashs[i] = v.Value.Hash()
- arr.rehash()
-}
-
-// Slice returns a slice of arr starting from i index to j. -1
-// indicates the end of the array. The returned value array is not a
-// copy and any modifications to either of arrays may be reflected to
-// the other.
-func (arr *Array) Slice(i, j int) *Array {
- var elems []*Term
- var hashs []int
- if j == -1 {
- elems = arr.elems[i:]
- hashs = arr.hashs[i:]
- } else {
- elems = arr.elems[i:j]
- hashs = arr.hashs[i:j]
- }
- // If arr is ground, the slice is, too.
- // If it's not, the slice could still be.
- gr := arr.ground || termSliceIsGround(elems)
-
- s := &Array{elems: elems, hashs: hashs, ground: gr}
- s.rehash()
- return s
-}
-
-// Iter calls f on each element in arr. If f returns an error,
-// iteration stops and the return value is the error.
-func (arr *Array) Iter(f func(*Term) error) error {
- for i := range arr.elems {
- if err := f(arr.elems[i]); err != nil {
- return err
- }
- }
- return nil
-}
-
-// Until calls f on each element in arr. If f returns true, iteration stops.
-func (arr *Array) Until(f func(*Term) bool) bool {
- err := arr.Iter(func(t *Term) error {
- if f(t) {
- return errStop
- }
- return nil
- })
- return err != nil
-}
-
-// Foreach calls f on each element in arr.
-func (arr *Array) Foreach(f func(*Term)) {
- _ = arr.Iter(func(t *Term) error {
- f(t)
- return nil
- }) // ignore error
-}
-
-// Append appends a term to arr, returning the appended array.
-func (arr *Array) Append(v *Term) *Array {
- cpy := *arr
- cpy.elems = append(arr.elems, v)
- cpy.hashs = append(arr.hashs, v.Value.Hash())
- cpy.hash = arr.hash + v.Value.Hash()
- cpy.ground = arr.ground && v.IsGround()
- return &cpy
-}
+type Array = v1.Array
// Set represents a set as defined by the language.
-type Set interface {
- Value
- Len() int
- Copy() Set
- Diff(Set) Set
- Intersect(Set) Set
- Union(Set) Set
- Add(*Term)
- Iter(func(*Term) error) error
- Until(func(*Term) bool) bool
- Foreach(func(*Term))
- Contains(*Term) bool
- Map(func(*Term) (*Term, error)) (Set, error)
- Reduce(*Term, func(*Term, *Term) (*Term, error)) (*Term, error)
- Sorted() *Array
- Slice() []*Term
-}
+type Set = v1.Set
// NewSet returns a new Set containing t.
func NewSet(t ...*Term) Set {
- s := newset(len(t))
- for i := range t {
- s.Add(t[i])
- }
- return s
+ return v1.NewSet(t...)
}
-func newset(n int) *set {
- var keys []*Term
- if n > 0 {
- keys = make([]*Term, 0, n)
- }
- return &set{
- elems: make(map[int]*Term, n),
- keys: keys,
- hash: 0,
- ground: true,
- sortGuard: new(sync.Once),
- }
-}
-
-// SetTerm returns a new Term representing a set containing terms t.
func SetTerm(t ...*Term) *Term {
- set := NewSet(t...)
- return &Term{
- Value: set,
- }
-}
-
-type set struct {
- elems map[int]*Term
- keys []*Term
- hash int
- ground bool
- sortGuard *sync.Once // Prevents race condition around sorting.
-}
-
-// Copy returns a deep copy of s.
-func (s *set) Copy() Set {
- cpy := newset(s.Len())
- s.Foreach(func(x *Term) {
- cpy.Add(x.Copy())
- })
- cpy.hash = s.hash
- cpy.ground = s.ground
- return cpy
-}
-
-// IsGround returns true if all terms in s are ground.
-func (s *set) IsGround() bool {
- return s.ground
-}
-
-// Hash returns a hash code for s.
-func (s *set) Hash() int {
- return s.hash
-}
-
-func (s *set) String() string {
- if s.Len() == 0 {
- return "set()"
- }
- var b strings.Builder
- b.WriteRune('{')
- for i := range s.sortedKeys() {
- if i > 0 {
- b.WriteString(", ")
- }
- b.WriteString(s.keys[i].Value.String())
- }
- b.WriteRune('}')
- return b.String()
-}
-
-func (s *set) sortedKeys() []*Term {
- s.sortGuard.Do(func() {
- sort.Sort(termSlice(s.keys))
- })
- return s.keys
-}
-
-// Compare compares s to other, return <0, 0, or >0 if it is less than, equal to,
-// or greater than other.
-func (s *set) Compare(other Value) int {
- o1 := sortOrder(s)
- o2 := sortOrder(other)
- if o1 < o2 {
- return -1
- } else if o1 > o2 {
- return 1
- }
- t := other.(*set)
- return termSliceCompare(s.sortedKeys(), t.sortedKeys())
-}
-
-// Find returns the set or dereferences the element itself.
-func (s *set) Find(path Ref) (Value, error) {
- if len(path) == 0 {
- return s, nil
- }
- if !s.Contains(path[0]) {
- return nil, errFindNotFound
- }
- return path[0].Value.Find(path[1:])
-}
-
-// Diff returns elements in s that are not in other.
-func (s *set) Diff(other Set) Set {
- r := NewSet()
- s.Foreach(func(x *Term) {
- if !other.Contains(x) {
- r.Add(x)
- }
- })
- return r
-}
-
-// Intersect returns the set containing elements in both s and other.
-func (s *set) Intersect(other Set) Set {
- o := other.(*set)
- n, m := s.Len(), o.Len()
- ss := s
- so := o
- if m < n {
- ss = o
- so = s
- n = m
- }
-
- r := newset(n)
- ss.Foreach(func(x *Term) {
- if so.Contains(x) {
- r.Add(x)
- }
- })
- return r
-}
-
-// Union returns the set containing all elements of s and other.
-func (s *set) Union(other Set) Set {
- r := NewSet()
- s.Foreach(func(x *Term) {
- r.Add(x)
- })
- other.Foreach(func(x *Term) {
- r.Add(x)
- })
- return r
-}
-
-// Add updates s to include t.
-func (s *set) Add(t *Term) {
- s.insert(t)
-}
-
-// Iter calls f on each element in s. If f returns an error, iteration stops
-// and the return value is the error.
-func (s *set) Iter(f func(*Term) error) error {
- for i := range s.sortedKeys() {
- if err := f(s.keys[i]); err != nil {
- return err
- }
- }
- return nil
-}
-
-var errStop = errors.New("stop")
-
-// Until calls f on each element in s. If f returns true, iteration stops.
-func (s *set) Until(f func(*Term) bool) bool {
- err := s.Iter(func(t *Term) error {
- if f(t) {
- return errStop
- }
- return nil
- })
- return err != nil
-}
-
-// Foreach calls f on each element in s.
-func (s *set) Foreach(f func(*Term)) {
- _ = s.Iter(func(t *Term) error {
- f(t)
- return nil
- }) // ignore error
-}
-
-// Map returns a new Set obtained by applying f to each value in s.
-func (s *set) Map(f func(*Term) (*Term, error)) (Set, error) {
- set := NewSet()
- err := s.Iter(func(x *Term) error {
- term, err := f(x)
- if err != nil {
- return err
- }
- set.Add(term)
- return nil
- })
- if err != nil {
- return nil, err
- }
- return set, nil
-}
-
-// Reduce returns a Term produced by applying f to each value in s. The first
-// argument to f is the reduced value (starting with i) and the second argument
-// to f is the element in s.
-func (s *set) Reduce(i *Term, f func(*Term, *Term) (*Term, error)) (*Term, error) {
- err := s.Iter(func(x *Term) error {
- var err error
- i, err = f(i, x)
- if err != nil {
- return err
- }
- return nil
- })
- return i, err
-}
-
-// Contains returns true if t is in s.
-func (s *set) Contains(t *Term) bool {
- return s.get(t) != nil
-}
-
-// Len returns the number of elements in the set.
-func (s *set) Len() int {
- return len(s.keys)
-}
-
-// MarshalJSON returns JSON encoded bytes representing s.
-func (s *set) MarshalJSON() ([]byte, error) {
- if s.keys == nil {
- return []byte(`[]`), nil
- }
- return json.Marshal(s.sortedKeys())
-}
-
-// Sorted returns an Array that contains the sorted elements of s.
-func (s *set) Sorted() *Array {
- cpy := make([]*Term, len(s.keys))
- copy(cpy, s.sortedKeys())
- return NewArray(cpy...)
-}
-
-// Slice returns a slice of terms contained in the set.
-func (s *set) Slice() []*Term {
- return s.sortedKeys()
-}
-
-// NOTE(philipc): We assume a many-readers, single-writer model here.
-// This method should NOT be used concurrently, or else we risk data races.
-func (s *set) insert(x *Term) {
- 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) {
- return
- }
-
- insertHash++
- curr, ok = s.elems[insertHash]
- }
-
- s.elems[insertHash] = x
- // O(1) insertion, but we'll have to re-sort the keys later.
- s.keys = append(s.keys, x)
- // Reset the sync.Once instance.
- // See https://github.com/golang/go/issues/25955 for why we do it this way.
- s.sortGuard = new(sync.Once)
-
- s.hash += hash
- s.ground = s.ground && x.IsGround()
-}
-
-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 }
- }
-
- for curr, ok := s.elems[hash]; ok; {
- if equal(curr.Value) {
- return curr
- }
-
- hash++
- curr, ok = s.elems[hash]
- }
- return nil
+ return v1.SetTerm(t...)
}
// Object represents an object as defined by the language.
-type Object interface {
- Value
- Len() int
- Get(*Term) *Term
- Copy() Object
- Insert(*Term, *Term)
- Iter(func(*Term, *Term) error) error
- Until(func(*Term, *Term) bool) bool
- Foreach(func(*Term, *Term))
- Map(func(*Term, *Term) (*Term, *Term, error)) (Object, error)
- Diff(other Object) Object
- Intersect(other Object) [][3]*Term
- Merge(other Object) (Object, bool)
- MergeWith(other Object, conflictResolver func(v1, v2 *Term) (*Term, bool)) (Object, bool)
- Filter(filter Object) (Object, error)
- Keys() []*Term
- KeysIterator() ObjectKeysIterator
- get(k *Term) *objectElem // To prevent external implementations
-}
+type Object = v1.Object
// NewObject creates a new Object with t.
func NewObject(t ...[2]*Term) Object {
- obj := newobject(len(t))
- for i := range t {
- obj.Insert(t[i][0], t[i][1])
- }
- return obj
+ return v1.NewObject(t...)
}
// ObjectTerm creates a new Term with an Object value.
func ObjectTerm(o ...[2]*Term) *Term {
- return &Term{Value: NewObject(o...)}
-}
-
-func LazyObject(blob map[string]interface{}) Object {
- return &lazyObj{native: blob, cache: map[string]Value{}}
-}
-
-type lazyObj struct {
- strict Object
- cache map[string]Value
- native map[string]interface{}
-}
-
-func (l *lazyObj) force() Object {
- if l.strict == nil {
- l.strict = MustInterfaceToValue(l.native).(Object)
- // NOTE(jf): a possible performance improvement here would be to check how many
- // entries have been realized to AST in the cache, and if some threshold compared to the
- // total number of keys is exceeded, realize the remaining entries and set l.strict to l.cache.
- l.cache = map[string]Value{} // We don't need the cache anymore; drop it to free up memory.
- }
- return l.strict
-}
-
-func (l *lazyObj) Compare(other Value) int {
- o1 := sortOrder(l)
- o2 := sortOrder(other)
- if o1 < o2 {
- return -1
- } else if o2 < o1 {
- return 1
- }
- return l.force().Compare(other)
-}
-
-func (l *lazyObj) Copy() Object {
- return l
-}
-
-func (l *lazyObj) Diff(other Object) Object {
- return l.force().Diff(other)
-}
-
-func (l *lazyObj) Intersect(other Object) [][3]*Term {
- return l.force().Intersect(other)
-}
-
-func (l *lazyObj) Iter(f func(*Term, *Term) error) error {
- return l.force().Iter(f)
-}
-
-func (l *lazyObj) Until(f func(*Term, *Term) bool) bool {
- // NOTE(sr): there could be benefits in not forcing here -- if we abort because
- // `f` returns true, we could save us from converting the rest of the object.
- return l.force().Until(f)
-}
-
-func (l *lazyObj) Foreach(f func(*Term, *Term)) {
- l.force().Foreach(f)
-}
-
-func (l *lazyObj) Filter(filter Object) (Object, error) {
- return l.force().Filter(filter)
-}
-
-func (l *lazyObj) Map(f func(*Term, *Term) (*Term, *Term, error)) (Object, error) {
- return l.force().Map(f)
-}
-
-func (l *lazyObj) MarshalJSON() ([]byte, error) {
- return l.force().(*object).MarshalJSON()
-}
-
-func (l *lazyObj) Merge(other Object) (Object, bool) {
- return l.force().Merge(other)
-}
-
-func (l *lazyObj) MergeWith(other Object, conflictResolver func(v1, v2 *Term) (*Term, bool)) (Object, bool) {
- return l.force().MergeWith(other, conflictResolver)
-}
-
-func (l *lazyObj) Len() int {
- return len(l.native)
+ return v1.ObjectTerm(o...)
}
-func (l *lazyObj) String() string {
- return l.force().String()
+func LazyObject(blob map[string]any) Object {
+ return v1.LazyObject(blob)
}
-// get is merely there to implement the Object interface -- `get` there serves the
-// purpose of prohibiting external implementations. It's never called for lazyObj.
-func (*lazyObj) get(*Term) *objectElem {
- return nil
-}
-
-func (l *lazyObj) Get(k *Term) *Term {
- if l.strict != nil {
- return l.strict.Get(k)
- }
- if s, ok := k.Value.(String); ok {
- if v, ok := l.cache[string(s)]; ok {
- return NewTerm(v)
- }
-
- if val, ok := l.native[string(s)]; ok {
- var converted Value
- switch val := val.(type) {
- case map[string]interface{}:
- converted = LazyObject(val)
- default:
- converted = MustInterfaceToValue(val)
- }
- l.cache[string(s)] = converted
- return NewTerm(converted)
- }
- }
- return nil
-}
-
-func (l *lazyObj) Insert(k, v *Term) {
- l.force().Insert(k, v)
-}
-
-func (*lazyObj) IsGround() bool {
- return true
-}
-
-func (l *lazyObj) Hash() int {
- return l.force().Hash()
-}
-
-func (l *lazyObj) Keys() []*Term {
- if l.strict != nil {
- return l.strict.Keys()
- }
- ret := make([]*Term, 0, len(l.native))
- for k := range l.native {
- ret = append(ret, StringTerm(k))
- }
- sort.Sort(termSlice(ret))
- return ret
-}
-
-func (l *lazyObj) KeysIterator() ObjectKeysIterator {
- return &lazyObjKeysIterator{keys: l.Keys()}
-}
-
-type lazyObjKeysIterator struct {
- current int
- keys []*Term
-}
-
-func (ki *lazyObjKeysIterator) Next() (*Term, bool) {
- if ki.current == len(ki.keys) {
- return nil, false
- }
- ki.current++
- return ki.keys[ki.current-1], true
-}
-
-func (l *lazyObj) Find(path Ref) (Value, error) {
- if l.strict != nil {
- return l.strict.Find(path)
- }
- if len(path) == 0 {
- return l, nil
- }
- if p0, ok := path[0].Value.(String); ok {
- if v, ok := l.cache[string(p0)]; ok {
- return v.Find(path[1:])
- }
-
- if v, ok := l.native[string(p0)]; ok {
- var converted Value
- switch v := v.(type) {
- case map[string]interface{}:
- converted = LazyObject(v)
- default:
- converted = MustInterfaceToValue(v)
- }
- l.cache[string(p0)] = converted
- return converted.Find(path[1:])
- }
- }
- return nil, errFindNotFound
-}
-
-type object struct {
- elems map[int]*objectElem
- keys objectElemSlice
- ground int // number of key and value grounds. Counting is
- // required to support insert's key-value replace.
- hash int
- sortGuard *sync.Once // Prevents race condition around sorting.
-}
-
-func newobject(n int) *object {
- var keys objectElemSlice
- if n > 0 {
- keys = make(objectElemSlice, 0, n)
- }
- return &object{
- elems: make(map[int]*objectElem, n),
- keys: keys,
- ground: 0,
- hash: 0,
- sortGuard: new(sync.Once),
- }
-}
-
-type objectElem struct {
- key *Term
- value *Term
- next *objectElem
-}
-
-type objectElemSlice []*objectElem
-
-func (s objectElemSlice) Less(i, j int) bool { return Compare(s[i].key.Value, s[j].key.Value) < 0 }
-func (s objectElemSlice) Swap(i, j int) { x := s[i]; s[i] = s[j]; s[j] = x }
-func (s objectElemSlice) Len() int { return len(s) }
-
// Item is a helper for constructing an tuple containing two Terms
// representing a key/value pair in an Object.
func Item(key, value *Term) [2]*Term {
- return [2]*Term{key, value}
-}
-
-func (obj *object) sortedKeys() objectElemSlice {
- obj.sortGuard.Do(func() {
- sort.Sort(obj.keys)
- })
- return obj.keys
-}
-
-// Compare compares obj to other, return <0, 0, or >0 if it is less than, equal to,
-// or greater than other.
-func (obj *object) Compare(other Value) int {
- if x, ok := other.(*lazyObj); ok {
- other = x.force()
- }
- o1 := sortOrder(obj)
- o2 := sortOrder(other)
- if o1 < o2 {
- return -1
- } else if o2 < o1 {
- return 1
- }
- a := obj
- b := other.(*object)
- // Ensure that keys are in canonical sorted order before use!
- akeys := a.sortedKeys()
- bkeys := b.sortedKeys()
- minLen := len(akeys)
- if len(b.keys) < len(akeys) {
- minLen = len(bkeys)
- }
- for i := 0; i < minLen; i++ {
- keysCmp := Compare(akeys[i].key, bkeys[i].key)
- if keysCmp < 0 {
- return -1
- }
- if keysCmp > 0 {
- return 1
- }
- valA := akeys[i].value
- valB := bkeys[i].value
- valCmp := Compare(valA, valB)
- if valCmp != 0 {
- return valCmp
- }
- }
- if len(akeys) < len(bkeys) {
- return -1
- }
- if len(bkeys) < len(akeys) {
- return 1
- }
- return 0
-}
-
-// Find returns the value at the key or undefined.
-func (obj *object) Find(path Ref) (Value, error) {
- if len(path) == 0 {
- return obj, nil
- }
- value := obj.Get(path[0])
- if value == nil {
- return nil, errFindNotFound
- }
- return value.Value.Find(path[1:])
-}
-
-func (obj *object) Insert(k, v *Term) {
- obj.insert(k, v)
-}
-
-// 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
- }
- return nil
-}
-
-// Hash returns the hash code for the Value.
-func (obj *object) Hash() int {
- return obj.hash
-}
-
-// IsGround returns true if all of the Object key/value pairs are ground.
-func (obj *object) IsGround() bool {
- return obj.ground == 2*len(obj.keys)
-}
-
-// Copy returns a deep copy of obj.
-func (obj *object) Copy() Object {
- cpy, _ := obj.Map(func(k, v *Term) (*Term, *Term, error) {
- return k.Copy(), v.Copy(), nil
- })
- cpy.(*object).hash = obj.hash
- return cpy
-}
-
-// Diff returns a new Object that contains only the key/value pairs that exist in obj.
-func (obj *object) Diff(other Object) Object {
- r := NewObject()
- obj.Foreach(func(k, v *Term) {
- if other.Get(k) == nil {
- r.Insert(k, v)
- }
- })
- return r
-}
-
-// Intersect returns a slice of term triplets that represent the intersection of keys
-// between obj and other. For each intersecting key, the values from obj and other are included
-// as the last two terms in the triplet (respectively).
-func (obj *object) Intersect(other Object) [][3]*Term {
- r := [][3]*Term{}
- obj.Foreach(func(k, v *Term) {
- if v2 := other.Get(k); v2 != nil {
- r = append(r, [3]*Term{k, v, v2})
- }
- })
- return r
-}
-
-// Iter calls the function f for each key-value pair in the object. If f
-// returns an error, iteration stops and the error is returned.
-func (obj *object) Iter(f func(*Term, *Term) error) error {
- for _, node := range obj.sortedKeys() {
- if err := f(node.key, node.value); err != nil {
- return err
- }
- }
- return nil
-}
-
-// Until calls f for each key-value pair in the object. If f returns
-// true, iteration stops and Until returns true. Otherwise, return
-// false.
-func (obj *object) Until(f func(*Term, *Term) bool) bool {
- err := obj.Iter(func(k, v *Term) error {
- if f(k, v) {
- return errStop
- }
- return nil
- })
- return err != nil
-}
-
-// Foreach calls f for each key-value pair in the object.
-func (obj *object) Foreach(f func(*Term, *Term)) {
- _ = obj.Iter(func(k, v *Term) error {
- f(k, v)
- return nil
- }) // ignore error
-}
-
-// Map returns a new Object constructed by mapping each element in the object
-// using the function f.
-func (obj *object) Map(f func(*Term, *Term) (*Term, *Term, error)) (Object, error) {
- cpy := newobject(obj.Len())
- err := obj.Iter(func(k, v *Term) error {
- var err error
- k, v, err = f(k, v)
- if err != nil {
- return err
- }
- cpy.insert(k, v)
- return nil
- })
- if err != nil {
- return nil, err
- }
- return cpy, nil
-}
-
-// Keys returns the keys of obj.
-func (obj *object) Keys() []*Term {
- keys := make([]*Term, len(obj.keys))
-
- for i, elem := range obj.sortedKeys() {
- keys[i] = elem.key
- }
-
- return keys
-}
-
-// Returns an iterator over the obj's keys.
-func (obj *object) KeysIterator() ObjectKeysIterator {
- return newobjectKeysIterator(obj)
-}
-
-// MarshalJSON returns JSON encoded bytes representing obj.
-func (obj *object) MarshalJSON() ([]byte, error) {
- sl := make([][2]*Term, obj.Len())
- for i, node := range obj.sortedKeys() {
- sl[i] = Item(node.key, node.value)
- }
- return json.Marshal(sl)
-}
-
-// Merge returns a new Object containing the non-overlapping keys of obj and other. If there are
-// overlapping keys between obj and other, the values of associated with the keys are merged. Only
-// objects can be merged with other objects. If the values cannot be merged, the second turn value
-// will be false.
-func (obj object) Merge(other Object) (Object, bool) {
- return obj.MergeWith(other, func(v1, v2 *Term) (*Term, bool) {
- obj1, ok1 := v1.Value.(Object)
- obj2, ok2 := v2.Value.(Object)
- if !ok1 || !ok2 {
- return nil, true
- }
- obj3, ok := obj1.Merge(obj2)
- if !ok {
- return nil, true
- }
- return NewTerm(obj3), false
- })
-}
-
-// MergeWith returns a new Object containing the merged keys of obj and other.
-// If there are overlapping keys between obj and other, the conflictResolver
-// is called. The conflictResolver can return a merged value and a boolean
-// indicating if the merge has failed and should stop.
-func (obj object) MergeWith(other Object, conflictResolver func(v1, v2 *Term) (*Term, bool)) (Object, bool) {
- result := NewObject()
- stop := obj.Until(func(k, v *Term) bool {
- v2 := other.Get(k)
- // The key didn't exist in other, keep the original value
- if v2 == nil {
- result.Insert(k, v)
- return false
- }
-
- // The key exists in both, resolve the conflict if possible
- merged, stop := conflictResolver(v, v2)
- if !stop {
- result.Insert(k, merged)
- }
- return stop
- })
-
- if stop {
- return nil, false
- }
-
- // Copy in any values from other for keys that don't exist in obj
- other.Foreach(func(k, v *Term) {
- if v2 := obj.Get(k); v2 == nil {
- result.Insert(k, v)
- }
- })
- return result, true
-}
-
-// Filter returns a new object from values in obj where the keys are
-// found in filter. Array indices for values can be specified as
-// number strings.
-func (obj *object) Filter(filter Object) (Object, error) {
- filtered, err := filterObject(obj, filter)
- if err != nil {
- return nil, err
- }
- return filtered.(Object), nil
-}
-
-// Len returns the number of elements in the object.
-func (obj object) Len() int {
- return len(obj.keys)
-}
-
-func (obj object) String() string {
- var b strings.Builder
- b.WriteRune('{')
-
- for i, elem := range obj.sortedKeys() {
- if i > 0 {
- b.WriteString(", ")
- }
- b.WriteString(elem.key.String())
- b.WriteString(": ")
- b.WriteString(elem.value.String())
- }
- b.WriteRune('}')
- return b.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, 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 := obj.elems[hash]; curr != nil; curr = curr.next {
- if equal(curr.key.Value) {
- return curr
- }
- }
- return nil
-}
-
-// NOTE(philipc): We assume a many-readers, single-writer model here.
-// This method should NOT be used concurrently, or else we risk data races.
-func (obj *object) insert(k, v *Term) {
- 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 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) {
- // The ground bit of the value may change in
- // replace, hence adjust the counter per old
- // and new value.
-
- if curr.value.IsGround() {
- obj.ground--
- }
- if v.IsGround() {
- obj.ground++
- }
-
- curr.value = v
-
- obj.rehash()
- return
- }
- }
- elem := &objectElem{
- key: k,
- value: v,
- next: head,
- }
- obj.elems[hash] = elem
- // O(1) insertion, but we'll have to re-sort the keys later.
- obj.keys = append(obj.keys, elem)
- // Reset the sync.Once instance.
- // See https://github.com/golang/go/issues/25955 for why we do it this way.
- obj.sortGuard = new(sync.Once)
- obj.hash += hash + v.Hash()
-
- if k.IsGround() {
- obj.ground++
- }
- if v.IsGround() {
- obj.ground++
- }
-}
-
-func (obj *object) rehash() {
- // obj.keys is considered truth, from which obj.hash and obj.elems are recalculated.
-
- obj.hash = 0
- obj.elems = make(map[int]*objectElem, len(obj.keys))
-
- for _, elem := range obj.keys {
- hash := elem.key.Hash()
- obj.hash += hash + elem.value.Hash()
- obj.elems[hash] = elem
- }
-}
-
-func filterObject(o Value, filter Value) (Value, error) {
- if filter.Compare(Null{}) == 0 {
- return o, nil
- }
-
- filteredObj, ok := filter.(*object)
- if !ok {
- return nil, fmt.Errorf("invalid filter value %q, expected an object", filter)
- }
-
- switch v := o.(type) {
- case String, Number, Boolean, Null:
- return o, nil
- case *Array:
- values := NewArray()
- for i := 0; i < v.Len(); i++ {
- subFilter := filteredObj.Get(StringTerm(strconv.Itoa(i)))
- if subFilter != nil {
- filteredValue, err := filterObject(v.Elem(i).Value, subFilter.Value)
- if err != nil {
- return nil, err
- }
- values = values.Append(NewTerm(filteredValue))
- }
- }
- return values, nil
- case Set:
- values := NewSet()
- err := v.Iter(func(t *Term) error {
- if filteredObj.Get(t) != nil {
- filteredValue, err := filterObject(t.Value, filteredObj.Get(t).Value)
- if err != nil {
- return err
- }
- values.Add(NewTerm(filteredValue))
- }
- return nil
- })
- return values, err
- case *object:
- values := NewObject()
-
- iterObj := v
- other := filteredObj
- if v.Len() < filteredObj.Len() {
- iterObj = filteredObj
- other = v
- }
-
- err := iterObj.Iter(func(key *Term, _ *Term) error {
- if other.Get(key) != nil {
- filteredValue, err := filterObject(v.Get(key).Value, filteredObj.Get(key).Value)
- if err != nil {
- return err
- }
- values.Insert(key, NewTerm(filteredValue))
- }
- return nil
- })
- return values, err
- default:
- return nil, fmt.Errorf("invalid object value type %q", v)
- }
+ return v1.Item(key, value)
}
// NOTE(philipc): The only way to get an ObjectKeyIterator should be
// from an Object. This ensures that the iterator can have implementation-
// specific details internally, with no contracts except to the very
// limited interface.
-type ObjectKeysIterator interface {
- Next() (*Term, bool)
-}
-
-type objectKeysIterator struct {
- obj *object
- numKeys int
- index int
-}
-
-func newobjectKeysIterator(o *object) ObjectKeysIterator {
- return &objectKeysIterator{
- obj: o,
- numKeys: o.Len(),
- index: 0,
- }
-}
-
-func (oki *objectKeysIterator) Next() (*Term, bool) {
- if oki.index == oki.numKeys || oki.numKeys == 0 {
- return nil, false
- }
- oki.index++
- return oki.obj.sortedKeys()[oki.index-1].key, true
-}
+type ObjectKeysIterator = v1.ObjectKeysIterator
// ArrayComprehension represents an array comprehension as defined in the language.
-type ArrayComprehension struct {
- Term *Term `json:"term"`
- Body Body `json:"body"`
-}
+type ArrayComprehension = v1.ArrayComprehension
// ArrayComprehensionTerm creates a new Term with an ArrayComprehension value.
func ArrayComprehensionTerm(term *Term, body Body) *Term {
- return &Term{
- Value: &ArrayComprehension{
- Term: term,
- Body: body,
- },
- }
-}
-
-// Copy returns a deep copy of ac.
-func (ac *ArrayComprehension) Copy() *ArrayComprehension {
- cpy := *ac
- cpy.Body = ac.Body.Copy()
- cpy.Term = ac.Term.Copy()
- return &cpy
-}
-
-// Equal returns true if ac is equal to other.
-func (ac *ArrayComprehension) Equal(other Value) bool {
- return Compare(ac, other) == 0
-}
-
-// Compare compares ac to other, return <0, 0, or >0 if it is less than, equal to,
-// or greater than other.
-func (ac *ArrayComprehension) Compare(other Value) int {
- return Compare(ac, other)
-}
-
-// Find returns the current value or a not found error.
-func (ac *ArrayComprehension) Find(path Ref) (Value, error) {
- if len(path) == 0 {
- return ac, nil
- }
- return nil, errFindNotFound
-}
-
-// Hash returns the hash code of the Value.
-func (ac *ArrayComprehension) Hash() int {
- return ac.Term.Hash() + ac.Body.Hash()
-}
-
-// IsGround returns true if the Term and Body are ground.
-func (ac *ArrayComprehension) IsGround() bool {
- return ac.Term.IsGround() && ac.Body.IsGround()
-}
-
-func (ac *ArrayComprehension) String() string {
- return "[" + ac.Term.String() + " | " + ac.Body.String() + "]"
+ return v1.ArrayComprehensionTerm(term, body)
}
// ObjectComprehension represents an object comprehension as defined in the language.
-type ObjectComprehension struct {
- Key *Term `json:"key"`
- Value *Term `json:"value"`
- Body Body `json:"body"`
-}
+type ObjectComprehension = v1.ObjectComprehension
// ObjectComprehensionTerm creates a new Term with an ObjectComprehension value.
func ObjectComprehensionTerm(key, value *Term, body Body) *Term {
- return &Term{
- Value: &ObjectComprehension{
- Key: key,
- Value: value,
- Body: body,
- },
- }
-}
-
-// Copy returns a deep copy of oc.
-func (oc *ObjectComprehension) Copy() *ObjectComprehension {
- cpy := *oc
- cpy.Body = oc.Body.Copy()
- cpy.Key = oc.Key.Copy()
- cpy.Value = oc.Value.Copy()
- return &cpy
-}
-
-// Equal returns true if oc is equal to other.
-func (oc *ObjectComprehension) Equal(other Value) bool {
- return Compare(oc, other) == 0
-}
-
-// Compare compares oc to other, return <0, 0, or >0 if it is less than, equal to,
-// or greater than other.
-func (oc *ObjectComprehension) Compare(other Value) int {
- return Compare(oc, other)
-}
-
-// Find returns the current value or a not found error.
-func (oc *ObjectComprehension) Find(path Ref) (Value, error) {
- if len(path) == 0 {
- return oc, nil
- }
- return nil, errFindNotFound
-}
-
-// Hash returns the hash code of the Value.
-func (oc *ObjectComprehension) Hash() int {
- return oc.Key.Hash() + oc.Value.Hash() + oc.Body.Hash()
-}
-
-// IsGround returns true if the Key, Value and Body are ground.
-func (oc *ObjectComprehension) IsGround() bool {
- return oc.Key.IsGround() && oc.Value.IsGround() && oc.Body.IsGround()
-}
-
-func (oc *ObjectComprehension) String() string {
- return "{" + oc.Key.String() + ": " + oc.Value.String() + " | " + oc.Body.String() + "}"
+ return v1.ObjectComprehensionTerm(key, value, body)
}
// SetComprehension represents a set comprehension as defined in the language.
-type SetComprehension struct {
- Term *Term `json:"term"`
- Body Body `json:"body"`
-}
+type SetComprehension = v1.SetComprehension
// SetComprehensionTerm creates a new Term with an SetComprehension value.
func SetComprehensionTerm(term *Term, body Body) *Term {
- return &Term{
- Value: &SetComprehension{
- Term: term,
- Body: body,
- },
- }
-}
-
-// Copy returns a deep copy of sc.
-func (sc *SetComprehension) Copy() *SetComprehension {
- cpy := *sc
- cpy.Body = sc.Body.Copy()
- cpy.Term = sc.Term.Copy()
- return &cpy
-}
-
-// Equal returns true if sc is equal to other.
-func (sc *SetComprehension) Equal(other Value) bool {
- return Compare(sc, other) == 0
-}
-
-// Compare compares sc to other, return <0, 0, or >0 if it is less than, equal to,
-// or greater than other.
-func (sc *SetComprehension) Compare(other Value) int {
- return Compare(sc, other)
-}
-
-// Find returns the current value or a not found error.
-func (sc *SetComprehension) Find(path Ref) (Value, error) {
- if len(path) == 0 {
- return sc, nil
- }
- return nil, errFindNotFound
-}
-
-// Hash returns the hash code of the Value.
-func (sc *SetComprehension) Hash() int {
- return sc.Term.Hash() + sc.Body.Hash()
-}
-
-// IsGround returns true if the Term and Body are ground.
-func (sc *SetComprehension) IsGround() bool {
- return sc.Term.IsGround() && sc.Body.IsGround()
-}
-
-func (sc *SetComprehension) String() string {
- return "{" + sc.Term.String() + " | " + sc.Body.String() + "}"
+ return v1.SetComprehensionTerm(term, body)
}
// Call represents as function call in the language.
-type Call []*Term
+type Call = v1.Call
// CallTerm returns a new Term with a Call value defined by terms. The first
// term is the operator and the rest are operands.
func CallTerm(terms ...*Term) *Term {
- return NewTerm(Call(terms))
-}
-
-// Copy returns a deep copy of c.
-func (c Call) Copy() Call {
- return termSliceCopy(c)
-}
-
-// Compare compares c to other, return <0, 0, or >0 if it is less than, equal to,
-// or greater than other.
-func (c Call) Compare(other Value) int {
- return Compare(c, other)
-}
-
-// Find returns the current value or a not found error.
-func (c Call) Find(Ref) (Value, error) {
- return nil, errFindNotFound
-}
-
-// Hash returns the hash code for the Value.
-func (c Call) Hash() int {
- return termSliceHash(c)
-}
-
-// IsGround returns true if the Value is ground.
-func (c Call) IsGround() bool {
- return termSliceIsGround(c)
-}
-
-// MakeExpr returns an ew Expr from this call.
-func (c Call) MakeExpr(output *Term) *Expr {
- terms := []*Term(c)
- return NewExpr(append(terms, output))
-}
-
-func (c Call) String() string {
- args := make([]string, len(c)-1)
- for i := 1; i < len(c); i++ {
- args[i-1] = c[i].String()
- }
- return fmt.Sprintf("%v(%v)", c[0], strings.Join(args, ", "))
-}
-
-func termSliceCopy(a []*Term) []*Term {
- cpy := make([]*Term, len(a))
- for i := range a {
- cpy[i] = a[i].Copy()
- }
- return cpy
-}
-
-func termSliceEqual(a, b []*Term) bool {
- if len(a) == len(b) {
- for i := range a {
- if !a[i].Equal(b[i]) {
- return false
- }
- }
- return true
- }
- return false
-}
-
-func termSliceHash(a []*Term) int {
- var hash int
- for _, v := range a {
- hash += v.Value.Hash()
- }
- return hash
-}
-
-func termSliceIsGround(a []*Term) bool {
- for _, v := range a {
- if !v.IsGround() {
- return false
- }
- }
- return true
-}
-
-// NOTE(tsandall): The unmarshalling errors in these functions are not
-// helpful for callers because they do not identify the source of the
-// unmarshalling error. Because OPA doesn't accept JSON describing ASTs
-// from callers, this is acceptable (for now). If that changes in the future,
-// the error messages should be revisited. The current approach focuses
-// on the happy path and treats all errors the same. If better error
-// reporting is needed, the error paths will need to be fleshed out.
-
-func unmarshalBody(b []interface{}) (Body, error) {
- buf := Body{}
- for _, e := range b {
- if m, ok := e.(map[string]interface{}); ok {
- expr := &Expr{}
- if err := unmarshalExpr(expr, m); err == nil {
- buf = append(buf, expr)
- continue
- }
- }
- goto unmarshal_error
- }
- return buf, nil
-unmarshal_error:
- return nil, fmt.Errorf("ast: unable to unmarshal body")
-}
-
-func unmarshalExpr(expr *Expr, v map[string]interface{}) error {
- if x, ok := v["negated"]; ok {
- if b, ok := x.(bool); ok {
- expr.Negated = b
- } else {
- return fmt.Errorf("ast: unable to unmarshal negated field with type: %T (expected true or false)", v["negated"])
- }
- }
- if generatedRaw, ok := v["generated"]; ok {
- if b, ok := generatedRaw.(bool); ok {
- expr.Generated = b
- } else {
- return fmt.Errorf("ast: unable to unmarshal generated field with type: %T (expected true or false)", v["generated"])
- }
- }
-
- if err := unmarshalExprIndex(expr, v); err != nil {
- return err
- }
- switch ts := v["terms"].(type) {
- case map[string]interface{}:
- t, err := unmarshalTerm(ts)
- if err != nil {
- return err
- }
- expr.Terms = t
- case []interface{}:
- terms, err := unmarshalTermSlice(ts)
- if err != nil {
- return err
- }
- expr.Terms = terms
- default:
- return fmt.Errorf(`ast: unable to unmarshal terms field with type: %T (expected {"value": ..., "type": ...} or [{"value": ..., "type": ...}, ...])`, v["terms"])
- }
- if x, ok := v["with"]; ok {
- if sl, ok := x.([]interface{}); ok {
- ws := make([]*With, len(sl))
- for i := range sl {
- var err error
- ws[i], err = unmarshalWith(sl[i])
- if err != nil {
- return err
- }
- }
- expr.With = ws
- }
- }
- if loc, ok := v["location"].(map[string]interface{}); ok {
- expr.Location = &Location{}
- if err := unmarshalLocation(expr.Location, loc); err != nil {
- return err
- }
- }
- return nil
-}
-
-func unmarshalLocation(loc *Location, v map[string]interface{}) error {
- if x, ok := v["file"]; ok {
- if s, ok := x.(string); ok {
- loc.File = s
- } else {
- return fmt.Errorf("ast: unable to unmarshal file field with type: %T (expected string)", v["file"])
- }
- }
- if x, ok := v["row"]; ok {
- if n, ok := x.(json.Number); ok {
- i64, err := n.Int64()
- if err != nil {
- return err
- }
- loc.Row = int(i64)
- } else {
- return fmt.Errorf("ast: unable to unmarshal row field with type: %T (expected number)", v["row"])
- }
- }
- if x, ok := v["col"]; ok {
- if n, ok := x.(json.Number); ok {
- i64, err := n.Int64()
- if err != nil {
- return err
- }
- loc.Col = int(i64)
- } else {
- return fmt.Errorf("ast: unable to unmarshal col field with type: %T (expected number)", v["col"])
- }
- }
-
- return nil
-}
-
-func unmarshalExprIndex(expr *Expr, v map[string]interface{}) error {
- if x, ok := v["index"]; ok {
- if n, ok := x.(json.Number); ok {
- i, err := n.Int64()
- if err == nil {
- expr.Index = int(i)
- return nil
- }
- }
- }
- return fmt.Errorf("ast: unable to unmarshal index field with type: %T (expected integer)", v["index"])
-}
-
-func unmarshalTerm(m map[string]interface{}) (*Term, error) {
- var term Term
-
- v, err := unmarshalValue(m)
- if err != nil {
- return nil, err
- }
- term.Value = v
-
- if loc, ok := m["location"].(map[string]interface{}); ok {
- term.Location = &Location{}
- if err := unmarshalLocation(term.Location, loc); err != nil {
- return nil, err
- }
- }
-
- return &term, nil
-}
-
-func unmarshalTermSlice(s []interface{}) ([]*Term, error) {
- buf := []*Term{}
- for _, x := range s {
- if m, ok := x.(map[string]interface{}); ok {
- t, err := unmarshalTerm(m)
- if err == nil {
- buf = append(buf, t)
- continue
- }
- return nil, err
- }
- return nil, fmt.Errorf("ast: unable to unmarshal term")
- }
- return buf, nil
-}
-
-func unmarshalTermSliceValue(d map[string]interface{}) ([]*Term, error) {
- if s, ok := d["value"].([]interface{}); ok {
- return unmarshalTermSlice(s)
- }
- return nil, fmt.Errorf(`ast: unable to unmarshal term (expected {"value": [...], "type": ...} where type is one of: ref, array, or set)`)
-}
-
-func unmarshalWith(i interface{}) (*With, error) {
- if m, ok := i.(map[string]interface{}); ok {
- tgt, _ := m["target"].(map[string]interface{})
- target, err := unmarshalTerm(tgt)
- if err == nil {
- val, _ := m["value"].(map[string]interface{})
- value, err := unmarshalTerm(val)
- if err == nil {
- return &With{
- Target: target,
- Value: value,
- }, nil
- }
- return nil, err
- }
- return nil, err
- }
- return nil, fmt.Errorf(`ast: unable to unmarshal with modifier (expected {"target": {...}, "value": {...}})`)
-}
-
-func unmarshalValue(d map[string]interface{}) (Value, error) {
- v := d["value"]
- switch d["type"] {
- case "null":
- return Null{}, nil
- case "boolean":
- if b, ok := v.(bool); ok {
- return Boolean(b), nil
- }
- case "number":
- if n, ok := v.(json.Number); ok {
- return Number(n), nil
- }
- case "string":
- if s, ok := v.(string); ok {
- return String(s), nil
- }
- case "var":
- if s, ok := v.(string); ok {
- return Var(s), nil
- }
- case "ref":
- if s, err := unmarshalTermSliceValue(d); err == nil {
- return Ref(s), nil
- }
- case "array":
- if s, err := unmarshalTermSliceValue(d); err == nil {
- return NewArray(s...), nil
- }
- case "set":
- if s, err := unmarshalTermSliceValue(d); err == nil {
- set := NewSet()
- for _, x := range s {
- set.Add(x)
- }
- return set, nil
- }
- case "object":
- if s, ok := v.([]interface{}); ok {
- buf := NewObject()
- for _, x := range s {
- if i, ok := x.([]interface{}); ok && len(i) == 2 {
- p, err := unmarshalTermSlice(i)
- if err == nil {
- buf.Insert(p[0], p[1])
- continue
- }
- }
- goto unmarshal_error
- }
- return buf, nil
- }
- case "arraycomprehension", "setcomprehension":
- if m, ok := v.(map[string]interface{}); ok {
- t, ok := m["term"].(map[string]interface{})
- if !ok {
- goto unmarshal_error
- }
-
- term, err := unmarshalTerm(t)
- if err != nil {
- goto unmarshal_error
- }
-
- b, ok := m["body"].([]interface{})
- if !ok {
- goto unmarshal_error
- }
-
- body, err := unmarshalBody(b)
- if err != nil {
- goto unmarshal_error
- }
-
- if d["type"] == "arraycomprehension" {
- return &ArrayComprehension{Term: term, Body: body}, nil
- }
- return &SetComprehension{Term: term, Body: body}, nil
- }
- case "objectcomprehension":
- if m, ok := v.(map[string]interface{}); ok {
- k, ok := m["key"].(map[string]interface{})
- if !ok {
- goto unmarshal_error
- }
-
- key, err := unmarshalTerm(k)
- if err != nil {
- goto unmarshal_error
- }
-
- v, ok := m["value"].(map[string]interface{})
- if !ok {
- goto unmarshal_error
- }
-
- value, err := unmarshalTerm(v)
- if err != nil {
- goto unmarshal_error
- }
-
- b, ok := m["body"].([]interface{})
- if !ok {
- goto unmarshal_error
- }
-
- body, err := unmarshalBody(b)
- if err != nil {
- goto unmarshal_error
- }
-
- return &ObjectComprehension{Key: key, Value: value, Body: body}, nil
- }
- case "call":
- if s, err := unmarshalTermSliceValue(d); err == nil {
- return Call(s), nil
- }
- }
-unmarshal_error:
- return nil, fmt.Errorf("ast: unable to unmarshal term")
+ return v1.CallTerm(terms...)
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/transform.go b/vendor/github.com/open-policy-agent/opa/ast/transform.go
index 391a164860..8c03c48663 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/transform.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/transform.go
@@ -5,427 +5,42 @@
package ast
import (
- "fmt"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
// Transformer defines the interface for transforming AST elements. If the
// transformer returns nil and does not indicate an error, the AST element will
// be set to nil and no transformations will be applied to children of the
// element.
-type Transformer interface {
- Transform(interface{}) (interface{}, error)
-}
+type Transformer = v1.Transformer
// Transform iterates the AST and calls the Transform function on the
// Transformer t for x before recursing.
-func Transform(t Transformer, x interface{}) (interface{}, error) {
-
- if term, ok := x.(*Term); ok {
- return Transform(t, term.Value)
- }
-
- y, err := t.Transform(x)
- if err != nil {
- return x, err
- }
-
- if y == nil {
- return nil, nil
- }
-
- var ok bool
- switch y := y.(type) {
- case *Module:
- p, err := Transform(t, y.Package)
- if err != nil {
- return nil, err
- }
- if y.Package, ok = p.(*Package); !ok {
- return nil, fmt.Errorf("illegal transform: %T != %T", y.Package, p)
- }
- for i := range y.Imports {
- imp, err := Transform(t, y.Imports[i])
- if err != nil {
- return nil, err
- }
- if y.Imports[i], ok = imp.(*Import); !ok {
- return nil, fmt.Errorf("illegal transform: %T != %T", y.Imports[i], imp)
- }
- }
- for i := range y.Rules {
- rule, err := Transform(t, y.Rules[i])
- if err != nil {
- return nil, err
- }
- if y.Rules[i], ok = rule.(*Rule); !ok {
- return nil, fmt.Errorf("illegal transform: %T != %T", y.Rules[i], rule)
- }
- }
- for i := range y.Annotations {
- a, err := Transform(t, y.Annotations[i])
- if err != nil {
- return nil, err
- }
- if y.Annotations[i], ok = a.(*Annotations); !ok {
- return nil, fmt.Errorf("illegal transform: %T != %T", y.Annotations[i], a)
- }
- }
- for i := range y.Comments {
- comment, err := Transform(t, y.Comments[i])
- if err != nil {
- return nil, err
- }
- if y.Comments[i], ok = comment.(*Comment); !ok {
- return nil, fmt.Errorf("illegal transform: %T != %T", y.Comments[i], comment)
- }
- }
- return y, nil
- case *Package:
- ref, err := Transform(t, y.Path)
- if err != nil {
- return nil, err
- }
- if y.Path, ok = ref.(Ref); !ok {
- return nil, fmt.Errorf("illegal transform: %T != %T", y.Path, ref)
- }
- return y, nil
- case *Import:
- y.Path, err = transformTerm(t, y.Path)
- if err != nil {
- return nil, err
- }
- if y.Alias, err = transformVar(t, y.Alias); err != nil {
- return nil, err
- }
- return y, nil
- case *Rule:
- if y.Head, err = transformHead(t, y.Head); err != nil {
- return nil, err
- }
- if y.Body, err = transformBody(t, y.Body); err != nil {
- return nil, err
- }
- if y.Else != nil {
- rule, err := Transform(t, y.Else)
- if err != nil {
- return nil, err
- }
- if y.Else, ok = rule.(*Rule); !ok {
- return nil, fmt.Errorf("illegal transform: %T != %T", y.Else, rule)
- }
- }
- return y, nil
- case *Head:
- if y.Reference, err = transformRef(t, y.Reference); err != nil {
- return nil, err
- }
- if y.Name, err = transformVar(t, y.Name); err != nil {
- return nil, err
- }
- if y.Args, err = transformArgs(t, y.Args); err != nil {
- return nil, err
- }
- if y.Key != nil {
- if y.Key, err = transformTerm(t, y.Key); err != nil {
- return nil, err
- }
- }
- if y.Value != nil {
- if y.Value, err = transformTerm(t, y.Value); err != nil {
- return nil, err
- }
- }
- return y, nil
- case Args:
- for i := range y {
- if y[i], err = transformTerm(t, y[i]); err != nil {
- return nil, err
- }
- }
- return y, nil
- case Body:
- for i, e := range y {
- e, err := Transform(t, e)
- if err != nil {
- return nil, err
- }
- if y[i], ok = e.(*Expr); !ok {
- return nil, fmt.Errorf("illegal transform: %T != %T", y[i], e)
- }
- }
- return y, nil
- case *Expr:
- switch ts := y.Terms.(type) {
- case *SomeDecl:
- decl, err := Transform(t, ts)
- if err != nil {
- return nil, err
- }
- if y.Terms, ok = decl.(*SomeDecl); !ok {
- return nil, fmt.Errorf("illegal transform: %T != %T", y, decl)
- }
- return y, nil
- case []*Term:
- for i := range ts {
- if ts[i], err = transformTerm(t, ts[i]); err != nil {
- return nil, err
- }
- }
- case *Term:
- if y.Terms, err = transformTerm(t, ts); err != nil {
- return nil, err
- }
- case *Every:
- if ts.Key != nil {
- ts.Key, err = transformTerm(t, ts.Key)
- if err != nil {
- return nil, err
- }
- }
- ts.Value, err = transformTerm(t, ts.Value)
- if err != nil {
- return nil, err
- }
- ts.Domain, err = transformTerm(t, ts.Domain)
- if err != nil {
- return nil, err
- }
- ts.Body, err = transformBody(t, ts.Body)
- if err != nil {
- return nil, err
- }
- y.Terms = ts
- }
- for i, w := range y.With {
- w, err := Transform(t, w)
- if err != nil {
- return nil, err
- }
- if y.With[i], ok = w.(*With); !ok {
- return nil, fmt.Errorf("illegal transform: %T != %T", y.With[i], w)
- }
- }
- return y, nil
- case *With:
- if y.Target, err = transformTerm(t, y.Target); err != nil {
- return nil, err
- }
- if y.Value, err = transformTerm(t, y.Value); err != nil {
- return nil, err
- }
- return y, nil
- case Ref:
- for i, term := range y {
- if y[i], err = transformTerm(t, term); err != nil {
- return nil, err
- }
- }
- return y, nil
- case *object:
- return y.Map(func(k, v *Term) (*Term, *Term, error) {
- k, err := transformTerm(t, k)
- if err != nil {
- return nil, nil, err
- }
- v, err = transformTerm(t, v)
- if err != nil {
- return nil, nil, err
- }
- return k, v, nil
- })
- case *Array:
- for i := 0; i < y.Len(); i++ {
- v, err := transformTerm(t, y.Elem(i))
- if err != nil {
- return nil, err
- }
- y.set(i, v)
- }
- return y, nil
- case Set:
- y, err = y.Map(func(term *Term) (*Term, error) {
- return transformTerm(t, term)
- })
- if err != nil {
- return nil, err
- }
- return y, nil
- case *ArrayComprehension:
- if y.Term, err = transformTerm(t, y.Term); err != nil {
- return nil, err
- }
- if y.Body, err = transformBody(t, y.Body); err != nil {
- return nil, err
- }
- return y, nil
- case *ObjectComprehension:
- if y.Key, err = transformTerm(t, y.Key); err != nil {
- return nil, err
- }
- if y.Value, err = transformTerm(t, y.Value); err != nil {
- return nil, err
- }
- if y.Body, err = transformBody(t, y.Body); err != nil {
- return nil, err
- }
- return y, nil
- case *SetComprehension:
- if y.Term, err = transformTerm(t, y.Term); err != nil {
- return nil, err
- }
- if y.Body, err = transformBody(t, y.Body); err != nil {
- return nil, err
- }
- return y, nil
- case Call:
- for i := range y {
- if y[i], err = transformTerm(t, y[i]); err != nil {
- return nil, err
- }
- }
- return y, nil
- default:
- return y, nil
- }
+func Transform(t Transformer, x any) (any, error) {
+ return v1.Transform(t, x)
}
// TransformRefs calls the function f on all references under x.
-func TransformRefs(x interface{}, f func(Ref) (Value, error)) (interface{}, error) {
- t := &GenericTransformer{func(x interface{}) (interface{}, error) {
- if r, ok := x.(Ref); ok {
- return f(r)
- }
- return x, nil
- }}
- return Transform(t, x)
+func TransformRefs(x any, f func(Ref) (Value, error)) (any, error) {
+ return v1.TransformRefs(x, f)
}
// TransformVars calls the function f on all vars under x.
-func TransformVars(x interface{}, f func(Var) (Value, error)) (interface{}, error) {
- t := &GenericTransformer{func(x interface{}) (interface{}, error) {
- if v, ok := x.(Var); ok {
- return f(v)
- }
- return x, nil
- }}
- return Transform(t, x)
+func TransformVars(x any, f func(Var) (Value, error)) (any, error) {
+ return v1.TransformVars(x, f)
}
// TransformComprehensions calls the functio nf on all comprehensions under x.
-func TransformComprehensions(x interface{}, f func(interface{}) (Value, error)) (interface{}, error) {
- t := &GenericTransformer{func(x interface{}) (interface{}, error) {
- switch x := x.(type) {
- case *ArrayComprehension:
- return f(x)
- case *SetComprehension:
- return f(x)
- case *ObjectComprehension:
- return f(x)
- }
- return x, nil
- }}
- return Transform(t, x)
+func TransformComprehensions(x any, f func(any) (Value, error)) (any, error) {
+ return v1.TransformComprehensions(x, f)
}
// GenericTransformer implements the Transformer interface to provide a utility
// to transform AST nodes using a closure.
-type GenericTransformer struct {
- f func(interface{}) (interface{}, error)
-}
+type GenericTransformer = v1.GenericTransformer
// NewGenericTransformer returns a new GenericTransformer that will transform
// AST nodes using the function f.
-func NewGenericTransformer(f func(x interface{}) (interface{}, error)) *GenericTransformer {
- return &GenericTransformer{
- f: f,
- }
-}
-
-// Transform calls the function f on the GenericTransformer.
-func (t *GenericTransformer) Transform(x interface{}) (interface{}, error) {
- return t.f(x)
-}
-
-func transformHead(t Transformer, head *Head) (*Head, error) {
- y, err := Transform(t, head)
- if err != nil {
- return nil, err
- }
- h, ok := y.(*Head)
- if !ok {
- return nil, fmt.Errorf("illegal transform: %T != %T", head, y)
- }
- return h, nil
-}
-
-func transformArgs(t Transformer, args Args) (Args, error) {
- y, err := Transform(t, args)
- if err != nil {
- return nil, err
- }
- a, ok := y.(Args)
- if !ok {
- return nil, fmt.Errorf("illegal transform: %T != %T", args, y)
- }
- return a, nil
-}
-
-func transformBody(t Transformer, body Body) (Body, error) {
- y, err := Transform(t, body)
- if err != nil {
- return nil, err
- }
- r, ok := y.(Body)
- if !ok {
- return nil, fmt.Errorf("illegal transform: %T != %T", body, y)
- }
- return r, nil
-}
-
-func transformTerm(t Transformer, term *Term) (*Term, error) {
- v, err := transformValue(t, term.Value)
- if err != nil {
- return nil, err
- }
- r := &Term{
- Value: v,
- Location: term.Location,
- }
- return r, nil
-}
-
-func transformValue(t Transformer, v Value) (Value, error) {
- v1, err := Transform(t, v)
- if err != nil {
- return nil, err
- }
- r, ok := v1.(Value)
- if !ok {
- return nil, fmt.Errorf("illegal transform: %T != %T", v, v1)
- }
- return r, nil
-}
-
-func transformVar(t Transformer, v Var) (Var, error) {
- v1, err := Transform(t, v)
- if err != nil {
- return "", err
- }
- r, ok := v1.(Var)
- if !ok {
- return "", fmt.Errorf("illegal transform: %T != %T", v, v1)
- }
- return r, nil
-}
-
-func transformRef(t Transformer, r Ref) (Ref, error) {
- r1, err := Transform(t, r)
- if err != nil {
- return nil, err
- }
- r2, ok := r1.(Ref)
- if !ok {
- return nil, fmt.Errorf("illegal transform: %T != %T", r, r2)
- }
- return r2, nil
+func NewGenericTransformer(f func(x any) (any, error)) *GenericTransformer {
+ return v1.NewGenericTransformer(f)
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/unify.go b/vendor/github.com/open-policy-agent/opa/ast/unify.go
index 60244974a9..3cb260272a 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/unify.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/unify.go
@@ -4,232 +4,11 @@
package ast
-func isRefSafe(ref Ref, safe VarSet) bool {
- switch head := ref[0].Value.(type) {
- case Var:
- return safe.Contains(head)
- case Call:
- return isCallSafe(head, safe)
- default:
- for v := range ref[0].Vars() {
- if !safe.Contains(v) {
- return false
- }
- }
- return true
- }
-}
-
-func isCallSafe(call Call, safe VarSet) bool {
- vis := NewVarVisitor().WithParams(SafetyCheckVisitorParams)
- vis.Walk(call)
- unsafe := vis.Vars().Diff(safe)
- return len(unsafe) == 0
-}
+import v1 "github.com/open-policy-agent/opa/v1/ast"
// Unify returns a set of variables that will be unified when the equality expression defined by
// terms a and b is evaluated. The unifier assumes that variables in the VarSet safe are already
// unified.
func Unify(safe VarSet, a *Term, b *Term) VarSet {
- u := &unifier{
- safe: safe,
- unified: VarSet{},
- unknown: map[Var]VarSet{},
- }
- u.unify(a, b)
- return u.unified
-}
-
-type unifier struct {
- safe VarSet
- unified VarSet
- unknown map[Var]VarSet
-}
-
-func (u *unifier) isSafe(x Var) bool {
- return u.safe.Contains(x) || u.unified.Contains(x)
-}
-
-func (u *unifier) unify(a *Term, b *Term) {
-
- switch a := a.Value.(type) {
-
- case Var:
- switch b := b.Value.(type) {
- case Var:
- if u.isSafe(b) {
- u.markSafe(a)
- } else if u.isSafe(a) {
- u.markSafe(b)
- } else {
- u.markUnknown(a, b)
- u.markUnknown(b, a)
- }
- case *Array, Object:
- u.unifyAll(a, b)
- case Ref:
- if isRefSafe(b, u.safe) {
- u.markSafe(a)
- }
- case Call:
- if isCallSafe(b, u.safe) {
- u.markSafe(a)
- }
- default:
- u.markSafe(a)
- }
-
- case Ref:
- if isRefSafe(a, u.safe) {
- switch b := b.Value.(type) {
- case Var:
- u.markSafe(b)
- case *Array, Object:
- u.markAllSafe(b)
- }
- }
-
- case Call:
- if isCallSafe(a, u.safe) {
- switch b := b.Value.(type) {
- case Var:
- u.markSafe(b)
- case *Array, Object:
- u.markAllSafe(b)
- }
- }
-
- case *ArrayComprehension:
- switch b := b.Value.(type) {
- case Var:
- u.markSafe(b)
- case *Array:
- u.markAllSafe(b)
- }
- case *ObjectComprehension:
- switch b := b.Value.(type) {
- case Var:
- u.markSafe(b)
- case *object:
- u.markAllSafe(b)
- }
- case *SetComprehension:
- switch b := b.Value.(type) {
- case Var:
- u.markSafe(b)
- }
-
- case *Array:
- switch b := b.Value.(type) {
- case Var:
- u.unifyAll(b, a)
- case *ArrayComprehension, *ObjectComprehension, *SetComprehension:
- u.markAllSafe(a)
- case Ref:
- if isRefSafe(b, u.safe) {
- u.markAllSafe(a)
- }
- case Call:
- if isCallSafe(b, u.safe) {
- u.markAllSafe(a)
- }
- case *Array:
- if a.Len() == b.Len() {
- for i := 0; i < a.Len(); i++ {
- u.unify(a.Elem(i), b.Elem(i))
- }
- }
- }
-
- case *object:
- switch b := b.Value.(type) {
- case Var:
- u.unifyAll(b, a)
- case Ref:
- if isRefSafe(b, u.safe) {
- u.markAllSafe(a)
- }
- case Call:
- if isCallSafe(b, u.safe) {
- u.markAllSafe(a)
- }
- case *object:
- if a.Len() == b.Len() {
- _ = a.Iter(func(k, v *Term) error {
- if v2 := b.Get(k); v2 != nil {
- u.unify(v, v2)
- }
- return nil
- }) // impossible to return error
- }
- }
-
- default:
- switch b := b.Value.(type) {
- case Var:
- u.markSafe(b)
- }
- }
-}
-
-func (u *unifier) markAllSafe(x Value) {
- vis := u.varVisitor()
- vis.Walk(x)
- for v := range vis.Vars() {
- u.markSafe(v)
- }
-}
-
-func (u *unifier) markSafe(x Var) {
- u.unified.Add(x)
-
- // Add dependencies of 'x' to safe set
- vs := u.unknown[x]
- delete(u.unknown, x)
- for v := range vs {
- u.markSafe(v)
- }
-
- // Add dependants of 'x' to safe set if they have no more
- // dependencies.
- for v, deps := range u.unknown {
- if deps.Contains(x) {
- delete(deps, x)
- if len(deps) == 0 {
- u.markSafe(v)
- }
- }
- }
-}
-
-func (u *unifier) markUnknown(a, b Var) {
- if _, ok := u.unknown[a]; !ok {
- u.unknown[a] = NewVarSet()
- }
- u.unknown[a].Add(b)
-}
-
-func (u *unifier) unifyAll(a Var, b Value) {
- if u.isSafe(a) {
- u.markAllSafe(b)
- } else {
- vis := u.varVisitor()
- vis.Walk(b)
- unsafe := vis.Vars().Diff(u.safe).Diff(u.unified)
- if len(unsafe) == 0 {
- u.markSafe(a)
- } else {
- for v := range unsafe {
- u.markUnknown(a, v)
- }
- }
- }
-}
-
-func (u *unifier) varVisitor() *VarVisitor {
- return NewVarVisitor().WithParams(VarVisitorParams{
- SkipRefHead: true,
- SkipObjectKeys: true,
- SkipClosures: true,
- })
+ return v1.Unify(safe, a, b)
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/varset.go b/vendor/github.com/open-policy-agent/opa/ast/varset.go
index 14f531494b..9e7db8efda 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/varset.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/varset.go
@@ -5,96 +5,13 @@
package ast
import (
- "fmt"
- "sort"
+ v1 "github.com/open-policy-agent/opa/v1/ast"
)
// VarSet represents a set of variables.
-type VarSet map[Var]struct{}
+type VarSet = v1.VarSet
// NewVarSet returns a new VarSet containing the specified variables.
func NewVarSet(vs ...Var) VarSet {
- s := VarSet{}
- for _, v := range vs {
- s.Add(v)
- }
- return s
-}
-
-// Add updates the set to include the variable "v".
-func (s VarSet) Add(v Var) {
- s[v] = struct{}{}
-}
-
-// Contains returns true if the set contains the variable "v".
-func (s VarSet) Contains(v Var) bool {
- _, ok := s[v]
- return ok
-}
-
-// Copy returns a shallow copy of the VarSet.
-func (s VarSet) Copy() VarSet {
- cpy := VarSet{}
- for v := range s {
- cpy.Add(v)
- }
- return cpy
-}
-
-// Diff returns a VarSet containing variables in s that are not in vs.
-func (s VarSet) Diff(vs VarSet) VarSet {
- r := VarSet{}
- for v := range s {
- if !vs.Contains(v) {
- r.Add(v)
- }
- }
- return r
-}
-
-// Equal returns true if s contains exactly the same elements as vs.
-func (s VarSet) Equal(vs VarSet) bool {
- if len(s.Diff(vs)) > 0 {
- return false
- }
- return len(vs.Diff(s)) == 0
-}
-
-// Intersect returns a VarSet containing variables in s that are in vs.
-func (s VarSet) Intersect(vs VarSet) VarSet {
- r := VarSet{}
- for v := range s {
- if vs.Contains(v) {
- r.Add(v)
- }
- }
- return r
-}
-
-// Sorted returns a sorted slice of vars from s.
-func (s VarSet) Sorted() []Var {
- sorted := make([]Var, 0, len(s))
- for v := range s {
- sorted = append(sorted, v)
- }
- sort.Slice(sorted, func(i, j int) bool {
- return sorted[i].Compare(sorted[j]) < 0
- })
- return sorted
-}
-
-// Update merges the other VarSet into this VarSet.
-func (s VarSet) Update(vs VarSet) {
- for v := range vs {
- s.Add(v)
- }
-}
-
-func (s VarSet) String() string {
- tmp := make([]string, 0, len(s))
- for v := range s {
- tmp = append(tmp, string(v))
- }
- sort.Strings(tmp)
- return fmt.Sprintf("%v", tmp)
+ return v1.NewVarSet(vs...)
}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/version_index.json b/vendor/github.com/open-policy-agent/opa/ast/version_index.json
deleted file mode 100644
index 718df220f9..0000000000
--- a/vendor/github.com/open-policy-agent/opa/ast/version_index.json
+++ /dev/null
@@ -1,1450 +0,0 @@
-{
- "builtins": {
- "abs": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "all": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "and": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "any": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "array.concat": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "array.reverse": {
- "Major": 0,
- "Minor": 36,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "array.slice": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "assign": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "base64.decode": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "base64.encode": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "base64.is_valid": {
- "Major": 0,
- "Minor": 24,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "base64url.decode": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "base64url.encode": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "base64url.encode_no_pad": {
- "Major": 0,
- "Minor": 25,
- "Patch": 0,
- "PreRelease": "rc2",
- "Metadata": ""
- },
- "bits.and": {
- "Major": 0,
- "Minor": 18,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "bits.lsh": {
- "Major": 0,
- "Minor": 18,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "bits.negate": {
- "Major": 0,
- "Minor": 18,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "bits.or": {
- "Major": 0,
- "Minor": 18,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "bits.rsh": {
- "Major": 0,
- "Minor": 18,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "bits.xor": {
- "Major": 0,
- "Minor": 18,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "cast_array": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "cast_boolean": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "cast_null": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "cast_object": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "cast_set": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "cast_string": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "ceil": {
- "Major": 0,
- "Minor": 26,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "concat": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "contains": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "count": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "crypto.hmac.equal": {
- "Major": 0,
- "Minor": 52,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "crypto.hmac.md5": {
- "Major": 0,
- "Minor": 36,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "crypto.hmac.sha1": {
- "Major": 0,
- "Minor": 36,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "crypto.hmac.sha256": {
- "Major": 0,
- "Minor": 36,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "crypto.hmac.sha512": {
- "Major": 0,
- "Minor": 36,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "crypto.md5": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "crypto.parse_private_keys": {
- "Major": 0,
- "Minor": 55,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "crypto.sha1": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "crypto.sha256": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "crypto.x509.parse_and_verify_certificates": {
- "Major": 0,
- "Minor": 31,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "crypto.x509.parse_and_verify_certificates_with_options": {
- "Major": 0,
- "Minor": 63,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "crypto.x509.parse_certificate_request": {
- "Major": 0,
- "Minor": 21,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "crypto.x509.parse_certificates": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "crypto.x509.parse_keypair": {
- "Major": 0,
- "Minor": 53,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "crypto.x509.parse_rsa_private_key": {
- "Major": 0,
- "Minor": 33,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "div": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "endswith": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "eq": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "equal": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "floor": {
- "Major": 0,
- "Minor": 26,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "format_int": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "glob.match": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "glob.quote_meta": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "graph.reachable": {
- "Major": 0,
- "Minor": 20,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "graph.reachable_paths": {
- "Major": 0,
- "Minor": 37,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "graphql.is_valid": {
- "Major": 0,
- "Minor": 41,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "graphql.parse": {
- "Major": 0,
- "Minor": 41,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "graphql.parse_and_verify": {
- "Major": 0,
- "Minor": 41,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "graphql.parse_query": {
- "Major": 0,
- "Minor": 41,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "graphql.parse_schema": {
- "Major": 0,
- "Minor": 41,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "graphql.schema_is_valid": {
- "Major": 0,
- "Minor": 46,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "gt": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "gte": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "hex.decode": {
- "Major": 0,
- "Minor": 25,
- "Patch": 0,
- "PreRelease": "rc2",
- "Metadata": ""
- },
- "hex.encode": {
- "Major": 0,
- "Minor": 25,
- "Patch": 0,
- "PreRelease": "rc2",
- "Metadata": ""
- },
- "http.send": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "indexof": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "indexof_n": {
- "Major": 0,
- "Minor": 37,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "internal.member_2": {
- "Major": 0,
- "Minor": 34,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "internal.member_3": {
- "Major": 0,
- "Minor": 34,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "internal.print": {
- "Major": 0,
- "Minor": 34,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "intersection": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "io.jwt.decode": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "io.jwt.decode_verify": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "io.jwt.encode_sign": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "io.jwt.encode_sign_raw": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "io.jwt.verify_es256": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "io.jwt.verify_es384": {
- "Major": 0,
- "Minor": 20,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "io.jwt.verify_es512": {
- "Major": 0,
- "Minor": 20,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "io.jwt.verify_hs256": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "io.jwt.verify_hs384": {
- "Major": 0,
- "Minor": 20,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "io.jwt.verify_hs512": {
- "Major": 0,
- "Minor": 20,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "io.jwt.verify_ps256": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "io.jwt.verify_ps384": {
- "Major": 0,
- "Minor": 20,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "io.jwt.verify_ps512": {
- "Major": 0,
- "Minor": 20,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "io.jwt.verify_rs256": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "io.jwt.verify_rs384": {
- "Major": 0,
- "Minor": 20,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "io.jwt.verify_rs512": {
- "Major": 0,
- "Minor": 20,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "is_array": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "is_boolean": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "is_null": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "is_number": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "is_object": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "is_set": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "is_string": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "json.filter": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "json.is_valid": {
- "Major": 0,
- "Minor": 25,
- "Patch": 0,
- "PreRelease": "rc1",
- "Metadata": ""
- },
- "json.marshal": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "json.marshal_with_options": {
- "Major": 0,
- "Minor": 64,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "json.match_schema": {
- "Major": 0,
- "Minor": 50,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "json.patch": {
- "Major": 0,
- "Minor": 25,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "json.remove": {
- "Major": 0,
- "Minor": 18,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "json.unmarshal": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "json.verify_schema": {
- "Major": 0,
- "Minor": 50,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "lower": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "lt": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "lte": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "max": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "min": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "minus": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "mul": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "neq": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "net.cidr_contains": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "net.cidr_contains_matches": {
- "Major": 0,
- "Minor": 19,
- "Patch": 0,
- "PreRelease": "rc1",
- "Metadata": ""
- },
- "net.cidr_expand": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "net.cidr_intersects": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "net.cidr_is_valid": {
- "Major": 0,
- "Minor": 46,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "net.cidr_merge": {
- "Major": 0,
- "Minor": 24,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "net.cidr_overlap": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "net.lookup_ip_addr": {
- "Major": 0,
- "Minor": 35,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "numbers.range": {
- "Major": 0,
- "Minor": 22,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "numbers.range_step": {
- "Major": 0,
- "Minor": 56,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "object.filter": {
- "Major": 0,
- "Minor": 17,
- "Patch": 2,
- "PreRelease": "",
- "Metadata": ""
- },
- "object.get": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "object.keys": {
- "Major": 0,
- "Minor": 47,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "object.remove": {
- "Major": 0,
- "Minor": 17,
- "Patch": 2,
- "PreRelease": "",
- "Metadata": ""
- },
- "object.subset": {
- "Major": 0,
- "Minor": 42,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "object.union": {
- "Major": 0,
- "Minor": 17,
- "Patch": 2,
- "PreRelease": "",
- "Metadata": ""
- },
- "object.union_n": {
- "Major": 0,
- "Minor": 37,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "opa.runtime": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "or": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "plus": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "print": {
- "Major": 0,
- "Minor": 34,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "product": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "providers.aws.sign_req": {
- "Major": 0,
- "Minor": 47,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "rand.intn": {
- "Major": 0,
- "Minor": 31,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "re_match": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "regex.find_all_string_submatch_n": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "regex.find_n": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "regex.globs_match": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "regex.is_valid": {
- "Major": 0,
- "Minor": 23,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "regex.match": {
- "Major": 0,
- "Minor": 23,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "regex.replace": {
- "Major": 0,
- "Minor": 45,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "regex.split": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "regex.template_match": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "rego.metadata.chain": {
- "Major": 0,
- "Minor": 40,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "rego.metadata.rule": {
- "Major": 0,
- "Minor": 40,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "rego.parse_module": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "rem": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "replace": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "round": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "semver.compare": {
- "Major": 0,
- "Minor": 22,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "semver.is_valid": {
- "Major": 0,
- "Minor": 22,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "set_diff": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "sort": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "split": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "sprintf": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "startswith": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "strings.any_prefix_match": {
- "Major": 0,
- "Minor": 44,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "strings.any_suffix_match": {
- "Major": 0,
- "Minor": 44,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "strings.count": {
- "Major": 0,
- "Minor": 67,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "strings.render_template": {
- "Major": 0,
- "Minor": 59,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "strings.replace_n": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "strings.reverse": {
- "Major": 0,
- "Minor": 36,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "substring": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "sum": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "time.add_date": {
- "Major": 0,
- "Minor": 19,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "time.clock": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "time.date": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "time.diff": {
- "Major": 0,
- "Minor": 28,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "time.format": {
- "Major": 0,
- "Minor": 48,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "time.now_ns": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "time.parse_duration_ns": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "time.parse_ns": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "time.parse_rfc3339_ns": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "time.weekday": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "to_number": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "trace": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "trim": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "trim_left": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "trim_prefix": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "trim_right": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "trim_space": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "trim_suffix": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "type_name": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "union": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "units.parse": {
- "Major": 0,
- "Minor": 41,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "units.parse_bytes": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "upper": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "urlquery.decode": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "urlquery.decode_object": {
- "Major": 0,
- "Minor": 24,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "urlquery.encode": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "urlquery.encode_object": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "uuid.parse": {
- "Major": 0,
- "Minor": 57,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "uuid.rfc4122": {
- "Major": 0,
- "Minor": 20,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "walk": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "yaml.is_valid": {
- "Major": 0,
- "Minor": 25,
- "Patch": 0,
- "PreRelease": "rc1",
- "Metadata": ""
- },
- "yaml.marshal": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "yaml.unmarshal": {
- "Major": 0,
- "Minor": 17,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- }
- },
- "features": {
- "rego_v1_import": {
- "Major": 0,
- "Minor": 59,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "rule_head_ref_string_prefixes": {
- "Major": 0,
- "Minor": 46,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "rule_head_refs": {
- "Major": 0,
- "Minor": 59,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- }
- },
- "keywords": {
- "contains": {
- "Major": 0,
- "Minor": 42,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "every": {
- "Major": 0,
- "Minor": 38,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "if": {
- "Major": 0,
- "Minor": 42,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- },
- "in": {
- "Major": 0,
- "Minor": 34,
- "Patch": 0,
- "PreRelease": "",
- "Metadata": ""
- }
- }
-}
diff --git a/vendor/github.com/open-policy-agent/opa/ast/visit.go b/vendor/github.com/open-policy-agent/opa/ast/visit.go
index d83c31149e..50028269d2 100644
--- a/vendor/github.com/open-policy-agent/opa/ast/visit.go
+++ b/vendor/github.com/open-policy-agent/opa/ast/visit.go
@@ -4,780 +4,124 @@
package ast
+import v1 "github.com/open-policy-agent/opa/v1/ast"
+
// Visitor defines the interface for iterating AST elements. The Visit function
// can return a Visitor w which will be used to visit the children of the AST
// element v. If the Visit function returns nil, the children will not be
// visited.
+//
// Deprecated: use GenericVisitor or another visitor implementation
-type Visitor interface {
- Visit(v interface{}) (w Visitor)
-}
+type Visitor = v1.Visitor //nolint:staticcheck
// BeforeAndAfterVisitor wraps Visitor to provide hooks for being called before
// and after the AST has been visited.
+//
// Deprecated: use GenericVisitor or another visitor implementation
-type BeforeAndAfterVisitor interface {
- Visitor
- Before(x interface{})
- After(x interface{})
-}
+type BeforeAndAfterVisitor = v1.BeforeAndAfterVisitor //nolint:staticcheck
// Walk iterates the AST by calling the Visit function on the Visitor
// v for x before recursing.
+//
// Deprecated: use GenericVisitor.Walk
-func Walk(v Visitor, x interface{}) {
- if bav, ok := v.(BeforeAndAfterVisitor); !ok {
- walk(v, x)
- } else {
- bav.Before(x)
- defer bav.After(x)
- walk(bav, x)
- }
+func Walk(v Visitor, x any) {
+ v1.Walk(v, x)
}
// WalkBeforeAndAfter iterates the AST by calling the Visit function on the
// Visitor v for x before recursing.
+//
// Deprecated: use GenericVisitor.Walk
-func WalkBeforeAndAfter(v BeforeAndAfterVisitor, x interface{}) {
- Walk(v, x)
-}
-
-func walk(v Visitor, x interface{}) {
- w := v.Visit(x)
- if w == nil {
- return
- }
- switch x := x.(type) {
- case *Module:
- Walk(w, x.Package)
- for i := range x.Imports {
- Walk(w, x.Imports[i])
- }
- for i := range x.Rules {
- Walk(w, x.Rules[i])
- }
- for i := range x.Annotations {
- Walk(w, x.Annotations[i])
- }
- for i := range x.Comments {
- Walk(w, x.Comments[i])
- }
- case *Package:
- Walk(w, x.Path)
- case *Import:
- Walk(w, x.Path)
- Walk(w, x.Alias)
- case *Rule:
- Walk(w, x.Head)
- Walk(w, x.Body)
- if x.Else != nil {
- Walk(w, x.Else)
- }
- case *Head:
- Walk(w, x.Name)
- Walk(w, x.Args)
- if x.Key != nil {
- Walk(w, x.Key)
- }
- if x.Value != nil {
- Walk(w, x.Value)
- }
- case Body:
- for i := range x {
- Walk(w, x[i])
- }
- case Args:
- for i := range x {
- Walk(w, x[i])
- }
- case *Expr:
- switch ts := x.Terms.(type) {
- case *Term, *SomeDecl, *Every:
- Walk(w, ts)
- case []*Term:
- for i := range ts {
- Walk(w, ts[i])
- }
- }
- for i := range x.With {
- Walk(w, x.With[i])
- }
- case *With:
- Walk(w, x.Target)
- Walk(w, x.Value)
- case *Term:
- Walk(w, x.Value)
- case Ref:
- for i := range x {
- Walk(w, x[i])
- }
- case *object:
- x.Foreach(func(k, vv *Term) {
- Walk(w, k)
- Walk(w, vv)
- })
- case *Array:
- x.Foreach(func(t *Term) {
- Walk(w, t)
- })
- case Set:
- x.Foreach(func(t *Term) {
- Walk(w, t)
- })
- case *ArrayComprehension:
- Walk(w, x.Term)
- Walk(w, x.Body)
- case *ObjectComprehension:
- Walk(w, x.Key)
- Walk(w, x.Value)
- Walk(w, x.Body)
- case *SetComprehension:
- Walk(w, x.Term)
- Walk(w, x.Body)
- case Call:
- for i := range x {
- Walk(w, x[i])
- }
- case *Every:
- if x.Key != nil {
- Walk(w, x.Key)
- }
- Walk(w, x.Value)
- Walk(w, x.Domain)
- Walk(w, x.Body)
- case *SomeDecl:
- for i := range x.Symbols {
- Walk(w, x.Symbols[i])
- }
- }
+func WalkBeforeAndAfter(v BeforeAndAfterVisitor, x any) {
+ v1.WalkBeforeAndAfter(v, x)
}
// WalkVars calls the function f on all vars under x. If the function f
// returns true, AST nodes under the last node will not be visited.
-func WalkVars(x interface{}, f func(Var) bool) {
- vis := &GenericVisitor{func(x interface{}) bool {
- if v, ok := x.(Var); ok {
- return f(v)
- }
- return false
- }}
- vis.Walk(x)
+func WalkVars(x any, f func(Var) bool) {
+ v1.WalkVars(x, f)
}
// WalkClosures calls the function f on all closures under x. If the function f
// returns true, AST nodes under the last node will not be visited.
-func WalkClosures(x interface{}, f func(interface{}) bool) {
- vis := &GenericVisitor{func(x interface{}) bool {
- switch x := x.(type) {
- case *ArrayComprehension, *ObjectComprehension, *SetComprehension, *Every:
- return f(x)
- }
- return false
- }}
- vis.Walk(x)
+func WalkClosures(x any, f func(any) bool) {
+ v1.WalkClosures(x, f)
}
// WalkRefs calls the function f on all references under x. If the function f
// returns true, AST nodes under the last node will not be visited.
-func WalkRefs(x interface{}, f func(Ref) bool) {
- vis := &GenericVisitor{func(x interface{}) bool {
- if r, ok := x.(Ref); ok {
- return f(r)
- }
- return false
- }}
- vis.Walk(x)
+func WalkRefs(x any, f func(Ref) bool) {
+ v1.WalkRefs(x, f)
}
// WalkTerms calls the function f on all terms under x. If the function f
// returns true, AST nodes under the last node will not be visited.
-func WalkTerms(x interface{}, f func(*Term) bool) {
- vis := &GenericVisitor{func(x interface{}) bool {
- if term, ok := x.(*Term); ok {
- return f(term)
- }
- return false
- }}
- vis.Walk(x)
+func WalkTerms(x any, f func(*Term) bool) {
+ v1.WalkTerms(x, f)
}
// WalkWiths calls the function f on all with modifiers under x. If the function f
// returns true, AST nodes under the last node will not be visited.
-func WalkWiths(x interface{}, f func(*With) bool) {
- vis := &GenericVisitor{func(x interface{}) bool {
- if w, ok := x.(*With); ok {
- return f(w)
- }
- return false
- }}
- vis.Walk(x)
+func WalkWiths(x any, f func(*With) bool) {
+ v1.WalkWiths(x, f)
}
// WalkExprs calls the function f on all expressions under x. If the function f
// returns true, AST nodes under the last node will not be visited.
-func WalkExprs(x interface{}, f func(*Expr) bool) {
- vis := &GenericVisitor{func(x interface{}) bool {
- if r, ok := x.(*Expr); ok {
- return f(r)
- }
- return false
- }}
- vis.Walk(x)
+func WalkExprs(x any, f func(*Expr) bool) {
+ v1.WalkExprs(x, f)
}
// WalkBodies calls the function f on all bodies under x. If the function f
// returns true, AST nodes under the last node will not be visited.
-func WalkBodies(x interface{}, f func(Body) bool) {
- vis := &GenericVisitor{func(x interface{}) bool {
- if b, ok := x.(Body); ok {
- return f(b)
- }
- return false
- }}
- vis.Walk(x)
+func WalkBodies(x any, f func(Body) bool) {
+ v1.WalkBodies(x, f)
}
// WalkRules calls the function f on all rules under x. If the function f
// returns true, AST nodes under the last node will not be visited.
-func WalkRules(x interface{}, f func(*Rule) bool) {
- vis := &GenericVisitor{func(x interface{}) bool {
- if r, ok := x.(*Rule); ok {
- stop := f(r)
- // NOTE(tsandall): since rules cannot be embedded inside of queries
- // we can stop early if there is no else block.
- if stop || r.Else == nil {
- return true
- }
- }
- return false
- }}
- vis.Walk(x)
+func WalkRules(x any, f func(*Rule) bool) {
+ v1.WalkRules(x, f)
}
// WalkNodes calls the function f on all nodes under x. If the function f
// returns true, AST nodes under the last node will not be visited.
-func WalkNodes(x interface{}, f func(Node) bool) {
- vis := &GenericVisitor{func(x interface{}) bool {
- if n, ok := x.(Node); ok {
- return f(n)
- }
- return false
- }}
- vis.Walk(x)
+func WalkNodes(x any, f func(Node) bool) {
+ v1.WalkNodes(x, f)
}
// GenericVisitor provides a utility to walk over AST nodes using a
// closure. If the closure returns true, the visitor will not walk
// over AST nodes under x.
-type GenericVisitor struct {
- f func(x interface{}) bool
-}
+type GenericVisitor = v1.GenericVisitor
// NewGenericVisitor returns a new GenericVisitor that will invoke the function
// f on AST nodes.
-func NewGenericVisitor(f func(x interface{}) bool) *GenericVisitor {
- return &GenericVisitor{f}
-}
-
-// Walk iterates the AST by calling the function f on the
-// GenericVisitor before recursing. Contrary to the generic Walk, this
-// does not require allocating the visitor from heap.
-func (vis *GenericVisitor) Walk(x interface{}) {
- if vis.f(x) {
- return
- }
-
- switch x := x.(type) {
- case *Module:
- vis.Walk(x.Package)
- for i := range x.Imports {
- vis.Walk(x.Imports[i])
- }
- for i := range x.Rules {
- vis.Walk(x.Rules[i])
- }
- for i := range x.Annotations {
- vis.Walk(x.Annotations[i])
- }
- for i := range x.Comments {
- vis.Walk(x.Comments[i])
- }
- case *Package:
- vis.Walk(x.Path)
- case *Import:
- vis.Walk(x.Path)
- vis.Walk(x.Alias)
- case *Rule:
- vis.Walk(x.Head)
- vis.Walk(x.Body)
- if x.Else != nil {
- vis.Walk(x.Else)
- }
- case *Head:
- vis.Walk(x.Name)
- vis.Walk(x.Args)
- if x.Key != nil {
- vis.Walk(x.Key)
- }
- if x.Value != nil {
- vis.Walk(x.Value)
- }
- case Body:
- for i := range x {
- vis.Walk(x[i])
- }
- case Args:
- for i := range x {
- vis.Walk(x[i])
- }
- case *Expr:
- switch ts := x.Terms.(type) {
- case *Term, *SomeDecl, *Every:
- vis.Walk(ts)
- case []*Term:
- for i := range ts {
- vis.Walk(ts[i])
- }
- }
- for i := range x.With {
- vis.Walk(x.With[i])
- }
- case *With:
- vis.Walk(x.Target)
- vis.Walk(x.Value)
- case *Term:
- vis.Walk(x.Value)
- case Ref:
- for i := range x {
- vis.Walk(x[i])
- }
- case *object:
- x.Foreach(func(k, _ *Term) {
- vis.Walk(k)
- vis.Walk(x.Get(k))
- })
- case Object:
- x.Foreach(func(k, _ *Term) {
- vis.Walk(k)
- vis.Walk(x.Get(k))
- })
- case *Array:
- x.Foreach(func(t *Term) {
- vis.Walk(t)
- })
- case Set:
- xSlice := x.Slice()
- for i := range xSlice {
- vis.Walk(xSlice[i])
- }
- case *ArrayComprehension:
- vis.Walk(x.Term)
- vis.Walk(x.Body)
- case *ObjectComprehension:
- vis.Walk(x.Key)
- vis.Walk(x.Value)
- vis.Walk(x.Body)
- case *SetComprehension:
- vis.Walk(x.Term)
- vis.Walk(x.Body)
- case Call:
- for i := range x {
- vis.Walk(x[i])
- }
- case *Every:
- if x.Key != nil {
- vis.Walk(x.Key)
- }
- vis.Walk(x.Value)
- vis.Walk(x.Domain)
- vis.Walk(x.Body)
- case *SomeDecl:
- for i := range x.Symbols {
- vis.Walk(x.Symbols[i])
- }
- }
+func NewGenericVisitor(f func(x any) bool) *GenericVisitor {
+ return v1.NewGenericVisitor(f)
}
// BeforeAfterVisitor provides a utility to walk over AST nodes using
// closures. If the before closure returns true, the visitor will not
// walk over AST nodes under x. The after closure is invoked always
// after visiting a node.
-type BeforeAfterVisitor struct {
- before func(x interface{}) bool
- after func(x interface{})
-}
+type BeforeAfterVisitor = v1.BeforeAfterVisitor
// NewBeforeAfterVisitor returns a new BeforeAndAfterVisitor that
// will invoke the functions before and after AST nodes.
-func NewBeforeAfterVisitor(before func(x interface{}) bool, after func(x interface{})) *BeforeAfterVisitor {
- return &BeforeAfterVisitor{before, after}
-}
-
-// Walk iterates the AST by calling the functions on the
-// BeforeAndAfterVisitor before and after recursing. Contrary to the
-// generic Walk, this does not require allocating the visitor from
-// heap.
-func (vis *BeforeAfterVisitor) Walk(x interface{}) {
- defer vis.after(x)
- if vis.before(x) {
- return
- }
-
- switch x := x.(type) {
- case *Module:
- vis.Walk(x.Package)
- for i := range x.Imports {
- vis.Walk(x.Imports[i])
- }
- for i := range x.Rules {
- vis.Walk(x.Rules[i])
- }
- for i := range x.Annotations {
- vis.Walk(x.Annotations[i])
- }
- for i := range x.Comments {
- vis.Walk(x.Comments[i])
- }
- case *Package:
- vis.Walk(x.Path)
- case *Import:
- vis.Walk(x.Path)
- vis.Walk(x.Alias)
- case *Rule:
- vis.Walk(x.Head)
- vis.Walk(x.Body)
- if x.Else != nil {
- vis.Walk(x.Else)
- }
- case *Head:
- if len(x.Reference) > 0 {
- vis.Walk(x.Reference)
- } else {
- vis.Walk(x.Name)
- if x.Key != nil {
- vis.Walk(x.Key)
- }
- }
- vis.Walk(x.Args)
- if x.Value != nil {
- vis.Walk(x.Value)
- }
- case Body:
- for i := range x {
- vis.Walk(x[i])
- }
- case Args:
- for i := range x {
- vis.Walk(x[i])
- }
- case *Expr:
- switch ts := x.Terms.(type) {
- case *Term, *SomeDecl, *Every:
- vis.Walk(ts)
- case []*Term:
- for i := range ts {
- vis.Walk(ts[i])
- }
- }
- for i := range x.With {
- vis.Walk(x.With[i])
- }
- case *With:
- vis.Walk(x.Target)
- vis.Walk(x.Value)
- case *Term:
- vis.Walk(x.Value)
- case Ref:
- for i := range x {
- vis.Walk(x[i])
- }
- case *object:
- x.Foreach(func(k, _ *Term) {
- vis.Walk(k)
- vis.Walk(x.Get(k))
- })
- case Object:
- x.Foreach(func(k, _ *Term) {
- vis.Walk(k)
- vis.Walk(x.Get(k))
- })
- case *Array:
- x.Foreach(func(t *Term) {
- vis.Walk(t)
- })
- case Set:
- xSlice := x.Slice()
- for i := range xSlice {
- vis.Walk(xSlice[i])
- }
- case *ArrayComprehension:
- vis.Walk(x.Term)
- vis.Walk(x.Body)
- case *ObjectComprehension:
- vis.Walk(x.Key)
- vis.Walk(x.Value)
- vis.Walk(x.Body)
- case *SetComprehension:
- vis.Walk(x.Term)
- vis.Walk(x.Body)
- case Call:
- for i := range x {
- vis.Walk(x[i])
- }
- case *Every:
- if x.Key != nil {
- vis.Walk(x.Key)
- }
- vis.Walk(x.Value)
- vis.Walk(x.Domain)
- vis.Walk(x.Body)
- case *SomeDecl:
- for i := range x.Symbols {
- vis.Walk(x.Symbols[i])
- }
- }
+func NewBeforeAfterVisitor(before func(x any) bool, after func(x any)) *BeforeAfterVisitor {
+ return v1.NewBeforeAfterVisitor(before, after)
}
// VarVisitor walks AST nodes under a given node and collects all encountered
// variables. The collected variables can be controlled by specifying
// VarVisitorParams when creating the visitor.
-type VarVisitor struct {
- params VarVisitorParams
- vars VarSet
-}
+type VarVisitor = v1.VarVisitor
// VarVisitorParams contains settings for a VarVisitor.
-type VarVisitorParams struct {
- SkipRefHead bool
- SkipRefCallHead bool
- SkipObjectKeys bool
- SkipClosures bool
- SkipWithTarget bool
- SkipSets bool
-}
+type VarVisitorParams = v1.VarVisitorParams
// NewVarVisitor returns a new VarVisitor object.
func NewVarVisitor() *VarVisitor {
- return &VarVisitor{
- vars: NewVarSet(),
- }
-}
-
-// WithParams sets the parameters in params on vis.
-func (vis *VarVisitor) WithParams(params VarVisitorParams) *VarVisitor {
- vis.params = params
- return vis
-}
-
-// Vars returns a VarSet that contains collected vars.
-func (vis *VarVisitor) Vars() VarSet {
- return vis.vars
-}
-
-// visit determines if the VarVisitor will recurse into x: if it returns `true`,
-// the visitor will _skip_ that branch of the AST
-func (vis *VarVisitor) visit(v interface{}) bool {
- if vis.params.SkipObjectKeys {
- if o, ok := v.(Object); ok {
- o.Foreach(func(_, v *Term) {
- vis.Walk(v)
- })
- return true
- }
- }
- if vis.params.SkipRefHead {
- if r, ok := v.(Ref); ok {
- rSlice := r[1:]
- for i := range rSlice {
- vis.Walk(rSlice[i])
- }
- return true
- }
- }
- if vis.params.SkipClosures {
- switch v := v.(type) {
- case *ArrayComprehension, *ObjectComprehension, *SetComprehension:
- return true
- case *Expr:
- if ev, ok := v.Terms.(*Every); ok {
- vis.Walk(ev.Domain)
- // We're _not_ walking ev.Body -- that's the closure here
- return true
- }
- }
- }
- if vis.params.SkipWithTarget {
- if v, ok := v.(*With); ok {
- vis.Walk(v.Value)
- return true
- }
- }
- if vis.params.SkipSets {
- if _, ok := v.(Set); ok {
- return true
- }
- }
- if vis.params.SkipRefCallHead {
- switch v := v.(type) {
- case *Expr:
- if terms, ok := v.Terms.([]*Term); ok {
- termSlice := terms[0].Value.(Ref)[1:]
- for i := range termSlice {
- vis.Walk(termSlice[i])
- }
- for i := 1; i < len(terms); i++ {
- vis.Walk(terms[i])
- }
- for i := range v.With {
- vis.Walk(v.With[i])
- }
- return true
- }
- case Call:
- operator := v[0].Value.(Ref)
- for i := 1; i < len(operator); i++ {
- vis.Walk(operator[i])
- }
- for i := 1; i < len(v); i++ {
- vis.Walk(v[i])
- }
- return true
- case *With:
- if ref, ok := v.Target.Value.(Ref); ok {
- refSlice := ref[1:]
- for i := range refSlice {
- vis.Walk(refSlice[i])
- }
- }
- if ref, ok := v.Value.Value.(Ref); ok {
- refSlice := ref[1:]
- for i := range refSlice {
- vis.Walk(refSlice[i])
- }
- } else {
- vis.Walk(v.Value)
- }
- return true
- }
- }
- if v, ok := v.(Var); ok {
- vis.vars.Add(v)
- }
- return false
-}
-
-// Walk iterates the AST by calling the function f on the
-// GenericVisitor before recursing. Contrary to the generic Walk, this
-// does not require allocating the visitor from heap.
-func (vis *VarVisitor) Walk(x interface{}) {
- if vis.visit(x) {
- return
- }
-
- switch x := x.(type) {
- case *Module:
- vis.Walk(x.Package)
- for i := range x.Imports {
- vis.Walk(x.Imports[i])
- }
- for i := range x.Rules {
- vis.Walk(x.Rules[i])
- }
- for i := range x.Comments {
- vis.Walk(x.Comments[i])
- }
- case *Package:
- vis.Walk(x.Path)
- case *Import:
- vis.Walk(x.Path)
- vis.Walk(x.Alias)
- case *Rule:
- vis.Walk(x.Head)
- vis.Walk(x.Body)
- if x.Else != nil {
- vis.Walk(x.Else)
- }
- case *Head:
- if len(x.Reference) > 0 {
- vis.Walk(x.Reference)
- } else {
- vis.Walk(x.Name)
- if x.Key != nil {
- vis.Walk(x.Key)
- }
- }
- vis.Walk(x.Args)
-
- if x.Value != nil {
- vis.Walk(x.Value)
- }
- case Body:
- for i := range x {
- vis.Walk(x[i])
- }
- case Args:
- for i := range x {
- vis.Walk(x[i])
- }
- case *Expr:
- switch ts := x.Terms.(type) {
- case *Term, *SomeDecl, *Every:
- vis.Walk(ts)
- case []*Term:
- for i := range ts {
- vis.Walk(ts[i])
- }
- }
- for i := range x.With {
- vis.Walk(x.With[i])
- }
- case *With:
- vis.Walk(x.Target)
- vis.Walk(x.Value)
- case *Term:
- vis.Walk(x.Value)
- case Ref:
- for i := range x {
- vis.Walk(x[i])
- }
- case *object:
- x.Foreach(func(k, _ *Term) {
- vis.Walk(k)
- vis.Walk(x.Get(k))
- })
- case *Array:
- x.Foreach(func(t *Term) {
- vis.Walk(t)
- })
- case Set:
- xSlice := x.Slice()
- for i := range xSlice {
- vis.Walk(xSlice[i])
- }
- case *ArrayComprehension:
- vis.Walk(x.Term)
- vis.Walk(x.Body)
- case *ObjectComprehension:
- vis.Walk(x.Key)
- vis.Walk(x.Value)
- vis.Walk(x.Body)
- case *SetComprehension:
- vis.Walk(x.Term)
- vis.Walk(x.Body)
- case Call:
- for i := range x {
- vis.Walk(x[i])
- }
- case *Every:
- if x.Key != nil {
- vis.Walk(x.Key)
- }
- vis.Walk(x.Value)
- vis.Walk(x.Domain)
- vis.Walk(x.Body)
- case *SomeDecl:
- for i := range x.Symbols {
- vis.Walk(x.Symbols[i])
- }
- }
+ return v1.NewVarVisitor()
}
diff --git a/vendor/github.com/open-policy-agent/opa/bundle/bundle.go b/vendor/github.com/open-policy-agent/opa/bundle/bundle.go
index 0e159384ef..50ad97349a 100644
--- a/vendor/github.com/open-policy-agent/opa/bundle/bundle.go
+++ b/vendor/github.com/open-policy-agent/opa/bundle/bundle.go
@@ -6,1386 +6,97 @@
package bundle
import (
- "archive/tar"
- "bytes"
- "compress/gzip"
- "encoding/hex"
- "encoding/json"
- "errors"
- "fmt"
"io"
- "net/url"
- "os"
- "path"
- "path/filepath"
- "reflect"
- "strings"
- "github.com/gobwas/glob"
"github.com/open-policy-agent/opa/ast"
- astJSON "github.com/open-policy-agent/opa/ast/json"
- "github.com/open-policy-agent/opa/format"
- "github.com/open-policy-agent/opa/internal/file/archive"
- "github.com/open-policy-agent/opa/internal/merge"
- "github.com/open-policy-agent/opa/metrics"
- "github.com/open-policy-agent/opa/util"
+ v1 "github.com/open-policy-agent/opa/v1/bundle"
)
// Common file extensions and file names.
const (
- RegoExt = ".rego"
- WasmFile = "policy.wasm"
- PlanFile = "plan.json"
- ManifestExt = ".manifest"
- SignaturesFile = "signatures.json"
- patchFile = "patch.json"
- dataFile = "data.json"
- yamlDataFile = "data.yaml"
- ymlDataFile = "data.yml"
- defaultHashingAlg = "SHA-256"
- DefaultSizeLimitBytes = (1024 * 1024 * 1024) // limit bundle reads to 1GB to protect against gzip bombs
- DeltaBundleType = "delta"
- SnapshotBundleType = "snapshot"
+ RegoExt = v1.RegoExt
+ WasmFile = v1.WasmFile
+ PlanFile = v1.PlanFile
+ ManifestExt = v1.ManifestExt
+ SignaturesFile = v1.SignaturesFile
+
+ DefaultSizeLimitBytes = v1.DefaultSizeLimitBytes
+ DeltaBundleType = v1.DeltaBundleType
+ SnapshotBundleType = v1.SnapshotBundleType
)
// Bundle represents a loaded bundle. The bundle can contain data and policies.
-type Bundle struct {
- Signatures SignaturesConfig
- Manifest Manifest
- Data map[string]interface{}
- Modules []ModuleFile
- Wasm []byte // Deprecated. Use WasmModules instead
- WasmModules []WasmModuleFile
- PlanModules []PlanModuleFile
- Patch Patch
- Etag string
- Raw []Raw
-
- lazyLoadingMode bool
- sizeLimitBytes int64
-}
+type Bundle = v1.Bundle
// Raw contains raw bytes representing the bundle's content
-type Raw struct {
- Path string
- Value []byte
-}
+type Raw = v1.Raw
// Patch contains an array of objects wherein each object represents the patch operation to be
// applied to the bundle data.
-type Patch struct {
- Data []PatchOperation `json:"data,omitempty"`
-}
+type Patch = v1.Patch
// PatchOperation models a single patch operation against a document.
-type PatchOperation struct {
- Op string `json:"op"`
- Path string `json:"path"`
- Value interface{} `json:"value"`
-}
+type PatchOperation = v1.PatchOperation
// SignaturesConfig represents an array of JWTs that encapsulate the signatures for the bundle.
-type SignaturesConfig struct {
- Signatures []string `json:"signatures,omitempty"`
- Plugin string `json:"plugin,omitempty"`
-}
-
-// isEmpty returns if the SignaturesConfig is empty.
-func (s SignaturesConfig) isEmpty() bool {
- return reflect.DeepEqual(s, SignaturesConfig{})
-}
+type SignaturesConfig = v1.SignaturesConfig
// DecodedSignature represents the decoded JWT payload.
-type DecodedSignature struct {
- Files []FileInfo `json:"files"`
- KeyID string `json:"keyid"` // Deprecated, use kid in the JWT header instead.
- Scope string `json:"scope"`
- IssuedAt int64 `json:"iat"`
- Issuer string `json:"iss"`
-}
+type DecodedSignature = v1.DecodedSignature
// FileInfo contains the hashing algorithm used, resulting digest etc.
-type FileInfo struct {
- Name string `json:"name"`
- Hash string `json:"hash"`
- Algorithm string `json:"algorithm"`
-}
+type FileInfo = v1.FileInfo
// NewFile returns a new FileInfo.
func NewFile(name, hash, alg string) FileInfo {
- return FileInfo{
- Name: name,
- Hash: hash,
- Algorithm: alg,
- }
+ return v1.NewFile(name, hash, alg)
}
// Manifest represents the manifest from a bundle. The manifest may contain
// metadata such as the bundle revision.
-type Manifest struct {
- Revision string `json:"revision"`
- Roots *[]string `json:"roots,omitempty"`
- WasmResolvers []WasmResolver `json:"wasm,omitempty"`
- // RegoVersion is the global Rego version for the bundle described by this Manifest.
- // The Rego version of individual files can be overridden in FileRegoVersions.
- // We don't use ast.RegoVersion here, as this iota type's order isn't guaranteed to be stable over time.
- // We use a pointer so that we can support hand-made bundles that don't have an explicit version appropriately.
- // E.g. in OPA 0.x if --v1-compatible is used when consuming the bundle, and there is no specified version,
- // we should default to v1; if --v1-compatible isn't used, we should default to v0. In OPA 1.0, no --x-compatible
- // flag and no explicit bundle version should default to v1.
- RegoVersion *int `json:"rego_version,omitempty"`
- // FileRegoVersions is a map from file paths to Rego versions.
- // This allows individual files to override the global Rego version specified by RegoVersion.
- FileRegoVersions map[string]int `json:"file_rego_versions,omitempty"`
- Metadata map[string]interface{} `json:"metadata,omitempty"`
-
- compiledFileRegoVersions []fileRegoVersion
-}
-
-type fileRegoVersion struct {
- path glob.Glob
- version int
-}
+type Manifest = v1.Manifest
// WasmResolver maps a wasm module to an entrypoint ref.
-type WasmResolver struct {
- Entrypoint string `json:"entrypoint,omitempty"`
- Module string `json:"module,omitempty"`
- Annotations []*ast.Annotations `json:"annotations,omitempty"`
-}
-
-// Init initializes the manifest. If you instantiate a manifest
-// manually, call Init to ensure that the roots are set properly.
-func (m *Manifest) Init() {
- if m.Roots == nil {
- defaultRoots := []string{""}
- m.Roots = &defaultRoots
- }
-}
-
-// AddRoot adds r to the roots of m. This function is idempotent.
-func (m *Manifest) AddRoot(r string) {
- m.Init()
- if !RootPathsContain(*m.Roots, r) {
- *m.Roots = append(*m.Roots, r)
- }
-}
-
-func (m *Manifest) SetRegoVersion(v ast.RegoVersion) {
- m.Init()
- regoVersion := 0
- if v == ast.RegoV1 {
- regoVersion = 1
- }
- m.RegoVersion = ®oVersion
-}
-
-// Equal returns true if m is semantically equivalent to other.
-func (m Manifest) Equal(other Manifest) bool {
-
- // This is safe since both are passed by value.
- m.Init()
- other.Init()
-
- if m.Revision != other.Revision {
- return false
- }
-
- if m.RegoVersion == nil && other.RegoVersion != nil {
- return false
- }
- if m.RegoVersion != nil && other.RegoVersion == nil {
- return false
- }
- if m.RegoVersion != nil && other.RegoVersion != nil && *m.RegoVersion != *other.RegoVersion {
- return false
- }
-
- // If both are nil, or both are empty, we consider them equal.
- if !(len(m.FileRegoVersions) == 0 && len(other.FileRegoVersions) == 0) &&
- !reflect.DeepEqual(m.FileRegoVersions, other.FileRegoVersions) {
- return false
- }
-
- if !reflect.DeepEqual(m.Metadata, other.Metadata) {
- return false
- }
-
- return m.equalWasmResolversAndRoots(other)
-}
-
-func (m Manifest) Empty() bool {
- return m.Equal(Manifest{})
-}
-
-// Copy returns a deep copy of the manifest.
-func (m Manifest) Copy() Manifest {
- m.Init()
- roots := make([]string, len(*m.Roots))
- copy(roots, *m.Roots)
- m.Roots = &roots
-
- wasmModules := make([]WasmResolver, len(m.WasmResolvers))
- copy(wasmModules, m.WasmResolvers)
- m.WasmResolvers = wasmModules
-
- metadata := m.Metadata
-
- if metadata != nil {
- m.Metadata = make(map[string]interface{})
- for k, v := range metadata {
- m.Metadata[k] = v
- }
- }
-
- return m
-}
-
-func (m Manifest) String() string {
- m.Init()
- if m.RegoVersion != nil {
- return fmt.Sprintf("",
- m.Revision, *m.RegoVersion, *m.Roots, m.WasmResolvers, m.Metadata)
- }
- return fmt.Sprintf("",
- m.Revision, *m.Roots, m.WasmResolvers, m.Metadata)
-}
-
-func (m Manifest) rootSet() stringSet {
- rs := map[string]struct{}{}
-
- for _, r := range *m.Roots {
- rs[r] = struct{}{}
- }
-
- return stringSet(rs)
-}
-
-func (m Manifest) equalWasmResolversAndRoots(other Manifest) bool {
- if len(m.WasmResolvers) != len(other.WasmResolvers) {
- return false
- }
-
- for i := 0; i < len(m.WasmResolvers); i++ {
- if !m.WasmResolvers[i].Equal(&other.WasmResolvers[i]) {
- return false
- }
- }
-
- return m.rootSet().Equal(other.rootSet())
-}
-
-func (wr *WasmResolver) Equal(other *WasmResolver) bool {
- if wr == nil && other == nil {
- return true
- }
-
- if wr == nil || other == nil {
- return false
- }
-
- if wr.Module != other.Module {
- return false
- }
-
- if wr.Entrypoint != other.Entrypoint {
- return false
- }
-
- annotLen := len(wr.Annotations)
- if annotLen != len(other.Annotations) {
- return false
- }
-
- for i := 0; i < annotLen; i++ {
- if wr.Annotations[i].Compare(other.Annotations[i]) != 0 {
- return false
- }
- }
-
- return true
-}
-
-type stringSet map[string]struct{}
-
-func (ss stringSet) Equal(other stringSet) bool {
- if len(ss) != len(other) {
- return false
- }
- for k := range other {
- if _, ok := ss[k]; !ok {
- return false
- }
- }
- return true
-}
-
-func (m *Manifest) validateAndInjectDefaults(b Bundle) error {
-
- m.Init()
-
- // Validate roots in bundle.
- roots := *m.Roots
-
- // Standardize the roots (no starting or trailing slash)
- for i := range roots {
- roots[i] = strings.Trim(roots[i], "/")
- }
-
- for i := 0; i < len(roots)-1; i++ {
- for j := i + 1; j < len(roots); j++ {
- if RootPathsOverlap(roots[i], roots[j]) {
- return fmt.Errorf("manifest has overlapped roots: '%v' and '%v'", roots[i], roots[j])
- }
- }
- }
-
- // Validate modules in bundle.
- for _, module := range b.Modules {
- found := false
- if path, err := module.Parsed.Package.Path.Ptr(); err == nil {
- found = RootPathsContain(roots, path)
- }
- if !found {
- return fmt.Errorf("manifest roots %v do not permit '%v' in module '%v'", roots, module.Parsed.Package, module.Path)
- }
- }
-
- // Build a set of wasm module entrypoints to validate
- wasmModuleToEps := map[string]string{}
- seenEps := map[string]struct{}{}
- for _, wm := range b.WasmModules {
- wasmModuleToEps[wm.Path] = ""
- }
-
- for _, wmConfig := range b.Manifest.WasmResolvers {
- _, ok := wasmModuleToEps[wmConfig.Module]
- if !ok {
- return fmt.Errorf("manifest references wasm module '%s' but the module file does not exist", wmConfig.Module)
- }
-
- // Ensure wasm module entrypoint in within bundle roots
- if !RootPathsContain(roots, wmConfig.Entrypoint) {
- return fmt.Errorf("manifest roots %v do not permit '%v' entrypoint for wasm module '%v'", roots, wmConfig.Entrypoint, wmConfig.Module)
- }
-
- if _, ok := seenEps[wmConfig.Entrypoint]; ok {
- return fmt.Errorf("entrypoint '%s' cannot be used by more than one wasm module", wmConfig.Entrypoint)
- }
- seenEps[wmConfig.Entrypoint] = struct{}{}
-
- wasmModuleToEps[wmConfig.Module] = wmConfig.Entrypoint
- }
-
- // Validate data patches in bundle.
- for _, patch := range b.Patch.Data {
- path := strings.Trim(patch.Path, "/")
- if !RootPathsContain(roots, path) {
- return fmt.Errorf("manifest roots %v do not permit data patch at path '%s'", roots, path)
- }
- }
-
- if b.lazyLoadingMode {
- return nil
- }
-
- // Validate data in bundle.
- return dfs(b.Data, "", func(path string, node interface{}) (bool, error) {
- path = strings.Trim(path, "/")
- if RootPathsContain(roots, path) {
- return true, nil
- }
-
- if _, ok := node.(map[string]interface{}); ok {
- for i := range roots {
- if RootPathsContain(strings.Split(path, "/"), roots[i]) {
- return false, nil
- }
- }
- }
- return false, fmt.Errorf("manifest roots %v do not permit data at path '/%s' (hint: check bundle directory structure)", roots, path)
- })
-}
+type WasmResolver = v1.WasmResolver
// ModuleFile represents a single module contained in a bundle.
-type ModuleFile struct {
- URL string
- Path string
- RelativePath string
- Raw []byte
- Parsed *ast.Module
-}
+type ModuleFile = v1.ModuleFile
// WasmModuleFile represents a single wasm module contained in a bundle.
-type WasmModuleFile struct {
- URL string
- Path string
- Entrypoints []ast.Ref
- Raw []byte
-}
+type WasmModuleFile = v1.WasmModuleFile
// PlanModuleFile represents a single plan module contained in a bundle.
//
// NOTE(tsandall): currently the plans are just opaque binary blobs. In the
// future we could inject the entrypoints so that the plans could be executed
// inside of OPA proper like we do for Wasm modules.
-type PlanModuleFile struct {
- URL string
- Path string
- Raw []byte
-}
+type PlanModuleFile = v1.PlanModuleFile
// Reader contains the reader to load the bundle from.
-type Reader struct {
- loader DirectoryLoader
- includeManifestInData bool
- metrics metrics.Metrics
- baseDir string
- verificationConfig *VerificationConfig
- skipVerify bool
- processAnnotations bool
- jsonOptions *astJSON.Options
- capabilities *ast.Capabilities
- files map[string]FileInfo // files in the bundle signature payload
- sizeLimitBytes int64
- etag string
- lazyLoadingMode bool
- name string
- persist bool
- regoVersion ast.RegoVersion
- followSymlinks bool
-}
+type Reader = v1.Reader
// NewReader is deprecated. Use NewCustomReader instead.
func NewReader(r io.Reader) *Reader {
- return NewCustomReader(NewTarballLoader(r))
+ return v1.NewReader(r).WithRegoVersion(ast.DefaultRegoVersion)
}
// NewCustomReader returns a new Reader configured to use the
// specified DirectoryLoader.
func NewCustomReader(loader DirectoryLoader) *Reader {
- nr := Reader{
- loader: loader,
- metrics: metrics.New(),
- files: make(map[string]FileInfo),
- sizeLimitBytes: DefaultSizeLimitBytes + 1,
- }
- return &nr
-}
-
-// IncludeManifestInData sets whether the manifest metadata should be
-// included in the bundle's data.
-func (r *Reader) IncludeManifestInData(includeManifestInData bool) *Reader {
- r.includeManifestInData = includeManifestInData
- return r
-}
-
-// WithMetrics sets the metrics object to be used while loading bundles
-func (r *Reader) WithMetrics(m metrics.Metrics) *Reader {
- r.metrics = m
- return r
-}
-
-// WithBaseDir sets a base directory for file paths of loaded Rego
-// modules. This will *NOT* affect the loaded path of data files.
-func (r *Reader) WithBaseDir(dir string) *Reader {
- r.baseDir = dir
- return r
-}
-
-// WithBundleVerificationConfig sets the key configuration used to verify a signed bundle
-func (r *Reader) WithBundleVerificationConfig(config *VerificationConfig) *Reader {
- r.verificationConfig = config
- return r
-}
-
-// WithSkipBundleVerification skips verification of a signed bundle
-func (r *Reader) WithSkipBundleVerification(skipVerify bool) *Reader {
- r.skipVerify = skipVerify
- return r
-}
-
-// WithProcessAnnotations enables annotation processing during .rego file parsing.
-func (r *Reader) WithProcessAnnotations(yes bool) *Reader {
- r.processAnnotations = yes
- return r
-}
-
-// WithCapabilities sets the supported capabilities when loading the files
-func (r *Reader) WithCapabilities(caps *ast.Capabilities) *Reader {
- r.capabilities = caps
- return r
-}
-
-// WithJSONOptions sets the JSONOptions to use when parsing policy files
-func (r *Reader) WithJSONOptions(opts *astJSON.Options) *Reader {
- r.jsonOptions = opts
- return r
-}
-
-// WithSizeLimitBytes sets the size limit to apply to files in the bundle. If files are larger
-// than this, an error will be returned by the reader.
-func (r *Reader) WithSizeLimitBytes(n int64) *Reader {
- r.sizeLimitBytes = n + 1
- return r
-}
-
-// WithBundleEtag sets the given etag value on the bundle
-func (r *Reader) WithBundleEtag(etag string) *Reader {
- r.etag = etag
- return r
-}
-
-// WithBundleName specifies the bundle name
-func (r *Reader) WithBundleName(name string) *Reader {
- r.name = name
- return r
-}
-
-func (r *Reader) WithFollowSymlinks(yes bool) *Reader {
- r.followSymlinks = yes
- return r
-}
-
-// WithLazyLoadingMode sets the bundle loading mode. If true,
-// bundles will be read in lazy mode. In this mode, data files in the bundle will not be
-// deserialized and the check to validate that the bundle data does not contain paths
-// outside the bundle's roots will not be performed while reading the bundle.
-func (r *Reader) WithLazyLoadingMode(yes bool) *Reader {
- r.lazyLoadingMode = yes
- return r
-}
-
-// WithBundlePersistence specifies if the downloaded bundle will eventually be persisted to disk.
-func (r *Reader) WithBundlePersistence(persist bool) *Reader {
- r.persist = persist
- return r
-}
-
-func (r *Reader) WithRegoVersion(version ast.RegoVersion) *Reader {
- r.regoVersion = version
- return r
-}
-
-func (r *Reader) ParserOptions() ast.ParserOptions {
- return ast.ParserOptions{
- ProcessAnnotation: r.processAnnotations,
- Capabilities: r.capabilities,
- JSONOptions: r.jsonOptions,
- RegoVersion: r.regoVersion,
- }
-}
-
-// Read returns a new Bundle loaded from the reader.
-func (r *Reader) Read() (Bundle, error) {
-
- var bundle Bundle
- var descriptors []*Descriptor
- var err error
- var raw []Raw
-
- bundle.Signatures, bundle.Patch, descriptors, err = preProcessBundle(r.loader, r.skipVerify, r.sizeLimitBytes)
- if err != nil {
- return bundle, err
- }
-
- bundle.lazyLoadingMode = r.lazyLoadingMode
- bundle.sizeLimitBytes = r.sizeLimitBytes
-
- if bundle.Type() == SnapshotBundleType {
- err = r.checkSignaturesAndDescriptors(bundle.Signatures)
- if err != nil {
- return bundle, err
- }
-
- bundle.Data = map[string]interface{}{}
- }
-
- var modules []ModuleFile
- for _, f := range descriptors {
- buf, err := readFile(f, r.sizeLimitBytes)
- if err != nil {
- return bundle, err
- }
-
- // verify the file content
- if bundle.Type() == SnapshotBundleType && !bundle.Signatures.isEmpty() {
- path := f.Path()
- if r.baseDir != "" {
- path = f.URL()
- }
- path = strings.TrimPrefix(path, "/")
-
- // check if the file is to be excluded from bundle verification
- if r.isFileExcluded(path) {
- delete(r.files, path)
- } else {
- if err = r.verifyBundleFile(path, buf); err != nil {
- return bundle, err
- }
- }
- }
-
- // Normalize the paths to use `/` separators
- path := filepath.ToSlash(f.Path())
-
- if strings.HasSuffix(path, RegoExt) {
- fullPath := r.fullPath(path)
- bs := buf.Bytes()
-
- if r.lazyLoadingMode {
- p := fullPath
- if r.name != "" {
- p = modulePathWithPrefix(r.name, fullPath)
- }
-
- raw = append(raw, Raw{Path: p, Value: bs})
- }
-
- // Modules are parsed after we've had a chance to read the manifest
- mf := ModuleFile{
- URL: f.URL(),
- Path: fullPath,
- RelativePath: path,
- Raw: bs,
- }
- modules = append(modules, mf)
- } else if filepath.Base(path) == WasmFile {
- bundle.WasmModules = append(bundle.WasmModules, WasmModuleFile{
- URL: f.URL(),
- Path: r.fullPath(path),
- Raw: buf.Bytes(),
- })
- } else if filepath.Base(path) == PlanFile {
- bundle.PlanModules = append(bundle.PlanModules, PlanModuleFile{
- URL: f.URL(),
- Path: r.fullPath(path),
- Raw: buf.Bytes(),
- })
- } else if filepath.Base(path) == dataFile {
- if r.lazyLoadingMode {
- raw = append(raw, Raw{Path: path, Value: buf.Bytes()})
- continue
- }
-
- var value interface{}
-
- r.metrics.Timer(metrics.RegoDataParse).Start()
- err := util.UnmarshalJSON(buf.Bytes(), &value)
- r.metrics.Timer(metrics.RegoDataParse).Stop()
-
- if err != nil {
- return bundle, fmt.Errorf("bundle load failed on %v: %w", r.fullPath(path), err)
- }
-
- if err := insertValue(&bundle, path, value); err != nil {
- return bundle, err
- }
-
- } else if filepath.Base(path) == yamlDataFile || filepath.Base(path) == ymlDataFile {
- if r.lazyLoadingMode {
- raw = append(raw, Raw{Path: path, Value: buf.Bytes()})
- continue
- }
-
- var value interface{}
-
- r.metrics.Timer(metrics.RegoDataParse).Start()
- err := util.Unmarshal(buf.Bytes(), &value)
- r.metrics.Timer(metrics.RegoDataParse).Stop()
-
- if err != nil {
- return bundle, fmt.Errorf("bundle load failed on %v: %w", r.fullPath(path), err)
- }
-
- if err := insertValue(&bundle, path, value); err != nil {
- return bundle, err
- }
-
- } else if strings.HasSuffix(path, ManifestExt) {
- if err := util.NewJSONDecoder(&buf).Decode(&bundle.Manifest); err != nil {
- return bundle, fmt.Errorf("bundle load failed on manifest decode: %w", err)
- }
- }
- }
-
- // Parse modules
- popts := r.ParserOptions()
- popts.RegoVersion = bundle.RegoVersion(popts.RegoVersion)
- for _, mf := range modules {
- modulePopts := popts
- if modulePopts.RegoVersion, err = bundle.RegoVersionForFile(mf.RelativePath, popts.RegoVersion); err != nil {
- return bundle, err
- }
- r.metrics.Timer(metrics.RegoModuleParse).Start()
- mf.Parsed, err = ast.ParseModuleWithOpts(mf.Path, string(mf.Raw), modulePopts)
- r.metrics.Timer(metrics.RegoModuleParse).Stop()
- if err != nil {
- return bundle, err
- }
- bundle.Modules = append(bundle.Modules, mf)
- }
-
- if bundle.Type() == DeltaBundleType {
- if len(bundle.Data) != 0 {
- return bundle, fmt.Errorf("delta bundle expected to contain only patch file but data files found")
- }
-
- if len(bundle.Modules) != 0 {
- return bundle, fmt.Errorf("delta bundle expected to contain only patch file but policy files found")
- }
-
- if len(bundle.WasmModules) != 0 {
- return bundle, fmt.Errorf("delta bundle expected to contain only patch file but wasm files found")
- }
-
- if r.persist {
- return bundle, fmt.Errorf("'persist' property is true in config. persisting delta bundle to disk is not supported")
- }
- }
-
- // check if the bundle signatures specify any files that weren't found in the bundle
- if bundle.Type() == SnapshotBundleType && len(r.files) != 0 {
- extra := []string{}
- for k := range r.files {
- extra = append(extra, k)
- }
- return bundle, fmt.Errorf("file(s) %v specified in bundle signatures but not found in the target bundle", extra)
- }
-
- if err := bundle.Manifest.validateAndInjectDefaults(bundle); err != nil {
- return bundle, err
- }
-
- // Inject the wasm module entrypoint refs into the WasmModuleFile structs
- epMap := map[string][]string{}
- for _, r := range bundle.Manifest.WasmResolvers {
- epMap[r.Module] = append(epMap[r.Module], r.Entrypoint)
- }
- for i := 0; i < len(bundle.WasmModules); i++ {
- entrypoints := epMap[bundle.WasmModules[i].Path]
- for _, entrypoint := range entrypoints {
- ref, err := ast.PtrRef(ast.DefaultRootDocument, entrypoint)
- if err != nil {
- return bundle, fmt.Errorf("failed to parse wasm module entrypoint '%s': %s", entrypoint, err)
- }
- bundle.WasmModules[i].Entrypoints = append(bundle.WasmModules[i].Entrypoints, ref)
- }
- }
-
- if r.includeManifestInData {
- var metadata map[string]interface{}
-
- b, err := json.Marshal(&bundle.Manifest)
- if err != nil {
- return bundle, fmt.Errorf("bundle load failed on manifest marshal: %w", err)
- }
-
- err = util.UnmarshalJSON(b, &metadata)
- if err != nil {
- return bundle, fmt.Errorf("bundle load failed on manifest unmarshal: %w", err)
- }
-
- // For backwards compatibility always write to the old unnamed manifest path
- // This will *not* be correct if >1 bundle is in use...
- if err := bundle.insertData(legacyManifestStoragePath, metadata); err != nil {
- return bundle, fmt.Errorf("bundle load failed on %v: %w", legacyRevisionStoragePath, err)
- }
- }
-
- bundle.Etag = r.etag
- bundle.Raw = raw
-
- return bundle, nil
-}
-
-func (r *Reader) isFileExcluded(path string) bool {
- for _, e := range r.verificationConfig.Exclude {
- match, _ := filepath.Match(e, path)
- if match {
- return true
- }
- }
- return false
-}
-
-func (r *Reader) checkSignaturesAndDescriptors(signatures SignaturesConfig) error {
- if r.skipVerify {
- return nil
- }
-
- if signatures.isEmpty() && r.verificationConfig != nil && r.verificationConfig.KeyID != "" {
- return fmt.Errorf("bundle missing .signatures.json file")
- }
-
- if !signatures.isEmpty() {
- if r.verificationConfig == nil {
- return fmt.Errorf("verification key not provided")
- }
-
- // verify the JWT signatures included in the `.signatures.json` file
- if err := r.verifyBundleSignature(signatures); err != nil {
- return err
- }
- }
- return nil
-}
-
-func (r *Reader) verifyBundleSignature(sc SignaturesConfig) error {
- var err error
- r.files, err = VerifyBundleSignature(sc, r.verificationConfig)
- return err
-}
-
-func (r *Reader) verifyBundleFile(path string, data bytes.Buffer) error {
- return VerifyBundleFile(path, data, r.files)
-}
-
-func (r *Reader) fullPath(path string) string {
- if r.baseDir != "" {
- path = filepath.Join(r.baseDir, path)
- }
- return path
+ return v1.NewCustomReader(loader).WithRegoVersion(ast.DefaultRegoVersion)
}
// Write is deprecated. Use NewWriter instead.
func Write(w io.Writer, bundle Bundle) error {
- return NewWriter(w).
- UseModulePath(true).
- DisableFormat(true).
- Write(bundle)
+ return v1.Write(w, bundle)
}
// Writer implements bundle serialization.
-type Writer struct {
- usePath bool
- disableFormat bool
- w io.Writer
-}
+type Writer = v1.Writer
// NewWriter returns a bundle writer that writes to w.
func NewWriter(w io.Writer) *Writer {
- return &Writer{
- w: w,
- }
-}
-
-// UseModulePath configures the writer to use the module file path instead of the
-// module file URL during serialization. This is for backwards compatibility.
-func (w *Writer) UseModulePath(yes bool) *Writer {
- w.usePath = yes
- return w
-}
-
-// DisableFormat configures the writer to just write out raw bytes instead
-// of formatting modules before serialization.
-func (w *Writer) DisableFormat(yes bool) *Writer {
- w.disableFormat = yes
- return w
-}
-
-// Write writes the bundle to the writer's output stream.
-func (w *Writer) Write(bundle Bundle) error {
- gw := gzip.NewWriter(w.w)
- tw := tar.NewWriter(gw)
-
- bundleType := bundle.Type()
-
- if bundleType == SnapshotBundleType {
- var buf bytes.Buffer
-
- if err := json.NewEncoder(&buf).Encode(bundle.Data); err != nil {
- return err
- }
-
- if err := archive.WriteFile(tw, "data.json", buf.Bytes()); err != nil {
- return err
- }
-
- for _, module := range bundle.Modules {
- path := module.URL
- if w.usePath {
- path = module.Path
- }
-
- if err := archive.WriteFile(tw, path, module.Raw); err != nil {
- return err
- }
- }
-
- if err := w.writeWasm(tw, bundle); err != nil {
- return err
- }
-
- if err := writeSignatures(tw, bundle); err != nil {
- return err
- }
-
- if err := w.writePlan(tw, bundle); err != nil {
- return err
- }
- } else if bundleType == DeltaBundleType {
- if err := writePatch(tw, bundle); err != nil {
- return err
- }
- }
-
- if err := writeManifest(tw, bundle); err != nil {
- return err
- }
-
- if err := tw.Close(); err != nil {
- return err
- }
-
- return gw.Close()
-}
-
-func (w *Writer) writeWasm(tw *tar.Writer, bundle Bundle) error {
- for _, wm := range bundle.WasmModules {
- path := wm.URL
- if w.usePath {
- path = wm.Path
- }
-
- err := archive.WriteFile(tw, path, wm.Raw)
- if err != nil {
- return err
- }
- }
-
- if len(bundle.Wasm) > 0 {
- err := archive.WriteFile(tw, "/"+WasmFile, bundle.Wasm)
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func (w *Writer) writePlan(tw *tar.Writer, bundle Bundle) error {
- for _, wm := range bundle.PlanModules {
- path := wm.URL
- if w.usePath {
- path = wm.Path
- }
-
- err := archive.WriteFile(tw, path, wm.Raw)
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func writeManifest(tw *tar.Writer, bundle Bundle) error {
-
- if bundle.Manifest.Empty() {
- return nil
- }
-
- var buf bytes.Buffer
-
- if err := json.NewEncoder(&buf).Encode(bundle.Manifest); err != nil {
- return err
- }
-
- return archive.WriteFile(tw, ManifestExt, buf.Bytes())
-}
-
-func writePatch(tw *tar.Writer, bundle Bundle) error {
-
- var buf bytes.Buffer
-
- if err := json.NewEncoder(&buf).Encode(bundle.Patch); err != nil {
- return err
- }
-
- return archive.WriteFile(tw, patchFile, buf.Bytes())
-}
-
-func writeSignatures(tw *tar.Writer, bundle Bundle) error {
-
- if bundle.Signatures.isEmpty() {
- return nil
- }
-
- bs, err := json.MarshalIndent(bundle.Signatures, "", " ")
- if err != nil {
- return err
- }
-
- return archive.WriteFile(tw, fmt.Sprintf(".%v", SignaturesFile), bs)
-}
-
-func hashBundleFiles(hash SignatureHasher, b *Bundle) ([]FileInfo, error) {
-
- files := []FileInfo{}
-
- bs, err := hash.HashFile(b.Data)
- if err != nil {
- return files, err
- }
- files = append(files, NewFile(strings.TrimPrefix("data.json", "/"), hex.EncodeToString(bs), defaultHashingAlg))
-
- if len(b.Wasm) != 0 {
- bs, err := hash.HashFile(b.Wasm)
- if err != nil {
- return files, err
- }
- files = append(files, NewFile(strings.TrimPrefix(WasmFile, "/"), hex.EncodeToString(bs), defaultHashingAlg))
- }
-
- for _, wasmModule := range b.WasmModules {
- bs, err := hash.HashFile(wasmModule.Raw)
- if err != nil {
- return files, err
- }
- files = append(files, NewFile(strings.TrimPrefix(wasmModule.Path, "/"), hex.EncodeToString(bs), defaultHashingAlg))
- }
-
- for _, planmodule := range b.PlanModules {
- bs, err := hash.HashFile(planmodule.Raw)
- if err != nil {
- return files, err
- }
- files = append(files, NewFile(strings.TrimPrefix(planmodule.Path, "/"), hex.EncodeToString(bs), defaultHashingAlg))
- }
-
- // If the manifest is essentially empty, don't add it to the signatures since it
- // won't be written to the bundle. Otherwise:
- // parse the manifest into a JSON structure;
- // then recursively order the fields of all objects alphabetically and then apply
- // the hash function to result to compute the hash.
- if !b.Manifest.Empty() {
- mbs, err := json.Marshal(b.Manifest)
- if err != nil {
- return files, err
- }
-
- var result map[string]interface{}
- if err := util.Unmarshal(mbs, &result); err != nil {
- return files, err
- }
-
- bs, err = hash.HashFile(result)
- if err != nil {
- return files, err
- }
-
- files = append(files, NewFile(strings.TrimPrefix(ManifestExt, "/"), hex.EncodeToString(bs), defaultHashingAlg))
- }
-
- return files, err
-}
-
-// FormatModules formats Rego modules
-// Modules will be formatted to comply with rego-v0, but Rego compatibility of individual parsed modules will be respected (e.g. if 'rego.v1' is imported).
-func (b *Bundle) FormatModules(useModulePath bool) error {
- return b.FormatModulesForRegoVersion(ast.RegoV0, true, useModulePath)
-}
-
-// FormatModulesForRegoVersion formats Rego modules to comply with a given Rego version
-func (b *Bundle) FormatModulesForRegoVersion(version ast.RegoVersion, preserveModuleRegoVersion bool, useModulePath bool) error {
- var err error
-
- for i, module := range b.Modules {
- opts := format.Opts{}
- if preserveModuleRegoVersion {
- opts.RegoVersion = module.Parsed.RegoVersion()
- opts.ParserOptions = &ast.ParserOptions{
- RegoVersion: opts.RegoVersion,
- }
- } else {
- opts.RegoVersion = version
- }
-
- if module.Raw == nil {
- module.Raw, err = format.AstWithOpts(module.Parsed, opts)
- if err != nil {
- return err
- }
- } else {
- path := module.URL
- if useModulePath {
- path = module.Path
- }
-
- module.Raw, err = format.SourceWithOpts(path, module.Raw, opts)
- if err != nil {
- return err
- }
- }
- b.Modules[i].Raw = module.Raw
- }
- return nil
-}
-
-// GenerateSignature generates the signature for the given bundle.
-func (b *Bundle) GenerateSignature(signingConfig *SigningConfig, keyID string, useModulePath bool) error {
-
- hash, err := NewSignatureHasher(HashingAlgorithm(defaultHashingAlg))
- if err != nil {
- return err
- }
-
- files := []FileInfo{}
-
- for _, module := range b.Modules {
- bytes, err := hash.HashFile(module.Raw)
- if err != nil {
- return err
- }
-
- path := module.URL
- if useModulePath {
- path = module.Path
- }
- files = append(files, NewFile(strings.TrimPrefix(path, "/"), hex.EncodeToString(bytes), defaultHashingAlg))
- }
-
- result, err := hashBundleFiles(hash, b)
- if err != nil {
- return err
- }
- files = append(files, result...)
-
- // generate signed token
- token, err := GenerateSignedToken(files, signingConfig, keyID)
- if err != nil {
- return err
- }
-
- if b.Signatures.isEmpty() {
- b.Signatures = SignaturesConfig{}
- }
-
- if signingConfig.Plugin != "" {
- b.Signatures.Plugin = signingConfig.Plugin
- }
-
- b.Signatures.Signatures = []string{token}
-
- return nil
-}
-
-// ParsedModules returns a map of parsed modules with names that are
-// unique and human readable for the given a bundle name.
-func (b *Bundle) ParsedModules(bundleName string) map[string]*ast.Module {
-
- mods := make(map[string]*ast.Module, len(b.Modules))
-
- for _, mf := range b.Modules {
- mods[modulePathWithPrefix(bundleName, mf.Path)] = mf.Parsed
- }
-
- return mods
-}
-
-func (b *Bundle) RegoVersion(def ast.RegoVersion) ast.RegoVersion {
- if v := b.Manifest.RegoVersion; v != nil {
- if *v == 0 {
- return ast.RegoV0
- } else if *v == 1 {
- return ast.RegoV1
- }
- }
- return def
-}
-
-func (b *Bundle) SetRegoVersion(v ast.RegoVersion) {
- b.Manifest.SetRegoVersion(v)
-}
-
-// RegoVersionForFile returns the rego-version for the specified file path.
-// If there is no defined version for the given path, the default version def is returned.
-// If the version does not correspond to ast.RegoV0 or ast.RegoV1, an error is returned.
-func (b *Bundle) RegoVersionForFile(path string, def ast.RegoVersion) (ast.RegoVersion, error) {
- version, err := b.Manifest.numericRegoVersionForFile(path)
- if err != nil {
- return def, err
- } else if version == nil {
- return def, nil
- } else if *version == 0 {
- return ast.RegoV0, nil
- } else if *version == 1 {
- return ast.RegoV1, nil
- }
- return def, fmt.Errorf("unknown bundle rego-version %d for file '%s'", *version, path)
-}
-
-func (m *Manifest) numericRegoVersionForFile(path string) (*int, error) {
- var version *int
-
- if len(m.FileRegoVersions) != len(m.compiledFileRegoVersions) {
- m.compiledFileRegoVersions = make([]fileRegoVersion, 0, len(m.FileRegoVersions))
- for pattern, v := range m.FileRegoVersions {
- compiled, err := glob.Compile(pattern)
- if err != nil {
- return nil, fmt.Errorf("failed to compile glob pattern %s: %s", pattern, err)
- }
- m.compiledFileRegoVersions = append(m.compiledFileRegoVersions, fileRegoVersion{compiled, v})
- }
- }
-
- for _, fv := range m.compiledFileRegoVersions {
- if fv.path.Match(path) {
- version = &fv.version
- break
- }
- }
-
- if version == nil {
- version = m.RegoVersion
- }
- return version, nil
-}
-
-// Equal returns true if this bundle's contents equal the other bundle's
-// contents.
-func (b Bundle) Equal(other Bundle) bool {
- if !reflect.DeepEqual(b.Data, other.Data) {
- return false
- }
-
- if len(b.Modules) != len(other.Modules) {
- return false
- }
- for i := range b.Modules {
- // To support bundles built from rootless filesystems we ignore a "/" prefix
- // for URLs and Paths, such that "/file" and "file" are equivalent
- if strings.TrimPrefix(b.Modules[i].URL, string(filepath.Separator)) !=
- strings.TrimPrefix(other.Modules[i].URL, string(filepath.Separator)) {
- return false
- }
- if strings.TrimPrefix(b.Modules[i].Path, string(filepath.Separator)) !=
- strings.TrimPrefix(other.Modules[i].Path, string(filepath.Separator)) {
- return false
- }
- if !b.Modules[i].Parsed.Equal(other.Modules[i].Parsed) {
- return false
- }
- if !bytes.Equal(b.Modules[i].Raw, other.Modules[i].Raw) {
- return false
- }
- }
- if (b.Wasm == nil && other.Wasm != nil) || (b.Wasm != nil && other.Wasm == nil) {
- return false
- }
-
- return bytes.Equal(b.Wasm, other.Wasm)
-}
-
-// Copy returns a deep copy of the bundle.
-func (b Bundle) Copy() Bundle {
-
- // Copy data.
- var x interface{} = b.Data
-
- if err := util.RoundTrip(&x); err != nil {
- panic(err)
- }
-
- if x != nil {
- b.Data = x.(map[string]interface{})
- }
-
- // Copy modules.
- for i := range b.Modules {
- bs := make([]byte, len(b.Modules[i].Raw))
- copy(bs, b.Modules[i].Raw)
- b.Modules[i].Raw = bs
- b.Modules[i].Parsed = b.Modules[i].Parsed.Copy()
- }
-
- // Copy manifest.
- b.Manifest = b.Manifest.Copy()
-
- return b
-}
-
-func (b *Bundle) insertData(key []string, value interface{}) error {
- // Build an object with the full structure for the value
- obj, err := mktree(key, value)
- if err != nil {
- return err
- }
-
- // Merge the new data in with the current bundle data object
- merged, ok := merge.InterfaceMaps(b.Data, obj)
- if !ok {
- return fmt.Errorf("failed to insert data file from path %s", filepath.Join(key...))
- }
-
- b.Data = merged
-
- return nil
-}
-
-func (b *Bundle) readData(key []string) *interface{} {
-
- if len(key) == 0 {
- if len(b.Data) == 0 {
- return nil
- }
- var result interface{} = b.Data
- return &result
- }
-
- node := b.Data
-
- for i := 0; i < len(key)-1; i++ {
-
- child, ok := node[key[i]]
- if !ok {
- return nil
- }
-
- childObj, ok := child.(map[string]interface{})
- if !ok {
- return nil
- }
-
- node = childObj
- }
-
- child, ok := node[key[len(key)-1]]
- if !ok {
- return nil
- }
-
- return &child
-}
-
-// Type returns the type of the bundle.
-func (b *Bundle) Type() string {
- if len(b.Patch.Data) != 0 {
- return DeltaBundleType
- }
- return SnapshotBundleType
-}
-
-func mktree(path []string, value interface{}) (map[string]interface{}, error) {
- if len(path) == 0 {
- // For 0 length path the value is the full tree.
- obj, ok := value.(map[string]interface{})
- if !ok {
- return nil, fmt.Errorf("root value must be object")
- }
- return obj, nil
- }
-
- dir := map[string]interface{}{}
- for i := len(path) - 1; i > 0; i-- {
- dir[path[i]] = value
- value = dir
- dir = map[string]interface{}{}
- }
- dir[path[0]] = value
-
- return dir, nil
+ return v1.NewWriter(w)
}
// Merge accepts a set of bundles and merges them into a single result bundle. If there are
@@ -1393,7 +104,7 @@ func mktree(path []string, value interface{}) (map[string]interface{}, error) {
// will have an empty revision except in the special case where a single bundle is provided
// (and in that case the bundle is just returned unmodified.)
func Merge(bundles []*Bundle) (*Bundle, error) {
- return MergeWithRegoVersion(bundles, ast.RegoV0, false)
+ return MergeWithRegoVersion(bundles, ast.DefaultRegoVersion, false)
}
// MergeWithRegoVersion creates a merged bundle from the provided bundles, similar to Merge.
@@ -1405,348 +116,19 @@ func Merge(bundles []*Bundle) (*Bundle, error) {
// If usePath is true, per-file rego-versions will be calculated using the file's ModuleFile.Path; otherwise, the file's
// ModuleFile.URL will be used.
func MergeWithRegoVersion(bundles []*Bundle, regoVersion ast.RegoVersion, usePath bool) (*Bundle, error) {
-
- if len(bundles) == 0 {
- return nil, errors.New("expected at least one bundle")
- }
-
- if len(bundles) == 1 {
- result := bundles[0]
- // We respect the bundle rego-version, defaulting to the provided rego version if not set.
- result.SetRegoVersion(result.RegoVersion(regoVersion))
- fileRegoVersions, err := bundleRegoVersions(result, result.RegoVersion(regoVersion), usePath)
- if err != nil {
- return nil, err
- }
- result.Manifest.FileRegoVersions = fileRegoVersions
- return result, nil
+ if regoVersion == ast.RegoUndefined {
+ regoVersion = ast.DefaultRegoVersion
}
- var roots []string
- var result Bundle
-
- for _, b := range bundles {
-
- if b.Manifest.Roots == nil {
- return nil, errors.New("bundle manifest not initialized")
- }
-
- roots = append(roots, *b.Manifest.Roots...)
-
- result.Modules = append(result.Modules, b.Modules...)
-
- for _, root := range *b.Manifest.Roots {
- key := strings.Split(root, "/")
- if val := b.readData(key); val != nil {
- if err := result.insertData(key, *val); err != nil {
- return nil, err
- }
- }
- }
-
- result.Manifest.WasmResolvers = append(result.Manifest.WasmResolvers, b.Manifest.WasmResolvers...)
- result.WasmModules = append(result.WasmModules, b.WasmModules...)
- result.PlanModules = append(result.PlanModules, b.PlanModules...)
-
- if b.Manifest.RegoVersion != nil || len(b.Manifest.FileRegoVersions) > 0 {
- if result.Manifest.FileRegoVersions == nil {
- result.Manifest.FileRegoVersions = map[string]int{}
- }
-
- fileRegoVersions, err := bundleRegoVersions(b, regoVersion, usePath)
- if err != nil {
- return nil, err
- }
- for k, v := range fileRegoVersions {
- result.Manifest.FileRegoVersions[k] = v
- }
- }
- }
-
- // We respect the bundle rego-version, defaulting to the provided rego version if not set.
- result.SetRegoVersion(result.RegoVersion(regoVersion))
-
- if result.Data == nil {
- result.Data = map[string]interface{}{}
- }
-
- result.Manifest.Roots = &roots
-
- if err := result.Manifest.validateAndInjectDefaults(result); err != nil {
- return nil, err
- }
-
- return &result, nil
-}
-
-func bundleRegoVersions(bundle *Bundle, regoVersion ast.RegoVersion, usePath bool) (map[string]int, error) {
- fileRegoVersions := map[string]int{}
-
- // we drop the bundle-global rego versions and record individual rego versions for each module.
- for _, m := range bundle.Modules {
- // We fetch rego-version by the path relative to the bundle root, as the complete path of the module might
- // contain the path between OPA working directory and the bundle root.
- v, err := bundle.RegoVersionForFile(bundleRelativePath(m, usePath), bundle.RegoVersion(regoVersion))
- if err != nil {
- return nil, err
- }
- // only record the rego version if it's different from one applied globally to the result bundle
- if v != regoVersion {
- // We store the rego version by the absolute path to the bundle root, as this will be the - possibly new - path
- // to the module inside the merged bundle.
- fileRegoVersions[bundleAbsolutePath(m, usePath)] = v.Int()
- }
- }
-
- return fileRegoVersions, nil
-}
-
-func bundleRelativePath(m ModuleFile, usePath bool) string {
- p := m.RelativePath
- if p == "" {
- if usePath {
- p = m.Path
- } else {
- p = m.URL
- }
- }
- return p
-}
-
-func bundleAbsolutePath(m ModuleFile, usePath bool) string {
- var p string
- if usePath {
- p = m.Path
- } else {
- p = m.URL
- }
- if !path.IsAbs(p) {
- p = "/" + p
- }
- return path.Clean(p)
+ return v1.MergeWithRegoVersion(bundles, regoVersion, usePath)
}
// RootPathsOverlap takes in two bundle root paths and returns true if they overlap.
func RootPathsOverlap(pathA string, pathB string) bool {
- a := rootPathSegments(pathA)
- b := rootPathSegments(pathB)
- return rootContains(a, b) || rootContains(b, a)
+ return v1.RootPathsOverlap(pathA, pathB)
}
// RootPathsContain takes a set of bundle root paths and returns true if the path is contained.
func RootPathsContain(roots []string, path string) bool {
- segments := rootPathSegments(path)
- for i := range roots {
- if rootContains(rootPathSegments(roots[i]), segments) {
- return true
- }
- }
- return false
-}
-
-func rootPathSegments(path string) []string {
- return strings.Split(path, "/")
-}
-
-func rootContains(root []string, other []string) bool {
-
- // A single segment, empty string root always contains the other.
- if len(root) == 1 && root[0] == "" {
- return true
- }
-
- if len(root) > len(other) {
- return false
- }
-
- for j := range root {
- if root[j] != other[j] {
- return false
- }
- }
-
- return true
-}
-
-func insertValue(b *Bundle, path string, value interface{}) error {
- if err := b.insertData(getNormalizedPath(path), value); err != nil {
- return fmt.Errorf("bundle load failed on %v: %w", path, err)
- }
- return nil
-}
-
-func getNormalizedPath(path string) []string {
- // Remove leading / and . characters from the directory path. If the bundle
- // was written with OPA then the paths will contain a leading slash. On the
- // other hand, if the path is empty, filepath.Dir will return '.'.
- // Note: filepath.Dir can return paths with '\' separators, always use
- // filepath.ToSlash to keep them normalized.
- dirpath := strings.TrimLeft(normalizePath(filepath.Dir(path)), "/.")
- var key []string
- if dirpath != "" {
- key = strings.Split(dirpath, "/")
- }
- return key
-}
-
-func dfs(value interface{}, path string, fn func(string, interface{}) (bool, error)) error {
- if stop, err := fn(path, value); err != nil {
- return err
- } else if stop {
- return nil
- }
- obj, ok := value.(map[string]interface{})
- if !ok {
- return nil
- }
- for key := range obj {
- if err := dfs(obj[key], path+"/"+key, fn); err != nil {
- return err
- }
- }
- return nil
-}
-
-func modulePathWithPrefix(bundleName string, modulePath string) string {
- // Default prefix is just the bundle name
- prefix := bundleName
-
- // Bundle names are sometimes just file paths, some of which
- // are full urls (file:///foo/). Parse these and only use the path.
- parsed, err := url.Parse(bundleName)
- if err == nil {
- prefix = filepath.Join(parsed.Host, parsed.Path)
- }
-
- // Note: filepath.Join can return paths with '\' separators, always use
- // filepath.ToSlash to keep them normalized.
- return normalizePath(filepath.Join(prefix, modulePath))
-}
-
-// IsStructuredDoc checks if the file name equals a structured file extension ex. ".json"
-func IsStructuredDoc(name string) bool {
- return filepath.Base(name) == dataFile || filepath.Base(name) == yamlDataFile ||
- filepath.Base(name) == SignaturesFile || filepath.Base(name) == ManifestExt
-}
-
-func preProcessBundle(loader DirectoryLoader, skipVerify bool, sizeLimitBytes int64) (SignaturesConfig, Patch, []*Descriptor, error) {
- descriptors := []*Descriptor{}
- var signatures SignaturesConfig
- var patch Patch
-
- for {
- f, err := loader.NextFile()
- if err == io.EOF {
- break
- }
-
- if err != nil {
- return signatures, patch, nil, fmt.Errorf("bundle read failed: %w", err)
- }
-
- // check for the signatures file
- if !skipVerify && strings.HasSuffix(f.Path(), SignaturesFile) {
- buf, err := readFile(f, sizeLimitBytes)
- if err != nil {
- return signatures, patch, nil, err
- }
-
- if err := util.NewJSONDecoder(&buf).Decode(&signatures); err != nil {
- return signatures, patch, nil, fmt.Errorf("bundle load failed on signatures decode: %w", err)
- }
- } else if !strings.HasSuffix(f.Path(), SignaturesFile) {
- descriptors = append(descriptors, f)
-
- if filepath.Base(f.Path()) == patchFile {
-
- var b bytes.Buffer
- tee := io.TeeReader(f.reader, &b)
- f.reader = tee
-
- buf, err := readFile(f, sizeLimitBytes)
- if err != nil {
- return signatures, patch, nil, err
- }
-
- if err := util.NewJSONDecoder(&buf).Decode(&patch); err != nil {
- return signatures, patch, nil, fmt.Errorf("bundle load failed on patch decode: %w", err)
- }
-
- f.reader = &b
- }
- }
- }
- return signatures, patch, descriptors, nil
-}
-
-func readFile(f *Descriptor, sizeLimitBytes int64) (bytes.Buffer, error) {
- // Case for pre-loaded byte buffers, like those from the tarballLoader.
- if bb, ok := f.reader.(*bytes.Buffer); ok {
- _ = f.Close() // always close, even on error
-
- if int64(bb.Len()) >= sizeLimitBytes {
- return *bb, fmt.Errorf("bundle file '%v' size (%d bytes) exceeded max size (%v bytes)",
- strings.TrimPrefix(f.Path(), "/"), bb.Len(), sizeLimitBytes-1)
- }
-
- return *bb, nil
- }
-
- // Case for *lazyFile readers:
- if lf, ok := f.reader.(*lazyFile); ok {
- var buf bytes.Buffer
- if lf.file == nil {
- var err error
- if lf.file, err = os.Open(lf.path); err != nil {
- return buf, fmt.Errorf("failed to open file %s: %w", f.path, err)
- }
- }
- // Bail out if we can't read the whole file-- there's nothing useful we can do at that point!
- fileSize, _ := fstatFileSize(lf.file)
- if fileSize > sizeLimitBytes {
- return buf, fmt.Errorf(maxSizeLimitBytesErrMsg, strings.TrimPrefix(f.Path(), "/"), fileSize, sizeLimitBytes-1)
- }
- // Prealloc the buffer for the file read.
- buffer := make([]byte, fileSize)
- _, err := io.ReadFull(lf.file, buffer)
- if err != nil {
- return buf, err
- }
- _ = lf.file.Close() // always close, even on error
-
- // Note(philipc): Replace the lazyFile reader in the *Descriptor with a
- // pointer to the wrapping bytes.Buffer, so that we don't re-read the
- // file on disk again by accident.
- buf = *bytes.NewBuffer(buffer)
- f.reader = &buf
- return buf, nil
- }
-
- // Fallback case:
- var buf bytes.Buffer
- n, err := f.Read(&buf, sizeLimitBytes)
- _ = f.Close() // always close, even on error
-
- if err != nil && err != io.EOF {
- return buf, err
- } else if err == nil && n >= sizeLimitBytes {
- return buf, fmt.Errorf(maxSizeLimitBytesErrMsg, strings.TrimPrefix(f.Path(), "/"), n, sizeLimitBytes-1)
- }
-
- return buf, nil
-}
-
-// Takes an already open file handle and invokes the os.Stat system call on it
-// to determine the file's size. Passes any errors from *File.Stat on up to the
-// caller.
-func fstatFileSize(f *os.File) (int64, error) {
- fileInfo, err := f.Stat()
- if err != nil {
- return 0, err
- }
- return fileInfo.Size(), nil
-}
-
-func normalizePath(p string) string {
- return filepath.ToSlash(p)
+ return v1.RootPathsContain(roots, path)
}
diff --git a/vendor/github.com/open-policy-agent/opa/bundle/doc.go b/vendor/github.com/open-policy-agent/opa/bundle/doc.go
new file mode 100644
index 0000000000..7ec7c9b332
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/bundle/doc.go
@@ -0,0 +1,8 @@
+// Copyright 2024 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.
+
+// Deprecated: This package is intended for older projects transitioning from OPA v0.x and will remain for the lifetime of OPA v1.x, but its use is not recommended.
+// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
+// See https://www.openpolicyagent.org/docs/latest/v0-compatibility/ for more information.
+package bundle
diff --git a/vendor/github.com/open-policy-agent/opa/bundle/file.go b/vendor/github.com/open-policy-agent/opa/bundle/file.go
index 80b1a87eb1..ccb7b23510 100644
--- a/vendor/github.com/open-policy-agent/opa/bundle/file.go
+++ b/vendor/github.com/open-policy-agent/opa/bundle/file.go
@@ -1,508 +1,50 @@
package bundle
import (
- "archive/tar"
- "bytes"
- "compress/gzip"
- "fmt"
"io"
- "io/fs"
- "os"
- "path/filepath"
- "sort"
- "strings"
- "sync"
-
- "github.com/open-policy-agent/opa/loader/filter"
"github.com/open-policy-agent/opa/storage"
+ v1 "github.com/open-policy-agent/opa/v1/bundle"
)
-const maxSizeLimitBytesErrMsg = "bundle file %s size (%d bytes) exceeds configured size_limit_bytes (%d bytes)"
-
// Descriptor contains information about a file and
// can be used to read the file contents.
-type Descriptor struct {
- url string
- path string
- reader io.Reader
- closer io.Closer
- closeOnce *sync.Once
-}
-
-// lazyFile defers reading the file until the first call of Read
-type lazyFile struct {
- path string
- file *os.File
-}
-
-// newLazyFile creates a new instance of lazyFile
-func newLazyFile(path string) *lazyFile {
- return &lazyFile{path: path}
-}
-
-// Read implements io.Reader. It will check if the file has been opened
-// and open it if it has not before attempting to read using the file's
-// read method
-func (f *lazyFile) Read(b []byte) (int, error) {
- var err error
-
- if f.file == nil {
- if f.file, err = os.Open(f.path); err != nil {
- return 0, fmt.Errorf("failed to open file %s: %w", f.path, err)
- }
- }
-
- return f.file.Read(b)
-}
-
-// Close closes the lazy file if it has been opened using the file's
-// close method
-func (f *lazyFile) Close() error {
- if f.file != nil {
- return f.file.Close()
- }
-
- return nil
-}
+type Descriptor = v1.Descriptor
func NewDescriptor(url, path string, reader io.Reader) *Descriptor {
- return &Descriptor{
- url: url,
- path: path,
- reader: reader,
- }
-}
-
-func (d *Descriptor) WithCloser(closer io.Closer) *Descriptor {
- d.closer = closer
- d.closeOnce = new(sync.Once)
- return d
-}
-
-// Path returns the path of the file.
-func (d *Descriptor) Path() string {
- return d.path
-}
-
-// URL returns the url of the file.
-func (d *Descriptor) URL() string {
- return d.url
-}
-
-// Read will read all the contents from the file the Descriptor refers to
-// into the dest writer up n bytes. Will return an io.EOF error
-// if EOF is encountered before n bytes are read.
-func (d *Descriptor) Read(dest io.Writer, n int64) (int64, error) {
- n, err := io.CopyN(dest, d.reader, n)
- return n, err
+ return v1.NewDescriptor(url, path, reader)
}
-// Close the file, on some Loader implementations this might be a no-op.
-// It should *always* be called regardless of file.
-func (d *Descriptor) Close() error {
- var err error
- if d.closer != nil {
- d.closeOnce.Do(func() {
- err = d.closer.Close()
- })
- }
- return err
-}
-
-type PathFormat int64
+type PathFormat = v1.PathFormat
const (
- Chrooted PathFormat = iota
- SlashRooted
- Passthrough
+ Chrooted = v1.Chrooted
+ SlashRooted = v1.SlashRooted
+ Passthrough = v1.Passthrough
)
// DirectoryLoader defines an interface which can be used to load
// files from a directory by iterating over each one in the tree.
-type DirectoryLoader interface {
- // NextFile must return io.EOF if there is no next value. The returned
- // descriptor should *always* be closed when no longer needed.
- NextFile() (*Descriptor, error)
- WithFilter(filter filter.LoaderFilter) DirectoryLoader
- WithPathFormat(PathFormat) DirectoryLoader
- WithSizeLimitBytes(sizeLimitBytes int64) DirectoryLoader
- WithFollowSymlinks(followSymlinks bool) DirectoryLoader
-}
-
-type dirLoader struct {
- root string
- files []string
- idx int
- filter filter.LoaderFilter
- pathFormat PathFormat
- maxSizeLimitBytes int64
- followSymlinks bool
-}
-
-// Normalize root directory, ex "./src/bundle" -> "src/bundle"
-// We don't need an absolute path, but this makes the joined/trimmed
-// paths more uniform.
-func normalizeRootDirectory(root string) string {
- if len(root) > 1 {
- if root[0] == '.' && root[1] == filepath.Separator {
- if len(root) == 2 {
- root = root[:1] // "./" -> "."
- } else {
- root = root[2:] // remove leading "./"
- }
- }
- }
- return root
-}
+type DirectoryLoader = v1.DirectoryLoader
// NewDirectoryLoader returns a basic DirectoryLoader implementation
// that will load files from a given root directory path.
func NewDirectoryLoader(root string) DirectoryLoader {
- d := dirLoader{
- root: normalizeRootDirectory(root),
- pathFormat: Chrooted,
- }
- return &d
-}
-
-// WithFilter specifies the filter object to use to filter files while loading bundles
-func (d *dirLoader) WithFilter(filter filter.LoaderFilter) DirectoryLoader {
- d.filter = filter
- return d
-}
-
-// WithPathFormat specifies how a path is formatted in a Descriptor
-func (d *dirLoader) WithPathFormat(pathFormat PathFormat) DirectoryLoader {
- d.pathFormat = pathFormat
- return d
-}
-
-// WithSizeLimitBytes specifies the maximum size of any file in the directory to read
-func (d *dirLoader) WithSizeLimitBytes(sizeLimitBytes int64) DirectoryLoader {
- d.maxSizeLimitBytes = sizeLimitBytes
- return d
-}
-
-// WithFollowSymlinks specifies whether to follow symlinks when loading files from the directory
-func (d *dirLoader) WithFollowSymlinks(followSymlinks bool) DirectoryLoader {
- d.followSymlinks = followSymlinks
- return d
-}
-
-func formatPath(fileName string, root string, pathFormat PathFormat) string {
- switch pathFormat {
- case SlashRooted:
- if !strings.HasPrefix(fileName, string(filepath.Separator)) {
- return string(filepath.Separator) + fileName
- }
- return fileName
- case Chrooted:
- // Trim off the root directory and return path as if chrooted
- result := strings.TrimPrefix(fileName, filepath.FromSlash(root))
- if root == "." && filepath.Base(fileName) == ManifestExt {
- result = fileName
- }
- if !strings.HasPrefix(result, string(filepath.Separator)) {
- result = string(filepath.Separator) + result
- }
- return result
- case Passthrough:
- fallthrough
- default:
- return fileName
- }
-}
-
-// NextFile iterates to the next file in the directory tree
-// and returns a file Descriptor for the file.
-func (d *dirLoader) NextFile() (*Descriptor, error) {
- // build a list of all files we will iterate over and read, but only one time
- if d.files == nil {
- d.files = []string{}
- err := filepath.Walk(d.root, func(path string, info os.FileInfo, _ error) error {
- if info == nil {
- return nil
- }
-
- if info.Mode().IsRegular() {
- if d.filter != nil && d.filter(filepath.ToSlash(path), info, getdepth(path, false)) {
- return nil
- }
- if d.maxSizeLimitBytes > 0 && info.Size() > d.maxSizeLimitBytes {
- return fmt.Errorf(maxSizeLimitBytesErrMsg, strings.TrimPrefix(path, "/"), info.Size(), d.maxSizeLimitBytes)
- }
- d.files = append(d.files, path)
- } else if d.followSymlinks && info.Mode().Type()&fs.ModeSymlink == fs.ModeSymlink {
- if d.filter != nil && d.filter(filepath.ToSlash(path), info, getdepth(path, false)) {
- return nil
- }
- if d.maxSizeLimitBytes > 0 && info.Size() > d.maxSizeLimitBytes {
- return fmt.Errorf(maxSizeLimitBytesErrMsg, strings.TrimPrefix(path, "/"), info.Size(), d.maxSizeLimitBytes)
- }
- d.files = append(d.files, path)
- } else if info.Mode().IsDir() {
- if d.filter != nil && d.filter(filepath.ToSlash(path), info, getdepth(path, true)) {
- return filepath.SkipDir
- }
- }
- return nil
- })
- if err != nil {
- return nil, fmt.Errorf("failed to list files: %w", err)
- }
- }
-
- // If done reading files then just return io.EOF
- // errors for each NextFile() call
- if d.idx >= len(d.files) {
- return nil, io.EOF
- }
-
- fileName := d.files[d.idx]
- d.idx++
- fh := newLazyFile(fileName)
-
- cleanedPath := formatPath(fileName, d.root, d.pathFormat)
- f := NewDescriptor(filepath.Join(d.root, cleanedPath), cleanedPath, fh).WithCloser(fh)
- return f, nil
-}
-
-type tarballLoader struct {
- baseURL string
- r io.Reader
- tr *tar.Reader
- files []file
- idx int
- filter filter.LoaderFilter
- skipDir map[string]struct{}
- pathFormat PathFormat
- maxSizeLimitBytes int64
-}
-
-type file struct {
- name string
- reader io.Reader
- path storage.Path
- raw []byte
+ return v1.NewDirectoryLoader(root)
}
// NewTarballLoader is deprecated. Use NewTarballLoaderWithBaseURL instead.
func NewTarballLoader(r io.Reader) DirectoryLoader {
- l := tarballLoader{
- r: r,
- pathFormat: Passthrough,
- }
- return &l
+ return v1.NewTarballLoader(r)
}
// NewTarballLoaderWithBaseURL returns a new DirectoryLoader that reads
// files out of a gzipped tar archive. The file URLs will be prefixed
// with the baseURL.
func NewTarballLoaderWithBaseURL(r io.Reader, baseURL string) DirectoryLoader {
- l := tarballLoader{
- baseURL: strings.TrimSuffix(baseURL, "/"),
- r: r,
- pathFormat: Passthrough,
- }
- return &l
-}
-
-// WithFilter specifies the filter object to use to filter files while loading bundles
-func (t *tarballLoader) WithFilter(filter filter.LoaderFilter) DirectoryLoader {
- t.filter = filter
- return t
-}
-
-// WithPathFormat specifies how a path is formatted in a Descriptor
-func (t *tarballLoader) WithPathFormat(pathFormat PathFormat) DirectoryLoader {
- t.pathFormat = pathFormat
- return t
-}
-
-// WithSizeLimitBytes specifies the maximum size of any file in the tarball to read
-func (t *tarballLoader) WithSizeLimitBytes(sizeLimitBytes int64) DirectoryLoader {
- t.maxSizeLimitBytes = sizeLimitBytes
- return t
-}
-
-// WithFollowSymlinks is a no-op for tarballLoader
-func (t *tarballLoader) WithFollowSymlinks(_ bool) DirectoryLoader {
- return t
-}
-
-// NextFile iterates to the next file in the directory tree
-// and returns a file Descriptor for the file.
-func (t *tarballLoader) NextFile() (*Descriptor, error) {
- if t.tr == nil {
- gr, err := gzip.NewReader(t.r)
- if err != nil {
- return nil, fmt.Errorf("archive read failed: %w", err)
- }
-
- t.tr = tar.NewReader(gr)
- }
-
- if t.files == nil {
- t.files = []file{}
-
- if t.skipDir == nil {
- t.skipDir = map[string]struct{}{}
- }
-
- for {
- header, err := t.tr.Next()
-
- if err == io.EOF {
- break
- }
-
- if err != nil {
- return nil, err
- }
-
- // Keep iterating on the archive until we find a normal file
- if header.Typeflag == tar.TypeReg {
-
- if t.filter != nil {
-
- if t.filter(filepath.ToSlash(header.Name), header.FileInfo(), getdepth(header.Name, false)) {
- continue
- }
-
- basePath := strings.Trim(filepath.Dir(filepath.ToSlash(header.Name)), "/")
-
- // check if the directory is to be skipped
- if _, ok := t.skipDir[basePath]; ok {
- continue
- }
-
- match := false
- for p := range t.skipDir {
- if strings.HasPrefix(basePath, p) {
- match = true
- break
- }
- }
-
- if match {
- continue
- }
- }
-
- if t.maxSizeLimitBytes > 0 && header.Size > t.maxSizeLimitBytes {
- return nil, fmt.Errorf(maxSizeLimitBytesErrMsg, header.Name, header.Size, t.maxSizeLimitBytes)
- }
-
- f := file{name: header.Name}
-
- // Note(philipc): We rely on the previous size check in this loop for safety.
- buf := bytes.NewBuffer(make([]byte, 0, header.Size))
- if _, err := io.Copy(buf, t.tr); err != nil {
- return nil, fmt.Errorf("failed to copy file %s: %w", header.Name, err)
- }
-
- f.reader = buf
-
- t.files = append(t.files, f)
- } else if header.Typeflag == tar.TypeDir {
- cleanedPath := filepath.ToSlash(header.Name)
- if t.filter != nil && t.filter(cleanedPath, header.FileInfo(), getdepth(header.Name, true)) {
- t.skipDir[strings.Trim(cleanedPath, "/")] = struct{}{}
- }
- }
- }
- }
-
- // If done reading files then just return io.EOF
- // errors for each NextFile() call
- if t.idx >= len(t.files) {
- return nil, io.EOF
- }
-
- f := t.files[t.idx]
- t.idx++
-
- cleanedPath := formatPath(f.name, "", t.pathFormat)
- d := NewDescriptor(filepath.Join(t.baseURL, cleanedPath), cleanedPath, f.reader)
- return d, nil
-}
-
-// Next implements the storage.Iterator interface.
-// It iterates to the next policy or data file in the directory tree
-// and returns a storage.Update for the file.
-func (it *iterator) Next() (*storage.Update, error) {
- if it.files == nil {
- it.files = []file{}
-
- for _, item := range it.raw {
- f := file{name: item.Path}
-
- fpath := strings.TrimLeft(normalizePath(filepath.Dir(f.name)), "/.")
- if strings.HasSuffix(f.name, RegoExt) {
- fpath = strings.Trim(normalizePath(f.name), "/")
- }
-
- p, ok := storage.ParsePathEscaped("/" + fpath)
- if !ok {
- return nil, fmt.Errorf("storage path invalid: %v", f.name)
- }
- f.path = p
-
- f.raw = item.Value
-
- it.files = append(it.files, f)
- }
-
- sortFilePathAscend(it.files)
- }
-
- // If done reading files then just return io.EOF
- // errors for each NextFile() call
- if it.idx >= len(it.files) {
- return nil, io.EOF
- }
-
- f := it.files[it.idx]
- it.idx++
-
- isPolicy := false
- if strings.HasSuffix(f.name, RegoExt) {
- isPolicy = true
- }
-
- return &storage.Update{
- Path: f.path,
- Value: f.raw,
- IsPolicy: isPolicy,
- }, nil
-}
-
-type iterator struct {
- raw []Raw
- files []file
- idx int
+ return v1.NewTarballLoaderWithBaseURL(r, baseURL)
}
func NewIterator(raw []Raw) storage.Iterator {
- it := iterator{
- raw: raw,
- }
- return &it
-}
-
-func sortFilePathAscend(files []file) {
- sort.Slice(files, func(i, j int) bool {
- return len(files[i].path) < len(files[j].path)
- })
-}
-
-func getdepth(path string, isDir bool) int {
- if isDir {
- cleanedPath := strings.Trim(filepath.ToSlash(path), "/")
- return len(strings.Split(cleanedPath, "/"))
- }
-
- basePath := strings.Trim(filepath.Dir(filepath.ToSlash(path)), "/")
- return len(strings.Split(basePath, "/"))
+ return v1.NewIterator(raw)
}
diff --git a/vendor/github.com/open-policy-agent/opa/bundle/filefs.go b/vendor/github.com/open-policy-agent/opa/bundle/filefs.go
index a3a0dbf204..f6d559e8c2 100644
--- a/vendor/github.com/open-policy-agent/opa/bundle/filefs.go
+++ b/vendor/github.com/open-policy-agent/opa/bundle/filefs.go
@@ -1,143 +1,19 @@
-//go:build go1.16
-// +build go1.16
-
package bundle
import (
- "fmt"
- "io"
"io/fs"
- "path/filepath"
- "sync"
-
- "github.com/open-policy-agent/opa/loader/filter"
-)
-const (
- defaultFSLoaderRoot = "."
+ v1 "github.com/open-policy-agent/opa/v1/bundle"
)
-type dirLoaderFS struct {
- sync.Mutex
- filesystem fs.FS
- files []string
- idx int
- filter filter.LoaderFilter
- root string
- pathFormat PathFormat
- maxSizeLimitBytes int64
- followSymlinks bool
-}
-
// NewFSLoader returns a basic DirectoryLoader implementation
// that will load files from a fs.FS interface
func NewFSLoader(filesystem fs.FS) (DirectoryLoader, error) {
- return NewFSLoaderWithRoot(filesystem, defaultFSLoaderRoot), nil
+ return v1.NewFSLoader(filesystem)
}
// NewFSLoaderWithRoot returns a basic DirectoryLoader implementation
// that will load files from a fs.FS interface at the supplied root
func NewFSLoaderWithRoot(filesystem fs.FS, root string) DirectoryLoader {
- d := dirLoaderFS{
- filesystem: filesystem,
- root: normalizeRootDirectory(root),
- pathFormat: Chrooted,
- }
-
- return &d
-}
-
-func (d *dirLoaderFS) walkDir(path string, dirEntry fs.DirEntry, err error) error {
- if err != nil {
- return err
- }
-
- if dirEntry != nil {
- info, err := dirEntry.Info()
- if err != nil {
- return err
- }
-
- if dirEntry.Type().IsRegular() {
- if d.filter != nil && d.filter(filepath.ToSlash(path), info, getdepth(path, false)) {
- return nil
- }
-
- if d.maxSizeLimitBytes > 0 && info.Size() > d.maxSizeLimitBytes {
- return fmt.Errorf("file %s size %d exceeds limit of %d", path, info.Size(), d.maxSizeLimitBytes)
- }
-
- d.files = append(d.files, path)
- } else if dirEntry.Type()&fs.ModeSymlink != 0 && d.followSymlinks {
- if d.filter != nil && d.filter(filepath.ToSlash(path), info, getdepth(path, false)) {
- return nil
- }
-
- if d.maxSizeLimitBytes > 0 && info.Size() > d.maxSizeLimitBytes {
- return fmt.Errorf("file %s size %d exceeds limit of %d", path, info.Size(), d.maxSizeLimitBytes)
- }
-
- d.files = append(d.files, path)
- } else if dirEntry.Type().IsDir() {
- if d.filter != nil && d.filter(filepath.ToSlash(path), info, getdepth(path, true)) {
- return fs.SkipDir
- }
- }
- }
- return nil
-}
-
-// WithFilter specifies the filter object to use to filter files while loading bundles
-func (d *dirLoaderFS) WithFilter(filter filter.LoaderFilter) DirectoryLoader {
- d.filter = filter
- return d
-}
-
-// WithPathFormat specifies how a path is formatted in a Descriptor
-func (d *dirLoaderFS) WithPathFormat(pathFormat PathFormat) DirectoryLoader {
- d.pathFormat = pathFormat
- return d
-}
-
-// WithSizeLimitBytes specifies the maximum size of any file in the filesystem directory to read
-func (d *dirLoaderFS) WithSizeLimitBytes(sizeLimitBytes int64) DirectoryLoader {
- d.maxSizeLimitBytes = sizeLimitBytes
- return d
-}
-
-func (d *dirLoaderFS) WithFollowSymlinks(followSymlinks bool) DirectoryLoader {
- d.followSymlinks = followSymlinks
- return d
-}
-
-// NextFile iterates to the next file in the directory tree
-// and returns a file Descriptor for the file.
-func (d *dirLoaderFS) NextFile() (*Descriptor, error) {
- d.Lock()
- defer d.Unlock()
-
- if d.files == nil {
- err := fs.WalkDir(d.filesystem, d.root, d.walkDir)
- if err != nil {
- return nil, fmt.Errorf("failed to list files: %w", err)
- }
- }
-
- // If done reading files then just return io.EOF
- // errors for each NextFile() call
- if d.idx >= len(d.files) {
- return nil, io.EOF
- }
-
- fileName := d.files[d.idx]
- d.idx++
-
- fh, err := d.filesystem.Open(fileName)
- if err != nil {
- return nil, fmt.Errorf("failed to open file %s: %w", fileName, err)
- }
-
- cleanedPath := formatPath(fileName, d.root, d.pathFormat)
- f := NewDescriptor(cleanedPath, cleanedPath, fh).WithCloser(fh)
- return f, nil
+ return v1.NewFSLoaderWithRoot(filesystem, root)
}
diff --git a/vendor/github.com/open-policy-agent/opa/bundle/hash.go b/vendor/github.com/open-policy-agent/opa/bundle/hash.go
index 021801bb0a..d4cc601dea 100644
--- a/vendor/github.com/open-policy-agent/opa/bundle/hash.go
+++ b/vendor/github.com/open-policy-agent/opa/bundle/hash.go
@@ -5,137 +5,28 @@
package bundle
import (
- "bytes"
- "crypto/md5"
- "crypto/sha1"
- "crypto/sha256"
- "crypto/sha512"
- "encoding/json"
- "fmt"
- "hash"
- "io"
- "sort"
- "strings"
+ v1 "github.com/open-policy-agent/opa/v1/bundle"
)
// HashingAlgorithm represents a subset of hashing algorithms implemented in Go
-type HashingAlgorithm string
+type HashingAlgorithm = v1.HashingAlgorithm
// Supported values for HashingAlgorithm
const (
- MD5 HashingAlgorithm = "MD5"
- SHA1 HashingAlgorithm = "SHA-1"
- SHA224 HashingAlgorithm = "SHA-224"
- SHA256 HashingAlgorithm = "SHA-256"
- SHA384 HashingAlgorithm = "SHA-384"
- SHA512 HashingAlgorithm = "SHA-512"
- SHA512224 HashingAlgorithm = "SHA-512-224"
- SHA512256 HashingAlgorithm = "SHA-512-256"
+ MD5 = v1.MD5
+ SHA1 = v1.SHA1
+ SHA224 = v1.SHA224
+ SHA256 = v1.SHA256
+ SHA384 = v1.SHA384
+ SHA512 = v1.SHA512
+ SHA512224 = v1.SHA512224
+ SHA512256 = v1.SHA512256
)
-// String returns the string representation of a HashingAlgorithm
-func (alg HashingAlgorithm) String() string {
- return string(alg)
-}
-
// SignatureHasher computes a signature digest for a file with (structured or unstructured) data and policy
-type SignatureHasher interface {
- HashFile(v interface{}) ([]byte, error)
-}
-
-type hasher struct {
- h func() hash.Hash // hash function factory
-}
+type SignatureHasher = v1.SignatureHasher
// NewSignatureHasher returns a signature hasher suitable for a particular hashing algorithm
func NewSignatureHasher(alg HashingAlgorithm) (SignatureHasher, error) {
- h := &hasher{}
-
- switch alg {
- case MD5:
- h.h = md5.New
- case SHA1:
- h.h = sha1.New
- case SHA224:
- h.h = sha256.New224
- case SHA256:
- h.h = sha256.New
- case SHA384:
- h.h = sha512.New384
- case SHA512:
- h.h = sha512.New
- case SHA512224:
- h.h = sha512.New512_224
- case SHA512256:
- h.h = sha512.New512_256
- default:
- return nil, fmt.Errorf("unsupported hashing algorithm: %s", alg)
- }
-
- return h, nil
-}
-
-// HashFile hashes the file content, JSON or binary, both in golang native format.
-func (h *hasher) HashFile(v interface{}) ([]byte, error) {
- hf := h.h()
- walk(v, hf)
- return hf.Sum(nil), nil
-}
-
-// walk hashes the file content, JSON or binary, both in golang native format.
-//
-// Computation for unstructured documents is a hash of the document.
-//
-// Computation for the types of structured JSON document is as follows:
-//
-// object: Hash {, then each key (in alphabetical order) and digest of the value, then comma (between items) and finally }.
-//
-// array: Hash [, then digest of the value, then comma (between items) and finally ].
-func walk(v interface{}, h io.Writer) {
-
- switch x := v.(type) {
- case map[string]interface{}:
- _, _ = h.Write([]byte("{"))
-
- var keys []string
- for k := range x {
- keys = append(keys, k)
- }
- sort.Strings(keys)
-
- for i, key := range keys {
- if i > 0 {
- _, _ = h.Write([]byte(","))
- }
-
- _, _ = h.Write(encodePrimitive(key))
- _, _ = h.Write([]byte(":"))
- walk(x[key], h)
- }
-
- _, _ = h.Write([]byte("}"))
- case []interface{}:
- _, _ = h.Write([]byte("["))
-
- for i, e := range x {
- if i > 0 {
- _, _ = h.Write([]byte(","))
- }
- walk(e, h)
- }
-
- _, _ = h.Write([]byte("]"))
- case []byte:
- _, _ = h.Write(x)
- default:
- _, _ = h.Write(encodePrimitive(x))
- }
-}
-
-func encodePrimitive(v interface{}) []byte {
- var buf bytes.Buffer
- encoder := json.NewEncoder(&buf)
- encoder.SetEscapeHTML(false)
- _ = encoder.Encode(v)
- return []byte(strings.Trim(buf.String(), "\n"))
+ return v1.NewSignatureHasher(alg)
}
diff --git a/vendor/github.com/open-policy-agent/opa/bundle/keys.go b/vendor/github.com/open-policy-agent/opa/bundle/keys.go
index 810bee4b72..99f9b0f165 100644
--- a/vendor/github.com/open-policy-agent/opa/bundle/keys.go
+++ b/vendor/github.com/open-policy-agent/opa/bundle/keys.go
@@ -6,139 +6,25 @@
package bundle
import (
- "encoding/pem"
- "fmt"
- "os"
-
- "github.com/open-policy-agent/opa/internal/jwx/jwa"
- "github.com/open-policy-agent/opa/internal/jwx/jws/sign"
- "github.com/open-policy-agent/opa/keys"
-
- "github.com/open-policy-agent/opa/util"
-)
-
-const (
- defaultTokenSigningAlg = "RS256"
+ v1 "github.com/open-policy-agent/opa/v1/bundle"
)
// KeyConfig holds the keys used to sign or verify bundles and tokens
// Moved to own package, alias kept for backwards compatibility
-type KeyConfig = keys.Config
+type KeyConfig = v1.KeyConfig
// VerificationConfig represents the key configuration used to verify a signed bundle
-type VerificationConfig struct {
- PublicKeys map[string]*KeyConfig
- KeyID string `json:"keyid"`
- Scope string `json:"scope"`
- Exclude []string `json:"exclude_files"`
-}
+type VerificationConfig = v1.VerificationConfig
// NewVerificationConfig return a new VerificationConfig
func NewVerificationConfig(keys map[string]*KeyConfig, id, scope string, exclude []string) *VerificationConfig {
- return &VerificationConfig{
- PublicKeys: keys,
- KeyID: id,
- Scope: scope,
- Exclude: exclude,
- }
-}
-
-// ValidateAndInjectDefaults validates the config and inserts default values
-func (vc *VerificationConfig) ValidateAndInjectDefaults(keys map[string]*KeyConfig) error {
- vc.PublicKeys = keys
-
- if vc.KeyID != "" {
- found := false
- for key := range keys {
- if key == vc.KeyID {
- found = true
- break
- }
- }
-
- if !found {
- return fmt.Errorf("key id %s not found", vc.KeyID)
- }
- }
- return nil
-}
-
-// GetPublicKey returns the public key corresponding to the given key id
-func (vc *VerificationConfig) GetPublicKey(id string) (*KeyConfig, error) {
- var kc *KeyConfig
- var ok bool
-
- if kc, ok = vc.PublicKeys[id]; !ok {
- return nil, fmt.Errorf("verification key corresponding to ID %v not found", id)
- }
- return kc, nil
+ return v1.NewVerificationConfig(keys, id, scope, exclude)
}
// SigningConfig represents the key configuration used to generate a signed bundle
-type SigningConfig struct {
- Plugin string
- Key string
- Algorithm string
- ClaimsPath string
-}
+type SigningConfig = v1.SigningConfig
// NewSigningConfig return a new SigningConfig
func NewSigningConfig(key, alg, claimsPath string) *SigningConfig {
- if alg == "" {
- alg = defaultTokenSigningAlg
- }
-
- return &SigningConfig{
- Plugin: defaultSignerID,
- Key: key,
- Algorithm: alg,
- ClaimsPath: claimsPath,
- }
-}
-
-// WithPlugin sets the signing plugin in the signing config
-func (s *SigningConfig) WithPlugin(plugin string) *SigningConfig {
- if plugin != "" {
- s.Plugin = plugin
- }
- return s
-}
-
-// GetPrivateKey returns the private key or secret from the signing config
-func (s *SigningConfig) GetPrivateKey() (interface{}, error) {
-
- block, _ := pem.Decode([]byte(s.Key))
- if block != nil {
- return sign.GetSigningKey(s.Key, jwa.SignatureAlgorithm(s.Algorithm))
- }
-
- var priv string
- if _, err := os.Stat(s.Key); err == nil {
- bs, err := os.ReadFile(s.Key)
- if err != nil {
- return nil, err
- }
- priv = string(bs)
- } else if os.IsNotExist(err) {
- priv = s.Key
- } else {
- return nil, err
- }
-
- return sign.GetSigningKey(priv, jwa.SignatureAlgorithm(s.Algorithm))
-}
-
-// GetClaims returns the claims by reading the file specified in the signing config
-func (s *SigningConfig) GetClaims() (map[string]interface{}, error) {
- var claims map[string]interface{}
-
- bs, err := os.ReadFile(s.ClaimsPath)
- if err != nil {
- return claims, err
- }
-
- if err := util.UnmarshalJSON(bs, &claims); err != nil {
- return claims, err
- }
- return claims, nil
+ return v1.NewSigningConfig(key, alg, claimsPath)
}
diff --git a/vendor/github.com/open-policy-agent/opa/bundle/sign.go b/vendor/github.com/open-policy-agent/opa/bundle/sign.go
index cf9a3e183a..56e25eec9c 100644
--- a/vendor/github.com/open-policy-agent/opa/bundle/sign.go
+++ b/vendor/github.com/open-policy-agent/opa/bundle/sign.go
@@ -6,130 +6,30 @@
package bundle
import (
- "crypto/rand"
- "encoding/json"
- "fmt"
-
- "github.com/open-policy-agent/opa/internal/jwx/jwa"
- "github.com/open-policy-agent/opa/internal/jwx/jws"
+ v1 "github.com/open-policy-agent/opa/v1/bundle"
)
-const defaultSignerID = "_default"
-
-var signers map[string]Signer
-
// Signer is the interface expected for implementations that generate bundle signatures.
-type Signer interface {
- GenerateSignedToken([]FileInfo, *SigningConfig, string) (string, error)
-}
+type Signer v1.Signer
// GenerateSignedToken will retrieve the Signer implementation based on the Plugin specified
// in SigningConfig, and call its implementation of GenerateSignedToken. The signer generates
// a signed token given the list of files to be included in the payload and the bundle
// signing config. The keyID if non-empty, represents the value for the "keyid" claim in the token.
func GenerateSignedToken(files []FileInfo, sc *SigningConfig, keyID string) (string, error) {
- var plugin string
- // for backwards compatibility, check if there is no plugin specified, and use default
- if sc.Plugin == "" {
- plugin = defaultSignerID
- } else {
- plugin = sc.Plugin
- }
- signer, err := GetSigner(plugin)
- if err != nil {
- return "", err
- }
- return signer.GenerateSignedToken(files, sc, keyID)
+ return v1.GenerateSignedToken(files, sc, keyID)
}
// DefaultSigner is the default bundle signing implementation. It signs bundles by generating
// a JWT and signing it using a locally-accessible private key.
-type DefaultSigner struct{}
-
-// GenerateSignedToken generates a signed token given the list of files to be
-// included in the payload and the bundle signing config. The keyID if non-empty,
-// represents the value for the "keyid" claim in the token
-func (*DefaultSigner) GenerateSignedToken(files []FileInfo, sc *SigningConfig, keyID string) (string, error) {
- payload, err := generatePayload(files, sc, keyID)
- if err != nil {
- return "", err
- }
-
- privateKey, err := sc.GetPrivateKey()
- if err != nil {
- return "", err
- }
-
- var headers jws.StandardHeaders
-
- if err := headers.Set(jws.AlgorithmKey, jwa.SignatureAlgorithm(sc.Algorithm)); err != nil {
- return "", err
- }
-
- if keyID != "" {
- if err := headers.Set(jws.KeyIDKey, keyID); err != nil {
- return "", err
- }
- }
-
- hdr, err := json.Marshal(headers)
- if err != nil {
- return "", err
- }
-
- token, err := jws.SignLiteral(payload,
- jwa.SignatureAlgorithm(sc.Algorithm),
- privateKey,
- hdr,
- rand.Reader)
- if err != nil {
- return "", err
- }
- return string(token), nil
-}
-
-func generatePayload(files []FileInfo, sc *SigningConfig, keyID string) ([]byte, error) {
- payload := make(map[string]interface{})
- payload["files"] = files
-
- if sc.ClaimsPath != "" {
- claims, err := sc.GetClaims()
- if err != nil {
- return nil, err
- }
-
- for claim, value := range claims {
- payload[claim] = value
- }
- } else {
- if keyID != "" {
- // keyid claim is deprecated but include it for backwards compatibility.
- payload["keyid"] = keyID
- }
- }
- return json.Marshal(payload)
-}
+type DefaultSigner v1.DefaultSigner
// GetSigner returns the Signer registered under the given id
func GetSigner(id string) (Signer, error) {
- signer, ok := signers[id]
- if !ok {
- return nil, fmt.Errorf("no signer exists under id %s", id)
- }
- return signer, nil
+ return v1.GetSigner(id)
}
// RegisterSigner registers a Signer under the given id
func RegisterSigner(id string, s Signer) error {
- if id == defaultSignerID {
- return fmt.Errorf("signer id %s is reserved, use a different id", id)
- }
- signers[id] = s
- return nil
-}
-
-func init() {
- signers = map[string]Signer{
- defaultSignerID: &DefaultSigner{},
- }
+ return v1.RegisterSigner(id, s)
}
diff --git a/vendor/github.com/open-policy-agent/opa/bundle/store.go b/vendor/github.com/open-policy-agent/opa/bundle/store.go
index 9a49f025e8..85b8515eb2 100644
--- a/vendor/github.com/open-policy-agent/opa/bundle/store.go
+++ b/vendor/github.com/open-policy-agent/opa/bundle/store.go
@@ -6,1031 +6,151 @@ package bundle
import (
"context"
- "encoding/base64"
- "encoding/json"
- "fmt"
- "path/filepath"
- "strings"
"github.com/open-policy-agent/opa/ast"
- iCompiler "github.com/open-policy-agent/opa/internal/compiler"
- "github.com/open-policy-agent/opa/internal/json/patch"
- "github.com/open-policy-agent/opa/metrics"
"github.com/open-policy-agent/opa/storage"
- "github.com/open-policy-agent/opa/util"
+ v1 "github.com/open-policy-agent/opa/v1/bundle"
)
// BundlesBasePath is the storage path used for storing bundle metadata
-var BundlesBasePath = storage.MustParsePath("/system/bundles")
+var BundlesBasePath = v1.BundlesBasePath
// Note: As needed these helpers could be memoized.
// ManifestStoragePath is the storage path used for the given named bundle manifest.
func ManifestStoragePath(name string) storage.Path {
- return append(BundlesBasePath, name, "manifest")
+ return v1.ManifestStoragePath(name)
}
// EtagStoragePath is the storage path used for the given named bundle etag.
func EtagStoragePath(name string) storage.Path {
- return append(BundlesBasePath, name, "etag")
-}
-
-func namedBundlePath(name string) storage.Path {
- return append(BundlesBasePath, name)
-}
-
-func rootsPath(name string) storage.Path {
- return append(BundlesBasePath, name, "manifest", "roots")
-}
-
-func revisionPath(name string) storage.Path {
- return append(BundlesBasePath, name, "manifest", "revision")
-}
-
-func wasmModulePath(name string) storage.Path {
- return append(BundlesBasePath, name, "wasm")
-}
-
-func wasmEntrypointsPath(name string) storage.Path {
- return append(BundlesBasePath, name, "manifest", "wasm")
-}
-
-func metadataPath(name string) storage.Path {
- return append(BundlesBasePath, name, "manifest", "metadata")
-}
-
-func read(ctx context.Context, store storage.Store, txn storage.Transaction, path storage.Path) (interface{}, error) {
- value, err := store.Read(ctx, txn, path)
- if err != nil {
- return nil, err
- }
-
- if astValue, ok := value.(ast.Value); ok {
- value, err = ast.JSON(astValue)
- if err != nil {
- return nil, err
- }
- }
-
- return value, nil
+ return v1.EtagStoragePath(name)
}
// ReadBundleNamesFromStore will return a list of bundle names which have had their metadata stored.
func ReadBundleNamesFromStore(ctx context.Context, store storage.Store, txn storage.Transaction) ([]string, error) {
- value, err := read(ctx, store, txn, BundlesBasePath)
- if err != nil {
- return nil, err
- }
-
- bundleMap, ok := value.(map[string]interface{})
- if !ok {
- return nil, fmt.Errorf("corrupt manifest roots")
- }
-
- bundles := make([]string, len(bundleMap))
- idx := 0
- for name := range bundleMap {
- bundles[idx] = name
- idx++
- }
- return bundles, nil
+ return v1.ReadBundleNamesFromStore(ctx, store, txn)
}
// WriteManifestToStore will write the manifest into the storage. This function is called when
// the bundle is activated.
func WriteManifestToStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string, manifest Manifest) error {
- return write(ctx, store, txn, ManifestStoragePath(name), manifest)
+ return v1.WriteManifestToStore(ctx, store, txn, name, manifest)
}
// WriteEtagToStore will write the bundle etag into the storage. This function is called when the bundle is activated.
func WriteEtagToStore(ctx context.Context, store storage.Store, txn storage.Transaction, name, etag string) error {
- return write(ctx, store, txn, EtagStoragePath(name), etag)
-}
-
-func write(ctx context.Context, store storage.Store, txn storage.Transaction, path storage.Path, value interface{}) error {
- if err := util.RoundTrip(&value); err != nil {
- return err
- }
-
- var dir []string
- if len(path) > 1 {
- dir = path[:len(path)-1]
- }
-
- if err := storage.MakeDir(ctx, store, txn, dir); err != nil {
- return err
- }
-
- return store.Write(ctx, txn, storage.AddOp, path, value)
+ return v1.WriteEtagToStore(ctx, store, txn, name, etag)
}
// EraseManifestFromStore will remove the manifest from storage. This function is called
// when the bundle is deactivated.
func EraseManifestFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string) error {
- path := namedBundlePath(name)
- err := store.Write(ctx, txn, storage.RemoveOp, path, nil)
- return suppressNotFound(err)
-}
-
-// eraseBundleEtagFromStore will remove the bundle etag from storage. This function is called
-// when the bundle is deactivated.
-func eraseBundleEtagFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string) error {
- path := EtagStoragePath(name)
- err := store.Write(ctx, txn, storage.RemoveOp, path, nil)
- return suppressNotFound(err)
-}
-
-func suppressNotFound(err error) error {
- if err == nil || storage.IsNotFound(err) {
- return nil
- }
- return err
-}
-
-func writeWasmModulesToStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string, b *Bundle) error {
- basePath := wasmModulePath(name)
- for _, wm := range b.WasmModules {
- path := append(basePath, wm.Path)
- err := write(ctx, store, txn, path, base64.StdEncoding.EncodeToString(wm.Raw))
- if err != nil {
- return err
- }
- }
- return nil
-}
-
-func eraseWasmModulesFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string) error {
- path := wasmModulePath(name)
-
- err := store.Write(ctx, txn, storage.RemoveOp, path, nil)
- return suppressNotFound(err)
-}
-
-// ReadWasmMetadataFromStore will read Wasm module resolver metadata from the store.
-func ReadWasmMetadataFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string) ([]WasmResolver, error) {
- path := wasmEntrypointsPath(name)
- value, err := read(ctx, store, txn, path)
- if err != nil {
- return nil, err
- }
-
- bs, err := json.Marshal(value)
- if err != nil {
- return nil, fmt.Errorf("corrupt wasm manifest data")
- }
-
- var wasmMetadata []WasmResolver
-
- err = util.UnmarshalJSON(bs, &wasmMetadata)
- if err != nil {
- return nil, fmt.Errorf("corrupt wasm manifest data")
- }
-
- return wasmMetadata, nil
+ return v1.EraseManifestFromStore(ctx, store, txn, name)
}
// ReadWasmModulesFromStore will write Wasm module resolver metadata from the store.
func ReadWasmModulesFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string) (map[string][]byte, error) {
- path := wasmModulePath(name)
- value, err := read(ctx, store, txn, path)
- if err != nil {
- return nil, err
- }
-
- encodedModules, ok := value.(map[string]interface{})
- if !ok {
- return nil, fmt.Errorf("corrupt wasm modules")
- }
-
- rawModules := map[string][]byte{}
- for path, enc := range encodedModules {
- encStr, ok := enc.(string)
- if !ok {
- return nil, fmt.Errorf("corrupt wasm modules")
- }
- bs, err := base64.StdEncoding.DecodeString(encStr)
- if err != nil {
- return nil, err
- }
- rawModules[path] = bs
- }
- return rawModules, nil
+ return v1.ReadWasmModulesFromStore(ctx, store, txn, name)
}
// ReadBundleRootsFromStore returns the roots in the specified bundle.
// If the bundle is not activated, this function will return
// storage NotFound error.
func ReadBundleRootsFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string) ([]string, error) {
- value, err := read(ctx, store, txn, rootsPath(name))
- if err != nil {
- return nil, err
- }
-
- sl, ok := value.([]interface{})
- if !ok {
- return nil, fmt.Errorf("corrupt manifest roots")
- }
-
- roots := make([]string, len(sl))
-
- for i := range sl {
- roots[i], ok = sl[i].(string)
- if !ok {
- return nil, fmt.Errorf("corrupt manifest root")
- }
- }
-
- return roots, nil
+ return v1.ReadBundleRootsFromStore(ctx, store, txn, name)
}
// ReadBundleRevisionFromStore returns the revision in the specified bundle.
// If the bundle is not activated, this function will return
// storage NotFound error.
func ReadBundleRevisionFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string) (string, error) {
- return readRevisionFromStore(ctx, store, txn, revisionPath(name))
-}
-
-func readRevisionFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, path storage.Path) (string, error) {
- value, err := read(ctx, store, txn, path)
- if err != nil {
- return "", err
- }
-
- str, ok := value.(string)
- if !ok {
- return "", fmt.Errorf("corrupt manifest revision")
- }
-
- return str, nil
+ return v1.ReadBundleRevisionFromStore(ctx, store, txn, name)
}
// ReadBundleMetadataFromStore returns the metadata in the specified bundle.
// If the bundle is not activated, this function will return
// storage NotFound error.
-func ReadBundleMetadataFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string) (map[string]interface{}, error) {
- return readMetadataFromStore(ctx, store, txn, metadataPath(name))
-}
-
-func readMetadataFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, path storage.Path) (map[string]interface{}, error) {
- value, err := read(ctx, store, txn, path)
- if err != nil {
- return nil, suppressNotFound(err)
- }
-
- data, ok := value.(map[string]interface{})
- if !ok {
- return nil, fmt.Errorf("corrupt manifest metadata")
- }
-
- return data, nil
+func ReadBundleMetadataFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string) (map[string]any, error) {
+ return v1.ReadBundleMetadataFromStore(ctx, store, txn, name)
}
// ReadBundleEtagFromStore returns the etag for the specified bundle.
// If the bundle is not activated, this function will return
// storage NotFound error.
func ReadBundleEtagFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, name string) (string, error) {
- return readEtagFromStore(ctx, store, txn, EtagStoragePath(name))
-}
-
-func readEtagFromStore(ctx context.Context, store storage.Store, txn storage.Transaction, path storage.Path) (string, error) {
- value, err := read(ctx, store, txn, path)
- if err != nil {
- return "", err
- }
-
- str, ok := value.(string)
- if !ok {
- return "", fmt.Errorf("corrupt bundle etag")
- }
-
- return str, nil
+ return v1.ReadBundleEtagFromStore(ctx, store, txn, name)
}
// ActivateOpts defines options for the Activate API call.
-type ActivateOpts struct {
- Ctx context.Context
- Store storage.Store
- Txn storage.Transaction
- TxnCtx *storage.Context
- Compiler *ast.Compiler
- Metrics metrics.Metrics
- Bundles map[string]*Bundle // Optional
- ExtraModules map[string]*ast.Module // Optional
- AuthorizationDecisionRef ast.Ref
- ParserOptions ast.ParserOptions
-
- legacy bool
-}
+type ActivateOpts = v1.ActivateOpts
// Activate the bundle(s) by loading into the given Store. This will load policies, data, and record
// the manifest in storage. The compiler provided will have had the polices compiled on it.
func Activate(opts *ActivateOpts) error {
- opts.legacy = false
- return activateBundles(opts)
+ return v1.Activate(setActivateDefaultRegoVersion(opts))
}
// DeactivateOpts defines options for the Deactivate API call
-type DeactivateOpts struct {
- Ctx context.Context
- Store storage.Store
- Txn storage.Transaction
- BundleNames map[string]struct{}
- ParserOptions ast.ParserOptions
-}
+type DeactivateOpts = v1.DeactivateOpts
// Deactivate the bundle(s). This will erase associated data, policies, and the manifest entry from the store.
func Deactivate(opts *DeactivateOpts) error {
- erase := map[string]struct{}{}
- for name := range opts.BundleNames {
- roots, err := ReadBundleRootsFromStore(opts.Ctx, opts.Store, opts.Txn, name)
- if suppressNotFound(err) != nil {
- return err
- }
- for _, root := range roots {
- erase[root] = struct{}{}
- }
- }
- _, err := eraseBundles(opts.Ctx, opts.Store, opts.Txn, opts.ParserOptions, opts.BundleNames, erase)
- return err
-}
-
-func activateBundles(opts *ActivateOpts) error {
-
- // Build collections of bundle names, modules, and roots to erase
- erase := map[string]struct{}{}
- names := map[string]struct{}{}
- deltaBundles := map[string]*Bundle{}
- snapshotBundles := map[string]*Bundle{}
-
- for name, b := range opts.Bundles {
- if b.Type() == DeltaBundleType {
- deltaBundles[name] = b
- } else {
- snapshotBundles[name] = b
- names[name] = struct{}{}
-
- roots, err := ReadBundleRootsFromStore(opts.Ctx, opts.Store, opts.Txn, name)
- if suppressNotFound(err) != nil {
- return err
- }
- for _, root := range roots {
- erase[root] = struct{}{}
- }
-
- // Erase data at new roots to prepare for writing the new data
- for _, root := range *b.Manifest.Roots {
- erase[root] = struct{}{}
- }
- }
- }
-
- // Before changing anything make sure the roots don't collide with any
- // other bundles that already are activated or other bundles being activated.
- err := hasRootsOverlap(opts.Ctx, opts.Store, opts.Txn, opts.Bundles)
- if err != nil {
- return err
- }
-
- if len(deltaBundles) != 0 {
- err := activateDeltaBundles(opts, deltaBundles)
- if err != nil {
- return err
- }
- }
-
- // Erase data and policies at new + old roots, and remove the old
- // manifests before activating a new snapshot bundle.
- remaining, err := eraseBundles(opts.Ctx, opts.Store, opts.Txn, opts.ParserOptions, names, erase)
- if err != nil {
- return err
- }
-
- // Validate data in bundle does not contain paths outside the bundle's roots.
- for _, b := range snapshotBundles {
-
- if b.lazyLoadingMode {
-
- for _, item := range b.Raw {
- path := filepath.ToSlash(item.Path)
-
- if filepath.Base(path) == dataFile || filepath.Base(path) == yamlDataFile {
- var val map[string]json.RawMessage
- err = util.Unmarshal(item.Value, &val)
- if err == nil {
- err = doDFS(val, filepath.Dir(strings.Trim(path, "/")), *b.Manifest.Roots)
- if err != nil {
- return err
- }
- } else {
- // Build an object for the value
- p := getNormalizedPath(path)
-
- if len(p) == 0 {
- return fmt.Errorf("root value must be object")
- }
-
- // verify valid YAML or JSON value
- var x interface{}
- err := util.Unmarshal(item.Value, &x)
- if err != nil {
- return err
- }
-
- value := item.Value
- dir := map[string]json.RawMessage{}
- for i := len(p) - 1; i > 0; i-- {
- dir[p[i]] = value
-
- bs, err := json.Marshal(dir)
- if err != nil {
- return err
- }
-
- value = bs
- dir = map[string]json.RawMessage{}
- }
- dir[p[0]] = value
-
- err = doDFS(dir, filepath.Dir(strings.Trim(path, "/")), *b.Manifest.Roots)
- if err != nil {
- return err
- }
- }
- }
- }
- }
- }
-
- // Compile the modules all at once to avoid having to re-do work.
- remainingAndExtra := make(map[string]*ast.Module)
- for name, mod := range remaining {
- remainingAndExtra[name] = mod
- }
- for name, mod := range opts.ExtraModules {
- remainingAndExtra[name] = mod
- }
-
- err = compileModules(opts.Compiler, opts.Metrics, snapshotBundles, remainingAndExtra, opts.legacy, opts.AuthorizationDecisionRef)
- if err != nil {
- return err
- }
-
- if err := writeDataAndModules(opts.Ctx, opts.Store, opts.Txn, opts.TxnCtx, snapshotBundles, opts.legacy); err != nil {
- return err
- }
-
- if err := ast.CheckPathConflicts(opts.Compiler, storage.NonEmpty(opts.Ctx, opts.Store, opts.Txn)); len(err) > 0 {
- return err
- }
-
- for name, b := range snapshotBundles {
- if err := writeManifestToStore(opts, name, b.Manifest); err != nil {
- return err
- }
-
- if err := writeEtagToStore(opts, name, b.Etag); err != nil {
- return err
- }
-
- if err := writeWasmModulesToStore(opts.Ctx, opts.Store, opts.Txn, name, b); err != nil {
- return err
- }
- }
-
- return nil
+ return v1.Deactivate(setDeactivateDefaultRegoVersion(opts))
}
-func doDFS(obj map[string]json.RawMessage, path string, roots []string) error {
- if len(roots) == 1 && roots[0] == "" {
- return nil
- }
-
- for key := range obj {
-
- newPath := filepath.Join(strings.Trim(path, "/"), key)
-
- // Note: filepath.Join can return paths with '\' separators, always use
- // filepath.ToSlash to keep them normalized.
- newPath = strings.TrimLeft(normalizePath(newPath), "/.")
-
- contains := false
- prefix := false
- if RootPathsContain(roots, newPath) {
- contains = true
- } else {
- for i := range roots {
- if strings.HasPrefix(strings.Trim(roots[i], "/"), newPath) {
- prefix = true
- break
- }
- }
- }
-
- if !contains && !prefix {
- return fmt.Errorf("manifest roots %v do not permit data at path '/%s' (hint: check bundle directory structure)", roots, newPath)
- }
-
- if contains {
- continue
- }
-
- var next map[string]json.RawMessage
- err := util.Unmarshal(obj[key], &next)
- if err != nil {
- return fmt.Errorf("manifest roots %v do not permit data at path '/%s' (hint: check bundle directory structure)", roots, newPath)
- }
-
- if err := doDFS(next, newPath, roots); err != nil {
- return err
- }
- }
- return nil
-}
-
-func activateDeltaBundles(opts *ActivateOpts, bundles map[string]*Bundle) error {
-
- // Check that the manifest roots and wasm resolvers in the delta bundle
- // match with those currently in the store
- for name, b := range bundles {
- value, err := opts.Store.Read(opts.Ctx, opts.Txn, ManifestStoragePath(name))
- if err != nil {
- if storage.IsNotFound(err) {
- continue
- }
- return err
- }
-
- manifest, err := valueToManifest(value)
- if err != nil {
- return fmt.Errorf("corrupt manifest data: %w", err)
- }
-
- if !b.Manifest.equalWasmResolversAndRoots(manifest) {
- return fmt.Errorf("delta bundle '%s' has wasm resolvers or manifest roots that are different from those in the store", name)
- }
- }
-
- for _, b := range bundles {
- err := applyPatches(opts.Ctx, opts.Store, opts.Txn, b.Patch.Data)
- if err != nil {
- return err
- }
- }
-
- if err := ast.CheckPathConflicts(opts.Compiler, storage.NonEmpty(opts.Ctx, opts.Store, opts.Txn)); len(err) > 0 {
- return err
- }
-
- for name, b := range bundles {
- if err := writeManifestToStore(opts, name, b.Manifest); err != nil {
- return err
- }
-
- if err := writeEtagToStore(opts, name, b.Etag); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func valueToManifest(v interface{}) (Manifest, error) {
- if astV, ok := v.(ast.Value); ok {
- var err error
- v, err = ast.JSON(astV)
- if err != nil {
- return Manifest{}, err
- }
- }
-
- var manifest Manifest
-
- bs, err := json.Marshal(v)
- if err != nil {
- return Manifest{}, err
- }
-
- err = util.UnmarshalJSON(bs, &manifest)
- if err != nil {
- return Manifest{}, err
- }
-
- return manifest, nil
-}
-
-// erase bundles by name and roots. This will clear all policies and data at its roots and remove its
-// manifest from storage.
-func eraseBundles(ctx context.Context, store storage.Store, txn storage.Transaction, parserOpts ast.ParserOptions, names map[string]struct{}, roots map[string]struct{}) (map[string]*ast.Module, error) {
-
- if err := eraseData(ctx, store, txn, roots); err != nil {
- return nil, err
- }
-
- remaining, err := erasePolicies(ctx, store, txn, parserOpts, roots)
- if err != nil {
- return nil, err
- }
-
- for name := range names {
- if err := EraseManifestFromStore(ctx, store, txn, name); suppressNotFound(err) != nil {
- return nil, err
- }
-
- if err := LegacyEraseManifestFromStore(ctx, store, txn); suppressNotFound(err) != nil {
- return nil, err
- }
-
- if err := eraseBundleEtagFromStore(ctx, store, txn, name); suppressNotFound(err) != nil {
- return nil, err
- }
-
- if err := eraseWasmModulesFromStore(ctx, store, txn, name); suppressNotFound(err) != nil {
- return nil, err
- }
- }
-
- return remaining, nil
-}
-
-func eraseData(ctx context.Context, store storage.Store, txn storage.Transaction, roots map[string]struct{}) error {
- for root := range roots {
- path, ok := storage.ParsePathEscaped("/" + root)
- if !ok {
- return fmt.Errorf("manifest root path invalid: %v", root)
- }
-
- if len(path) > 0 {
- if err := store.Write(ctx, txn, storage.RemoveOp, path, nil); suppressNotFound(err) != nil {
- return err
- }
- }
- }
- return nil
-}
-
-func erasePolicies(ctx context.Context, store storage.Store, txn storage.Transaction, parserOpts ast.ParserOptions, roots map[string]struct{}) (map[string]*ast.Module, error) {
-
- ids, err := store.ListPolicies(ctx, txn)
- if err != nil {
- return nil, err
- }
-
- remaining := map[string]*ast.Module{}
-
- for _, id := range ids {
- bs, err := store.GetPolicy(ctx, txn, id)
- if err != nil {
- return nil, err
- }
- module, err := ast.ParseModuleWithOpts(id, string(bs), parserOpts)
- if err != nil {
- return nil, err
- }
- path, err := module.Package.Path.Ptr()
- if err != nil {
- return nil, err
- }
- deleted := false
- for root := range roots {
- if RootPathsContain([]string{root}, path) {
- if err := store.DeletePolicy(ctx, txn, id); err != nil {
- return nil, err
- }
- deleted = true
- break
- }
- }
- if !deleted {
- remaining[id] = module
- }
- }
-
- return remaining, nil
-}
-
-func writeManifestToStore(opts *ActivateOpts, name string, manifest Manifest) error {
- // Always write manifests to the named location. If the plugin is in the older style config
- // then also write to the old legacy unnamed location.
- if err := WriteManifestToStore(opts.Ctx, opts.Store, opts.Txn, name, manifest); err != nil {
- return err
- }
-
- if opts.legacy {
- if err := LegacyWriteManifestToStore(opts.Ctx, opts.Store, opts.Txn, manifest); err != nil {
- return err
- }
- }
-
- return nil
+// LegacyWriteManifestToStore will write the bundle manifest to the older single (unnamed) bundle manifest location.
+//
+// Deprecated: Use WriteManifestToStore and named bundles instead.
+func LegacyWriteManifestToStore(ctx context.Context, store storage.Store, txn storage.Transaction, manifest Manifest) error {
+ return v1.LegacyWriteManifestToStore(ctx, store, txn, manifest)
}
-func writeEtagToStore(opts *ActivateOpts, name, etag string) error {
- if err := WriteEtagToStore(opts.Ctx, opts.Store, opts.Txn, name, etag); err != nil {
- return err
- }
-
- return nil
+// LegacyEraseManifestFromStore will erase the bundle manifest from the older single (unnamed) bundle manifest location.
+//
+// Deprecated: Use WriteManifestToStore and named bundles instead.
+func LegacyEraseManifestFromStore(ctx context.Context, store storage.Store, txn storage.Transaction) error {
+ return v1.LegacyEraseManifestFromStore(ctx, store, txn)
}
-func writeDataAndModules(ctx context.Context, store storage.Store, txn storage.Transaction, txnCtx *storage.Context, bundles map[string]*Bundle, legacy bool) error {
- params := storage.WriteParams
- params.Context = txnCtx
-
- for name, b := range bundles {
- if len(b.Raw) == 0 {
- // Write data from each new bundle into the store. Only write under the
- // roots contained in their manifest.
- if err := writeData(ctx, store, txn, *b.Manifest.Roots, b.Data); err != nil {
- return err
- }
-
- for _, mf := range b.Modules {
- var path string
-
- // For backwards compatibility, in legacy mode, upsert policies to
- // the unprefixed path.
- if legacy {
- path = mf.Path
- } else {
- path = modulePathWithPrefix(name, mf.Path)
- }
-
- if err := store.UpsertPolicy(ctx, txn, path, mf.Raw); err != nil {
- return err
- }
- }
- } else {
- params.BasePaths = *b.Manifest.Roots
-
- err := store.Truncate(ctx, txn, params, NewIterator(b.Raw))
- if err != nil {
- return fmt.Errorf("store truncate failed for bundle '%s': %v", name, err)
- }
- }
- }
-
- return nil
+// LegacyReadRevisionFromStore will read the bundle manifest revision from the older single (unnamed) bundle manifest location.
+//
+// Deprecated: Use ReadBundleRevisionFromStore and named bundles instead.
+func LegacyReadRevisionFromStore(ctx context.Context, store storage.Store, txn storage.Transaction) (string, error) {
+ return v1.LegacyReadRevisionFromStore(ctx, store, txn)
}
-func writeData(ctx context.Context, store storage.Store, txn storage.Transaction, roots []string, data map[string]interface{}) error {
- for _, root := range roots {
- path, ok := storage.ParsePathEscaped("/" + root)
- if !ok {
- return fmt.Errorf("manifest root path invalid: %v", root)
- }
- if value, ok := lookup(path, data); ok {
- if len(path) > 0 {
- if err := storage.MakeDir(ctx, store, txn, path[:len(path)-1]); err != nil {
- return err
- }
- }
- if err := store.Write(ctx, txn, storage.AddOp, path, value); err != nil {
- return err
- }
- }
- }
- return nil
+// ActivateLegacy calls Activate for the bundles but will also write their manifest to the older unnamed store location.
+//
+// Deprecated: Use Activate with named bundles instead.
+func ActivateLegacy(opts *ActivateOpts) error {
+ return v1.ActivateLegacy(opts)
}
-func compileModules(compiler *ast.Compiler, m metrics.Metrics, bundles map[string]*Bundle, extraModules map[string]*ast.Module, legacy bool, authorizationDecisionRef ast.Ref) error {
-
- m.Timer(metrics.RegoModuleCompile).Start()
- defer m.Timer(metrics.RegoModuleCompile).Stop()
-
- modules := map[string]*ast.Module{}
-
- // preserve any modules already on the compiler
- for name, module := range compiler.Modules {
- modules[name] = module
- }
-
- // preserve any modules passed in from the store
- for name, module := range extraModules {
- modules[name] = module
- }
-
- // include all the new bundle modules
- for bundleName, b := range bundles {
- if legacy {
- for _, mf := range b.Modules {
- modules[mf.Path] = mf.Parsed
- }
- } else {
- for name, module := range b.ParsedModules(bundleName) {
- modules[name] = module
- }
- }
- }
-
- if compiler.Compile(modules); compiler.Failed() {
- return compiler.Errors
- }
-
- if authorizationDecisionRef.Equal(ast.EmptyRef()) {
+func setActivateDefaultRegoVersion(opts *ActivateOpts) *ActivateOpts {
+ if opts == nil {
return nil
}
- return iCompiler.VerifyAuthorizationPolicySchema(compiler, authorizationDecisionRef)
-}
-
-func writeModules(ctx context.Context, store storage.Store, txn storage.Transaction, compiler *ast.Compiler, m metrics.Metrics, bundles map[string]*Bundle, extraModules map[string]*ast.Module, legacy bool) error {
-
- m.Timer(metrics.RegoModuleCompile).Start()
- defer m.Timer(metrics.RegoModuleCompile).Stop()
-
- modules := map[string]*ast.Module{}
-
- // preserve any modules already on the compiler
- for name, module := range compiler.Modules {
- modules[name] = module
+ if opts.ParserOptions.RegoVersion == ast.RegoUndefined {
+ cpy := *opts
+ cpy.ParserOptions.RegoVersion = ast.DefaultRegoVersion
+ return &cpy
}
- // preserve any modules passed in from the store
- for name, module := range extraModules {
- modules[name] = module
- }
-
- // include all the new bundle modules
- for bundleName, b := range bundles {
- if legacy {
- for _, mf := range b.Modules {
- modules[mf.Path] = mf.Parsed
- }
- } else {
- for name, module := range b.ParsedModules(bundleName) {
- modules[name] = module
- }
- }
- }
-
- if compiler.Compile(modules); compiler.Failed() {
- return compiler.Errors
- }
- for bundleName, b := range bundles {
- for _, mf := range b.Modules {
- var path string
-
- // For backwards compatibility, in legacy mode, upsert policies to
- // the unprefixed path.
- if legacy {
- path = mf.Path
- } else {
- path = modulePathWithPrefix(bundleName, mf.Path)
- }
-
- if err := store.UpsertPolicy(ctx, txn, path, mf.Raw); err != nil {
- return err
- }
- }
- }
- return nil
+ return opts
}
-func lookup(path storage.Path, data map[string]interface{}) (interface{}, bool) {
- if len(path) == 0 {
- return data, true
- }
- for i := 0; i < len(path)-1; i++ {
- value, ok := data[path[i]]
- if !ok {
- return nil, false
- }
- obj, ok := value.(map[string]interface{})
- if !ok {
- return nil, false
- }
- data = obj
- }
- value, ok := data[path[len(path)-1]]
- return value, ok
-}
-
-func hasRootsOverlap(ctx context.Context, store storage.Store, txn storage.Transaction, bundles map[string]*Bundle) error {
- collisions := map[string][]string{}
- allBundles, err := ReadBundleNamesFromStore(ctx, store, txn)
- if suppressNotFound(err) != nil {
- return err
- }
-
- allRoots := map[string][]string{}
-
- // Build a map of roots for existing bundles already in the system
- for _, name := range allBundles {
- roots, err := ReadBundleRootsFromStore(ctx, store, txn, name)
- if suppressNotFound(err) != nil {
- return err
- }
- allRoots[name] = roots
- }
-
- // Add in any bundles that are being activated, overwrite existing roots
- // with new ones where bundles are in both groups.
- for name, bundle := range bundles {
- allRoots[name] = *bundle.Manifest.Roots
- }
-
- // Now check for each new bundle if it conflicts with any of the others
- for name, bundle := range bundles {
- for otherBundle, otherRoots := range allRoots {
- if name == otherBundle {
- // Skip the current bundle being checked
- continue
- }
-
- // Compare the "new" roots with other existing (or a different bundles new roots)
- for _, newRoot := range *bundle.Manifest.Roots {
- for _, otherRoot := range otherRoots {
- if RootPathsOverlap(newRoot, otherRoot) {
- collisions[otherBundle] = append(collisions[otherBundle], newRoot)
- }
- }
- }
- }
- }
-
- if len(collisions) > 0 {
- var bundleNames []string
- for name := range collisions {
- bundleNames = append(bundleNames, name)
- }
- return fmt.Errorf("detected overlapping roots in bundle manifest with: %s", bundleNames)
- }
- return nil
-}
-
-func applyPatches(ctx context.Context, store storage.Store, txn storage.Transaction, patches []PatchOperation) error {
- for _, pat := range patches {
-
- // construct patch path
- path, ok := patch.ParsePatchPathEscaped("/" + strings.Trim(pat.Path, "/"))
- if !ok {
- return fmt.Errorf("error parsing patch path")
- }
-
- var op storage.PatchOp
- switch pat.Op {
- case "upsert":
- op = storage.AddOp
-
- _, err := store.Read(ctx, txn, path[:len(path)-1])
- if err != nil {
- if !storage.IsNotFound(err) {
- return err
- }
-
- if err := storage.MakeDir(ctx, store, txn, path[:len(path)-1]); err != nil {
- return err
- }
- }
- case "remove":
- op = storage.RemoveOp
- case "replace":
- op = storage.ReplaceOp
- default:
- return fmt.Errorf("bad patch operation: %v", pat.Op)
- }
-
- // apply the patch
- if err := store.Write(ctx, txn, op, path, pat.Value); err != nil {
- return err
- }
+func setDeactivateDefaultRegoVersion(opts *DeactivateOpts) *DeactivateOpts {
+ if opts == nil {
+ return nil
}
- return nil
-}
-
-// Helpers for the older single (unnamed) bundle style manifest storage.
-
-// LegacyManifestStoragePath is the older unnamed bundle path for manifests to be stored.
-// Deprecated: Use ManifestStoragePath and named bundles instead.
-var legacyManifestStoragePath = storage.MustParsePath("/system/bundle/manifest")
-var legacyRevisionStoragePath = append(legacyManifestStoragePath, "revision")
-
-// LegacyWriteManifestToStore will write the bundle manifest to the older single (unnamed) bundle manifest location.
-// Deprecated: Use WriteManifestToStore and named bundles instead.
-func LegacyWriteManifestToStore(ctx context.Context, store storage.Store, txn storage.Transaction, manifest Manifest) error {
- return write(ctx, store, txn, legacyManifestStoragePath, manifest)
-}
-
-// LegacyEraseManifestFromStore will erase the bundle manifest from the older single (unnamed) bundle manifest location.
-// Deprecated: Use WriteManifestToStore and named bundles instead.
-func LegacyEraseManifestFromStore(ctx context.Context, store storage.Store, txn storage.Transaction) error {
- err := store.Write(ctx, txn, storage.RemoveOp, legacyManifestStoragePath, nil)
- if err != nil {
- return err
+ if opts.ParserOptions.RegoVersion == ast.RegoUndefined {
+ cpy := *opts
+ cpy.ParserOptions.RegoVersion = ast.DefaultRegoVersion
+ return &cpy
}
- return nil
-}
-// LegacyReadRevisionFromStore will read the bundle manifest revision from the older single (unnamed) bundle manifest location.
-// Deprecated: Use ReadBundleRevisionFromStore and named bundles instead.
-func LegacyReadRevisionFromStore(ctx context.Context, store storage.Store, txn storage.Transaction) (string, error) {
- return readRevisionFromStore(ctx, store, txn, legacyRevisionStoragePath)
-}
-
-// ActivateLegacy calls Activate for the bundles but will also write their manifest to the older unnamed store location.
-// Deprecated: Use Activate with named bundles instead.
-func ActivateLegacy(opts *ActivateOpts) error {
- opts.legacy = true
- return activateBundles(opts)
+ return opts
}
diff --git a/vendor/github.com/open-policy-agent/opa/bundle/verify.go b/vendor/github.com/open-policy-agent/opa/bundle/verify.go
index e85be835be..ef2e1e32db 100644
--- a/vendor/github.com/open-policy-agent/opa/bundle/verify.go
+++ b/vendor/github.com/open-policy-agent/opa/bundle/verify.go
@@ -6,26 +6,11 @@
package bundle
import (
- "bytes"
- "encoding/base64"
- "encoding/hex"
- "encoding/json"
- "fmt"
-
- "github.com/open-policy-agent/opa/internal/jwx/jwa"
- "github.com/open-policy-agent/opa/internal/jwx/jws"
- "github.com/open-policy-agent/opa/internal/jwx/jws/verify"
- "github.com/open-policy-agent/opa/util"
+ v1 "github.com/open-policy-agent/opa/v1/bundle"
)
-const defaultVerifierID = "_default"
-
-var verifiers map[string]Verifier
-
// Verifier is the interface expected for implementations that verify bundle signatures.
-type Verifier interface {
- VerifyBundleSignature(SignaturesConfig, *VerificationConfig) (map[string]FileInfo, error)
-}
+type Verifier v1.Verifier
// VerifyBundleSignature will retrieve the Verifier implementation based
// on the Plugin specified in SignaturesConfig, and call its implementation
@@ -33,199 +18,19 @@ type Verifier interface {
// using the given public keys or secret. If a signature is verified, it keeps
// track of the files specified in the JWT payload
func VerifyBundleSignature(sc SignaturesConfig, bvc *VerificationConfig) (map[string]FileInfo, error) {
- // default implementation does not return a nil for map, so don't
- // do it here either
- files := make(map[string]FileInfo)
- var plugin string
- // for backwards compatibility, check if there is no plugin specified, and use default
- if sc.Plugin == "" {
- plugin = defaultVerifierID
- } else {
- plugin = sc.Plugin
- }
- verifier, err := GetVerifier(plugin)
- if err != nil {
- return files, err
- }
- return verifier.VerifyBundleSignature(sc, bvc)
+ return v1.VerifyBundleSignature(sc, bvc)
}
// DefaultVerifier is the default bundle verification implementation. It verifies bundles by checking
// the JWT signature using a locally-accessible public key.
-type DefaultVerifier struct{}
-
-// VerifyBundleSignature verifies the bundle signature using the given public keys or secret.
-// If a signature is verified, it keeps track of the files specified in the JWT payload
-func (*DefaultVerifier) VerifyBundleSignature(sc SignaturesConfig, bvc *VerificationConfig) (map[string]FileInfo, error) {
- files := make(map[string]FileInfo)
-
- if len(sc.Signatures) == 0 {
- return files, fmt.Errorf(".signatures.json: missing JWT (expected exactly one)")
- }
-
- if len(sc.Signatures) > 1 {
- return files, fmt.Errorf(".signatures.json: multiple JWTs not supported (expected exactly one)")
- }
-
- for _, token := range sc.Signatures {
- payload, err := verifyJWTSignature(token, bvc)
- if err != nil {
- return files, err
- }
-
- for _, file := range payload.Files {
- files[file.Name] = file
- }
- }
- return files, nil
-}
-
-func verifyJWTSignature(token string, bvc *VerificationConfig) (*DecodedSignature, error) {
- // decode JWT to check if the header specifies the key to use and/or if claims have the scope.
-
- parts, err := jws.SplitCompact(token)
- if err != nil {
- return nil, err
- }
-
- var decodedHeader []byte
- if decodedHeader, err = base64.RawURLEncoding.DecodeString(parts[0]); err != nil {
- return nil, fmt.Errorf("failed to base64 decode JWT headers: %w", err)
- }
-
- var hdr jws.StandardHeaders
- if err := json.Unmarshal(decodedHeader, &hdr); err != nil {
- return nil, fmt.Errorf("failed to parse JWT headers: %w", err)
- }
-
- payload, err := base64.RawURLEncoding.DecodeString(parts[1])
- if err != nil {
- return nil, err
- }
-
- var ds DecodedSignature
- if err := json.Unmarshal(payload, &ds); err != nil {
- return nil, err
- }
-
- // check for the id of the key to use for JWT signature verification
- // first in the OPA config. If not found, then check the JWT kid.
- keyID := bvc.KeyID
- if keyID == "" {
- keyID = hdr.KeyID
- }
- if keyID == "" {
- // If header has no key id, check the deprecated key claim.
- keyID = ds.KeyID
- }
-
- if keyID == "" {
- return nil, fmt.Errorf("verification key ID is empty")
- }
-
- // now that we have the keyID, fetch the actual key
- keyConfig, err := bvc.GetPublicKey(keyID)
- if err != nil {
- return nil, err
- }
-
- // verify JWT signature
- alg := jwa.SignatureAlgorithm(keyConfig.Algorithm)
- key, err := verify.GetSigningKey(keyConfig.Key, alg)
- if err != nil {
- return nil, err
- }
-
- _, err = jws.Verify([]byte(token), alg, key)
- if err != nil {
- return nil, err
- }
-
- // verify the scope
- scope := bvc.Scope
- if scope == "" {
- scope = keyConfig.Scope
- }
-
- if ds.Scope != scope {
- return nil, fmt.Errorf("scope mismatch")
- }
- return &ds, nil
-}
-
-// VerifyBundleFile verifies the hash of a file in the bundle matches to that provided in the bundle's signature
-func VerifyBundleFile(path string, data bytes.Buffer, files map[string]FileInfo) error {
- var file FileInfo
- var ok bool
-
- if file, ok = files[path]; !ok {
- return fmt.Errorf("file %v not included in bundle signature", path)
- }
-
- if file.Algorithm == "" {
- return fmt.Errorf("no hashing algorithm provided for file %v", path)
- }
-
- hash, err := NewSignatureHasher(HashingAlgorithm(file.Algorithm))
- if err != nil {
- return err
- }
-
- // hash the file content
- // For unstructured files, hash the byte stream of the file
- // For structured files, read the byte stream and parse into a JSON structure;
- // then recursively order the fields of all objects alphabetically and then apply
- // the hash function to result to compute the hash. This ensures that the digital signature is
- // independent of whitespace and other non-semantic JSON features.
- var value interface{}
- if IsStructuredDoc(path) {
- err := util.Unmarshal(data.Bytes(), &value)
- if err != nil {
- return err
- }
- } else {
- value = data.Bytes()
- }
-
- bs, err := hash.HashFile(value)
- if err != nil {
- return err
- }
-
- // compare file hash with same file in the JWT payloads
- fb, err := hex.DecodeString(file.Hash)
- if err != nil {
- return err
- }
-
- if !bytes.Equal(fb, bs) {
- return fmt.Errorf("%v: digest mismatch (want: %x, got: %x)", path, fb, bs)
- }
-
- delete(files, path)
- return nil
-}
+type DefaultVerifier = v1.DefaultVerifier
// GetVerifier returns the Verifier registered under the given id
func GetVerifier(id string) (Verifier, error) {
- verifier, ok := verifiers[id]
- if !ok {
- return nil, fmt.Errorf("no verifier exists under id %s", id)
- }
- return verifier, nil
+ return v1.GetVerifier(id)
}
// RegisterVerifier registers a Verifier under the given id
func RegisterVerifier(id string, v Verifier) error {
- if id == defaultVerifierID {
- return fmt.Errorf("verifier id %s is reserved, use a different id", id)
- }
- verifiers[id] = v
- return nil
-}
-
-func init() {
- verifiers = map[string]Verifier{
- defaultVerifierID: &DefaultVerifier{},
- }
+ return v1.RegisterVerifier(id, v)
}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/capabilities.go b/vendor/github.com/open-policy-agent/opa/capabilities/capabilities.go
index ba32cf977e..5482720f7c 100644
--- a/vendor/github.com/open-policy-agent/opa/capabilities/capabilities.go
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/capabilities.go
@@ -2,9 +2,6 @@
// Use of this source code is governed by an Apache2
// license that can be found in the LICENSE file.
-//go:build go1.16
-// +build go1.16
-
package capabilities
import (
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/doc.go b/vendor/github.com/open-policy-agent/opa/capabilities/doc.go
new file mode 100644
index 0000000000..189c2e727a
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/doc.go
@@ -0,0 +1,8 @@
+// Copyright 2024 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.
+
+// Deprecated: This package is intended for older projects transitioning from OPA v0.x and will remain for the lifetime of OPA v1.x, but its use is not recommended.
+// For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the [github.com/open-policy-agent/opa/v1] package instead.
+// See https://www.openpolicyagent.org/docs/latest/v0-compatibility/ for more information.
+package capabilities
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.0.0.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.0.0.json
new file mode 100644
index 0000000000..48a87b0c35
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.0.0.json
@@ -0,0 +1,4835 @@
+{
+ "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": "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_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": [
+ "rego_v1"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.0.1.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.0.1.json
new file mode 100644
index 0000000000..48a87b0c35
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.0.1.json
@@ -0,0 +1,4835 @@
+{
+ "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": "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_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": [
+ "rego_v1"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.1.0.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.1.0.json
new file mode 100644
index 0000000000..48a87b0c35
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.1.0.json
@@ -0,0 +1,4835 @@
+{
+ "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": "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_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": [
+ "rego_v1"
+ ]
+}
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.11.0.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.11.0.json
new file mode 100644
index 0000000000..d58fc6760f
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.11.0.json
@@ -0,0 +1,4878 @@
+{
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_boolean",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "boolean"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_null",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "null"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_object",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "dynamic": {
+ "key": {
+ "type": "any"
+ },
+ "value": {
+ "type": "any"
+ }
+ },
+ "type": "object"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_set",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "of": {
+ "type": "any"
+ },
+ "type": "set"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_string",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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.11.1.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.11.1.json
new file mode 100644
index 0000000000..d58fc6760f
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.11.1.json
@@ -0,0 +1,4878 @@
+{
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_boolean",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "boolean"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_null",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "null"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_object",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "dynamic": {
+ "key": {
+ "type": "any"
+ },
+ "value": {
+ "type": "any"
+ }
+ },
+ "type": "object"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_set",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "of": {
+ "type": "any"
+ },
+ "type": "set"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_string",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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.12.0.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.12.0.json
new file mode 100644
index 0000000000..e4bf21abf3
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.12.0.json
@@ -0,0 +1,4896 @@
+{
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_boolean",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "boolean"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_null",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "null"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_object",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "dynamic": {
+ "key": {
+ "type": "any"
+ },
+ "value": {
+ "type": "any"
+ }
+ },
+ "type": "object"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_set",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "of": {
+ "type": "any"
+ },
+ "type": "set"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_string",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "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.template_string",
+ "decl": {
+ "args": [
+ {
+ "dynamic": {
+ "type": "any"
+ },
+ "type": "array"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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",
+ "template_strings"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.12.1.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.12.1.json
new file mode 100644
index 0000000000..e4bf21abf3
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.12.1.json
@@ -0,0 +1,4896 @@
+{
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_boolean",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "boolean"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_null",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "null"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_object",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "dynamic": {
+ "key": {
+ "type": "any"
+ },
+ "value": {
+ "type": "any"
+ }
+ },
+ "type": "object"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_set",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "of": {
+ "type": "any"
+ },
+ "type": "set"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_string",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "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.template_string",
+ "decl": {
+ "args": [
+ {
+ "dynamic": {
+ "type": "any"
+ },
+ "type": "array"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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",
+ "template_strings"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.12.2.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.12.2.json
new file mode 100644
index 0000000000..e4bf21abf3
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.12.2.json
@@ -0,0 +1,4896 @@
+{
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_boolean",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "boolean"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_null",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "null"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_object",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "dynamic": {
+ "key": {
+ "type": "any"
+ },
+ "value": {
+ "type": "any"
+ }
+ },
+ "type": "object"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_set",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "of": {
+ "type": "any"
+ },
+ "type": "set"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_string",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "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.template_string",
+ "decl": {
+ "args": [
+ {
+ "dynamic": {
+ "type": "any"
+ },
+ "type": "array"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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",
+ "template_strings"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.12.3.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.12.3.json
new file mode 100644
index 0000000000..e4bf21abf3
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.12.3.json
@@ -0,0 +1,4896 @@
+{
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_boolean",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "boolean"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_null",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "null"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_object",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "dynamic": {
+ "key": {
+ "type": "any"
+ },
+ "value": {
+ "type": "any"
+ }
+ },
+ "type": "object"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_set",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "of": {
+ "type": "any"
+ },
+ "type": "set"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_string",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "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.template_string",
+ "decl": {
+ "args": [
+ {
+ "dynamic": {
+ "type": "any"
+ },
+ "type": "array"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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",
+ "template_strings"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.13.0.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.13.0.json
new file mode 100644
index 0000000000..9eb82c2968
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.13.0.json
@@ -0,0 +1,4916 @@
+{
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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.flatten",
+ "decl": {
+ "args": [
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_boolean",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "boolean"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_null",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "null"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_object",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "dynamic": {
+ "key": {
+ "type": "any"
+ },
+ "value": {
+ "type": "any"
+ }
+ },
+ "type": "object"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_set",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "of": {
+ "type": "any"
+ },
+ "type": "set"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_string",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "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.template_string",
+ "decl": {
+ "args": [
+ {
+ "dynamic": {
+ "type": "any"
+ },
+ "type": "array"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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",
+ "template_strings"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.13.1.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.13.1.json
new file mode 100644
index 0000000000..9eb82c2968
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.13.1.json
@@ -0,0 +1,4916 @@
+{
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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.flatten",
+ "decl": {
+ "args": [
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_boolean",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "boolean"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_null",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "null"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_object",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "dynamic": {
+ "key": {
+ "type": "any"
+ },
+ "value": {
+ "type": "any"
+ }
+ },
+ "type": "object"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_set",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "of": {
+ "type": "any"
+ },
+ "type": "set"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_string",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "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.template_string",
+ "decl": {
+ "args": [
+ {
+ "dynamic": {
+ "type": "any"
+ },
+ "type": "array"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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",
+ "template_strings"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.13.2.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.13.2.json
new file mode 100644
index 0000000000..9eb82c2968
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.13.2.json
@@ -0,0 +1,4916 @@
+{
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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.flatten",
+ "decl": {
+ "args": [
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_boolean",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "boolean"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_null",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "null"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_object",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "dynamic": {
+ "key": {
+ "type": "any"
+ },
+ "value": {
+ "type": "any"
+ }
+ },
+ "type": "object"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_set",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "of": {
+ "type": "any"
+ },
+ "type": "set"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_string",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "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.template_string",
+ "decl": {
+ "args": [
+ {
+ "dynamic": {
+ "type": "any"
+ },
+ "type": "array"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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",
+ "template_strings"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.14.0.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.14.0.json
new file mode 100644
index 0000000000..9eb82c2968
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.14.0.json
@@ -0,0 +1,4916 @@
+{
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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.flatten",
+ "decl": {
+ "args": [
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_boolean",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "boolean"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_null",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "null"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_object",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "dynamic": {
+ "key": {
+ "type": "any"
+ },
+ "value": {
+ "type": "any"
+ }
+ },
+ "type": "object"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_set",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "of": {
+ "type": "any"
+ },
+ "type": "set"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_string",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "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.template_string",
+ "decl": {
+ "args": [
+ {
+ "dynamic": {
+ "type": "any"
+ },
+ "type": "array"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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",
+ "template_strings"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.14.1.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.14.1.json
new file mode 100644
index 0000000000..9eb82c2968
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.14.1.json
@@ -0,0 +1,4916 @@
+{
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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.flatten",
+ "decl": {
+ "args": [
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_boolean",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "boolean"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_null",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "null"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_object",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "dynamic": {
+ "key": {
+ "type": "any"
+ },
+ "value": {
+ "type": "any"
+ }
+ },
+ "type": "object"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_set",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "of": {
+ "type": "any"
+ },
+ "type": "set"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_string",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "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.template_string",
+ "decl": {
+ "args": [
+ {
+ "dynamic": {
+ "type": "any"
+ },
+ "type": "array"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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",
+ "template_strings"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.15.0.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.15.0.json
new file mode 100644
index 0000000000..9eb82c2968
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.15.0.json
@@ -0,0 +1,4916 @@
+{
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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.flatten",
+ "decl": {
+ "args": [
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_boolean",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "boolean"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_null",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "null"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_object",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "dynamic": {
+ "key": {
+ "type": "any"
+ },
+ "value": {
+ "type": "any"
+ }
+ },
+ "type": "object"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_set",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "of": {
+ "type": "any"
+ },
+ "type": "set"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_string",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "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.template_string",
+ "decl": {
+ "args": [
+ {
+ "dynamic": {
+ "type": "any"
+ },
+ "type": "array"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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",
+ "template_strings"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.15.1.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.15.1.json
new file mode 100644
index 0000000000..9eb82c2968
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.15.1.json
@@ -0,0 +1,4916 @@
+{
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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.flatten",
+ "decl": {
+ "args": [
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_boolean",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "boolean"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_null",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "null"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_object",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "dynamic": {
+ "key": {
+ "type": "any"
+ },
+ "value": {
+ "type": "any"
+ }
+ },
+ "type": "object"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_set",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "of": {
+ "type": "any"
+ },
+ "type": "set"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_string",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "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.template_string",
+ "decl": {
+ "args": [
+ {
+ "dynamic": {
+ "type": "any"
+ },
+ "type": "array"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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",
+ "template_strings"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.15.2.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.15.2.json
new file mode 100644
index 0000000000..9eb82c2968
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.15.2.json
@@ -0,0 +1,4916 @@
+{
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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.flatten",
+ "decl": {
+ "args": [
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_boolean",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "boolean"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_null",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "null"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_object",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "dynamic": {
+ "key": {
+ "type": "any"
+ },
+ "value": {
+ "type": "any"
+ }
+ },
+ "type": "object"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_set",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "of": {
+ "type": "any"
+ },
+ "type": "set"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "name": "cast_string",
+ "decl": {
+ "args": [
+ {
+ "type": "any"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "type": "function"
+ },
+ "deprecated": true
+ },
+ {
+ "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.template_string",
+ "decl": {
+ "args": [
+ {
+ "dynamic": {
+ "type": "any"
+ },
+ "type": "array"
+ }
+ ],
+ "result": {
+ "type": "string"
+ },
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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"
+ },
+ "deprecated": true
+ },
+ {
+ "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",
+ "template_strings"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.2.0.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.2.0.json
new file mode 100644
index 0000000000..1253c88b30
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.2.0.json
@@ -0,0 +1,4849 @@
+{
+ "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_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": [
+ "rego_v1"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.3.0.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.3.0.json
new file mode 100644
index 0000000000..1253c88b30
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.3.0.json
@@ -0,0 +1,4849 @@
+{
+ "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_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": [
+ "rego_v1"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.4.0.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.4.0.json
new file mode 100644
index 0000000000..1253c88b30
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.4.0.json
@@ -0,0 +1,4849 @@
+{
+ "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_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": [
+ "rego_v1"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.4.1.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.4.1.json
new file mode 100644
index 0000000000..1253c88b30
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.4.1.json
@@ -0,0 +1,4849 @@
+{
+ "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_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": [
+ "rego_v1"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.4.2.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.4.2.json
new file mode 100644
index 0000000000..1253c88b30
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.4.2.json
@@ -0,0 +1,4849 @@
+{
+ "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_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": [
+ "rego_v1"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.5.0.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.5.0.json
new file mode 100644
index 0000000000..1253c88b30
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.5.0.json
@@ -0,0 +1,4849 @@
+{
+ "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_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": [
+ "rego_v1"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.5.1.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.5.1.json
new file mode 100644
index 0000000000..1253c88b30
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.5.1.json
@@ -0,0 +1,4849 @@
+{
+ "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_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": [
+ "rego_v1"
+ ]
+}
diff --git a/vendor/github.com/open-policy-agent/opa/capabilities/v1.6.0.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.6.0.json
new file mode 100644
index 0000000000..110c3eca91
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.6.0.json
@@ -0,0 +1,4850 @@
+{
+ "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_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.7.0.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.7.0.json
new file mode 100644
index 0000000000..110c3eca91
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.7.0.json
@@ -0,0 +1,4850 @@
+{
+ "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_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.8.0.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.8.0.json
new file mode 100644
index 0000000000..0a37621d0c
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.8.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.9.0.json b/vendor/github.com/open-policy-agent/opa/capabilities/v1.9.0.json
new file mode 100644
index 0000000000..0a37621d0c
--- /dev/null
+++ b/vendor/github.com/open-policy-agent/opa/capabilities/v1.9.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/config/config.go b/vendor/github.com/open-policy-agent/opa/config/config.go
deleted file mode 100644
index 87ab109113..0000000000
--- a/vendor/github.com/open-policy-agent/opa/config/config.go
+++ /dev/null
@@ -1,259 +0,0 @@
-// Copyright 2018 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 config implements OPA configuration file parsing and validation.
-package config
-
-import (
- "encoding/json"
- "fmt"
- "os"
- "path/filepath"
- "reflect"
- "sort"
- "strings"
-
- "github.com/open-policy-agent/opa/ast"
- "github.com/open-policy-agent/opa/internal/ref"
- "github.com/open-policy-agent/opa/util"
- "github.com/open-policy-agent/opa/version"
-)
-
-// Config represents the configuration file that OPA can be started with.
-type Config struct {
- Services json.RawMessage `json:"services,omitempty"`
- Labels map[string]string `json:"labels,omitempty"`
- Discovery json.RawMessage `json:"discovery,omitempty"`
- Bundle json.RawMessage `json:"bundle,omitempty"` // Deprecated: Use `bundles` instead
- Bundles json.RawMessage `json:"bundles,omitempty"`
- DecisionLogs json.RawMessage `json:"decision_logs,omitempty"`
- Status json.RawMessage `json:"status,omitempty"`
- Plugins map[string]json.RawMessage `json:"plugins,omitempty"`
- Keys json.RawMessage `json:"keys,omitempty"`
- DefaultDecision *string `json:"default_decision,omitempty"`
- DefaultAuthorizationDecision *string `json:"default_authorization_decision,omitempty"`
- Caching json.RawMessage `json:"caching,omitempty"`
- NDBuiltinCache bool `json:"nd_builtin_cache,omitempty"`
- PersistenceDirectory *string `json:"persistence_directory,omitempty"`
- DistributedTracing json.RawMessage `json:"distributed_tracing,omitempty"`
- Server *struct {
- Encoding json.RawMessage `json:"encoding,omitempty"`
- Decoding json.RawMessage `json:"decoding,omitempty"`
- Metrics json.RawMessage `json:"metrics,omitempty"`
- } `json:"server,omitempty"`
- Storage *struct {
- Disk json.RawMessage `json:"disk,omitempty"`
- } `json:"storage,omitempty"`
- Extra map[string]json.RawMessage `json:"-"`
-}
-
-// ParseConfig returns a valid Config object with defaults injected. The id
-// and version parameters will be set in the labels map.
-func ParseConfig(raw []byte, id string) (*Config, error) {
- // NOTE(sr): based on https://stackoverflow.com/a/33499066/993018
- var result Config
- objValue := reflect.ValueOf(&result).Elem()
- knownFields := map[string]reflect.Value{}
- for i := 0; i != objValue.NumField(); i++ {
- jsonName := strings.Split(objValue.Type().Field(i).Tag.Get("json"), ",")[0]
- knownFields[jsonName] = objValue.Field(i)
- }
-
- if err := util.Unmarshal(raw, &result.Extra); err != nil {
- return nil, err
- }
-
- for key, chunk := range result.Extra {
- if field, found := knownFields[key]; found {
- if err := util.Unmarshal(chunk, field.Addr().Interface()); err != nil {
- return nil, err
- }
- delete(result.Extra, key)
- }
- }
- if len(result.Extra) == 0 {
- result.Extra = nil
- }
- return &result, result.validateAndInjectDefaults(id)
-}
-
-// PluginNames returns a sorted list of names of enabled plugins.
-func (c Config) PluginNames() (result []string) {
- if c.Bundle != nil || c.Bundles != nil {
- result = append(result, "bundles")
- }
- if c.Status != nil {
- result = append(result, "status")
- }
- if c.DecisionLogs != nil {
- result = append(result, "decision_logs")
- }
- for name := range c.Plugins {
- result = append(result, name)
- }
- sort.Strings(result)
- return result
-}
-
-// PluginsEnabled returns true if one or more plugin features are enabled.
-//
-// Deprecated. Use PluginNames instead.
-func (c Config) PluginsEnabled() bool {
- return c.Bundle != nil || c.Bundles != nil || c.DecisionLogs != nil || c.Status != nil || len(c.Plugins) > 0
-}
-
-// DefaultDecisionRef returns the default decision as a reference.
-func (c Config) DefaultDecisionRef() ast.Ref {
- r, _ := ref.ParseDataPath(*c.DefaultDecision)
- return r
-}
-
-// DefaultAuthorizationDecisionRef returns the default authorization decision
-// as a reference.
-func (c Config) DefaultAuthorizationDecisionRef() ast.Ref {
- r, _ := ref.ParseDataPath(*c.DefaultAuthorizationDecision)
- return r
-}
-
-// NDBuiltinCacheEnabled returns if the ND builtins cache should be used.
-func (c Config) NDBuiltinCacheEnabled() bool {
- return c.NDBuiltinCache
-}
-
-func (c *Config) validateAndInjectDefaults(id string) error {
-
- if c.DefaultDecision == nil {
- s := defaultDecisionPath
- c.DefaultDecision = &s
- }
-
- _, err := ref.ParseDataPath(*c.DefaultDecision)
- if err != nil {
- return err
- }
-
- if c.DefaultAuthorizationDecision == nil {
- s := defaultAuthorizationDecisionPath
- c.DefaultAuthorizationDecision = &s
- }
-
- _, err = ref.ParseDataPath(*c.DefaultAuthorizationDecision)
- if err != nil {
- return err
- }
-
- if c.Labels == nil {
- c.Labels = map[string]string{}
- }
-
- c.Labels["id"] = id
- c.Labels["version"] = version.Version
-
- return nil
-}
-
-// GetPersistenceDirectory returns the configured persistence directory, or $PWD/.opa if none is configured
-func (c Config) GetPersistenceDirectory() (string, error) {
- if c.PersistenceDirectory == nil {
- pwd, err := os.Getwd()
- if err != nil {
- return "", err
- }
- return filepath.Join(pwd, ".opa"), nil
- }
- return *c.PersistenceDirectory, nil
-}
-
-// ActiveConfig returns OPA's active configuration
-// with the credentials and crypto keys removed
-func (c *Config) ActiveConfig() (interface{}, error) {
- bs, err := json.Marshal(c)
- if err != nil {
- return nil, err
- }
-
- var result map[string]interface{}
- if err := util.UnmarshalJSON(bs, &result); err != nil {
- return nil, err
- }
- for k, e := range c.Extra {
- var v any
- if err := util.UnmarshalJSON(e, &v); err != nil {
- return nil, err
- }
- result[k] = v
- }
-
- if err := removeServiceCredentials(result["services"]); err != nil {
- return nil, err
- }
-
- if err := removeCryptoKeys(result["keys"]); err != nil {
- return nil, err
- }
-
- return result, nil
-}
-
-func removeServiceCredentials(x interface{}) error {
- switch x := x.(type) {
- case nil:
- return nil
- case []interface{}:
- for _, v := range x {
- err := removeKey(v, "credentials")
- if err != nil {
- return err
- }
- }
-
- case map[string]interface{}:
- for _, v := range x {
- err := removeKey(v, "credentials")
- if err != nil {
- return err
- }
- }
- default:
- return fmt.Errorf("illegal service config type: %T", x)
- }
-
- return nil
-}
-
-func removeCryptoKeys(x interface{}) error {
- switch x := x.(type) {
- case nil:
- return nil
- case map[string]interface{}:
- for _, v := range x {
- err := removeKey(v, "key", "private_key")
- if err != nil {
- return err
- }
- }
- default:
- return fmt.Errorf("illegal keys config type: %T", x)
- }
-
- return nil
-}
-
-func removeKey(x interface{}, keys ...string) error {
- val, ok := x.(map[string]interface{})
- if !ok {
- return fmt.Errorf("type assertion error")
- }
-
- for _, key := range keys {
- delete(val, key)
- }
-
- return nil
-}
-
-const (
- defaultDecisionPath = "/system/main"
- defaultAuthorizationDecisionPath = "/system/authz/allow"
-)
diff --git a/vendor/github.com/open-policy-agent/opa/format/format.go b/vendor/github.com/open-policy-agent/opa/format/format.go
deleted file mode 100644
index 43e5594669..0000000000
--- a/vendor/github.com/open-policy-agent/opa/format/format.go
+++ /dev/null
@@ -1,1640 +0,0 @@
-// Copyright 2017 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 format implements formatting of Rego source files.
-package format
-
-import (
- "bytes"
- "fmt"
- "regexp"
- "sort"
- "strings"
- "unicode"
-
- "github.com/open-policy-agent/opa/ast"
- "github.com/open-policy-agent/opa/internal/future"
- "github.com/open-policy-agent/opa/types"
-)
-
-// Opts lets you control the code formatting via `AstWithOpts()`.
-type Opts struct {
- // IgnoreLocations instructs the formatter not to use the AST nodes' locations
- // into account when laying out the code: notably, when the input is the result
- // of partial evaluation, arguments maybe have been shuffled around, but still
- // carry along their original source locations.
- IgnoreLocations bool
-
- // RegoVersion is the version of Rego to format code for.
- RegoVersion ast.RegoVersion
-
- // ParserOptions is the parser options used when parsing the module to be formatted.
- ParserOptions *ast.ParserOptions
-}
-
-// 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{})
-}
-
-func SourceWithOpts(filename string, src []byte, opts Opts) ([]byte, error) {
- var parserOpts ast.ParserOptions
- if opts.ParserOptions != nil {
- parserOpts = *opts.ParserOptions
- } else {
- if opts.RegoVersion == ast.RegoV1 {
- // If the rego version is V1, we need to parse it as such, to allow for future keywords not being imported.
- // Otherwise, we'll default to the default rego-version.
- parserOpts.RegoVersion = ast.RegoV1
- }
- }
-
- module, err := ast.ParseModuleWithOpts(filename, string(src), parserOpts)
- if err != nil {
- return nil, err
- }
-
- if opts.RegoVersion == ast.RegoV0CompatV1 || opts.RegoVersion == ast.RegoV1 {
- checkOpts := ast.NewRegoCheckOptions()
- // The module is parsed as v0, so we need to disable checks that will be automatically amended by the AstWithOpts call anyways.
- checkOpts.RequireIfKeyword = false
- checkOpts.RequireContainsKeyword = false
- checkOpts.RequireRuleBodyOrValue = false
- errors := ast.CheckRegoV1WithOptions(module, checkOpts)
- if len(errors) > 0 {
- return nil, errors
- }
- }
-
- formatted, err := AstWithOpts(module, opts)
- if err != nil {
- return nil, fmt.Errorf("%s: %v", filename, err)
- }
-
- return formatted, nil
-}
-
-// MustAst is a helper function to format a Rego AST element. If any errors
-// occurs this function will panic. This is mostly used for test
-func MustAst(x interface{}) []byte {
- bs, err := Ast(x)
- if err != nil {
- panic(err)
- }
- return bs
-}
-
-// MustAstWithOpts is a helper function to format a Rego AST element. If any errors
-// occurs this function will panic. This is mostly used for test
-func MustAstWithOpts(x interface{}, opts Opts) []byte {
- bs, err := AstWithOpts(x, opts)
- if err != nil {
- panic(err)
- }
- return bs
-}
-
-// Ast formats a Rego AST element. If the passed value is not a valid AST
-// element, Ast returns nil and an error. If AST nodes are missing locations
-// an arbitrary location will be used.
-func Ast(x interface{}) ([]byte, error) {
- return AstWithOpts(x, Opts{})
-}
-
-type fmtOpts struct {
- // When the future keyword "contains" is imported, all the pretty-printed
- // modules will use that format for partial sets.
- // NOTE(sr): For ref-head rules, this will be the default behaviour, since
- // we need "contains" to disambiguate complete rules from partial sets.
- contains bool
-
- // Same logic applies as for "contains": if `future.keywords.if` (or all
- // future keywords) is imported, we'll render rules that can use `if` with
- // `if`.
- ifs bool
-
- // We check all rule ref heads to see if any of them _requires_ support
- // for ref heads -- if they do, we'll print all of them in a different way
- // than if they don't.
- refHeads bool
-
- regoV1 bool
- futureKeywords []string
-}
-
-func (o fmtOpts) keywords() []string {
- if o.regoV1 {
- return ast.KeywordsV1[:]
- }
- kws := ast.KeywordsV0[:]
- return append(kws, o.futureKeywords...)
-}
-
-func AstWithOpts(x interface{}, 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)
-
- wildcards := map[ast.Var]*ast.Term{}
-
- // NOTE(sr): When the formatter encounters a call to internal.member_2
- // or internal.member_3, it will sugarize them into usage of the `in`
- // operator. It has to ensure that the proper future keyword import is
- // present.
- extraFutureKeywordImports := map[string]struct{}{}
-
- o := fmtOpts{}
-
- if opts.RegoVersion == ast.RegoV0CompatV1 || opts.RegoVersion == ast.RegoV1 {
- o.regoV1 = true
- o.ifs = true
- o.contains = true
- }
-
- // Preprocess the AST. Set any required defaults and calculate
- // values required for printing the formatted output.
- ast.WalkNodes(x, func(x ast.Node) bool {
- switch n := x.(type) {
- case ast.Body:
- if len(n) == 0 {
- return false
- }
- case *ast.Term:
- unmangleWildcardVar(wildcards, n)
-
- case *ast.Expr:
- switch {
- case n.IsCall() && ast.Member.Ref().Equal(n.Operator()) || ast.MemberWithKey.Ref().Equal(n.Operator()):
- extraFutureKeywordImports["in"] = struct{}{}
- case n.IsEvery():
- extraFutureKeywordImports["every"] = struct{}{}
- }
-
- case *ast.Import:
- if kw, ok := future.WhichFutureKeyword(n); ok {
- o.futureKeywords = append(o.futureKeywords, kw)
- }
-
- switch {
- case isRegoV1Compatible(n):
- o.contains = true
- o.ifs = true
- case future.IsAllFutureKeywords(n):
- o.contains = true
- o.ifs = true
- case future.IsFutureKeyword(n, "contains"):
- o.contains = true
- case future.IsFutureKeyword(n, "if"):
- o.ifs = true
- }
-
- case *ast.Rule:
- if len(n.Head.Ref()) > 2 {
- o.refHeads = true
- }
- if len(n.Head.Ref()) == 2 && n.Head.Key != nil && n.Head.Value == nil { // p.q contains "x"
- o.refHeads = true
- }
- }
-
- if opts.IgnoreLocations || x.Loc() == nil {
- x.SetLoc(defaultLocation(x))
- }
- return false
- })
-
- w := &writer{
- indent: "\t",
- errs: make([]*ast.Error, 0),
- fmtOpts: o,
- }
-
- switch x := x.(type) {
- case *ast.Module:
- if opts.RegoVersion == ast.RegoV1 {
- x.Imports = filterRegoV1Import(x.Imports)
- } else if opts.RegoVersion == ast.RegoV0CompatV1 {
- x.Imports = ensureRegoV1Import(x.Imports)
- }
-
- if opts.RegoVersion == ast.RegoV0CompatV1 || opts.RegoVersion == ast.RegoV1 || moduleIsRegoV1Compatible(x) {
- x.Imports = future.FilterFutureImports(x.Imports)
- } else {
- for kw := range extraFutureKeywordImports {
- x.Imports = ensureFutureKeywordImport(x.Imports, kw)
- }
- }
- w.writeModule(x)
- case *ast.Package:
- w.writePackage(x, nil)
- case *ast.Import:
- w.writeImports([]*ast.Import{x}, nil)
- case *ast.Rule:
- w.writeRule(x, false /* isElse */, nil)
- case *ast.Head:
- w.writeHead(x,
- false, // isDefault
- false, // isExpandedConst
- nil)
- case ast.Body:
- w.writeBody(x, nil)
- case *ast.Expr:
- w.writeExpr(x, nil)
- case *ast.With:
- w.writeWith(x, nil, false)
- case *ast.Term:
- w.writeTerm(x, nil)
- case ast.Value:
- w.writeTerm(&ast.Term{Value: x, Location: &ast.Location{}}, nil)
- case *ast.Comment:
- w.writeComments([]*ast.Comment{x})
- default:
- return nil, fmt.Errorf("not an ast element: %v", x)
- }
-
- if len(w.errs) > 0 {
- return nil, w.errs
- }
- return squashTrailingNewlines(w.buf.Bytes()), nil
-}
-
-func unmangleWildcardVar(wildcards map[ast.Var]*ast.Term, n *ast.Term) {
-
- v, ok := n.Value.(ast.Var)
- if !ok || !v.IsWildcard() {
- return
- }
-
- first, ok := wildcards[v]
- if !ok {
- wildcards[v] = n
- return
- }
-
- w := v[len(ast.WildcardPrefix):]
-
- // Prepend an underscore to ensure the variable will parse.
- if len(w) == 0 || w[0] != '_' {
- w = "_" + w
- }
-
- if first != nil {
- first.Value = w
- wildcards[v] = nil
- }
-
- n.Value = w
-}
-
-func squashTrailingNewlines(bs []byte) []byte {
- if bytes.HasSuffix(bs, []byte("\n")) {
- return append(bytes.TrimRight(bs, "\n"), '\n')
- }
- return bs
-}
-
-func defaultLocation(x ast.Node) *ast.Location {
- return ast.NewLocation([]byte(x.String()), defaultLocationFile, 1, 1)
-}
-
-type writer struct {
- buf bytes.Buffer
-
- indent string
- level int
- inline bool
- beforeEnd *ast.Comment
- delay bool
- errs ast.Errors
- fmtOpts fmtOpts
-}
-
-func (w *writer) writeModule(module *ast.Module) {
- var pkg *ast.Package
- var others []interface{}
- var comments []*ast.Comment
- visitor := ast.NewGenericVisitor(func(x interface{}) bool {
- switch x := x.(type) {
- case *ast.Comment:
- comments = append(comments, x)
- return true
- case *ast.Import, *ast.Rule:
- others = append(others, x)
- return true
- case *ast.Package:
- pkg = x
- return true
- default:
- return false
- }
- })
- visitor.Walk(module)
-
- sort.Slice(comments, func(i, j int) bool {
- return locLess(comments[i], comments[j])
- })
-
- sort.Slice(others, func(i, j int) bool {
- return locLess(others[i], others[j])
- })
-
- comments = trimTrailingWhitespaceInComments(comments)
-
- comments = w.writePackage(pkg, comments)
- var imports []*ast.Import
- var rules []*ast.Rule
- for len(others) > 0 {
- imports, others = gatherImports(others)
- comments = w.writeImports(imports, comments)
- rules, others = gatherRules(others)
- comments = w.writeRules(rules, comments)
- }
-
- for i, c := range comments {
- w.writeLine(c.String())
- if i == len(comments)-1 {
- w.write("\n")
- }
- }
-}
-
-func trimTrailingWhitespaceInComments(comments []*ast.Comment) []*ast.Comment {
- for _, c := range comments {
- c.Text = bytes.TrimRightFunc(c.Text, unicode.IsSpace)
- }
-
- return comments
-}
-
-func (w *writer) writePackage(pkg *ast.Package, comments []*ast.Comment) []*ast.Comment {
- comments = w.insertComments(comments, pkg.Location)
-
- w.startLine()
-
- // Omit head as all packages have the DefaultRootDocument prepended at parse time.
- path := make(ast.Ref, len(pkg.Path)-1)
- path[0] = ast.VarTerm(string(pkg.Path[1].Value.(ast.String)))
- copy(path[1:], pkg.Path[2:])
-
- w.write("package ")
- w.writeRef(path)
-
- w.blankLine()
-
- return comments
-}
-
-func (w *writer) writeComments(comments []*ast.Comment) {
- for i := 0; i < len(comments); i++ {
- if i > 0 && locCmp(comments[i], comments[i-1]) > 1 {
- w.blankLine()
- }
- w.writeLine(comments[i].String())
- }
-}
-
-func (w *writer) writeRules(rules []*ast.Rule, comments []*ast.Comment) []*ast.Comment {
- for _, rule := range rules {
- comments = w.insertComments(comments, rule.Location)
- comments = w.writeRule(rule, false, comments)
- w.blankLine()
- }
- return comments
-}
-
-func (w *writer) writeRule(rule *ast.Rule, isElse bool, comments []*ast.Comment) []*ast.Comment {
- if rule == nil {
- return comments
- }
-
- if !isElse {
- w.startLine()
- }
-
- if rule.Default {
- w.write("default ")
- }
-
- // OPA transforms lone bodies like `foo = {"a": "b"}` into rules of the form
- // `foo = {"a": "b"} { true }` in the AST. We want to preserve that notation
- // in the formatted code instead of expanding the bodies into rules, so we
- // pretend that the rule has no body in this case.
- isExpandedConst := rule.Body.Equal(ast.NewBody(ast.NewExpr(ast.BooleanTerm(true)))) && rule.Else == nil
-
- comments = w.writeHead(rule.Head, rule.Default, isExpandedConst, comments)
-
- // this excludes partial sets UNLESS `contains` is used
- partialSetException := w.fmtOpts.contains || rule.Head.Value != nil
-
- if len(rule.Body) == 0 || isExpandedConst {
- w.endLine()
- return comments
- }
-
- if (w.fmtOpts.regoV1 || w.fmtOpts.ifs) && partialSetException {
- w.write(" if")
- if len(rule.Body) == 1 {
- if rule.Body[0].Location.Row == rule.Head.Location.Row {
- w.write(" ")
- comments = w.writeExpr(rule.Body[0], comments)
- w.endLine()
- if rule.Else != nil {
- comments = w.writeElse(rule, comments)
- }
- return comments
- }
- }
- }
- w.write(" {")
- w.endLine()
- w.up()
-
- comments = w.writeBody(rule.Body, comments)
-
- var closeLoc *ast.Location
-
- if len(rule.Head.Args) > 0 {
- closeLoc = closingLoc('(', ')', '{', '}', rule.Location)
- } else if rule.Head.Key != nil {
- closeLoc = closingLoc('[', ']', '{', '}', rule.Location)
- } else {
- closeLoc = closingLoc(0, 0, '{', '}', rule.Location)
- }
-
- comments = w.insertComments(comments, closeLoc)
-
- w.down()
- w.startLine()
- w.write("}")
- if rule.Else != nil {
- comments = w.writeElse(rule, comments)
- }
- return comments
-}
-
-func (w *writer) writeElse(rule *ast.Rule, comments []*ast.Comment) []*ast.Comment {
- // If there was nothing else on the line before the "else" starts
- // then preserve this style of else block, otherwise it will be
- // started as an "inline" else eg:
- //
- // p {
- // ...
- // }
- //
- // else {
- // ...
- // }
- //
- // versus
- //
- // p {
- // ...
- // } else {
- // ...
- // }
- //
- // Note: This doesn't use the `close` as it currently isn't accurate for all
- // types of values. Checking the actual line text is the most consistent approach.
- wasInline := false
- ruleLines := bytes.Split(rule.Location.Text, []byte("\n"))
- relativeElseRow := rule.Else.Location.Row - rule.Location.Row
- if relativeElseRow > 0 && relativeElseRow < len(ruleLines) {
- elseLine := ruleLines[relativeElseRow]
- if !bytes.HasPrefix(bytes.TrimSpace(elseLine), []byte("else")) {
- wasInline = true
- }
- }
-
- // If there are any comments between the closing brace of the previous rule and the start
- // of the else block we will always insert a new blank line between them.
- hasCommentAbove := len(comments) > 0 && comments[0].Location.Row-rule.Else.Head.Location.Row < 0 || w.beforeEnd != nil
-
- if !hasCommentAbove && wasInline {
- w.write(" ")
- } else {
- w.blankLine()
- w.startLine()
- }
-
- rule.Else.Head.Name = "else" // NOTE(sr): whaaat
- rule.Else.Head.Reference = ast.Ref{ast.VarTerm("else")}
- rule.Else.Head.Args = nil
- comments = w.insertComments(comments, rule.Else.Head.Location)
-
- if hasCommentAbove && !wasInline {
- // The comments would have ended the line, be sure to start one again
- // before writing the rest of the "else" rule.
- w.startLine()
- }
-
- // For backwards compatibility adjust the rule head value location
- // TODO: Refactor the logic for inserting comments, or special
- // case comments in a rule head value so this can be removed
- if rule.Else.Head.Value != nil {
- rule.Else.Head.Value.Location = rule.Else.Head.Location
- }
-
- return w.writeRule(rule.Else, true, comments)
-}
-
-func (w *writer) writeHead(head *ast.Head, isDefault, isExpandedConst bool, comments []*ast.Comment) []*ast.Comment {
- ref := head.Ref()
- if head.Key != nil && head.Value == nil && !head.HasDynamicRef() {
- ref = ref.GroundPrefix()
- }
- if w.fmtOpts.refHeads || len(ref) == 1 {
- w.writeRef(ref)
- } else {
- w.write(ref[0].String())
- w.write("[")
- w.write(ref[1].String())
- w.write("]")
- }
-
- if len(head.Args) > 0 {
- w.write("(")
- var args []interface{}
- for _, arg := range head.Args {
- args = append(args, arg)
- }
- comments = w.writeIterable(args, head.Location, closingLoc(0, 0, '(', ')', head.Location), comments, w.listWriter())
- w.write(")")
- }
- if head.Key != nil {
- if w.fmtOpts.contains && head.Value == nil {
- w.write(" contains ")
- comments = w.writeTerm(head.Key, comments)
- } else if head.Value == nil { // no `if` for p[x] notation
- w.write("[")
- comments = w.writeTerm(head.Key, comments)
- w.write("]")
- }
- }
-
- if head.Value != nil &&
- (head.Key != nil || ast.Compare(head.Value, ast.BooleanTerm(true)) != 0 || isExpandedConst || isDefault) {
-
- // in rego v1, explicitly print value for ref-head constants that aren't partial set assignments, e.g.:
- // * a -> parser error, won't reach here
- // * a.b -> a contains "b"
- // * a.b.c -> a.b.c := true
- // * a.b.c.d -> a.b.c.d := true
- isRegoV1RefConst := w.fmtOpts.regoV1 && isExpandedConst && head.Key == nil && len(head.Args) == 0
-
- if head.Location == head.Value.Location &&
- head.Name != "else" &&
- ast.Compare(head.Value, ast.BooleanTerm(true)) == 0 &&
- !isRegoV1RefConst {
- // If the value location is the same as the location of the head,
- // we know that the value is generated, i.e. f(1)
- // Don't print the value (` = true`) as it is implied.
- return comments
- }
-
- if head.Assign || w.fmtOpts.regoV1 {
- // preserve assignment operator, and enforce it if formatting for Rego v1
- w.write(" := ")
- } else {
- w.write(" = ")
- }
- comments = w.writeTerm(head.Value, comments)
- }
- return comments
-}
-
-func (w *writer) insertComments(comments []*ast.Comment, loc *ast.Location) []*ast.Comment {
- before, at, comments := partitionComments(comments, loc)
- w.writeComments(before)
- if len(before) > 0 && loc.Row-before[len(before)-1].Location.Row > 1 {
- w.blankLine()
- }
-
- w.beforeLineEnd(at)
- return comments
-}
-
-func (w *writer) writeBody(body ast.Body, comments []*ast.Comment) []*ast.Comment {
- comments = w.insertComments(comments, body.Loc())
- for i, expr := range body {
- // Insert a blank line in before the expression if it was not right
- // after the previous expression.
- if i > 0 {
- lastRow := body[i-1].Location.Row
- for _, c := range body[i-1].Location.Text {
- if c == '\n' {
- lastRow++
- }
- }
- if expr.Location.Row > lastRow+1 {
- w.blankLine()
- }
- }
- w.startLine()
-
- comments = w.writeExpr(expr, comments)
- w.endLine()
- }
- return comments
-}
-
-func (w *writer) writeExpr(expr *ast.Expr, comments []*ast.Comment) []*ast.Comment {
- comments = w.insertComments(comments, expr.Location)
- if !w.inline {
- w.startLine()
- }
-
- if expr.Negated {
- w.write("not ")
- }
-
- switch t := expr.Terms.(type) {
- case *ast.SomeDecl:
- comments = w.writeSomeDecl(t, comments)
- case *ast.Every:
- comments = w.writeEvery(t, comments)
- case []*ast.Term:
- comments = w.writeFunctionCall(expr, comments)
- case *ast.Term:
- comments = w.writeTerm(t, comments)
- }
-
- var indented bool
- for i, with := range expr.With {
- if i == 0 || with.Location.Row == expr.With[i-1].Location.Row { // we're on the same line
- comments = w.writeWith(with, comments, false)
- } else { // we're on a new line
- if !indented {
- indented = true
-
- w.up()
- defer w.down()
- }
- w.endLine()
- w.startLine()
- comments = w.writeWith(with, comments, true)
- }
- }
-
- return comments
-}
-
-func (w *writer) writeSomeDecl(decl *ast.SomeDecl, comments []*ast.Comment) []*ast.Comment {
- comments = w.insertComments(comments, decl.Location)
- w.write("some ")
-
- row := decl.Location.Row
-
- for i, term := range decl.Symbols {
- switch val := term.Value.(type) {
- case ast.Var:
- if term.Location.Row > row {
- w.endLine()
- w.startLine()
- w.write(w.indent)
- row = term.Location.Row
- } else if i > 0 {
- w.write(" ")
- }
-
- comments = w.writeTerm(term, comments)
-
- if i < len(decl.Symbols)-1 {
- w.write(",")
- }
- case ast.Call:
- comments = w.writeInOperator(false, val[1:], comments, decl.Location, ast.BuiltinMap[val[0].String()].Decl)
- }
- }
-
- return comments
-}
-
-func (w *writer) writeEvery(every *ast.Every, comments []*ast.Comment) []*ast.Comment {
- comments = w.insertComments(comments, every.Location)
- w.write("every ")
- if every.Key != nil {
- comments = w.writeTerm(every.Key, comments)
- w.write(", ")
- }
- comments = w.writeTerm(every.Value, comments)
- w.write(" in ")
- comments = w.writeTerm(every.Domain, comments)
- w.write(" {")
- comments = w.writeComprehensionBody('{', '}', every.Body, every.Loc(), every.Loc(), comments)
-
- if len(every.Body) == 1 &&
- every.Body[0].Location.Row == every.Location.Row {
- w.write(" ")
- }
- w.write("}")
- return comments
-}
-
-func (w *writer) writeFunctionCall(expr *ast.Expr, comments []*ast.Comment) []*ast.Comment {
-
- terms := expr.Terms.([]*ast.Term)
- operator := terms[0].Value.String()
-
- switch operator {
- case ast.Member.Name, ast.MemberWithKey.Name:
- return w.writeInOperator(false, terms[1:], comments, terms[0].Location, ast.BuiltinMap[terms[0].String()].Decl)
- }
-
- bi, ok := ast.BuiltinMap[operator]
- if !ok || bi.Infix == "" {
- return w.writeFunctionCallPlain(terms, comments)
- }
-
- numDeclArgs := len(bi.Decl.Args())
- numCallArgs := len(terms) - 1
-
- switch numCallArgs {
- case numDeclArgs: // Print infix where result is unassigned (e.g., x != y)
- comments = w.writeTerm(terms[1], comments)
- w.write(" " + bi.Infix + " ")
- return w.writeTerm(terms[2], comments)
-
- case numDeclArgs + 1: // Print infix where result is assigned (e.g., z = x + y)
- comments = w.writeTerm(terms[3], comments)
- w.write(" " + ast.Equality.Infix + " ")
- comments = w.writeTerm(terms[1], comments)
- w.write(" " + bi.Infix + " ")
- comments = w.writeTerm(terms[2], comments)
- return comments
- }
- // NOTE(Trolloldem): in this point we are operating with a built-in function with the
- // wrong arity even when the assignment notation is used
- w.errs = append(w.errs, ArityFormatMismatchError(terms[1:], terms[0].String(), terms[0].Location, bi.Decl))
- return w.writeFunctionCallPlain(terms, comments)
-}
-
-func (w *writer) writeFunctionCallPlain(terms []*ast.Term, comments []*ast.Comment) []*ast.Comment {
- w.write(terms[0].String() + "(")
- defer w.write(")")
- args := make([]interface{}, len(terms)-1)
- for i, t := range terms[1:] {
- args[i] = t
- }
- loc := terms[0].Location
- return w.writeIterable(args, loc, closingLoc(0, 0, '(', ')', loc), comments, w.listWriter())
-}
-
-func (w *writer) writeWith(with *ast.With, comments []*ast.Comment, indented bool) []*ast.Comment {
- comments = w.insertComments(comments, with.Location)
- if !indented {
- w.write(" ")
- }
- w.write("with ")
- comments = w.writeTerm(with.Target, comments)
- w.write(" as ")
- return w.writeTerm(with.Value, comments)
-}
-
-func (w *writer) writeTerm(term *ast.Term, comments []*ast.Comment) []*ast.Comment {
- return w.writeTermParens(false, term, comments)
-}
-
-func (w *writer) writeTermParens(parens bool, term *ast.Term, comments []*ast.Comment) []*ast.Comment {
- comments = w.insertComments(comments, term.Location)
- if !w.inline {
- w.startLine()
- }
-
- switch x := term.Value.(type) {
- case ast.Ref:
- w.writeRef(x)
- case ast.Object:
- comments = w.writeObject(x, term.Location, comments)
- case *ast.Array:
- comments = w.writeArray(x, term.Location, comments)
- case ast.Set:
- comments = w.writeSet(x, term.Location, comments)
- case *ast.ArrayComprehension:
- comments = w.writeArrayComprehension(x, term.Location, comments)
- case *ast.ObjectComprehension:
- comments = w.writeObjectComprehension(x, term.Location, comments)
- case *ast.SetComprehension:
- comments = w.writeSetComprehension(x, term.Location, comments)
- case ast.String:
- if term.Location.Text[0] == '`' {
- // To preserve raw strings, we need to output the original text,
- // not what x.String() would give us.
- w.write(string(term.Location.Text))
- } else {
- w.write(x.String())
- }
- case ast.Var:
- w.write(w.formatVar(x))
- case ast.Call:
- comments = w.writeCall(parens, x, term.Location, comments)
- case fmt.Stringer:
- w.write(x.String())
- }
-
- if !w.inline {
- w.startLine()
- }
- return comments
-}
-
-func (w *writer) writeRef(x ast.Ref) {
- if len(x) > 0 {
- parens := false
- _, ok := x[0].Value.(ast.Call)
- if ok {
- parens = x[0].Location.Text[0] == 40 // Starts with "("
- }
- w.writeTermParens(parens, x[0], nil)
- path := x[1:]
- for _, t := range path {
- switch p := t.Value.(type) {
- case ast.String:
- w.writeRefStringPath(p)
- case ast.Var:
- w.writeBracketed(w.formatVar(p))
- default:
- w.write("[")
- w.writeTerm(t, nil)
- w.write("]")
- }
- }
- }
-}
-
-func (w *writer) writeBracketed(str string) {
- w.write("[" + str + "]")
-}
-
-var varRegexp = regexp.MustCompile("^[[:alpha:]_][[:alpha:][:digit:]_]*$")
-
-func (w *writer) writeRefStringPath(s ast.String) {
- str := string(s)
- if varRegexp.MatchString(str) && !ast.IsInKeywords(str, w.fmtOpts.keywords()) {
- w.write("." + str)
- } else {
- w.writeBracketed(s.String())
- }
-}
-
-func (w *writer) formatVar(v ast.Var) string {
- if v.IsWildcard() {
- return ast.Wildcard.String()
- }
- return v.String()
-}
-
-func (w *writer) writeCall(parens bool, x ast.Call, loc *ast.Location, comments []*ast.Comment) []*ast.Comment {
- bi, ok := ast.BuiltinMap[x[0].String()]
- if !ok || bi.Infix == "" {
- return w.writeFunctionCallPlain(x, comments)
- }
-
- if bi.Infix == "in" {
- // NOTE(sr): `in` requires special handling, mirroring what happens in the parser,
- // since there can be one or two lhs arguments.
- return w.writeInOperator(true, x[1:], comments, loc, bi.Decl)
- }
-
- // TODO(tsandall): improve to consider precedence?
- if parens {
- w.write("(")
- }
-
- // NOTE(Trolloldem): writeCall is only invoked when the function call is a term
- // of another function. The only valid arity is the one of the
- // built-in function
- if len(bi.Decl.Args()) != len(x)-1 {
- w.errs = append(w.errs, ArityFormatMismatchError(x[1:], x[0].String(), loc, bi.Decl))
- return comments
- }
-
- comments = w.writeTermParens(true, x[1], comments)
- w.write(" " + bi.Infix + " ")
- comments = w.writeTermParens(true, x[2], comments)
- if parens {
- w.write(")")
- }
-
- return comments
-}
-
-func (w *writer) writeInOperator(parens bool, operands []*ast.Term, comments []*ast.Comment, loc *ast.Location, f *types.Function) []*ast.Comment {
-
- if len(operands) != len(f.Args()) {
- // The number of operands does not math the arity of the `in` operator
- operator := ast.Member.Name
- if len(f.Args()) == 3 {
- operator = ast.MemberWithKey.Name
- }
- w.errs = append(w.errs, ArityFormatMismatchError(operands, operator, loc, f))
- return comments
- }
- kw := "in"
- switch len(operands) {
- case 2:
- comments = w.writeTermParens(true, operands[0], comments)
- w.write(" ")
- w.write(kw)
- w.write(" ")
- comments = w.writeTermParens(true, operands[1], comments)
- case 3:
- if parens {
- w.write("(")
- defer w.write(")")
- }
- comments = w.writeTermParens(true, operands[0], comments)
- w.write(", ")
- comments = w.writeTermParens(true, operands[1], comments)
- w.write(" ")
- w.write(kw)
- w.write(" ")
- comments = w.writeTermParens(true, operands[2], comments)
- }
- return comments
-}
-
-func (w *writer) writeObject(obj ast.Object, loc *ast.Location, comments []*ast.Comment) []*ast.Comment {
- w.write("{")
- defer w.write("}")
-
- var s []interface{}
- obj.Foreach(func(k, v *ast.Term) {
- s = append(s, ast.Item(k, v))
- })
- return w.writeIterable(s, loc, closingLoc(0, 0, '{', '}', loc), comments, w.objectWriter())
-}
-
-func (w *writer) writeArray(arr *ast.Array, loc *ast.Location, comments []*ast.Comment) []*ast.Comment {
- w.write("[")
- defer w.write("]")
-
- var s []interface{}
- arr.Foreach(func(t *ast.Term) {
- s = append(s, t)
- })
- return w.writeIterable(s, loc, closingLoc(0, 0, '[', ']', loc), comments, w.listWriter())
-}
-
-func (w *writer) writeSet(set ast.Set, loc *ast.Location, comments []*ast.Comment) []*ast.Comment {
-
- if set.Len() == 0 {
- w.write("set()")
- return w.insertComments(comments, closingLoc(0, 0, '(', ')', loc))
- }
-
- w.write("{")
- defer w.write("}")
-
- var s []interface{}
- set.Foreach(func(t *ast.Term) {
- s = append(s, t)
- })
- return w.writeIterable(s, loc, closingLoc(0, 0, '{', '}', loc), comments, w.listWriter())
-}
-
-func (w *writer) writeArrayComprehension(arr *ast.ArrayComprehension, loc *ast.Location, comments []*ast.Comment) []*ast.Comment {
- w.write("[")
- defer w.write("]")
-
- return w.writeComprehension('[', ']', arr.Term, arr.Body, loc, comments)
-}
-
-func (w *writer) writeSetComprehension(set *ast.SetComprehension, loc *ast.Location, comments []*ast.Comment) []*ast.Comment {
- w.write("{")
- defer w.write("}")
-
- return w.writeComprehension('{', '}', set.Term, set.Body, loc, comments)
-}
-
-func (w *writer) writeObjectComprehension(object *ast.ObjectComprehension, loc *ast.Location, comments []*ast.Comment) []*ast.Comment {
- w.write("{")
- defer w.write("}")
-
- object.Value.Location = object.Key.Location // Ensure the value is not written on the next line.
- if object.Key.Location.Row-loc.Row > 1 {
- w.endLine()
- w.startLine()
- }
-
- comments = w.writeTerm(object.Key, comments)
- w.write(": ")
- return w.writeComprehension('{', '}', object.Value, object.Body, loc, comments)
-}
-
-func (w *writer) writeComprehension(open, close byte, term *ast.Term, body ast.Body, loc *ast.Location, comments []*ast.Comment) []*ast.Comment {
- if term.Location.Row-loc.Row >= 1 {
- w.endLine()
- w.startLine()
- }
-
- parens := false
- _, ok := term.Value.(ast.Call)
- if ok {
- parens = term.Location.Text[0] == 40 // Starts with "("
- }
- comments = w.writeTermParens(parens, term, comments)
- w.write(" |")
-
- return w.writeComprehensionBody(open, close, body, term.Location, loc, comments)
-}
-
-func (w *writer) writeComprehensionBody(open, close byte, body ast.Body, term, compr *ast.Location, comments []*ast.Comment) []*ast.Comment {
- exprs := make([]interface{}, 0, len(body))
- for _, expr := range body {
- exprs = append(exprs, expr)
- }
- lines := groupIterable(exprs, term)
-
- if body.Loc().Row-term.Row > 0 || len(lines) > 1 {
- w.endLine()
- w.up()
- defer w.startLine()
- defer w.down()
-
- comments = w.writeBody(body, comments)
- } else {
- w.write(" ")
- i := 0
- for ; i < len(body)-1; i++ {
- comments = w.writeExpr(body[i], comments)
- w.write("; ")
- }
- comments = w.writeExpr(body[i], comments)
- }
-
- return w.insertComments(comments, closingLoc(0, 0, open, close, compr))
-}
-
-func (w *writer) writeImports(imports []*ast.Import, comments []*ast.Comment) []*ast.Comment {
- m, comments := mapImportsToComments(imports, comments)
-
- groups := groupImports(imports)
- for _, group := range groups {
- comments = w.insertComments(comments, group[0].Loc())
-
- // Sort imports within a newline grouping.
- sort.Slice(group, func(i, j int) bool {
- a := group[i]
- b := group[j]
- return a.Compare(b) < 0
- })
- for _, i := range group {
- w.startLine()
- w.writeImport(i)
- if c, ok := m[i]; ok {
- w.write(" " + c.String())
- }
- w.endLine()
- }
- w.blankLine()
- }
-
- return comments
-}
-
-func (w *writer) writeImport(imp *ast.Import) {
- path := imp.Path.Value.(ast.Ref)
-
- buf := []string{"import"}
-
- if _, ok := future.WhichFutureKeyword(imp); ok {
- // We don't want to wrap future.keywords imports in parens, so we create a new writer that doesn't
- w2 := writer{
- buf: bytes.Buffer{},
- }
- w2.writeRef(path)
- buf = append(buf, w2.buf.String())
- } else {
- buf = append(buf, path.String())
- }
-
- if len(imp.Alias) > 0 {
- buf = append(buf, "as "+imp.Alias.String())
- }
- w.write(strings.Join(buf, " "))
-}
-
-type entryWriter func(interface{}, []*ast.Comment) []*ast.Comment
-
-func (w *writer) writeIterable(elements []interface{}, last *ast.Location, close *ast.Location, comments []*ast.Comment, fn entryWriter) []*ast.Comment {
- lines := groupIterable(elements, last)
- if len(lines) > 1 {
- w.delayBeforeEnd()
- w.startMultilineSeq()
- }
-
- i := 0
- for ; i < len(lines)-1; i++ {
- comments = w.writeIterableLine(lines[i], comments, fn)
- w.write(",")
-
- w.endLine()
- w.startLine()
- }
-
- comments = w.writeIterableLine(lines[i], comments, fn)
-
- if len(lines) > 1 {
- w.write(",")
- w.endLine()
- comments = w.insertComments(comments, close)
- w.down()
- w.startLine()
- }
-
- return comments
-}
-
-func (w *writer) writeIterableLine(elements []interface{}, comments []*ast.Comment, fn entryWriter) []*ast.Comment {
- if len(elements) == 0 {
- return comments
- }
-
- i := 0
- for ; i < len(elements)-1; i++ {
- comments = fn(elements[i], comments)
- w.write(", ")
- }
-
- return fn(elements[i], comments)
-}
-
-func (w *writer) objectWriter() entryWriter {
- return func(x interface{}, comments []*ast.Comment) []*ast.Comment {
- entry := x.([2]*ast.Term)
-
- call, isCall := entry[0].Value.(ast.Call)
-
- paren := false
- if isCall && ast.Or.Ref().Equal(call[0].Value) && entry[0].Location.Text[0] == 40 { // Starts with "("
- paren = true
- w.write("(")
- }
-
- comments = w.writeTerm(entry[0], comments)
- if paren {
- w.write(")")
- }
-
- w.write(": ")
-
- call, isCall = entry[1].Value.(ast.Call)
- if isCall && ast.Or.Ref().Equal(call[0].Value) && entry[1].Location.Text[0] == 40 { // Starts with "("
- w.write("(")
- defer w.write(")")
- }
-
- return w.writeTerm(entry[1], comments)
- }
-}
-
-func (w *writer) listWriter() entryWriter {
- return func(x interface{}, comments []*ast.Comment) []*ast.Comment {
- t, ok := x.(*ast.Term)
- if ok {
- call, isCall := t.Value.(ast.Call)
- if isCall && ast.Or.Ref().Equal(call[0].Value) && t.Location.Text[0] == 40 { // Starts with "("
- w.write("(")
- defer w.write(")")
- }
- }
-
- return w.writeTerm(t, comments)
- }
-}
-
-// groupIterable will group the `elements` slice into slices according to their
-// location: anything on the same line will be put into a slice.
-func groupIterable(elements []interface{}, last *ast.Location) [][]interface{} {
- // Generated vars occur in the AST when we're rendering the result of
- // partial evaluation in a bundle build with optimization.
- // Those variables, and wildcard variables have the "default location",
- // set in `Ast()`). That is no proper file location, and the grouping
- // based on source location will yield a bad result.
- // Another case is generated variables: they do have proper file locations,
- // but their row/col information may no longer match their AST location.
- // So, for generated variables, we also don't trust the location, but
- // keep them ungrouped.
- def := false // default location found?
- for _, elem := range elements {
- ast.WalkTerms(elem, func(t *ast.Term) bool {
- if t.Location.File == defaultLocationFile {
- def = true
- return true
- }
- return false
- })
- ast.WalkVars(elem, func(v ast.Var) bool {
- if v.IsGenerated() {
- def = true
- return true
- }
- return false
- })
- if def { // return as-is
- return [][]interface{}{elements}
- }
- }
- sort.Slice(elements, func(i, j int) bool {
- return locLess(elements[i], elements[j])
- })
-
- var lines [][]interface{}
- cur := make([]interface{}, 0, len(elements))
- for i, t := range elements {
- elem := t
- loc := getLoc(elem)
- lineDiff := loc.Row - last.Row
- if lineDiff > 0 && i > 0 {
- lines = append(lines, cur)
- cur = nil
- }
-
- last = loc
- cur = append(cur, elem)
- }
- return append(lines, cur)
-}
-
-func mapImportsToComments(imports []*ast.Import, comments []*ast.Comment) (map[*ast.Import]*ast.Comment, []*ast.Comment) {
- var leftovers []*ast.Comment
- m := map[*ast.Import]*ast.Comment{}
-
- for _, c := range comments {
- matched := false
- for _, i := range imports {
- if c.Loc().Row == i.Loc().Row {
- m[i] = c
- matched = true
- break
- }
- }
- if !matched {
- leftovers = append(leftovers, c)
- }
- }
-
- return m, leftovers
-}
-
-func groupImports(imports []*ast.Import) [][]*ast.Import {
- switch len(imports) { // shortcuts
- case 0:
- return nil
- case 1:
- return [][]*ast.Import{imports}
- }
- // there are >=2 imports to group
-
- var groups [][]*ast.Import
- group := []*ast.Import{imports[0]}
-
- for _, i := range imports[1:] {
- last := group[len(group)-1]
-
- // nil-location imports have been sorted up to come first
- if i.Loc() != nil && last.Loc() != nil && // first import with a location, or
- i.Loc().Row-last.Loc().Row > 1 { // more than one row apart from previous import
-
- // start a new group
- groups = append(groups, group)
- group = []*ast.Import{}
- }
- group = append(group, i)
- }
- if len(group) > 0 {
- groups = append(groups, group)
- }
-
- return groups
-}
-
-func partitionComments(comments []*ast.Comment, l *ast.Location) (before []*ast.Comment, at *ast.Comment, after []*ast.Comment) {
- for _, c := range comments {
- switch cmp := c.Location.Row - l.Row; {
- case cmp < 0:
- before = append(before, c)
- case cmp > 0:
- after = append(after, c)
- case cmp == 0:
- at = c
- }
- }
-
- return before, at, after
-}
-
-func gatherImports(others []interface{}) (imports []*ast.Import, rest []interface{}) {
- i := 0
-loop:
- for ; i < len(others); i++ {
- switch x := others[i].(type) {
- case *ast.Import:
- imports = append(imports, x)
- case *ast.Rule:
- break loop
- }
- }
- return imports, others[i:]
-}
-
-func gatherRules(others []interface{}) (rules []*ast.Rule, rest []interface{}) {
- i := 0
-loop:
- for ; i < len(others); i++ {
- switch x := others[i].(type) {
- case *ast.Rule:
- rules = append(rules, x)
- case *ast.Import:
- break loop
- }
- }
- return rules, others[i:]
-}
-
-func locLess(a, b interface{}) bool {
- return locCmp(a, b) < 0
-}
-
-func locCmp(a, b interface{}) int {
- al := getLoc(a)
- bl := getLoc(b)
- switch {
- case al == nil && bl == nil:
- return 0
- case al == nil:
- return -1
- case bl == nil:
- return 1
- }
-
- if cmp := al.Row - bl.Row; cmp != 0 {
- return cmp
-
- }
- return al.Col - bl.Col
-}
-
-func getLoc(x interface{}) *ast.Location {
- switch x := x.(type) {
- case ast.Node: // *ast.Head, *ast.Expr, *ast.With, *ast.Term
- return x.Loc()
- case *ast.Location:
- return x
- case [2]*ast.Term: // Special case to allow for easy printing of objects.
- return x[0].Location
- default:
- panic("Not reached")
- }
-}
-
-func closingLoc(skipOpen, skipClose, open, close byte, loc *ast.Location) *ast.Location {
- i, offset := 0, 0
-
- // Skip past parens/brackets/braces in rule heads.
- if skipOpen > 0 {
- i, offset = skipPast(skipOpen, skipClose, loc)
- }
-
- for ; i < len(loc.Text); i++ {
- if loc.Text[i] == open {
- break
- }
- }
-
- if i >= len(loc.Text) {
- return &ast.Location{Row: -1}
- }
-
- state := 1
- for state > 0 {
- i++
- if i >= len(loc.Text) {
- return &ast.Location{Row: -1}
- }
-
- switch loc.Text[i] {
- case open:
- state++
- case close:
- state--
- case '\n':
- offset++
- }
- }
-
- return &ast.Location{Row: loc.Row + offset}
-}
-
-func skipPast(open, close byte, loc *ast.Location) (int, int) {
- i := 0
- for ; i < len(loc.Text); i++ {
- if loc.Text[i] == open {
- break
- }
- }
-
- state := 1
- offset := 0
- for state > 0 {
- i++
- if i >= len(loc.Text) {
- return i, offset
- }
-
- switch loc.Text[i] {
- case open:
- state++
- case close:
- state--
- case '\n':
- offset++
- }
- }
-
- return i, offset
-}
-
-// startLine begins a line with the current indentation level.
-func (w *writer) startLine() {
- w.inline = true
- for i := 0; i < w.level; i++ {
- w.write(w.indent)
- }
-}
-
-// endLine ends a line with a newline.
-func (w *writer) endLine() {
- w.inline = false
- if w.beforeEnd != nil && !w.delay {
- w.write(" " + w.beforeEnd.String())
- w.beforeEnd = nil
- }
- w.delay = false
- w.write("\n")
-}
-
-// beforeLineEnd registers a comment to be printed at the end of the current line.
-func (w *writer) beforeLineEnd(c *ast.Comment) {
- if w.beforeEnd != nil {
- if c == nil {
- return
- }
- panic("overwriting non-nil beforeEnd")
- }
- w.beforeEnd = c
-}
-
-func (w *writer) delayBeforeEnd() {
- w.delay = true
-}
-
-// line prints a blank line. If the writer is currently in the middle of a line,
-// line ends it and then prints a blank one.
-func (w *writer) blankLine() {
- if w.inline {
- w.endLine()
- }
- w.write("\n")
-}
-
-// write the input string and writes it to the buffer.
-func (w *writer) write(s string) {
- w.buf.WriteString(s)
-}
-
-// writeLine writes the string on a newly started line, then terminate the line.
-func (w *writer) writeLine(s string) {
- if !w.inline {
- w.startLine()
- }
- w.write(s)
- w.endLine()
-}
-
-func (w *writer) startMultilineSeq() {
- w.endLine()
- w.up()
- w.startLine()
-}
-
-// up increases the indentation level
-func (w *writer) up() {
- w.level++
-}
-
-// down decreases the indentation level
-func (w *writer) down() {
- if w.level == 0 {
- panic("negative indentation level")
- }
- w.level--
-}
-
-func ensureFutureKeywordImport(imps []*ast.Import, kw string) []*ast.Import {
- for _, imp := range imps {
- if future.IsAllFutureKeywords(imp) ||
- future.IsFutureKeyword(imp, kw) ||
- (future.IsFutureKeyword(imp, "every") && kw == "in") { // "every" implies "in", so we don't need to add both
- return imps
- }
- }
- imp := &ast.Import{
- // NOTE: This is a hack to not error on the ref containing a keyword already present in v1.
- // A cleaner solution would be to instead allow refs to contain keyword terms.
- // E.g. in v1, `import future.keywords["in"]` is valid, but `import future.keywords.in` is not
- // as it contains a reserved keyword.
- Path: ast.MustParseTerm("future.keywords[\"" + kw + "\"]"),
- //Path: ast.MustParseTerm("future.keywords." + kw),
- }
- imp.Location = defaultLocation(imp)
- return append(imps, imp)
-}
-
-func ensureRegoV1Import(imps []*ast.Import) []*ast.Import {
- return ensureImport(imps, ast.RegoV1CompatibleRef)
-}
-
-func filterRegoV1Import(imps []*ast.Import) []*ast.Import {
- var ret []*ast.Import
- for _, imp := range imps {
- path := imp.Path.Value.(ast.Ref)
- if !ast.RegoV1CompatibleRef.Equal(path) {
- ret = append(ret, imp)
- }
- }
- return ret
-}
-
-func ensureImport(imps []*ast.Import, path ast.Ref) []*ast.Import {
- for _, imp := range imps {
- p := imp.Path.Value.(ast.Ref)
- if p.Equal(path) {
- return imps
- }
- }
- imp := &ast.Import{
- Path: ast.NewTerm(path),
- }
- imp.Location = defaultLocation(imp)
- return append(imps, imp)
-}
-
-// ArgErrDetail but for `fmt` checks since compiler has not run yet.
-type ArityFormatErrDetail struct {
- Have []string `json:"have"`
- Want []string `json:"want"`
-}
-
-// arityMismatchError but for `fmt` checks since the compiler has not run yet.
-func ArityFormatMismatchError(operands []*ast.Term, operator string, loc *ast.Location, f *types.Function) *ast.Error {
- want := make([]string, len(f.Args()))
- for i := range f.Args() {
- want[i] = types.Sprint(f.Args()[i])
- }
-
- have := make([]string, len(operands))
- for i := 0; i < len(operands); i++ {
- have[i] = ast.TypeName(operands[i].Value)
- }
- err := ast.NewError(ast.TypeErr, loc, "%s: %s", operator, "arity mismatch")
- err.Details = &ArityFormatErrDetail{
- Have: have,
- Want: want,
- }
- return err
-}
-
-// Lines returns the string representation of the detail.
-func (d *ArityFormatErrDetail) Lines() []string {
- return []string{
- "have: " + "(" + strings.Join(d.Have, ",") + ")",
- "want: " + "(" + strings.Join(d.Want, ",") + ")",
- }
-}
-
-func moduleIsRegoV1Compatible(m *ast.Module) bool {
- for _, imp := range m.Imports {
- if isRegoV1Compatible(imp) {
- return true
- }
- }
- return false
-}
-
-// isRegoV1Compatible returns true if the passed *ast.Import is `rego.v1`
-func isRegoV1Compatible(imp *ast.Import) bool {
- path := imp.Path.Value.(ast.Ref)
- return len(path) == 2 &&
- ast.RegoRootDocument.Equal(path[0]) &&
- path[1].Equal(ast.StringTerm("v1"))
-}
diff --git a/vendor/github.com/open-policy-agent/opa/hooks/hooks.go b/vendor/github.com/open-policy-agent/opa/hooks/hooks.go
deleted file mode 100644
index 9659d7b499..0000000000
--- a/vendor/github.com/open-policy-agent/opa/hooks/hooks.go
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2023 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 hooks
-
-import (
- "context"
- "fmt"
-
- "github.com/open-policy-agent/opa/config"
-)
-
-// Hook is a hook to be called in some select places in OPA's operation.
-//
-// The base Hook interface is any, and wherever a hook can occur, the calling code
-// will check if your hook implements an appropriate interface. If so, your hook
-// is called.
-//
-// This allows you to only hook in to behavior you care about, and it allows the
-// OPA to add more hooks in the future.
-//
-// All hook interfaces in this package have Hook in the name. Hooks must be safe
-// for concurrent use. It is expected that hooks are fast; if a hook needs to take
-// time, then copy what you need and ensure the hook is async.
-//
-// When multiple instances of a hook are provided, they are all going to be executed
-// in an unspecified order (it's a map-range call underneath). If you need hooks to
-// be run in order, you can wrap them into another hook, and configure that one.
-type Hook any
-
-// Hooks is the type used for every struct in OPA that can work with hooks.
-type Hooks struct {
- m map[Hook]struct{} // we are NOT providing a stable invocation ordering
-}
-
-// New creates a new instance of Hooks.
-func New(hs ...Hook) Hooks {
- h := Hooks{m: make(map[Hook]struct{}, len(hs))}
- for i := range hs {
- h.m[hs[i]] = struct{}{}
- }
- return h
-}
-
-func (hs Hooks) Each(fn func(Hook)) {
- for h := range hs.m {
- fn(h)
- }
-}
-
-// ConfigHook allows inspecting or rewriting the configuration when the plugin
-// manager is processing it.
-// Note that this hook is not run when the plugin manager is reconfigured. This
-// usually only happens when there's a new config from a discovery bundle, and
-// for processing _that_, there's `ConfigDiscoveryHook`.
-type ConfigHook interface {
- OnConfig(context.Context, *config.Config) (*config.Config, error)
-}
-
-// ConfigHook allows inspecting or rewriting the discovered configuration when
-// the discovery plugin is processing it.
-type ConfigDiscoveryHook interface {
- OnConfigDiscovery(context.Context, *config.Config) (*config.Config, error)
-}
-
-func (hs Hooks) Validate() error {
- for h := range hs.m {
- switch h.(type) {
- case ConfigHook,
- ConfigDiscoveryHook: // OK
- default:
- return fmt.Errorf("unknown hook type %T", h)
- }
- }
- return nil
-}
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 064649733a..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
@@ -6,15 +6,16 @@ package bundle
import (
"context"
+ "errors"
"fmt"
"io"
"os"
"path/filepath"
- "github.com/open-policy-agent/opa/ast"
- "github.com/open-policy-agent/opa/bundle"
- "github.com/open-policy-agent/opa/resolver/wasm"
- "github.com/open-policy-agent/opa/storage"
+ "github.com/open-policy-agent/opa/v1/ast"
+ "github.com/open-policy-agent/opa/v1/bundle"
+ "github.com/open-policy-agent/opa/v1/resolver/wasm"
+ "github.com/open-policy-agent/opa/v1/storage"
)
// LoadWasmResolversFromStore will lookup all Wasm modules from the store along with the
@@ -71,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)
}
@@ -97,7 +98,7 @@ func LoadBundleFromDiskForRegoVersion(regoVersion ast.RegoVersion, path, name st
_, err := os.Stat(bundlePath)
if err == nil {
- f, err := os.Open(filepath.Join(bundlePath))
+ f, err := os.Open(bundlePath)
if err != nil {
return nil, err
}
@@ -132,7 +133,7 @@ func SaveBundleToDisk(path string, raw io.Reader) (string, error) {
}
if raw == nil {
- return "", fmt.Errorf("no raw bundle bytes to persist to disk")
+ return "", errors.New("no raw bundle bytes to persist to disk")
}
dest, err := os.CreateTemp(path, ".bundle.tar.gz.*.tmp")
diff --git a/vendor/github.com/open-policy-agent/opa/internal/cidr/merge/merge.go b/vendor/github.com/open-policy-agent/opa/internal/cidr/merge/merge.go
index a019cde128..c2392b6775 100644
--- a/vendor/github.com/open-policy-agent/opa/internal/cidr/merge/merge.go
+++ b/vendor/github.com/open-policy-agent/opa/internal/cidr/merge/merge.go
@@ -114,7 +114,7 @@ func GetAddressRange(ipNet net.IPNet) (net.IP, net.IP) {
copy(lastIPMask, ipNet.Mask)
for i := range lastIPMask {
lastIPMask[len(lastIPMask)-i-1] = ^lastIPMask[len(lastIPMask)-i-1]
- lastIP[net.IPv6len-i-1] = lastIP[net.IPv6len-i-1] | lastIPMask[len(lastIPMask)-i-1]
+ lastIP[net.IPv6len-i-1] |= lastIPMask[len(lastIPMask)-i-1]
}
return firstIP, lastIP
diff --git a/vendor/github.com/open-policy-agent/opa/internal/compiler/utils.go b/vendor/github.com/open-policy-agent/opa/internal/compiler/utils.go
index 4d80aeeef9..5d2e778b13 100644
--- a/vendor/github.com/open-policy-agent/opa/internal/compiler/utils.go
+++ b/vendor/github.com/open-policy-agent/opa/internal/compiler/utils.go
@@ -5,9 +5,12 @@
package compiler
import (
- "github.com/open-policy-agent/opa/ast"
- "github.com/open-policy-agent/opa/schemas"
- "github.com/open-policy-agent/opa/util"
+ "errors"
+ "sync"
+
+ "github.com/open-policy-agent/opa/v1/ast"
+ "github.com/open-policy-agent/opa/v1/schemas"
+ "github.com/open-policy-agent/opa/v1/util"
)
type SchemaFile string
@@ -16,12 +19,35 @@ const (
AuthorizationPolicySchema SchemaFile = "authorizationPolicy.json"
)
-var schemaDefinitions = map[SchemaFile]interface{}{}
+var schemaDefinitions = map[SchemaFile]any{}
+
+var loadOnce = sync.OnceValue(func() error {
+ cont, err := schemas.FS.ReadFile(string(AuthorizationPolicySchema))
+ if err != nil {
+ return err
+ }
+
+ if len(cont) == 0 {
+ return errors.New("expected authorization policy schema file to be present")
+ }
+
+ var schema any
+ if err := util.Unmarshal(cont, &schema); err != nil {
+ return err
+ }
+
+ schemaDefinitions[AuthorizationPolicySchema] = schema
+
+ return nil
+})
// VerifyAuthorizationPolicySchema performs type checking on rules against the schema for the Authorization Policy
// Input document.
// NOTE: The provided compiler should have already run the compilation process on the input modules
func VerifyAuthorizationPolicySchema(compiler *ast.Compiler, ref ast.Ref) error {
+ if err := loadOnce(); err != nil {
+ panic(err)
+ }
rules := getRulesWithDependencies(compiler, ref)
@@ -32,7 +58,10 @@ func VerifyAuthorizationPolicySchema(compiler *ast.Compiler, ref ast.Ref) error
schemaSet := ast.NewSchemaSet()
schemaSet.Put(ast.SchemaRootRef, schemaDefinitions[AuthorizationPolicySchema])
- errs := ast.NewCompiler().WithSchemas(schemaSet).PassesTypeCheckRules(rules)
+ errs := ast.NewCompiler().
+ WithDefaultRegoVersion(compiler.DefaultRegoVersion()).
+ WithSchemas(schemaSet).
+ PassesTypeCheckRules(rules)
if len(errs) > 0 {
return errs
@@ -64,26 +93,3 @@ func transitiveDependencies(compiler *ast.Compiler, rule *ast.Rule, deps map[*as
transitiveDependencies(compiler, other, deps)
}
}
-
-func loadAuthorizationPolicySchema() {
-
- cont, err := schemas.FS.ReadFile(string(AuthorizationPolicySchema))
- if err != nil {
- panic(err)
- }
-
- if len(cont) == 0 {
- panic("expected authorization policy schema file to be present")
- }
-
- var schema interface{}
- if err := util.Unmarshal(cont, &schema); err != nil {
- panic(err)
- }
-
- schemaDefinitions[AuthorizationPolicySchema] = schema
-}
-
-func init() {
- loadAuthorizationPolicySchema()
-}
diff --git a/vendor/github.com/open-policy-agent/opa/internal/compiler/wasm/opa/callgraph.csv b/vendor/github.com/open-policy-agent/opa/internal/compiler/wasm/opa/callgraph.csv
index 473497abbd..10dc4d482e 100644
--- a/vendor/github.com/open-policy-agent/opa/internal/compiler/wasm/opa/callgraph.csv
+++ b/vendor/github.com/open-policy-agent/opa/internal/compiler/wasm/opa/callgraph.csv
@@ -111,6 +111,9 @@ opa_arith_rem,opa_bf_to_number
opa_array_concat,opa_value_type
opa_array_concat,opa_array_with_cap
opa_array_concat,opa_array_append
+opa_array_flatten,opa_value_type
+opa_array_flatten,opa_array_with_cap
+opa_array_flatten,opa_array_append
opa_array_slice,opa_value_type
opa_array_slice,opa_number_try_int
opa_array_slice,opa_array_with_cap
@@ -194,7 +197,9 @@ opa_cidr_contains,parse_ip
opa_cidr_contains,opa_boolean
parse_cidr,parse_ip
parse_cidr,opa_atoi64
+parse_ip,inet_pton4
parse_ip,memchr
+inet_pton4,memchr
opa_cidr_intersects,opa_value_type
opa_cidr_intersects,parse_cidr
opa_cidr_intersects,opa_boolean
@@ -347,15 +352,15 @@ opa_value_dump,opa_json_writer_write
move_freelists,opa_abort
opa_heap_blocks_stash,move_freelists
opa_heap_blocks_restore,move_freelists
-opa_malloc,opa_free_bulk_commit
+opa_malloc,merge_sort_blocks
+opa_malloc,merge_blocks
opa_malloc,opa_abort
-opa_free_bulk_commit,merge_sort_blocks
+merge_sort_blocks,merge_sort_blocks
+merge_sort_blocks,merge_blocks
opa_realloc,opa_malloc
opa_realloc,memcpy
-opa_realloc,opa_free
opa_builtin_cache_get,opa_abort
opa_builtin_cache_set,opa_abort
-merge_sort_blocks,merge_sort_blocks
opa_memoize_init,opa_malloc
opa_memoize_init,opa_object
opa_memoize_push,opa_malloc
@@ -583,6 +588,8 @@ opa_sets_union,opa_value_type
opa_sets_union,opa_set
opa_sets_union,opa_set_add
opa_sets_union,opa_value_free_shallow
+opa_strlen,strlen
+opa_itoa,strlen
opa_strings_any_prefix_match,opa_value_type
opa_strings_any_prefix_match,opa_value_iter
opa_strings_any_prefix_match,opa_value_get
@@ -719,6 +726,18 @@ opa_strings_upper,opa_abort
opa_strings_upper,opa_unicode_to_upper
opa_strings_upper,opa_realloc
opa_strings_upper,opa_unicode_encode_utf8
+to_string,opa_value_type
+to_string,opa_string_terminated
+to_string,opa_value_dump
+to_string,opa_strlen
+to_string,opa_string_allocated
+opa_template_string,opa_value_type
+opa_template_string,opa_array_with_cap
+opa_template_string,to_string
+opa_template_string,opa_array_append
+opa_template_string,opa_malloc
+opa_template_string,memcpy
+opa_template_string,opa_string_allocated
opa_types_is_number,opa_value_type
opa_types_is_number,opa_boolean
opa_types_is_string,opa_value_type
@@ -789,8 +808,8 @@ opa_object_keys,opa_value_compare
opa_object_keys,opa_value_compare_number
opa_object_keys,opa_strncmp
opa_object_keys,opa_value_compare_object
-opa_object_keys,opa_abort
opa_object_keys,opa_value_compare_set
+opa_object_keys,opa_abort
opa_array_free,__opa_value_free
opa_array_free,opa_free
opa_array_free,opa_free_bulk
@@ -836,17 +855,16 @@ opa_number_ref,opa_malloc
opa_number_int,opa_malloc
opa_string,opa_malloc
opa_value_shallow_copy_object,opa_malloc
+opa_value_shallow_copy_object,memset
opa_value_shallow_copy_object,opa_value_iter
opa_value_shallow_copy_object,opa_value_get
opa_value_shallow_copy_object,__opa_object_insert
-opa_value_shallow_copy_set,opa_malloc
-opa_value_shallow_copy_set,opa_value_iter
-opa_value_shallow_copy_set,opa_set_add
opa_set_add,opa_value_hash
opa_set_add,opa_value_compare
opa_set_add,__opa_set_grow
opa_set_add,opa_malloc
__opa_set_grow,opa_malloc
+__opa_set_grow,memset
__opa_set_grow,opa_value_hash
__opa_set_grow,opa_value_compare_number
__opa_set_grow,opa_strncmp
@@ -857,7 +875,9 @@ __opa_set_grow,opa_abort
__opa_set_grow,opa_free
opa_value_shallow_copy,opa_malloc
opa_value_shallow_copy,opa_value_shallow_copy_object
-opa_value_shallow_copy,opa_value_shallow_copy_set
+opa_value_shallow_copy,memset
+opa_value_shallow_copy,opa_set_add
+opa_value_shallow_copy,opa_value_iter
opa_value_shallow_copy,opa_abort
opa_value_transitive_closure,opa_malloc
opa_value_transitive_closure,__opa_value_transitive_closure
@@ -881,7 +901,9 @@ opa_array_with_cap,opa_free
opa_object,opa_malloc
opa_set,opa_malloc
opa_set_with_cap,opa_malloc
+opa_set_with_cap,memset
__opa_object_grow,opa_malloc
+__opa_object_grow,memset
__opa_object_grow,opa_value_hash
__opa_object_grow,opa_value_compare_number
__opa_object_grow,opa_strncmp
@@ -908,170 +930,191 @@ opa_lookup,opa_abort
opa_lookup,opa_atoi64
opa_mapping_init,opa_json_parse
opa_mapping_lookup,opa_lookup
-node::re2\28std::__1::basic_string\2c\20std::__1::allocator\20>\20const&\29,std::__1::basic_string\2c\20std::__1::allocator\20>::assign\28char\20const*\29
-node::re2\28std::__1::basic_string\2c\20std::__1::allocator\20>\20const&\29,node::re2\28std::__1::basic_string\2c\20std::__1::allocator\20>\20const&\29
-node::re2\28std::__1::basic_string\2c\20std::__1::allocator\20>\20const&\29,std::__1::basic_string\2c\20std::__1::allocator\20>::append\28char\20const*\2c\20unsigned\20long\29
-node::re2\28std::__1::basic_string\2c\20std::__1::allocator\20>\20const&\29,operator\20delete\28void*\29
-node::re2\28std::__1::basic_string\2c\20std::__1::allocator\20>\20const&\29,std::__1::basic_string\2c\20std::__1::allocator\20>::append\28char\20const*\29
-node::re2\28std::__1::basic_string\2c\20std::__1::allocator\20>\20const&\29,escape\28std::__1::basic_string\2c\20std::__1::allocator\20>\20const&\29
-node::re2\28std::__1::basic_string\2c\20std::__1::allocator\20>\20const&\29,operator\20new\28unsigned\20long\29
-node::re2\28std::__1::basic_string\2c\20std::__1::allocator\20>\20const&\29,memcpy
-node::re2\28std::__1::basic_string\2c\20std::__1::allocator\20>\20const&\29,abort
-escape\28std::__1::basic_string\2c\20std::__1::allocator\20>\20const&\29,std::__1::basic_string\2c\20std::__1::allocator\20>::push_back\28char\29
-glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::__1::vector\2c\20std::__1::allocator\20>\2c\20std::__1::allocator\2c\20std::__1::allocator\20>\20>\20>\20const&\2c\20std::__1::basic_string\2c\20std::__1::allocator\20>*\29,operator\20new\28unsigned\20long\29
-glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::__1::vector\2c\20std::__1::allocator\20>\2c\20std::__1::allocator\2c\20std::__1::allocator\20>\20>\20>\20const&\2c\20std::__1::basic_string\2c\20std::__1::allocator\20>*\29,lexer::lexer\28char\20const*\2c\20unsigned\20long\29
-glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::__1::vector\2c\20std::__1::allocator\20>\2c\20std::__1::allocator\2c\20std::__1::allocator\20>\20>\20>\20const&\2c\20std::__1::basic_string\2c\20std::__1::allocator\20>*\29,glob_parse\28lexer*\2c\20node**\29
-glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::__1::vector\2c\20std::__1::allocator\20>\2c\20std::__1::allocator\2c\20std::__1::allocator\20>\20>\20>\20const&\2c\20std::__1::basic_string\2c\20std::__1::allocator\20>*\29,std::__1::basic_string\2c\20std::__1::allocator\20>::compare\28unsigned\20long\2c\20unsigned\20long\2c\20char\20const*\2c\20unsigned\20long\29\20const
-glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::__1::vector\2c\20std::__1::allocator\20>\2c\20std::__1::allocator\2c\20std::__1::allocator\20>\20>\20>\20const&\2c\20std::__1::basic_string\2c\20std::__1::allocator\20>*\29,lexer::~lexer\28\29
-glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::__1::vector\2c\20std::__1::allocator\20>\2c\20std::__1::allocator\2c\20std::__1::allocator\20>\20>\20>\20const&\2c\20std::__1::basic_string\2c\20std::__1::allocator\20>*\29,operator\20delete\28void*\29
-glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::__1::vector\2c\20std::__1::allocator\20>\2c\20std::__1::allocator\2c\20std::__1::allocator\20>\20>\20>\20const&\2c\20std::__1::basic_string\2c\20std::__1::allocator\20>*\29,std::__1::basic_string\2c\20std::__1::allocator\20>::assign\28char\20const*\29
-glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::__1::vector\2c\20std::__1::allocator\20>\2c\20std::__1::allocator\2c\20std::__1::allocator\20>\20>\20>\20const&\2c\20std::__1::basic_string\2c\20std::__1::allocator\20>*\29,opa_unicode_decode_utf8
-glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::__1::vector\2c\20std::__1::allocator\20>\2c\20std::__1::allocator\2c\20std::__1::allocator\20>\20>\20>\20const&\2c\20std::__1::basic_string\2c\20std::__1::allocator\20>*\29,escape\28std::__1::basic_string\2c\20std::__1::allocator\20>\20const&\29
-glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::__1::vector\2c\20std::__1::allocator\20>\2c\20std::__1::allocator\2c\20std::__1::allocator\20>\20>\20>\20const&\2c\20std::__1::basic_string\2c\20std::__1::allocator\20>*\29,std::__1::basic_string\2c\20std::__1::allocator\20>::append\28char\20const*\2c\20unsigned\20long\29
-glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::__1::vector\2c\20std::__1::allocator\20>\2c\20std::__1::allocator\2c\20std::__1::allocator\20>\20>\20>\20const&\2c\20std::__1::basic_string\2c\20std::__1::allocator\20>*\29,std::__1::basic_string\2c\20std::__1::allocator\20>::append\28char\20const*\29
-glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::__1::vector\2c\20std::__1::allocator\20>\2c\20std::__1::allocator\2c\20std::__1::allocator\20>\20>\20>\20const&\2c\20std::__1::basic_string\2c\20std::__1::allocator\20>*\29,node::re2\28std::__1::basic_string\2c\20std::__1::allocator\20>\20const&\29
-glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::__1::vector\2c\20std::__1::allocator\20>\2c\20std::__1::allocator\2c\20std::__1::allocator\20>\20>\20>\20const&\2c\20std::__1::basic_string\2c\20std::__1::allocator\20>*\29,node::~node\28\29
-lexer::~lexer\28\29,operator\20delete\28void*\29
+node::re2\28std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\20const&\29,std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>::assign\28char\20const*\29
+node::re2\28std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\20const&\29,node::re2\28std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\20const&\29
+node::re2\28std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\20const&\29,std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>::append\28char\20const*\2c\20unsigned\20long\29
+node::re2\28std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\20const&\29,operator\20delete\28void*\2c\20unsigned\20long\29
+node::re2\28std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\20const&\29,std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>::append\28char\20const*\29
+node::re2\28std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\20const&\29,std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>::push_back\28char\29
+node::re2\28std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\20const&\29,operator\20new\28unsigned\20long\29
+node::re2\28std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\20const&\29,memmove
+node::re2\28std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\20const&\29,std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>::__throw_length_error\5babi:nn210108\5d\28\29
+std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>::__throw_length_error\5babi:nn210108\5d\28\29,std::_LIBCPP_ABI_NAMESPACE::__throw_length_error\5babi:nn210108\5d\28char\20const*\29
+glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::_LIBCPP_ABI_NAMESPACE::vector\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>>>\20const&\2c\20std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>*\29,operator\20new\28unsigned\20long\29
+glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::_LIBCPP_ABI_NAMESPACE::vector\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>>>\20const&\2c\20std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>*\29,lexer::lexer\28char\20const*\2c\20unsigned\20long\29
+glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::_LIBCPP_ABI_NAMESPACE::vector\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>>>\20const&\2c\20std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>*\29,glob_parse\28lexer*\2c\20node**\29
+glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::_LIBCPP_ABI_NAMESPACE::vector\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>>>\20const&\2c\20std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>*\29,lexer::~lexer\28\29
+glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::_LIBCPP_ABI_NAMESPACE::vector\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>>>\20const&\2c\20std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>*\29,operator\20delete\28void*\2c\20unsigned\20long\29
+glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::_LIBCPP_ABI_NAMESPACE::vector\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>>>\20const&\2c\20std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>*\29,std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>::assign\28char\20const*\29
+glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::_LIBCPP_ABI_NAMESPACE::vector\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>>>\20const&\2c\20std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>*\29,opa_unicode_decode_utf8
+glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::_LIBCPP_ABI_NAMESPACE::vector\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>>>\20const&\2c\20std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>*\29,std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>::push_back\28char\29
+glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::_LIBCPP_ABI_NAMESPACE::vector\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>>>\20const&\2c\20std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>*\29,std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>::append\28char\20const*\2c\20unsigned\20long\29
+glob_translate\28char\20const*\2c\20unsigned\20long\2c\20std::_LIBCPP_ABI_NAMESPACE::vector\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>>>\20const&\2c\20std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator>*\29,std::_LIBCPP_ABI_NAMESPACE::basic_string\2c\20std::_LIBCPP_ABI_NAMESPACE::allocator