diff --git a/.gitignore b/.gitignore index 6c2314c..331ddc5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ bin/ *.out web/main.wasm +web/assets/main.wasm.gz +web/assets/data.json \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 19aaef5..42e8e91 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,14 +1,19 @@ -# Contributing to CEL Playground +# Contributing to Expr Playground :+1::tada: Thanks for taking the time to contribute! :tada::+1: -The following is a set of guidelines for contributing to CEL Playground, -which are hosted in the [Undistro Organization](https://github.com/undistro) on GitHub. +The following is a set of guidelines for contributing to Expr Playground, +which is maintained by [polds](https://github.com/polds) on GitHub. + +## CEL Playground + +Expr playground is a fork of [CEL Playground](https://github.com/undistro/cel-playground) but swapping CEL support for +[Expr](https://expr-lang.org/) support. Please make sure to check out their project and give them a star as well! ## How Can I Contribute? - **Giving us a star.** It may not seem like much, but it really makes a - difference. This is something that everyone can do to help out CEL Playground. + difference. This is something that everyone can do to help out Expr Playground. GitHub stars help the project gain visibility and stand out. - **Reviewing the documentation.** @@ -17,9 +22,9 @@ which are hosted in the [Undistro Organization](https://github.com/undistro) on feel free to open a Pull Request with your suggestions. - **Reporting bugs.** We use GitHub issues to track public bugs. - Report a bug by [opening a new issue](https://github.com/undistro/cel-playground/issues/new/choose). + Report a bug by [opening a new issue](https://github.com/polds/expr-playground/issues/new/choose). - **Pull Request.** Unless you are fixing a known bug, we **strongly** recommend discussing it with the core team via a GitHub issue before - getting started to ensure your work is consistent with CEL Playground's roadmap and architecture. + getting started to ensure your work is consistent with Expr Playground's roadmap and architecture. diff --git a/Makefile b/Makefile index b21b9ee..cf3da91 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CEL_GO_VERSION=$(shell go list -f "{{.Version}}" -m github.com/google/cel-go) +EXPR_GO_VERSION=$(shell go list -f "{{.Version}}" -m github.com/expr-lang/expr) # Setting SHELL to bash allows bash commands to be executed by recipes. # Options are set to exit when a recipe line exits non-zero or a piped command fails. @@ -25,31 +25,29 @@ test: fmt ## Run tests. go test ./... -coverprofile cover.out .PHONY: serve -serve: ## Serve static files. - python3 -m http.server -d web/ 8080 - #Uncomment the command below to serve with Go - #go run cmd/server/main.go --dir web/ +serve: build ## Serve static files. + go run cmd/server/main.go .PHONY: update-data update-data: ## Update the web/assets/data.json file. yq -ojson '.' examples.yaml > web/assets/data.json - yq -ojson -i '.versions.cel-go = "$(CEL_GO_VERSION)"' web/assets/data.json + yq -ojson -i '.versions.expr = "$(EXPR_GO_VERSION)"' web/assets/data.json .PHONY: addlicense addlicense: ## Add copyright license headers in source code files. @test -s $(LOCALBIN)/addlicense || GOBIN=$(LOCALBIN) go install github.com/google/addlicense@latest - $(LOCALBIN)/addlicense -c "Undistro Authors" -l "apache" -ignore ".github/**" -ignore ".idea/**" -ignore "web/dist/**" . + $(LOCALBIN)/addlicense -c "Undistro Authors; Fork and conversion to Expr by Peter Olds " -l "apache" -ignore ".github/**" -ignore ".idea/**" -ignore "web/dist/**" . .PHONY: checklicense checklicense: ## Check copyright license headers in source code files. @test -s $(LOCALBIN)/addlicense || GOBIN=$(LOCALBIN) go install github.com/google/addlicense@latest - $(LOCALBIN)/addlicense -c "Undistro Authors" -l "apache" -ignore ".github/**" -ignore ".idea/**" -ignore "web/dist/**" -check . + $(LOCALBIN)/addlicense -c "Undistro Authors; Fork and conversion to Expr by Peter Olds " -l "apache" -ignore ".github/**" -ignore ".idea/**" -ignore "web/dist/**" -check . ##@ Build .PHONY: build build: fmt update-data ## Build the wasm binary. - GOOS=js GOARCH=wasm go build -ldflags="-s -w" -o web/assets/main.wasm cmd/wasm/main.go + GOOS=js GOARCH=wasm go build -trimpath -ldflags="-s -w" -o web/assets/main.wasm cmd/wasm/main.go gzip --best -f web/assets/main.wasm ## Location to install dependencies to diff --git a/README.md b/README.md index 55c2712..80ecf7d 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,23 @@ -# CEL Playground -![GitHub](https://img.shields.io/github/license/undistro/cel-playground) -[![Go Report Card](https://goreportcard.com/badge/github.com/undistro/cel-playground)](https://goreportcard.com/report/github.com/undistro/cel-playground) +# Expr Playground +![GitHub](https://img.shields.io/github/license/polds/expr-playground) +[![Go Report Card](https://goreportcard.com/badge/github.com/polds/expr-playground)](https://goreportcard.com/report/github.com/polds/expr-playground) -CEL Playground is an interactive WebAssembly (Wasm) powered environment to explore and experiment with the [Common Expression Language (CEL)](https://github.com/google/cel-spec). -It provides a simple and user-friendly interface to write and quickly evaluate CEL expressions. +Expr Playground is an interactive WebAssembly (Wasm) powered environment to explore and experiment with +[Expr-lang](https://expr-lang.org/). It provides a simple and user-friendly interface to write and quickly evaluate +Expr expressions. -## CEL libraries +## Credits -CEL Playground is built by compiling Go code to WebAssembly and includes the following libraries that are available in the environment: +This project is forked from [CEL Playground](https://github.com/undistro/cel-playground) and modified to support Expr. +Please be sure to check out their project and give them a star as well! -- CEL [extended string function library](https://pkg.go.dev/github.com/google/cel-go/ext#Strings) -- [Kubernetes list library](https://kubernetes.io/docs/reference/using-api/cel/#kubernetes-list-library) -- [Kubernetes regex library](https://kubernetes.io/docs/reference/using-api/cel/#kubernetes-regex-library) -- [Kubernetes URL library](https://kubernetes.io/docs/reference/using-api/cel/#kubernetes-url-library) +## Expr libraries -Take a look at [all the environment options](eval/eval.go#L26). +CEL Playground is built by compiling Go code to WebAssembly. At present only the Expr engine is available in this +environment. We will look at injecting some other utilities to make this environment more useful, on-par with the the +CEL standard library and CEL Playground. + +Take a look at [all the environment options](eval/eval.go#L31). ## Development @@ -31,8 +34,8 @@ make serve ## Contributing We appreciate your contribution. -Please refer to our [contributing guideline](https://github.com/undistro/cel-playground/blob/main/CONTRIBUTING.md) for further information. -This project adheres to the Contributor Covenant [code of conduct](https://github.com/undistro/cel-playground/blob/main/CODE_OF_CONDUCT.md). +Please refer to our [contributing guideline](https://github.com/polds/expr-playground/blob/main/CONTRIBUTING.md) for further information. +This project adheres to the Contributor Covenant [code of conduct](https://github.com/polds/expr-playground/blob/main/CODE_OF_CONDUCT.md). ## License diff --git a/cmd/server/main.go b/cmd/server/main.go index be8fcc8..7e61601 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -1,4 +1,5 @@ // Copyright 2023 Undistro Authors +// Modifications Fork and conversion to Expr Copyright 2024 Peter Olds // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,16 +19,17 @@ import ( "flag" "log" "net/http" + + "github.com/polds/expr-playground/web" ) var ( listen = flag.String("listen", ":8080", "listen address") - dir = flag.String("dir", ".", "directory to serve") ) func main() { flag.Parse() log.Printf("listening on %s...", *listen) - err := http.ListenAndServe(*listen, http.FileServer(http.Dir(*dir))) + err := http.ListenAndServe(*listen, http.FileServer(http.FS(web.Assets))) log.Fatalln(err) } diff --git a/cmd/wasm/main.go b/cmd/wasm/main.go index 1396984..2078564 100644 --- a/cmd/wasm/main.go +++ b/cmd/wasm/main.go @@ -1,4 +1,5 @@ // Copyright 2023 Undistro Authors +// Modifications Fork and conversion to Expr Copyright 2024 Peter Olds // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -23,7 +24,7 @@ import ( "gopkg.in/yaml.v3" - "github.com/undistro/cel-playground/eval" + "github.com/polds/expr-playground/eval" ) func main() { diff --git a/eval/eval.go b/eval/eval.go index 6785646..f9a7314 100644 --- a/eval/eval.go +++ b/eval/eval.go @@ -1,4 +1,5 @@ // Copyright 2023 Undistro Authors +// Modifications Fork and conversion to Expr Copyright 2024 Peter Olds // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,116 +18,39 @@ package eval import ( "encoding/json" "fmt" - "reflect" - "github.com/google/cel-go/cel" - "github.com/google/cel-go/checker" - "github.com/google/cel-go/common/types/ref" - "github.com/google/cel-go/ext" - "github.com/google/cel-go/interpreter" - "google.golang.org/protobuf/types/known/structpb" - k8s "k8s.io/apiserver/pkg/cel/library" + "github.com/expr-lang/expr" + "github.com/expr-lang/expr/vm" ) -type EvalResponse struct { - Result any `json:"result"` - Cost *uint64 `json:"cost, omitempty"` +type RunResponse struct { + Result any `json:"result"` + Bytecode []vm.Opcode `json:"bytecode"` } -var celEnvOptions = []cel.EnvOption{ - // 1.0 (1.23) - cel.HomogeneousAggregateLiterals(), - cel.EagerlyValidateDeclarations(true), - cel.DefaultUTCTimeZone(true), - k8s.URLs(), - k8s.Regex(), - k8s.Lists(), - - // 1.27 - // k8s.Authz(), - - // 1.28 - cel.CrossTypeNumericComparisons(true), - cel.OptionalTypes(), - k8s.Quantity(), - - // 1.29 (see also validator.ExtendedValidations()) - cel.ASTValidators( - cel.ValidateDurationLiterals(), - cel.ValidateTimestampLiterals(), - cel.ValidateRegexLiterals(), - cel.ValidateHomogeneousAggregateLiterals(), - ), - - // Strings (from 1.29 onwards) - ext.Strings(ext.StringsVersion(2)), - // Set library (1.29 onwards) - ext.Sets(), - - // cel-go v0.17.7 introduced CostEstimatorOptions. - // Previous the presence has a cost of 0 but cel fixed it to 1. We still set to 0 here to avoid breaking changes. - cel.CostEstimatorOptions(checker.PresenceTestHasCost(false)), +var exprEnvOptions = []expr.Option{ + expr.AsAny(), } -var celProgramOptions = []cel.ProgramOption{ - cel.EvalOptions(cel.OptOptimize, cel.OptTrackCost), - - // cel-go v0.17.7 introduced CostTrackerOptions. - // Previous the presence has a cost of 0 but cel fixed it to 1. We still set to 0 here to avoid breaking changes. - cel.CostTrackerOptions(interpreter.PresenceTestHasCost(false)), -} - -// Eval evaluates the cel expression against the given input +// Eval evaluates the expr expression against the given input. func Eval(exp string, input map[string]any) (string, error) { - inputVars := make([]cel.EnvOption, 0, len(input)) - for k := range input { - inputVars = append(inputVars, cel.Variable(k, cel.DynType)) - } - env, err := cel.NewEnv(append(celEnvOptions, inputVars...)...) - if err != nil { - return "", fmt.Errorf("failed to create CEL env: %w", err) - } - ast, issues := env.Compile(exp) - if issues != nil { - return "", fmt.Errorf("failed to compile the CEL expression: %s", issues.String()) - } - prog, err := env.Program(ast, celProgramOptions...) + exprEnvOptions = append(exprEnvOptions, expr.Env(input)) + program, err := expr.Compile(exp, exprEnvOptions...) if err != nil { - return "", fmt.Errorf("failed to instantiate CEL program: %w", err) + return "", fmt.Errorf("failed to compile the Expr expression: %w", err) } - val, costTracker, err := prog.Eval(input) + output, err := expr.Run(program, input) if err != nil { return "", fmt.Errorf("failed to evaluate: %w", err) } - response, err := generateResponse(val, costTracker) - if err != nil { - return "", fmt.Errorf("failed to generate the response: %w", err) + res := &RunResponse{ + Result: output, + Bytecode: program.Bytecode, } - - out, err := json.Marshal(response) + out, err := json.MarshalIndent(res, "", " ") if err != nil { return "", fmt.Errorf("failed to marshal the output: %w", err) } return string(out), nil } - -func getResults(val *ref.Val) (any, error) { - if value, err := (*val).ConvertToNative(reflect.TypeOf(&structpb.Value{})); err != nil { - return nil, err - } else { - return value, nil - } -} - -func generateResponse(val ref.Val, costTracker *cel.EvalDetails) (*EvalResponse, error) { - result, evalError := getResults(&val) - if evalError != nil { - return nil, evalError - } - cost := costTracker.ActualCost() - return &EvalResponse{ - Result: result, - Cost: cost, - }, nil -} diff --git a/examples.yaml b/examples.yaml index d10ae81..055f14d 100644 --- a/examples.yaml +++ b/examples.yaml @@ -1,4 +1,5 @@ # Copyright 2023 Undistro Authors +# Modifications Fork and conversion to Expr Copyright 2024 Peter Olds # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +15,13 @@ examples: - name: "default" - cel: | - // Welcome to the CEL Playground! - // CEL Playground is an interactive WebAssembly powered environment to explore and experiment with the Common Expression Language (CEL). + expr: | + // Welcome to the Expr Playground! + // Expr Playground is an interactive WebAssembly powered environment to explore and experiment with the Expr-lang. // - // - Write your CEL expression here + // - Write your Expr expression here // - Use the area on the side for input data, in YAML or JSON format - // - Press 'Run' to evaluate your CEL expression against the input data + // - Press 'Run' to evaluate your Expr expression against the input data // - Explore our collection of examples for inspiration account.balance >= transaction.withdrawal @@ -39,7 +40,10 @@ examples: category: "default" - name: "Check image registry" - cel: | + expr: | + // Needs Expr translation from CEL. Contributions welcome! + // + object.spec.template.spec.containers.all(container, params.allowedRegistries.exists(registry, ((registry in ['docker.io', 'docker.io/library']) && !container.image.contains('/')) || @@ -72,7 +76,9 @@ examples: category: "Kubernetes" - name: "Disallow HostPorts" - cel: | + expr: | + // Needs Expr translation from CEL. Contributions welcome! + // // According the Pod Security Standards, HostPorts should be disallowed entirely. // https://kubernetes.io/docs/concepts/security/pod-security-standards/#baseline @@ -108,7 +114,9 @@ examples: category: "Kubernetes" - name: "Require non-root containers" - cel: | + expr: | + // Needs Expr translation from CEL. Contributions welcome! + // // According the Pod Security Standards, Containers must be required to run as non-root users. // https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted @@ -155,7 +163,9 @@ examples: category: "Kubernetes" - name: "Drop ALL capabilities" - cel: | + expr: | + // Needs Expr translation from CEL. Contributions welcome! + // // According the Pod Security Standards, Containers must drop `ALL` capabilities, and are only permitted to add back the `NET_BIND_SERVICE` capability. // https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted @@ -203,7 +213,9 @@ examples: category: "Kubernetes" - name: "Semantic version check for image tags (Regex)" - cel: | + expr: | + // Needs Expr translation from CEL. Contributions welcome! + // // Checks if the container images are tagged following the semantic version. object.spec.containers.all(container, @@ -233,7 +245,9 @@ examples: category: "Kubernetes" - name: "URLs" - cel: | + expr: | + // Needs Expr translation from CEL. Contributions welcome! + // // Examples of Kubernetes URL CEL library that is available in the playground. // https://kubernetes.io/docs/reference/using-api/cel/#kubernetes-url-library @@ -253,7 +267,9 @@ examples: category: "General" - name: "Check JWT custom claims" - cel: | + expr: | + // Translated from CEL to Expr. + // // Exercise provided in CEL-Go Google Codelab. // https://codelabs.developers.google.com/codelabs/cel-go/index.html#10 // @@ -261,11 +277,10 @@ examples: // with the group prefix, and ensure that all group-like keys have list // values containing only strings that end with '@acme.co'. - jwt.extra_claims.exists(c, c.startsWith('group')) - && jwt.extra_claims - .filter(c, c.startsWith('group')) - .all(c, jwt.extra_claims[c] - .all(g, g.endsWith('@acme.co'))) + any(keys(jwt.extra_claims), hasPrefix(#, "group")) + && all( + filter(keys(jwt.extra_claims), hasPrefix(#, "group")), + all(jwt.extra_claims[#], hasSuffix(#, "acme.co"))) data: | jwt: { "iss": "auth.acme.com:12350", @@ -285,12 +300,17 @@ examples: category: "General" - name: "Optional" - cel: 'object.?foo.orValue("fallback")' + expr: | + // Needs Expr translation from CEL. Contributions welcome! + // + object.?foo.orValue("fallback")' data: "object: {}" category: "General" - name: "Duration and timestamp" - cel: | + expr: | + // Needs Expr translation from CEL. Contributions welcome! + // // Validate that 'expired' date is after a 'created' date plus a 'ttl' duration has(object.expired) && timestamp(object.created) + duration(object.ttl) < timestamp(object.expired) @@ -302,7 +322,9 @@ examples: category: "General" - name: "Quantity" - cel: | + expr: | + // Needs Expr translation from CEL. Contributions welcome! + // // Quantity library introduced in Kubernetes 1.28 isQuantity(object.memory) && @@ -317,7 +339,9 @@ examples: category: "General" - name: "Access Log Filtering" - cel: | + expr: | + // Needs Expr translation from CEL. Contributions welcome! + // // Use CEL to filter access logs in Istio by response code or target cluster. // https://istio.io/latest/docs/tasks/observability/logs/telemetry-api/#get-started-with-telemetry-api // @@ -382,7 +406,9 @@ examples: category: "Istio" - name: "Custom Metrics" - cel: | + expr: | + // Needs Expr translation from CEL. Contributions welcome! + // // Use CEL to customize the metrics that Istio generates // https://istio.io/latest/docs/tasks/observability/metrics/customize-metrics/#use-expressions-for-values // @@ -473,6 +499,6 @@ examples: category: "Istio" - name: "Blank" - cel: "" + expr: "" data: "" category: "Blank" diff --git a/go.mod b/go.mod index 5addee2..08b1530 100644 --- a/go.mod +++ b/go.mod @@ -1,55 +1,23 @@ -module github.com/undistro/cel-playground +module github.com/polds/expr-playground go 1.21 require ( + github.com/expr-lang/expr v1.15.8 github.com/google/cel-go v0.17.7 - google.golang.org/protobuf v1.31.0 gopkg.in/yaml.v3 v3.0.1 - k8s.io/apiserver v0.28.4 ) require ( github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/emicklei/go-restful/v3 v3.11.0 // indirect - github.com/go-logr/logr v1.3.0 // indirect - github.com/go-openapi/jsonpointer v0.19.6 // indirect - github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.3 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/google/gnostic-models v0.6.8 // indirect - github.com/google/gofuzz v1.2.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/josharian/intern v1.0.0 // indirect - github.com/json-iterator/go v1.1.12 // indirect - github.com/mailru/easyjson v0.7.7 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/stoewer/go-strcase v1.2.0 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect + github.com/stoewer/go-strcase v1.3.0 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/oauth2 v0.10.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - golang.org/x/time v0.3.0 // indirect - google.golang.org/appengine v1.6.7 // indirect + golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - gopkg.in/inf.v0 v0.9.1 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect - k8s.io/api v0.28.4 // indirect - k8s.io/apimachinery v0.28.4 // indirect - k8s.io/client-go v0.28.4 // indirect - k8s.io/klog/v2 v2.110.1 // indirect - k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect - k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect - sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect - sigs.k8s.io/yaml v1.3.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) - -replace k8s.io/apiserver v0.28.4 => github.com/kubernetes/kubernetes/staging/src/k8s.io/apiserver v0.0.0-20231128103858-022d50fe3a1b diff --git a/go.sum b/go.sum index 05111e0..1f46470 100644 --- a/go.sum +++ b/go.sum @@ -4,45 +4,14 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 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/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= -github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= -github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= -github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= -github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= -github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= -github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/expr-lang/expr v1.15.8 h1:FL8+d3rSSP4tmK9o+vKfSMqqpGL8n15pEPiHcnBpxoI= +github.com/expr-lang/expr v1.15.8/go.mod h1:uCkhfG+x7fcZ5A5sXHKuQ07jGZRl6J0FCAaf2k4PtVQ= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/cel-go v0.17.7 h1:6ebJFzu1xO2n7TLtN+UBqShGBhlD85bhvglh5DpcfqQ= github.com/google/cel-go v0.17.7/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY= -github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= -github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= -github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -50,121 +19,37 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kubernetes/kubernetes/staging/src/k8s.io/apiserver v0.0.0-20231128103858-022d50fe3a1b h1:Fk/E68MGkRYWKDV3EDg+b8+TG8Hnhx4eCu2xOdhXwpg= -github.com/kubernetes/kubernetes/staging/src/k8s.io/apiserver v0.0.0-20231128103858-022d50fe3a1b/go.mod h1:ddHr74uxpPxJC1BxYVZizfDu6oTTTPhQWdj/WkMmaRA= -github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -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/onsi/ginkgo/v2 v2.9.4 h1:xR7vG4IXt5RWx6FfIjyAtsoMAtnc3C/rFXBBd2AjZwE= -github.com/onsi/ginkgo/v2 v2.9.4/go.mod h1:gCQYp2Q+kSoIj7ykSVb9nskRSsR6PUj4AiLywzIhbKM= -github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= -github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= 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/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ainaU= -github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= +github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= -golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y= -golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 h1:nIgk/EEq3/YlnmVVXVnm14rC2oxgs1o0ong4sD/rd44= google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q= google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.28.4 h1:8ZBrLjwosLl/NYgv1P7EQLqoO8MGQApnbgH8tu3BMzY= -k8s.io/api v0.28.4/go.mod h1:axWTGrY88s/5YE+JSt4uUi6NMM+gur1en2REMR7IRj0= -k8s.io/apimachinery v0.28.4 h1:zOSJe1mc+GxuMnFzD4Z/U1wst50X28ZNsn5bhgIIao8= -k8s.io/apimachinery v0.28.4/go.mod h1:wI37ncBvfAoswfq626yPTe6Bz1c22L7uaJ8dho83mgg= -k8s.io/client-go v0.28.4 h1:Np5ocjlZcTrkyRJ3+T3PkXDpe4UpatQxj85+xjaD2wY= -k8s.io/client-go v0.28.4/go.mod h1:0VDZFpgoZfelyP5Wqu0/r/TRYcLYuJ2U1KEeoaPa1N4= -k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= -k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= -k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= -k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= -sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= -sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/web/assets/css/styles.css b/web/assets/css/styles.css index d03d4b6..cf7afaa 100644 --- a/web/assets/css/styles.css +++ b/web/assets/css/styles.css @@ -1,5 +1,6 @@ /** * Copyright 2023 Undistro Authors + * Modifications Fork and conversion to Expr Copyright 2024 Peter Olds * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +39,7 @@ a { color: #9551ec; } -.cel-logo { +.expr-logo { height: 24px; } diff --git a/web/assets/data.json b/web/assets/data.json deleted file mode 100644 index c0a4739..0000000 --- a/web/assets/data.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "examples": [ - { - "name": "default", - "cel": "// Welcome to the CEL Playground!\n// CEL Playground is an interactive WebAssembly powered environment to explore and experiment with the Common Expression Language (CEL).\n//\n// - Write your CEL expression here\n// - Use the area on the side for input data, in YAML or JSON format\n// - Press 'Run' to evaluate your CEL expression against the input data\n// - Explore our collection of examples for inspiration\n\naccount.balance >= transaction.withdrawal\n || (account.overdraftProtection\n && account.overdraftLimit >= transaction.withdrawal - account.balance)\n", - "data": "# Here is the input data in YAML or JSON format.\n\naccount:\n balance: 500\n overdraftProtection: true\n overdraftLimit: 1000\ntransaction:\n withdrawal: 700\n", - "category": "default" - }, - { - "name": "Check image registry", - "cel": "object.spec.template.spec.containers.all(container,\n params.allowedRegistries.exists(registry,\n ((registry in ['docker.io', 'docker.io/library']) && !container.image.contains('/')) ||\n container.image.startsWith(registry)\n )\n)\n", - "data": "params:\n allowedRegistries: \n - myregistry.com\n - docker.io # use 'docker.io' for Docker Hub\nobject:\n apiVersion: apps/v1\n kind: Deployment\n metadata:\n name: nginx\n spec:\n template:\n metadata:\n name: nginx\n labels:\n app: nginx\n spec:\n containers:\n - name: nginx\n image: nginx # the expression looks for this field\n selector:\n matchLabels:\n app: nginx\n", - "category": "Kubernetes" - }, - { - "name": "Disallow HostPorts", - "cel": "// According the Pod Security Standards, HostPorts should be disallowed entirely.\n// https://kubernetes.io/docs/concepts/security/pod-security-standards/#baseline\n\nobject.spec.template.spec.containers.all(container,\n !has(container.ports) ||\n container.ports.all(port,\n !has(port.hostPort) ||\n port.hostPort == 0\n )\n)\n", - "data": "object:\n apiVersion: apps/v1\n kind: Deployment\n metadata:\n name: nginx\n spec:\n template:\n metadata:\n name: nginx\n labels:\n app: nginx\n spec:\n containers:\n - name: nginx\n image: nginx\n ports:\n - containerPort: 80\n hostPort: 80 # the expression looks for this field\n selector:\n matchLabels:\n app: nginx\n", - "category": "Kubernetes" - }, - { - "name": "Require non-root containers", - "cel": "// According the Pod Security Standards, Containers must be required to run as non-root users.\n// https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted\n\n// Pod or Containers must set `securityContext.runAsNonRoot`\n(\n (has(object.spec.template.spec.securityContext) && has(object.spec.template.spec.securityContext.runAsNonRoot)) ||\n object.spec.template.spec.containers.all(container,\n has(container.securityContext) && has(container.securityContext.runAsNonRoot)\n )\n)\n&&\n\n// Neither Pod nor Containers should set `securityContext.runAsNonRoot` to false\n(\n (!has(object.spec.template.spec.securityContext) || !has(object.spec.template.spec.securityContext.runAsNonRoot) || object.spec.template.spec.securityContext.runAsNonRoot != false)\n &&\n object.spec.template.spec.containers.all(container,\n !has(container.securityContext) || !has(container.securityContext.runAsNonRoot) || container.securityContext.runAsNonRoot != false\n )\n)\n", - "data": "object:\n apiVersion: apps/v1\n kind: Deployment\n metadata:\n name: nginx\n spec:\n template:\n metadata:\n name: nginx\n labels:\n app: nginx\n spec:\n securityContext:\n runAsNonRoot: true # the expression looks for this field\n containers:\n - name: nginx\n image: nginx\n securityContext:\n runAsNonRoot: false # and this one\n selector:\n matchLabels:\n app: nginx\n", - "category": "Kubernetes" - }, - { - "name": "Drop ALL capabilities", - "cel": "// According the Pod Security Standards, Containers must drop `ALL` capabilities, and are only permitted to add back the `NET_BIND_SERVICE` capability.\n// https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted\n\n// Containers must drop `ALL` capabilities,\nobject.spec.template.spec.containers.all(container,\n has(container.securityContext) &&\n has(container.securityContext.capabilities) &&\n has(container.securityContext.capabilities.drop) &&\n size(container.securityContext.capabilities.drop) >= 1 &&\n container.securityContext.capabilities.drop.exists(c, c == 'ALL')\n)\n&&\n// and are only permitted to add back the `NET_BIND_SERVICE` capability\nobject.spec.template.spec.containers.all(container,\n !has(container.securityContext) ||\n !has(container.securityContext.capabilities) ||\n !has(container.securityContext.capabilities.add) ||\n container.securityContext.capabilities.add.all(cap, cap in params.allowedCapabilities)\n)\n", - "data": "params:\n allowedCapabilities: [NET_BIND_SERVICE]\nobject:\n apiVersion: apps/v1\n kind: Deployment\n metadata:\n name: nginx\n spec:\n template:\n metadata:\n name: nginx\n labels:\n app: nginx\n spec:\n containers:\n - name: nginx\n image: nginx\n securityContext:\n capabilities: # the expression looks for this object\n drop: [ALL]\n add: [NET_BIND_SERVICE]\n selector:\n matchLabels:\n app: nginx\n", - "category": "Kubernetes" - }, - { - "name": "Semantic version check for image tags (Regex)", - "cel": "// Checks if the container images are tagged following the semantic version.\n\nobject.spec.containers.all(container,\n container.image.contains(\"@sha256\") || // allow digest\n container.image.lastIndexOf(\":\") > -1 &&\n container.image.substring(container.image.lastIndexOf(\":\") + 1)\n .matches('^v?(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)\\\\.(0|[1-9]\\\\d*)(?:-((?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\\\.(?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\\\+([0-9a-zA-Z-]+(?:\\\\.[0-9a-zA-Z-]+)*))?$')\n // the regex above is suggested by semver.org: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\n // allowing the \"v\" prefix\n)\n", - "data": "object:\n apiVersion: v1\n kind: Pod\n metadata:\n name: nginx\n labels:\n app: nginx\n spec:\n containers:\n - name: ok1\n image: registry.com:80/nginx:v1.2.3-rc.1\n - name: ok2\n image: registry.com:80/nginx@sha256:asdf\n - name: wrong\n image: registry.com:80/nginx:latest # comment the wrong container to test a success scenario\n", - "category": "Kubernetes" - }, - { - "name": "URLs", - "cel": "// Examples of Kubernetes URL CEL library that is available in the playground.\n// https://kubernetes.io/docs/reference/using-api/cel/#kubernetes-url-library\n\nisURL(object.href) \n&& url(object.href).getScheme() == 'https' \n&& url(object.href).getHost() == 'example.com:80'\n&& url(object.href).getHostname() == 'example.com'\n&& url(object.href).getPort() == '80'\n&& url(object.href).getEscapedPath() == '/path'\n&& url(object.href).getQuery().size() == 1\n", - "data": "{\n \"object\": {\n \"href\": \"https://user:pass@example.com:80/path?query=val#fragment\"\n }\n}\n", - "category": "General" - }, - { - "name": "Check JWT custom claims", - "cel": "// Exercise provided in CEL-Go Google Codelab.\n// https://codelabs.developers.google.com/codelabs/cel-go/index.html#10\n// \n// Determine whether the jwt.extra_claims has at least one key that starts\n// with the group prefix, and ensure that all group-like keys have list\n// values containing only strings that end with '@acme.co'.\n\njwt.extra_claims.exists(c, c.startsWith('group'))\n&& jwt.extra_claims\n .filter(c, c.startsWith('group'))\n .all(c, jwt.extra_claims[c]\n .all(g, g.endsWith('@acme.co')))\n", - "data": "jwt: {\n \"iss\": \"auth.acme.com:12350\",\n \"sub\": \"serviceAccount:delegate@acme.co\",\n \"aud\": \"my-project\",\n \"extra_claims\": {\n \"group1\": [\n \"admin@acme.co\",\n \"analyst@acme.co\"\n ],\n \"groupN\": [\n \"forever@acme.co\"\n ],\n \"labels\": [ \"metadata\", \"prod\", \"pii\" ]\n }\n}\n", - "category": "General" - }, - { - "name": "Optional", - "cel": "object.?foo.orValue(\"fallback\")", - "data": "object: {}", - "category": "General" - }, - { - "name": "Duration and timestamp", - "cel": "// Validate that 'expired' date is after a 'created' date plus a 'ttl' duration\nhas(object.expired) && \ntimestamp(object.created) + duration(object.ttl) < timestamp(object.expired)\n", - "data": "object:\n created: \"2023-06-14T02:00:14+00:00\"\n ttl: \"5m\"\n expired: \"2023-06-14T02:06:14+00:00\"\n", - "category": "General" - }, - { - "name": "Quantity", - "cel": "// Quantity library introduced in Kubernetes 1.28\n\nisQuantity(object.memory) && \nquantity(object.memory)\n .add(quantity(\"700M\"))\n .sub(1) // test without this subtraction\n .isLessThan(quantity(object.limit))\n", - "data": "object:\n memory: 1.3G\n limit: 2G\n", - "category": "General" - }, - { - "name": "Access Log Filtering", - "cel": "// Use CEL to filter access logs in Istio by response code or target cluster.\n// https://istio.io/latest/docs/tasks/observability/logs/telemetry-api/#get-started-with-telemetry-api\n//\n// apiVersion: telemetry.istio.io/v1alpha1\n// kind: Telemetry\n// metadata:\n// name: default-exception-logging\n// namespace: istio-system\n// spec:\n// accessLogging:\n// - providers:\n// - name: otel\n// filter:\n// expression: \"response.code >= 400 || xds.cluster_name == 'BlackHoleCluster' || xds.cluster_name == 'PassthroughCluster' \"\n\nresponse.code >= 400 || (xds.cluster_name == 'BlackHoleCluster' || xds.cluster_name == 'PassthroughCluster')\n", - "data": "# The following configuration is true access logs only when the response code is greater or equal to 400\n# or the request went to the BlackHoleCluster or the PassthroughCluster\nrequest:\n duration: \"173.403244ms\"\n headers:\n x-request-id: \"e8e687ab-fbbd-4662-8416-11761a29de36\"\n host: \"httpbin.org\"\n id: \"e8e687ab-fbbd-4662-8416-11761a29de36\"\n method: \"GET\"\n path: \"/get\"\n protocol: \"HTTP/1.1\"\n query: \"\"\n referer: null\n scheme: \"http\"\n size: 0\n time: \"2023-10-13T20:32:04.7006+00:00\"\n total_size: 1000\n url_path: \"/get\"\n useragent: \"curl/8.2.1\"\nresponse:\n code: 200\n code_details: \"via_upstream\"\n flags: 0\n grpc_status: 2\n headers:\n content-type: \"application/json\"\n size: 1181\n total_size: 1377\nconnection:\n id: 269\n mtls: false\n requested_server_name: \"\"\nupstream:\n address: \"54.80.46.162:80\"\n local_address: \"10.244.0.37:51128\"\n port: 80\n transport_failure_reason: \"\"\nxds:\n cluster_metadata: \"\"\n cluster_name: \"PassthroughCluster\"\n filter_chain_name: \"\"\n route_metadata: \"\"\n route_name: \"allow_any\"\n upstream_host_metadata: \"NULL\"\n", - "category": "Istio" - }, - { - "name": "Custom Metrics", - "cel": "// Use CEL to customize the metrics that Istio generates\n// https://istio.io/latest/docs/tasks/observability/metrics/customize-metrics/#use-expressions-for-values\n// \n// apiVersion: telemetry.istio.io/v1alpha1\n// kind: Telemetry\n// metadata:\n// name: namespace-metrics\n// spec:\n// metrics:\n// - providers:\n// - name: prometheus\n// overrides:\n// - match:\n// metric: REQUEST_COUNT\n// tagOverrides:\n// destination_port:\n// value: \"string(destination.port)\" # <--- CEL\n// request_host:\n// value: \"request.host\" # <--- CEL\n\nhas(request.host) ? request.host : \"unknown\"\n", - "data": "request:\n duration: \"4.144461ms\"\n headers:\n x-request-id: \"7a61a297-e508-43b7-94e8-b3919367e2d2\"\n host: \"echo\"\n id: \"7a61a297-e508-43b7-94e8-b3919367e2d2\"\n method: \"GET\"\n path: \"/\"\n protocol: \"HTTP/1.1\"\n query: \"\"\n referer: null\n scheme: \"http\"\n size: 0\n time: \"2023-10-13T20:30:38.106932+00:00\"\n total_size: 478\n url_path: \"/\"\n useragent: \"curl/8.2.1\"\nresponse:\n code: \"200\"\n code_details: \"via_upstream\"\n flags: \"0\"\n grpc_status: \"2\"\n headers:\n content-type: \"application/json\"\n size: 714\n total_size: 1594\nconnection:\n id: 36\n mtls: true\n dns_san_local_certificate: null\n dns_san_peer_certificate: null\n requested_server_name: \"outbound_.80_._.echo.default.svc.cluster.local\"\n sha256_peer_certificate_digest: \"1386a353d125910412d0ecfa7abb2f3fbee9ff3c77dd4d5c19312a8d51e27557\"\n subject_local_certificate: \"\"\n subject_peer_certificate: \"\"\n termination_details: null\n tls_version: \"TLSv1.3\"\n uri_san_local_certificate: \"spiffe://cluster.local/ns/default/sa/default\"\n uri_san_peer_certificate: \"spiffe://cluster.local/ns/default/sa/default\"\nupstream:\n address: \"10.244.0.38:80\"\n dns_san_local_certificate: null\n dns_san_peer_certificate: null\n local_address: \"127.0.0.6:58023\"\n port: 80\n sha256_peer_certificate_digest: null\n subject_local_certificate: null\n subject_peer_certificate: null\n tls_version: null\n transport_failure_reason: \"\"\n uri_san_local_certificate: null\n uri_san_peer_certificate: null\nxds:\n cluster_metadata:\n filter_metadata:\n istio:\n services:\n - host: \"echo.default.svc.cluster.local\"\n name: \"echo\"\n namespace: \"default\"\n cluster_name: \"inbound|80||\"\n filter_chain_name: \"0.0.0.0_80\"\n route_metadata: \"\"\n route_name: \"default\"\n upstream_host_metadata: \"NULL\"\n", - "category": "Istio" - }, - { - "name": "Blank", - "cel": "", - "data": "", - "category": "Blank" - } - ], - "versions": { - "cel-go": "v0.17.7" - } -} diff --git a/web/assets/js/cost-tooltip.js b/web/assets/js/cost-tooltip.js deleted file mode 100644 index 1e75da9..0000000 --- a/web/assets/js/cost-tooltip.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2023 Undistro 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. - */ - -const costTooltipElement = document.getElementById("cost-tooltip"); -const costInfoElement = document.getElementById("cost-info"); - -function openCostInfoTooltip() { - costTooltipElement.style.display = "initial"; -} - -costInfoElement.addEventListener("mouseover", openCostInfoTooltip); - -costInfoElement.addEventListener("mouseleave", () => { - costTooltipElement.style.display = "none"; -}); diff --git a/web/assets/js/editor.js b/web/assets/js/editor.js index a757312..3694583 100644 --- a/web/assets/js/editor.js +++ b/web/assets/js/editor.js @@ -1,5 +1,6 @@ /** * Copyright 2023 Undistro Authors + * Modifications Fork and conversion to Expr Copyright 2024 Peter Olds * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +16,7 @@ */ const EDITOR_DEFAULTS = { - "cel-input": { + "expr-input": { theme: "ace/theme/clouds", mode: "ace/mode/javascript", }, diff --git a/web/assets/js/main.js b/web/assets/js/main.js index f6043a4..1fb6c70 100644 --- a/web/assets/js/main.js +++ b/web/assets/js/main.js @@ -1,5 +1,6 @@ /** * Copyright 2023 Undistro Authors + * Modifications Fork and conversion to Expr Copyright 2024 Peter Olds * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,22 +30,15 @@ if (!WebAssembly.instantiateStreaming) { }; } -const celEditor = new AceEditor("cel-input"); +const exprEditor = new AceEditor("expr-input"); const dataEditor = new AceEditor("data-input"); const output = document.getElementById("output"); -const costElem = document.getElementById("cost"); - -function setCost(cost) { - costElem.innerText = cost || "-"; -} function run() { const data = dataEditor.getValue(); - const expression = celEditor.getValue(); - const cost = document.getElementById("cost"); + const expression = exprEditor.getValue(); output.value = "Evaluating..."; - setCost(""); const result = eval(expression, data); @@ -54,10 +48,9 @@ function run() { output.value = resultOutput; output.style.color = "red"; } else { - const { result, cost } = JSON.parse(resultOutput); - output.value = JSON.stringify(result); + const { result } = JSON.parse(resultOutput); + output.value = JSON.stringify(result, null, 2); output.style.color = "white"; - setCost(cost); } } @@ -77,24 +70,24 @@ toggleBtn.addEventListener("click", function () { function toggleMode(theme) { let toggleIcon = document.getElementsByClassName("toggle-theme__icon")[0]; - let celLogo = document.getElementsByClassName("cel-logo")[0]; + let exprLogo = document.getElementsByClassName("expr-logo")[0]; let copyIcon = document.querySelectorAll(".editor-copy-icon"); if (theme === "dark") { document.body.classList.add("dark"); toggleIcon.src = "./assets/img/moon.svg"; - celEditor.editor.setTheme("ace/theme/tomorrow_night"); + exprEditor.editor.setTheme("ace/theme/tomorrow_night"); dataEditor.editor.setTheme("ace/theme/tomorrow_night"); - celLogo.src = "./assets/img/logo-dark.svg"; + exprLogo.src = "./assets/img/logo-dark.svg"; copyIcon[0].src = "./assets/img/copy-dark.svg"; copyIcon[1].src = "./assets/img/copy-dark.svg"; localStorage.setItem("theme", "dark"); } else { document.body.classList.remove("dark"); toggleIcon.src = "./assets/img/sun.svg"; - celEditor.editor.setTheme("ace/theme/clouds"); + exprEditor.editor.setTheme("ace/theme/clouds"); dataEditor.editor.setTheme("ace/theme/clouds"); - celLogo.src = "./assets/img/logo.svg"; + exprLogo.src = "./assets/img/logo.svg"; copyIcon[0].src = "./assets/img/copy.svg"; copyIcon[1].src = "./assets/img/copy.svg"; localStorage.setItem("theme", "light"); @@ -103,7 +96,7 @@ function toggleMode(theme) { function share() { const data = dataEditor.getValue(); - const expression = celEditor.getValue(); + const expression = exprEditor.getValue(); const obj = { data: data, @@ -141,41 +134,41 @@ if (urlParams.has("content")) { throw new Error("Invalid content parameter"); } const obj = JSON.parse(decompressedData); - celEditor.setValue(obj.expression, -1); + exprEditor.setValue(obj.expression, -1); dataEditor.setValue(obj.data, -1); } catch (error) { console.error(error); } } -let celCopyIcon = document.getElementById("cel-copy-icon"); -let celCopyHover = document.getElementById("cel-copy-hover"); -let celCopyClick = document.getElementById("cel-copy-click"); -let celInput = document.getElementById("cel-cont"); +let exprCopyIcon = document.getElementById("expr-copy-icon"); +let exprCopyHover = document.getElementById("expr-copy-hover"); +let exprCopyClick = document.getElementById("expr-copy-click"); +let exprInput = document.getElementById("expr-cont"); -celInput.addEventListener("mouseover", () => { - celCopyIcon.style.display = "inline"; +exprInput.addEventListener("mouseover", () => { + exprCopyIcon.style.display = "inline"; }); -celInput.addEventListener("mouseleave", () => { - celCopyIcon.style.display = "none"; +exprInput.addEventListener("mouseleave", () => { + exprCopyIcon.style.display = "none"; }); -celCopyIcon.addEventListener("click", () => { - let value = celEditor.editor.getValue(); +exprCopyIcon.addEventListener("click", () => { + let value = exprEditor.editor.getValue(); navigator.clipboard.writeText(value).catch(console.error); - celCopyHover.style.display = "none"; - celCopyClick.style.display = "flex"; + exprCopyHover.style.display = "none"; + exprCopyClick.style.display = "flex"; setTimeout(() => { - celCopyClick.style.display = "none"; + exprCopyClick.style.display = "none"; }, 1000); }); -celCopyIcon.addEventListener("mouseover", () => { - celCopyHover.style.display = "flex"; +exprCopyIcon.addEventListener("mouseover", () => { + exprCopyHover.style.display = "flex"; }); -celCopyIcon.addEventListener("mouseleave", () => { - celCopyHover.style.display = "none"; +exprCopyIcon.addEventListener("mouseleave", () => { + exprCopyHover.style.display = "none"; }); let dataCopyIcon = document.getElementById("data-copy-icon"); @@ -241,7 +234,7 @@ function copy() { go.run(result.instance); document.getElementById("run").disabled = false; document.getElementById("output").placeholder = - "Press 'Run' to evaluate your CEL expression."; + "Press 'Run' to evaluate your Expr expression."; }) .catch((err) => { console.error(err); @@ -264,8 +257,8 @@ document.addEventListener("keydown", (event) => { fetch("../assets/data.json") .then((response) => response.json()) .then(({ examples, versions }) => { - // Dynamically set the CEL Go version - document.getElementById("version").innerText = versions["cel-go"]; + // Dynamically set the Expr Go version + document.getElementById("version").innerText = versions["expr"]; // Load the examples into the select element const examplesList = document.getElementById("examples"); @@ -296,7 +289,7 @@ fetch("../assets/data.json") if (example.label === "default") { if (!urlParams.has("content")) { - celEditor.setValue(example.value[0].cel, -1); + exprEditor.setValue(example.value[0].expr, -1); dataEditor.setValue(example.value[0].data, -1); } } else if (example.label === "Blank") { @@ -317,9 +310,8 @@ fetch("../assets/data.json") const example = examples.find( (example) => example.name === event.target.value ); - celEditor.setValue(example.cel, -1); + exprEditor.setValue(example.expr, -1); dataEditor.setValue(example.data, -1); - setCost(""); output.value = ""; }); }) diff --git a/web/assets/main.wasm.gz b/web/assets/main.wasm.gz deleted file mode 100755 index d57d783..0000000 Binary files a/web/assets/main.wasm.gz and /dev/null differ diff --git a/web/index.html b/web/index.html index 7c99147..b8da1cd 100644 --- a/web/index.html +++ b/web/index.html @@ -1,6 +1,7 @@ - - -