Files
ocis/vendor/github.com/vektah/gqlparser/v2/ast/value.go
Michal Klos b9077d96d8 chore(deps): consolidate dependency and security bumps (#13081)
* chore(deps): consolidate dependency and security bumps

Dependabot PRs applied:
- #12878 qs 6.15.2 -> 6.16.0 (web/web-runtime)
- #13013 alpine 3.24.1 -> 3.24.2
- #13061 actions/checkout -> v7.0.1 (missed instance in k8s.yml)
- #13062 actions/setup-node -> v7.0.0 (missed instance in k8s.yml)
- #13075 simple-git 3.36.0 -> 4.0.1 (security)
- #13076 katex 0.16.45 -> 0.18.2+ (security)
- #13077 dompurify 3.4.13 -> 3.4.16 (security)
- #13079 go deps minor-and-patch group, 18 updates (opa 1.19.0 -> 1.21.1, otel 1.46 -> 1.47, bleve, govips, grpc-gateway, lico, tablewriter, logrus, gjson, x/exp, x/image, genproto, etc.)

Skipped (already satisfied on master): #12513, #12624, #12625, #12633

Manual security bumps via pnpm.overrides (no dependabot PR existed):
- axios -> 1.20.0
- smol-toml -> 1.9.0
- postcss -> 8.5.23
- postcss-selector-parser -> 7.1.6
- colord -> 2.9.4
- unhead -> 2.1.13
- markdown-it -> 14.3.1
- esbuild -> 0.28.1
- brace-expansion 5.0.11 -> 5.0.12

Not fixable: sprintf-js and elliptic have no patched version released upstream yet; left as-is.

go build and pnpm install verified clean.

* chore(deps): fix residual transitive vulns found by trivy

trivy flagged duplicate/stale resolutions that survived the earlier
override pass: dompurify (3.4.12 -> 3.4.16), qs (6.14.2 -> 6.16.0),
and fast-uri (3.1.7 -> 3.1.8, CVE-2026-86472). Added/bumped pnpm.overrides
accordingly. trivy fs scan of web/pnpm-lock.yaml now clean.

* chore(deps): bump reva to bac0e1ee144ab853a81c6b02142032f102dd245a

Pins github.com/owncloud/reva/v2 to bac0e1ee144ab853a81c6b02142032f102dd245a,
pulling in its go-playground/locales and huandu/xstrings version bumps.
Appends this PR to changelog/unreleased/bump-reva.md.

go build ./... verified clean after go mod vendor resync.

* fix(ci): revert unhead override, breaks web build

* revert: keep k8s.yml actions/checkout and setup-node pinned
2026-10-07 07:56:56 +02:00

139 lines
2.9 KiB
Go

package ast
import (
"fmt"
"strconv"
"strings"
)
type ValueKind int
const (
Variable ValueKind = iota
IntValue
FloatValue
StringValue
BlockValue
BooleanValue
NullValue
EnumValue
ListValue
ObjectValue
)
type Value struct {
Raw string
Children ChildValueList
Kind ValueKind
Position *Position `dump:"-" json:"-"`
Comment *CommentGroup
// Require validation
Definition *Definition
VariableDefinition *VariableDefinition
ExpectedType *Type
ExpectedTypeHasDefault bool
}
type ChildValue struct {
Name string
Value *Value
Position *Position `dump:"-" json:"-"`
Comment *CommentGroup
}
// isUnsetVariable reports whether v is a variable reference with no supplied
// value and no default — it should be treated as absent, not null.
func (v *Value) isUnsetVariable(vars map[string]any) bool {
if v.Kind != Variable {
return false
}
if _, ok := vars[v.Raw]; ok {
return false
}
return v.VariableDefinition == nil || v.VariableDefinition.DefaultValue == nil
}
func (v *Value) Value(vars map[string]any) (any, error) {
if v == nil {
return nil, nil
}
switch v.Kind {
case Variable:
if value, ok := vars[v.Raw]; ok {
return value, nil
}
if v.VariableDefinition != nil && v.VariableDefinition.DefaultValue != nil {
return v.VariableDefinition.DefaultValue.Value(vars)
}
return nil, nil
case IntValue:
return strconv.ParseInt(v.Raw, 10, 64)
case FloatValue:
return strconv.ParseFloat(v.Raw, 64)
case StringValue, BlockValue, EnumValue:
return v.Raw, nil
case BooleanValue:
return strconv.ParseBool(v.Raw)
case NullValue:
return nil, nil
case ListValue:
var val []any
for _, elem := range v.Children {
elemVal, err := elem.Value.Value(vars)
if err != nil {
return val, err
}
val = append(val, elemVal)
}
return val, nil
case ObjectValue:
val := map[string]any{}
for _, elem := range v.Children {
if elem.Value.isUnsetVariable(vars) {
continue
}
elemVal, err := elem.Value.Value(vars)
if err != nil {
return val, err
}
val[elem.Name] = elemVal
}
return val, nil
default:
panic(fmt.Errorf("unknown value kind %d", v.Kind))
}
}
func (v *Value) String() string {
if v == nil {
return "<nil>"
}
switch v.Kind {
case Variable:
return "$" + v.Raw
case IntValue, FloatValue, EnumValue, BooleanValue, NullValue:
return v.Raw
case StringValue, BlockValue:
return strconv.Quote(v.Raw)
case ListValue:
var val []string
for _, elem := range v.Children {
val = append(val, elem.Value.String())
}
return "[" + strings.Join(val, ",") + "]"
case ObjectValue:
var val []string
for _, elem := range v.Children {
val = append(val, elem.Name+":"+elem.Value.String())
}
return "{" + strings.Join(val, ",") + "}"
default:
panic(fmt.Errorf("unknown value kind %d", v.Kind))
}
}
func (v *Value) Dump() string {
return v.String()
}