diff --git a/CHANGELOG.md b/CHANGELOG.md index 98677a49..1f08f0e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Add `secrets: inherit` when calling release-info workflow [#555](https://github.com/hypermodeinc/modus/pull/555) - Fix introspection query when only mutations exist [#558](https://github.com/hypermodeinc/modus/pull/558) - Make `modus --version` just print modus CLI's version [#563](https://github.com/hypermodeinc/modus/pull/563) +- Refactor metadata dependencies [#564](https://github.com/hypermodeinc/modus/pull/564) ## 2024-11-04 - CLI 0.13.7 diff --git a/lib/metadata/go.mod b/lib/metadata/go.mod index 62d49ab2..52408361 100644 --- a/lib/metadata/go.mod +++ b/lib/metadata/go.mod @@ -6,20 +6,9 @@ require github.com/hypermodeinc/modus/lib/wasmextractor v0.0.0 replace github.com/hypermodeinc/modus/lib/wasmextractor => ../wasmextractor -require ( - github.com/hypermodeinc/modus/runtime v0.13.0-test.3 - github.com/tidwall/gjson v1.18.0 -) +require github.com/tidwall/gjson v1.18.0 require ( - github.com/getsentry/sentry-go v0.29.1 // indirect - github.com/go-viper/mapstructure/v2 v2.2.1 // indirect - github.com/goccy/go-json v0.10.3 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/spf13/cast v1.7.0 // indirect - github.com/tetratelabs/wazero v1.8.1 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect ) diff --git a/lib/metadata/go.sum b/lib/metadata/go.sum index aec9e595..2f9f294c 100644 --- a/lib/metadata/go.sum +++ b/lib/metadata/go.sum @@ -1,39 +1,3 @@ -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/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= -github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -github.com/getsentry/sentry-go v0.29.1 h1:DyZuChN8Hz3ARxGVV8ePaNXh1dQ7d76AiB117xcREwA= -github.com/getsentry/sentry-go v0.29.1/go.mod h1:x3AtIzN01d6SiWkderzaH28Tm0lgkafpJ5Bm3li39O0= -github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= -github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= -github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= -github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -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/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hypermodeinc/modus/runtime v0.13.0-test.3 h1:C+B+10Bn+axzpChzIzt9+A1Pgqa18QnGmaH2E5Wz4ng= -github.com/hypermodeinc/modus/runtime v0.13.0-test.3/go.mod h1:n5QMRjrF3yDnKDEUg2dv8NbCpy0M1Gzq701S0Rl0J/s= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= -github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= -github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/tetratelabs/wazero v1.8.1 h1:NrcgVbWfkWvVc4UtT4LRLDf91PsOzDzefMdwhLfA550= -github.com/tetratelabs/wazero v1.8.1/go.mod h1:yAI0XTsMBhREkM/YDAK/zNou3GoiAce1P6+rp/wQhjs= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= @@ -41,9 +5,3 @@ github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JT github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/lib/metadata/metadata.go b/lib/metadata/metadata.go index 1121fccd..f8f8dccb 100644 --- a/lib/metadata/metadata.go +++ b/lib/metadata/metadata.go @@ -10,13 +10,9 @@ package metadata import ( - "context" - "errors" "fmt" "strings" - "github.com/hypermodeinc/modus/runtime/utils" - "github.com/tidwall/gjson" ) @@ -150,11 +146,3 @@ func parseNameAndVersion(s string) (name string, version string) { } return s[:i], s[i+1:] } - -func GetMetadataFromContext(ctx context.Context) (*Metadata, error) { - v := ctx.Value(utils.MetadataContextKey) - if v == nil { - return nil, errors.New("metadata not found in context") - } - return v.(*Metadata), nil -} diff --git a/runtime/langsupport/typeinfo.go b/runtime/langsupport/typeinfo.go index a7a7ba48..9658216c 100644 --- a/runtime/langsupport/typeinfo.go +++ b/runtime/langsupport/typeinfo.go @@ -11,9 +11,11 @@ package langsupport import ( "context" + "errors" "reflect" "github.com/hypermodeinc/modus/lib/metadata" + "github.com/hypermodeinc/modus/runtime/utils" ) type TypeInfo interface { @@ -130,7 +132,7 @@ func GetTypeInfo(ctx context.Context, lti LanguageTypeInfo, typeName string, typ } else if lti.IsObjectType(typeName) { flags |= tfObject - md, err := metadata.GetMetadataFromContext(ctx) + md, err := getMetadataFromContext(ctx) if err != nil { return nil, err } @@ -302,3 +304,11 @@ func (h *typeInfo) ObjectFieldTypes() []TypeInfo { func (h *typeInfo) ObjectFieldOffsets() []uint32 { return h.fieldOffsets } + +func getMetadataFromContext(ctx context.Context) (*metadata.Metadata, error) { + v := ctx.Value(utils.MetadataContextKey) + if v == nil { + return nil, errors.New("metadata not found in context") + } + return v.(*metadata.Metadata), nil +}