Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- chore: Refactor metadata dependencies [#564](https://github.com/hypermodeinc/modus/pull/564)
- chore: Use Go workspace to simplify project dependencies [#565](https://github.com/hypermodeinc/modus/pull/565)
- fix: "WASM Host not found in context" error on shutdown [#566](https://github.com/hypermodeinc/modus/pull/566)
- fix: `__typename` should succeed on root fields [#573](https://github.com/hypermodeinc/modus/pull/573)

## 2024-11-06 - AssemblyScript SDK 0.13.4

Expand Down
16 changes: 9 additions & 7 deletions runtime/graphql/datasource/planner.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ type HypDSPlanner struct {
}

type fieldInfo struct {
ref int `json:"-"`
Name string `json:"name"`
Alias string `json:"alias,omitempty"`
TypeName string `json:"type,omitempty"`
Fields []fieldInfo `json:"fields,omitempty"`
IsMapType bool `json:"isMapType,omitempty"`
fieldRefs []int `json:"-"`
ref int `json:"-"`
Name string `json:"name"`
Alias string `json:"alias,omitempty"`
TypeName string `json:"type,omitempty"`
ParentType string `json:"parentType,omitempty"`
Fields []fieldInfo `json:"fields,omitempty"`
IsMapType bool `json:"isMapType,omitempty"`
fieldRefs []int `json:"-"`
}

func (t *fieldInfo) AliasOrName() string {
Expand Down Expand Up @@ -168,6 +169,7 @@ func (p *HypDSPlanner) captureField(ref int) *fieldInfo {
def, ok := walker.FieldDefinition(ref)
if ok {
f.TypeName = definition.FieldDefinitionTypeNameString(def)
f.ParentType = walker.EnclosingTypeDefinition.NameString(definition)
f.IsMapType = slices.Contains(p.config.MapTypes, f.TypeName)
}

Expand Down
5 changes: 5 additions & 0 deletions runtime/graphql/datasource/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ func (*ModusDataSource) LoadWithFiles(ctx context.Context, input []byte, files [

func (ds *ModusDataSource) callFunction(ctx context.Context, callInfo *callInfo) (any, []resolve.GraphQLError, error) {

// Handle special case for __typename on root Query or Mutation
if callInfo.FieldInfo.Name == "__typename" {
return callInfo.FieldInfo.ParentType, nil, nil
}

// Get the function info
fnInfo, err := ds.WasmHost.GetFunctionInfo(callInfo.FunctionName)
if err != nil {
Expand Down