diff --git a/server/e2e/gql_nlslayer_test.go b/server/e2e/gql_nlslayer_test.go new file mode 100644 index 0000000000..9732dbe34b --- /dev/null +++ b/server/e2e/gql_nlslayer_test.go @@ -0,0 +1,156 @@ +package e2e + +// import ( +// "net/http" +// "testing" + +// "github.com/gavv/httpexpect/v2" +// "github.com/reearth/reearth/server/internal/app/config" +// ) + +// func addNLSLayerSimple(e *httpexpect.Expect, sId string) (GraphQLRequest, *httpexpect.Value, string) { +// requestBody := GraphQLRequest{ +// OperationName: "addNLSLayerSimple", +// Query: `mutation AddNLSLayerSimple($input: AddNLSLayerSimpleInput!) { +// addNLSLayerSimple(input: $input) { +// layers { +// id +// __typename +// } +// __typename +// } +// }`, +// Variables: map[string]any{ +// "input": map[string]any{ +// "parentLayerId": "parent12345", +// "layerType": "SimpleType", +// "sceneID": sId, +// "config": map[string]any{ +// "data": map[string]any{ +// "type": "ExampleType", +// "url": "https://example.com/data", +// "value": "sampleValue", +// "layers": "sampleLayerData", +// "jsonProperties": []string{"prop1", "prop2"}, +// "updateInterval": 10, +// "parameters": map[string]any{ +// "sampleKey": "sampleValue", +// }, +// "time": map[string]any{ +// "property": "time", +// "interval": 5, +// "updateClockOnLoad": true, +// }, +// "csv": map[string]any{ +// "idColumn": "id", +// "latColumn": "latitude", +// "lngColumn": "longitude", +// "heightColumn": "height", +// "noHeader": false, +// "disableTypeConversion": true, +// }, +// }, +// "properties": "sampleProperties", +// "defines": map[string]string{ +// "defineKey": "defineValue", +// }, +// "events": "sampleEvents", +// }, +// "index": 0, +// }, +// }, +// } + +// res := e.POST("/api/graphql"). +// WithHeader("Origin", "https://example.com"). +// WithHeader("X-Reearth-Debug-User", uID.String()). +// WithHeader("Content-Type", "application/json"). +// WithJSON(requestBody). +// Expect(). +// Status(http.StatusOK). +// JSON() + +// layerId := res.Path("$.data.addNLSLayerSimple.layers.id").Raw().(string) +// return requestBody, res, layerId +// } + +// func removeNLSLayer(e *httpexpect.Expect, layerId string) (GraphQLRequest, *httpexpect.Value) { +// requestBody := GraphQLRequest{ +// OperationName: "removeNLSLayer", +// Query: `mutation RemoveNLSLayer($input: RemoveNLSLayerInput!) { +// removeNLSLayer(input: $input) { +// layerId +// } +// }`, +// Variables: map[string]any{ +// "input": map[string]any{ +// "layerId": layerId, +// }, +// }, +// } + +// res := e.POST("/api/graphql"). +// WithHeader("Origin", "https://example.com"). +// WithHeader("X-Reearth-Debug-User", uID.String()). +// WithHeader("Content-Type", "application/json"). +// WithJSON(requestBody). +// Expect(). +// Status(http.StatusOK). +// JSON() + +// return requestBody, res +// } + +// func updateNLSLayer(e *httpexpect.Expect, layerId string) (GraphQLRequest, *httpexpect.Value) { +// requestBody := GraphQLRequest{ +// OperationName: "updateNLSLayer", +// Query: `mutation UpdateNLSLayer($input: UpdateNLSLayerInput!) { +// updateNLSLayer(input: $input) { +// layer { +// id +// __typename +// } +// __typename +// } +// }`, +// Variables: map[string]any{ +// "input": map[string]any{ +// "layerId": layerId, +// "name": "Updated Layer", +// "visible": true, +// }, +// }, +// } + +// res := e.POST("/api/graphql"). +// WithHeader("Origin", "https://example.com"). +// WithHeader("X-Reearth-Debug-User", uID.String()). +// WithHeader("Content-Type", "application/json"). +// WithJSON(requestBody). +// Expect(). +// Status(http.StatusOK). +// JSON() + +// return requestBody, res +// } + +// func TestNLSLayerCRUD(t *testing.T) { +// e := StartServer(t, &config.Config{ +// Origins: []string{"https://example.com"}, +// AuthSrv: config.AuthSrvConfig{ +// Disabled: true, +// }, +// }, true, baseSeeder) + +// pId := createProject(e) +// _, _, sId := createScene(e, pId) + +// // Add NLSLayer +// _, _, layerId := addNLSLayerSimple(e, sId) + +// // Update NLSLayer +// _, _ = updateNLSLayer(e, layerId) + +// // Remove NLSLayer +// _, _ = removeNLSLayer(e, layerId) +// } diff --git a/server/go.sum b/server/go.sum index acc730e159..d537e712f5 100644 --- a/server/go.sum +++ b/server/go.sum @@ -493,10 +493,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/ravilushqa/otelgqlgen v0.8.0 h1:x48k+D1GMgm87xhMO2Lekrr9YGzFbpG3yijn9GpxuAY= github.com/ravilushqa/otelgqlgen v0.8.0/go.mod h1:6JO5YO2iY4POC7R6yB/L/RKXCcyISL8qQt5NnHOhh0o= -github.com/reearth/reearthx v0.0.0-20230728095451-b9d255b762d5 h1:FUjyN05gB3OeF+CyhUZ5LDrx8TLmjI+b8DueZMtKq2A= -github.com/reearth/reearthx v0.0.0-20230728095451-b9d255b762d5/go.mod h1:O4zFr6ks8jDKfgy9NBpZKp31jpmAPnfOtMQK9B6xX54= -github.com/reearth/reearthx v0.0.0-20230825065409-20e5d57ed3cf h1:84IW4YBa6xjxJml/F/jh51WR6WGlcI6QsRVACi5PhwQ= -github.com/reearth/reearthx v0.0.0-20230825065409-20e5d57ed3cf/go.mod h1:O4zFr6ks8jDKfgy9NBpZKp31jpmAPnfOtMQK9B6xX54= github.com/reearth/reearthx v0.0.0-20230825072907-543ac159f33b h1:7IsqB7KdGzp0hwlOIGb2imQW8mWJ9Ua9Ad5pAGNYaRs= github.com/reearth/reearthx v0.0.0-20230825072907-543ac159f33b/go.mod h1:b8EygPZ9VcMv9vTbnl/oz3PU/wHz3wpBa4rc7W7URjw= github.com/robertkrimen/godocdown v0.0.0-20130622164427-0bfa04905481/go.mod h1:C9WhFzY47SzYBIvzFqSvHIR6ROgDo4TtdTuRaOMjF/s= diff --git a/server/gql/layer.graphql b/server/gql/layer.graphql index 902a5b92d1..fa2ef558f1 100644 --- a/server/gql/layer.graphql +++ b/server/gql/layer.graphql @@ -298,5 +298,4 @@ extend type Mutation { importLayer(input: ImportLayerInput!): ImportLayerPayload attachTagToLayer(input: AttachTagToLayerInput!): AttachTagToLayerPayload detachTagFromLayer(input: DetachTagFromLayerInput!): DetachTagFromLayerPayload - } \ No newline at end of file diff --git a/server/gql/newlayer.graphql b/server/gql/newlayer.graphql new file mode 100644 index 0000000000..af1e56b002 --- /dev/null +++ b/server/gql/newlayer.graphql @@ -0,0 +1,81 @@ +# TODO: Make LayerGroup Real +interface NLSLayer { + id: ID! + layerType: String! + sceneId: ID! + title: String! + visible: Boolean! + infobox: Infobox + tags: [LayerTag!]! +} + +type NLSLayerSimple implements NLSLayer { + id: ID! + layerType: String! + sceneId: ID! + config: JSON + title: String! + visible: Boolean! + infobox: Infobox + tags: [LayerTag!]! + scene: Scene +} + +type NLSLayerGroup implements NLSLayer { + id: ID! + layerType: String! + sceneId: ID! + children: [NLSLayer]! + childrenIds: [ID!]! + config: JSON + title: String! + visible: Boolean! + infobox: Infobox + tags: [LayerTag!]! + scene: Scene +} + +# InputType + +input AddNLSLayerSimpleInput { + parentLayerId: ID! + layerType: String! + sceneID: ID! + config: JSON + index: Int +} + +input RemoveNLSLayerInput { + layerId: ID! +} + +input UpdateNLSLayerInput { + layerId: ID! + name: String + visible: Boolean +} + +# Payload + +type AddNLSLayerSimplePayload { + layers: NLSLayerSimple! +} + +type RemoveNLSLayerPayload { + layerId: ID! +} + +type UpdateNLSLayerPayload { + layer: NLSLayer! +} + +# TODO +# extend type Query{ +# newLayer(id: ID!): NLSLayer +# } + +extend type Mutation { + addNLSLayerSimple(input: AddNLSLayerSimpleInput!): AddNLSLayerSimplePayload + removeNLSLayer(input: RemoveNLSLayerInput!): RemoveNLSLayerPayload + updateNLSLayer(input: UpdateNLSLayerInput!): UpdateNLSLayerPayload +} \ No newline at end of file diff --git a/server/gql/scene.graphql b/server/gql/scene.graphql index 83162edb78..d4422fd325 100644 --- a/server/gql/scene.graphql +++ b/server/gql/scene.graphql @@ -13,6 +13,7 @@ type Scene implements Node { team: Team property: Property rootLayer: LayerGroup + newLayers: [NLSLayer!]! stories: [Story!]! styles: [Style!]! datasetSchemas(first: Int, last: Int, after: Cursor, before: Cursor): DatasetSchemaConnection! diff --git a/server/gqlgen.yml b/server/gqlgen.yml index 24595d90d6..3377acf0f5 100644 --- a/server/gqlgen.yml +++ b/server/gqlgen.yml @@ -302,6 +302,8 @@ models: resolver: true rootLayer: resolver: true + newLayers: + resolver: true datasetSchemas: resolver: true tags: @@ -390,3 +392,11 @@ models: resolver: true pluginExtension: resolver: true + NLSLayerSimple: + fields: + scene: + resolver: true + NLSLayerGroup: + fields: + scene: + resolver: true diff --git a/server/internal/adapter/gql/generated.go b/server/internal/adapter/gql/generated.go index e0fb72869e..9b5dee955b 100644 --- a/server/internal/adapter/gql/generated.go +++ b/server/internal/adapter/gql/generated.go @@ -60,6 +60,8 @@ type ResolverRoot interface { MergedPropertyField() MergedPropertyFieldResolver MergedPropertyGroup() MergedPropertyGroupResolver Mutation() MutationResolver + NLSLayerGroup() NLSLayerGroupResolver + NLSLayerSimple() NLSLayerSimpleResolver Plugin() PluginResolver PluginExtension() PluginExtensionResolver Project() ProjectResolver @@ -119,6 +121,10 @@ type ComplexityRoot struct { Team func(childComplexity int) int } + AddNLSLayerSimplePayload struct { + Layers func(childComplexity int) int + } + AddStylePayload struct { Scene func(childComplexity int) int Style func(childComplexity int) int @@ -544,6 +550,7 @@ type ComplexityRoot struct { AddLayerGroup func(childComplexity int, input gqlmodel.AddLayerGroupInput) int AddLayerItem func(childComplexity int, input gqlmodel.AddLayerItemInput) int AddMemberToTeam func(childComplexity int, input gqlmodel.AddMemberToTeamInput) int + AddNLSLayerSimple func(childComplexity int, input gqlmodel.AddNLSLayerSimpleInput) int AddPageLayer func(childComplexity int, input gqlmodel.PageLayerInput) int AddPropertyItem func(childComplexity int, input gqlmodel.AddPropertyItemInput) int AddStyle func(childComplexity int, input gqlmodel.AddStyleInput) int @@ -588,6 +595,7 @@ type ComplexityRoot struct { RemoveLayer func(childComplexity int, input gqlmodel.RemoveLayerInput) int RemoveMemberFromTeam func(childComplexity int, input gqlmodel.RemoveMemberFromTeamInput) int RemoveMyAuth func(childComplexity int, input gqlmodel.RemoveMyAuthInput) int + RemoveNLSLayer func(childComplexity int, input gqlmodel.RemoveNLSLayerInput) int RemovePageLayer func(childComplexity int, input gqlmodel.PageLayerInput) int RemovePropertyField func(childComplexity int, input gqlmodel.RemovePropertyFieldInput) int RemovePropertyItem func(childComplexity int, input gqlmodel.RemovePropertyItemInput) int @@ -605,6 +613,7 @@ type ComplexityRoot struct { UpdateLayer func(childComplexity int, input gqlmodel.UpdateLayerInput) int UpdateMe func(childComplexity int, input gqlmodel.UpdateMeInput) int UpdateMemberOfTeam func(childComplexity int, input gqlmodel.UpdateMemberOfTeamInput) int + UpdateNLSLayer func(childComplexity int, input gqlmodel.UpdateNLSLayerInput) int UpdateProject func(childComplexity int, input gqlmodel.UpdateProjectInput) int UpdatePropertyItems func(childComplexity int, input gqlmodel.UpdatePropertyItemInput) int UpdatePropertyValue func(childComplexity int, input gqlmodel.UpdatePropertyValueInput) int @@ -620,6 +629,32 @@ type ComplexityRoot struct { UploadPlugin func(childComplexity int, input gqlmodel.UploadPluginInput) int } + NLSLayerGroup struct { + Children func(childComplexity int) int + ChildrenIds func(childComplexity int) int + Config func(childComplexity int) int + ID func(childComplexity int) int + Infobox func(childComplexity int) int + LayerType func(childComplexity int) int + Scene func(childComplexity int) int + SceneID func(childComplexity int) int + Tags func(childComplexity int) int + Title func(childComplexity int) int + Visible func(childComplexity int) int + } + + NLSLayerSimple struct { + Config func(childComplexity int) int + ID func(childComplexity int) int + Infobox func(childComplexity int) int + LayerType func(childComplexity int) int + Scene func(childComplexity int) int + SceneID func(childComplexity int) int + Tags func(childComplexity int) int + Title func(childComplexity int) int + Visible func(childComplexity int) int + } + PageInfo struct { EndCursor func(childComplexity int) int HasNextPage func(childComplexity int) int @@ -903,6 +938,10 @@ type ComplexityRoot struct { Team func(childComplexity int) int } + RemoveNLSLayerPayload struct { + LayerID func(childComplexity int) int + } + RemoveStoryBlockPayload struct { BlockID func(childComplexity int) int Page func(childComplexity int) int @@ -929,6 +968,7 @@ type ComplexityRoot struct { CreatedAt func(childComplexity int) int DatasetSchemas func(childComplexity int, first *int, last *int, after *usecasex.Cursor, before *usecasex.Cursor) int ID func(childComplexity int) int + NewLayers func(childComplexity int) int Plugins func(childComplexity int) int Project func(childComplexity int) int ProjectID func(childComplexity int) int @@ -1129,6 +1169,10 @@ type ComplexityRoot struct { Team func(childComplexity int) int } + UpdateNLSLayerPayload struct { + Layer func(childComplexity int) int + } + UpdateStylePayload struct { Scene func(childComplexity int) int Style func(childComplexity int) int @@ -1353,6 +1397,9 @@ type MutationResolver interface { ImportLayer(ctx context.Context, input gqlmodel.ImportLayerInput) (*gqlmodel.ImportLayerPayload, error) AttachTagToLayer(ctx context.Context, input gqlmodel.AttachTagToLayerInput) (*gqlmodel.AttachTagToLayerPayload, error) DetachTagFromLayer(ctx context.Context, input gqlmodel.DetachTagFromLayerInput) (*gqlmodel.DetachTagFromLayerPayload, error) + AddNLSLayerSimple(ctx context.Context, input gqlmodel.AddNLSLayerSimpleInput) (*gqlmodel.AddNLSLayerSimplePayload, error) + RemoveNLSLayer(ctx context.Context, input gqlmodel.RemoveNLSLayerInput) (*gqlmodel.RemoveNLSLayerPayload, error) + UpdateNLSLayer(ctx context.Context, input gqlmodel.UpdateNLSLayerInput) (*gqlmodel.UpdateNLSLayerPayload, error) InstallPlugin(ctx context.Context, input gqlmodel.InstallPluginInput) (*gqlmodel.InstallPluginPayload, error) UninstallPlugin(ctx context.Context, input gqlmodel.UninstallPluginInput) (*gqlmodel.UninstallPluginPayload, error) UploadPlugin(ctx context.Context, input gqlmodel.UploadPluginInput) (*gqlmodel.UploadPluginPayload, error) @@ -1410,6 +1457,12 @@ type MutationResolver interface { UpdateWidgetAlignSystem(ctx context.Context, input gqlmodel.UpdateWidgetAlignSystemInput) (*gqlmodel.UpdateWidgetAlignSystemPayload, error) RemoveWidget(ctx context.Context, input gqlmodel.RemoveWidgetInput) (*gqlmodel.RemoveWidgetPayload, error) } +type NLSLayerGroupResolver interface { + Scene(ctx context.Context, obj *gqlmodel.NLSLayerGroup) (*gqlmodel.Scene, error) +} +type NLSLayerSimpleResolver interface { + Scene(ctx context.Context, obj *gqlmodel.NLSLayerSimple) (*gqlmodel.Scene, error) +} type PluginResolver interface { Scene(ctx context.Context, obj *gqlmodel.Plugin) (*gqlmodel.Scene, error) TranslatedName(ctx context.Context, obj *gqlmodel.Plugin, lang *language.Tag) (string, error) @@ -1490,6 +1543,7 @@ type SceneResolver interface { Team(ctx context.Context, obj *gqlmodel.Scene) (*gqlmodel.Team, error) Property(ctx context.Context, obj *gqlmodel.Scene) (*gqlmodel.Property, error) RootLayer(ctx context.Context, obj *gqlmodel.Scene) (*gqlmodel.LayerGroup, error) + NewLayers(ctx context.Context, obj *gqlmodel.Scene) ([]gqlmodel.NLSLayer, error) Stories(ctx context.Context, obj *gqlmodel.Scene) ([]*gqlmodel.Story, error) DatasetSchemas(ctx context.Context, obj *gqlmodel.Scene, first *int, last *int, after *usecasex.Cursor, before *usecasex.Cursor) (*gqlmodel.DatasetSchemaConnection, error) @@ -1644,6 +1698,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.AddMemberToTeamPayload.Team(childComplexity), true + case "AddNLSLayerSimplePayload.layers": + if e.complexity.AddNLSLayerSimplePayload.Layers == nil { + break + } + + return e.complexity.AddNLSLayerSimplePayload.Layers(childComplexity), true + case "AddStylePayload.scene": if e.complexity.AddStylePayload.Scene == nil { break @@ -3513,6 +3574,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.AddMemberToTeam(childComplexity, args["input"].(gqlmodel.AddMemberToTeamInput)), true + case "Mutation.addNLSLayerSimple": + if e.complexity.Mutation.AddNLSLayerSimple == nil { + break + } + + args, err := ec.field_Mutation_addNLSLayerSimple_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.AddNLSLayerSimple(childComplexity, args["input"].(gqlmodel.AddNLSLayerSimpleInput)), true + case "Mutation.addPageLayer": if e.complexity.Mutation.AddPageLayer == nil { break @@ -4041,6 +4114,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.RemoveMyAuth(childComplexity, args["input"].(gqlmodel.RemoveMyAuthInput)), true + case "Mutation.removeNLSLayer": + if e.complexity.Mutation.RemoveNLSLayer == nil { + break + } + + args, err := ec.field_Mutation_removeNLSLayer_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RemoveNLSLayer(childComplexity, args["input"].(gqlmodel.RemoveNLSLayerInput)), true + case "Mutation.removePageLayer": if e.complexity.Mutation.RemovePageLayer == nil { break @@ -4245,6 +4330,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.UpdateMemberOfTeam(childComplexity, args["input"].(gqlmodel.UpdateMemberOfTeamInput)), true + case "Mutation.updateNLSLayer": + if e.complexity.Mutation.UpdateNLSLayer == nil { + break + } + + args, err := ec.field_Mutation_updateNLSLayer_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateNLSLayer(childComplexity, args["input"].(gqlmodel.UpdateNLSLayerInput)), true + case "Mutation.updateProject": if e.complexity.Mutation.UpdateProject == nil { break @@ -4401,6 +4498,146 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Mutation.UploadPlugin(childComplexity, args["input"].(gqlmodel.UploadPluginInput)), true + case "NLSLayerGroup.children": + if e.complexity.NLSLayerGroup.Children == nil { + break + } + + return e.complexity.NLSLayerGroup.Children(childComplexity), true + + case "NLSLayerGroup.childrenIds": + if e.complexity.NLSLayerGroup.ChildrenIds == nil { + break + } + + return e.complexity.NLSLayerGroup.ChildrenIds(childComplexity), true + + case "NLSLayerGroup.config": + if e.complexity.NLSLayerGroup.Config == nil { + break + } + + return e.complexity.NLSLayerGroup.Config(childComplexity), true + + case "NLSLayerGroup.id": + if e.complexity.NLSLayerGroup.ID == nil { + break + } + + return e.complexity.NLSLayerGroup.ID(childComplexity), true + + case "NLSLayerGroup.infobox": + if e.complexity.NLSLayerGroup.Infobox == nil { + break + } + + return e.complexity.NLSLayerGroup.Infobox(childComplexity), true + + case "NLSLayerGroup.layerType": + if e.complexity.NLSLayerGroup.LayerType == nil { + break + } + + return e.complexity.NLSLayerGroup.LayerType(childComplexity), true + + case "NLSLayerGroup.scene": + if e.complexity.NLSLayerGroup.Scene == nil { + break + } + + return e.complexity.NLSLayerGroup.Scene(childComplexity), true + + case "NLSLayerGroup.sceneId": + if e.complexity.NLSLayerGroup.SceneID == nil { + break + } + + return e.complexity.NLSLayerGroup.SceneID(childComplexity), true + + case "NLSLayerGroup.tags": + if e.complexity.NLSLayerGroup.Tags == nil { + break + } + + return e.complexity.NLSLayerGroup.Tags(childComplexity), true + + case "NLSLayerGroup.title": + if e.complexity.NLSLayerGroup.Title == nil { + break + } + + return e.complexity.NLSLayerGroup.Title(childComplexity), true + + case "NLSLayerGroup.visible": + if e.complexity.NLSLayerGroup.Visible == nil { + break + } + + return e.complexity.NLSLayerGroup.Visible(childComplexity), true + + case "NLSLayerSimple.config": + if e.complexity.NLSLayerSimple.Config == nil { + break + } + + return e.complexity.NLSLayerSimple.Config(childComplexity), true + + case "NLSLayerSimple.id": + if e.complexity.NLSLayerSimple.ID == nil { + break + } + + return e.complexity.NLSLayerSimple.ID(childComplexity), true + + case "NLSLayerSimple.infobox": + if e.complexity.NLSLayerSimple.Infobox == nil { + break + } + + return e.complexity.NLSLayerSimple.Infobox(childComplexity), true + + case "NLSLayerSimple.layerType": + if e.complexity.NLSLayerSimple.LayerType == nil { + break + } + + return e.complexity.NLSLayerSimple.LayerType(childComplexity), true + + case "NLSLayerSimple.scene": + if e.complexity.NLSLayerSimple.Scene == nil { + break + } + + return e.complexity.NLSLayerSimple.Scene(childComplexity), true + + case "NLSLayerSimple.sceneId": + if e.complexity.NLSLayerSimple.SceneID == nil { + break + } + + return e.complexity.NLSLayerSimple.SceneID(childComplexity), true + + case "NLSLayerSimple.tags": + if e.complexity.NLSLayerSimple.Tags == nil { + break + } + + return e.complexity.NLSLayerSimple.Tags(childComplexity), true + + case "NLSLayerSimple.title": + if e.complexity.NLSLayerSimple.Title == nil { + break + } + + return e.complexity.NLSLayerSimple.Title(childComplexity), true + + case "NLSLayerSimple.visible": + if e.complexity.NLSLayerSimple.Visible == nil { + break + } + + return e.complexity.NLSLayerSimple.Visible(childComplexity), true + case "PageInfo.endCursor": if e.complexity.PageInfo.EndCursor == nil { break @@ -5851,6 +6088,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.RemoveMemberFromTeamPayload.Team(childComplexity), true + case "RemoveNLSLayerPayload.layerId": + if e.complexity.RemoveNLSLayerPayload.LayerID == nil { + break + } + + return e.complexity.RemoveNLSLayerPayload.LayerID(childComplexity), true + case "RemoveStoryBlockPayload.blockId": if e.complexity.RemoveStoryBlockPayload.BlockID == nil { break @@ -5947,6 +6191,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Scene.ID(childComplexity), true + case "Scene.newLayers": + if e.complexity.Scene.NewLayers == nil { + break + } + + return e.complexity.Scene.NewLayers(childComplexity), true + case "Scene.plugins": if e.complexity.Scene.Plugins == nil { break @@ -6881,6 +7132,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.UpdateMemberOfTeamPayload.Team(childComplexity), true + case "UpdateNLSLayerPayload.layer": + if e.complexity.UpdateNLSLayerPayload.Layer == nil { + break + } + + return e.complexity.UpdateNLSLayerPayload.Layer(childComplexity), true + case "UpdateStylePayload.scene": if e.complexity.UpdateStylePayload.Scene == nil { break @@ -7189,6 +7447,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputAddLayerGroupInput, ec.unmarshalInputAddLayerItemInput, ec.unmarshalInputAddMemberToTeamInput, + ec.unmarshalInputAddNLSLayerSimpleInput, ec.unmarshalInputAddPropertyItemInput, ec.unmarshalInputAddStyleInput, ec.unmarshalInputAddWidgetInput, @@ -7235,6 +7494,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputRemoveLayerInput, ec.unmarshalInputRemoveMemberFromTeamInput, ec.unmarshalInputRemoveMyAuthInput, + ec.unmarshalInputRemoveNLSLayerInput, ec.unmarshalInputRemovePropertyFieldInput, ec.unmarshalInputRemovePropertyItemInput, ec.unmarshalInputRemoveStoryBlockInput, @@ -7250,6 +7510,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputUpdateLayerInput, ec.unmarshalInputUpdateMeInput, ec.unmarshalInputUpdateMemberOfTeamInput, + ec.unmarshalInputUpdateNLSLayerInput, ec.unmarshalInputUpdateProjectInput, ec.unmarshalInputUpdatePropertyItemInput, ec.unmarshalInputUpdatePropertyItemOperationInput, @@ -8001,7 +8262,87 @@ extend type Mutation { importLayer(input: ImportLayerInput!): ImportLayerPayload attachTagToLayer(input: AttachTagToLayerInput!): AttachTagToLayerPayload detachTagFromLayer(input: DetachTagFromLayerInput!): DetachTagFromLayerPayload +}`, BuiltIn: false}, + {Name: "../../../gql/newlayer.graphql", Input: `# TODO: Make LayerGroup Real +interface NLSLayer { + id: ID! + layerType: String! + sceneId: ID! + title: String! + visible: Boolean! + infobox: Infobox + tags: [LayerTag!]! +} + +type NLSLayerSimple implements NLSLayer { + id: ID! + layerType: String! + sceneId: ID! + config: JSON + title: String! + visible: Boolean! + infobox: Infobox + tags: [LayerTag!]! + scene: Scene +} + +type NLSLayerGroup implements NLSLayer { + id: ID! + layerType: String! + sceneId: ID! + children: [NLSLayer]! + childrenIds: [ID!]! + config: JSON + title: String! + visible: Boolean! + infobox: Infobox + tags: [LayerTag!]! + scene: Scene +} + +# InputType + +input AddNLSLayerSimpleInput { + parentLayerId: ID! + layerType: String! + sceneID: ID! + config: JSON + index: Int +} + +input RemoveNLSLayerInput { + layerId: ID! +} + +input UpdateNLSLayerInput { + layerId: ID! + name: String + visible: Boolean +} + +# Payload +type AddNLSLayerSimplePayload { + layers: NLSLayerSimple! +} + +type RemoveNLSLayerPayload { + layerId: ID! +} + +type UpdateNLSLayerPayload { + layer: NLSLayer! +} + +# TODO +# extend type Query{ +# newLayer(id: ID!): NLSLayer +# } + +extend type Mutation { + addNLSLayerSimple(input: AddNLSLayerSimpleInput!): AddNLSLayerSimplePayload + removeNLSLayer(input: RemoveNLSLayerInput!): RemoveNLSLayerPayload + updateNLSLayer(input: UpdateNLSLayerInput!): UpdateNLSLayerPayload }`, BuiltIn: false}, {Name: "../../../gql/plugin.graphql", Input: `type Plugin { id: ID! @@ -8546,6 +8887,7 @@ extend type Mutation { team: Team property: Property rootLayer: LayerGroup + newLayers: [NLSLayer!]! stories: [Story!]! styles: [Style!]! datasetSchemas(first: Int, last: Int, after: Cursor, before: Cursor): DatasetSchemaConnection! @@ -9482,6 +9824,21 @@ func (ec *executionContext) field_Mutation_addMemberToTeam_args(ctx context.Cont return args, nil } +func (ec *executionContext) field_Mutation_addNLSLayerSimple_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 gqlmodel.AddNLSLayerSimpleInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalNAddNLSLayerSimpleInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐAddNLSLayerSimpleInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["input"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_addPageLayer_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -10142,6 +10499,21 @@ func (ec *executionContext) field_Mutation_removeMyAuth_args(ctx context.Context return args, nil } +func (ec *executionContext) field_Mutation_removeNLSLayer_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 gqlmodel.RemoveNLSLayerInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalNRemoveNLSLayerInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐRemoveNLSLayerInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["input"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_removePageLayer_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -10397,6 +10769,21 @@ func (ec *executionContext) field_Mutation_updateMemberOfTeam_args(ctx context.C return args, nil } +func (ec *executionContext) field_Mutation_updateNLSLayer_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 gqlmodel.UpdateNLSLayerInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalNUpdateNLSLayerInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐUpdateNLSLayerInput(ctx, tmp) + if err != nil { + return nil, err + } + } + args["input"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_updateProject_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -11369,6 +11756,8 @@ func (ec *executionContext) fieldContext_AddClusterPayload_scene(ctx context.Con return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -12121,8 +12510,8 @@ func (ec *executionContext) fieldContext_AddMemberToTeamPayload_team(ctx context return fc, nil } -func (ec *executionContext) _AddStylePayload_scene(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.AddStylePayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_AddStylePayload_scene(ctx, field) +func (ec *executionContext) _AddNLSLayerSimplePayload_layers(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.AddNLSLayerSimplePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_AddNLSLayerSimplePayload_layers(ctx, field) if err != nil { return graphql.Null } @@ -12135,7 +12524,7 @@ func (ec *executionContext) _AddStylePayload_scene(ctx context.Context, field gr }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Scene, nil + return obj.Layers, nil }) if err != nil { ec.Error(ctx, err) @@ -12147,120 +12536,46 @@ func (ec *executionContext) _AddStylePayload_scene(ctx context.Context, field gr } return graphql.Null } - res := resTmp.(*gqlmodel.Scene) + res := resTmp.(*gqlmodel.NLSLayerSimple) fc.Result = res - return ec.marshalNScene2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐScene(ctx, field.Selections, res) + return ec.marshalNNLSLayerSimple2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNLSLayerSimple(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_AddStylePayload_scene(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_AddNLSLayerSimplePayload_layers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "AddStylePayload", + Object: "AddNLSLayerSimplePayload", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": - return ec.fieldContext_Scene_id(ctx, field) - case "projectId": - return ec.fieldContext_Scene_projectId(ctx, field) - case "teamId": - return ec.fieldContext_Scene_teamId(ctx, field) - case "propertyId": - return ec.fieldContext_Scene_propertyId(ctx, field) - case "createdAt": - return ec.fieldContext_Scene_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Scene_updatedAt(ctx, field) - case "rootLayerId": - return ec.fieldContext_Scene_rootLayerId(ctx, field) - case "widgets": - return ec.fieldContext_Scene_widgets(ctx, field) - case "plugins": - return ec.fieldContext_Scene_plugins(ctx, field) - case "widgetAlignSystem": - return ec.fieldContext_Scene_widgetAlignSystem(ctx, field) - case "project": - return ec.fieldContext_Scene_project(ctx, field) - case "team": - return ec.fieldContext_Scene_team(ctx, field) - case "property": - return ec.fieldContext_Scene_property(ctx, field) - case "rootLayer": - return ec.fieldContext_Scene_rootLayer(ctx, field) - case "stories": - return ec.fieldContext_Scene_stories(ctx, field) - case "styles": - return ec.fieldContext_Scene_styles(ctx, field) - case "datasetSchemas": - return ec.fieldContext_Scene_datasetSchemas(ctx, field) - case "tagIds": - return ec.fieldContext_Scene_tagIds(ctx, field) + return ec.fieldContext_NLSLayerSimple_id(ctx, field) + case "layerType": + return ec.fieldContext_NLSLayerSimple_layerType(ctx, field) + case "sceneId": + return ec.fieldContext_NLSLayerSimple_sceneId(ctx, field) + case "config": + return ec.fieldContext_NLSLayerSimple_config(ctx, field) + case "title": + return ec.fieldContext_NLSLayerSimple_title(ctx, field) + case "visible": + return ec.fieldContext_NLSLayerSimple_visible(ctx, field) + case "infobox": + return ec.fieldContext_NLSLayerSimple_infobox(ctx, field) case "tags": - return ec.fieldContext_Scene_tags(ctx, field) - case "clusters": - return ec.fieldContext_Scene_clusters(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Scene", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _AddStylePayload_Style(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.AddStylePayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_AddStylePayload_Style(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Style, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*gqlmodel.Style) - fc.Result = res - return ec.marshalNStyle2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐStyle(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_AddStylePayload_Style(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "AddStylePayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Style_id(ctx, field) - case "name": - return ec.fieldContext_Style_name(ctx, field) - case "value": - return ec.fieldContext_Style_value(ctx, field) + return ec.fieldContext_NLSLayerSimple_tags(ctx, field) + case "scene": + return ec.fieldContext_NLSLayerSimple_scene(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Style", field.Name) + return nil, fmt.Errorf("no field named %q was found under type NLSLayerSimple", field.Name) }, } return fc, nil } -func (ec *executionContext) _AddWidgetPayload_scene(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.AddWidgetPayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_AddWidgetPayload_scene(ctx, field) +func (ec *executionContext) _AddStylePayload_scene(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.AddStylePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_AddStylePayload_scene(ctx, field) if err != nil { return graphql.Null } @@ -12290,9 +12605,9 @@ func (ec *executionContext) _AddWidgetPayload_scene(ctx context.Context, field g return ec.marshalNScene2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐScene(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_AddWidgetPayload_scene(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_AddStylePayload_scene(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "AddWidgetPayload", + Object: "AddStylePayload", Field: field, IsMethod: false, IsResolver: false, @@ -12326,6 +12641,148 @@ func (ec *executionContext) fieldContext_AddWidgetPayload_scene(ctx context.Cont return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) + case "stories": + return ec.fieldContext_Scene_stories(ctx, field) + case "styles": + return ec.fieldContext_Scene_styles(ctx, field) + case "datasetSchemas": + return ec.fieldContext_Scene_datasetSchemas(ctx, field) + case "tagIds": + return ec.fieldContext_Scene_tagIds(ctx, field) + case "tags": + return ec.fieldContext_Scene_tags(ctx, field) + case "clusters": + return ec.fieldContext_Scene_clusters(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Scene", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _AddStylePayload_Style(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.AddStylePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_AddStylePayload_Style(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Style, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*gqlmodel.Style) + fc.Result = res + return ec.marshalNStyle2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐStyle(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_AddStylePayload_Style(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "AddStylePayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Style_id(ctx, field) + case "name": + return ec.fieldContext_Style_name(ctx, field) + case "value": + return ec.fieldContext_Style_value(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Style", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _AddWidgetPayload_scene(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.AddWidgetPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_AddWidgetPayload_scene(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Scene, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*gqlmodel.Scene) + fc.Result = res + return ec.marshalNScene2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐScene(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_AddWidgetPayload_scene(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "AddWidgetPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Scene_id(ctx, field) + case "projectId": + return ec.fieldContext_Scene_projectId(ctx, field) + case "teamId": + return ec.fieldContext_Scene_teamId(ctx, field) + case "propertyId": + return ec.fieldContext_Scene_propertyId(ctx, field) + case "createdAt": + return ec.fieldContext_Scene_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Scene_updatedAt(ctx, field) + case "rootLayerId": + return ec.fieldContext_Scene_rootLayerId(ctx, field) + case "widgets": + return ec.fieldContext_Scene_widgets(ctx, field) + case "plugins": + return ec.fieldContext_Scene_plugins(ctx, field) + case "widgetAlignSystem": + return ec.fieldContext_Scene_widgetAlignSystem(ctx, field) + case "project": + return ec.fieldContext_Scene_project(ctx, field) + case "team": + return ec.fieldContext_Scene_team(ctx, field) + case "property": + return ec.fieldContext_Scene_property(ctx, field) + case "rootLayer": + return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -13861,6 +14318,8 @@ func (ec *executionContext) fieldContext_CreateScenePayload_scene(ctx context.Co return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -15887,6 +16346,8 @@ func (ec *executionContext) fieldContext_DatasetSchema_scene(ctx context.Context return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -17811,6 +18272,8 @@ func (ec *executionContext) fieldContext_Infobox_scene(ctx context.Context, fiel return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -18632,6 +19095,8 @@ func (ec *executionContext) fieldContext_InfoboxField_scene(ctx context.Context, return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -18769,6 +19234,8 @@ func (ec *executionContext) fieldContext_InstallPluginPayload_scene(ctx context. return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -20103,6 +20570,8 @@ func (ec *executionContext) fieldContext_LayerGroup_scene(ctx context.Context, f return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -21131,6 +21600,8 @@ func (ec *executionContext) fieldContext_LayerItem_scene(ctx context.Context, fi return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -22086,6 +22557,8 @@ func (ec *executionContext) fieldContext_MergedInfobox_scene(ctx context.Context return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -22558,6 +23031,8 @@ func (ec *executionContext) fieldContext_MergedInfoboxField_scene(ctx context.Co return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -23099,6 +23574,8 @@ func (ec *executionContext) fieldContext_MergedLayer_scene(ctx context.Context, return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -27165,6 +27642,174 @@ func (ec *executionContext) fieldContext_Mutation_detachTagFromLayer(ctx context return fc, nil } +func (ec *executionContext) _Mutation_addNLSLayerSimple(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_addNLSLayerSimple(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().AddNLSLayerSimple(rctx, fc.Args["input"].(gqlmodel.AddNLSLayerSimpleInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*gqlmodel.AddNLSLayerSimplePayload) + fc.Result = res + return ec.marshalOAddNLSLayerSimplePayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐAddNLSLayerSimplePayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_addNLSLayerSimple(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "layers": + return ec.fieldContext_AddNLSLayerSimplePayload_layers(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AddNLSLayerSimplePayload", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_addNLSLayerSimple_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return + } + return fc, nil +} + +func (ec *executionContext) _Mutation_removeNLSLayer(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_removeNLSLayer(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RemoveNLSLayer(rctx, fc.Args["input"].(gqlmodel.RemoveNLSLayerInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*gqlmodel.RemoveNLSLayerPayload) + fc.Result = res + return ec.marshalORemoveNLSLayerPayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐRemoveNLSLayerPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_removeNLSLayer(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "layerId": + return ec.fieldContext_RemoveNLSLayerPayload_layerId(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type RemoveNLSLayerPayload", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_removeNLSLayer_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateNLSLayer(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateNLSLayer(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateNLSLayer(rctx, fc.Args["input"].(gqlmodel.UpdateNLSLayerInput)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*gqlmodel.UpdateNLSLayerPayload) + fc.Result = res + return ec.marshalOUpdateNLSLayerPayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐUpdateNLSLayerPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateNLSLayer(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "layer": + return ec.fieldContext_UpdateNLSLayerPayload_layer(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UpdateNLSLayerPayload", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateNLSLayer_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return + } + return fc, nil +} + func (ec *executionContext) _Mutation_installPlugin(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Mutation_installPlugin(ctx, field) if err != nil { @@ -30428,6 +31073,1000 @@ func (ec *executionContext) fieldContext_Mutation_removeWidget(ctx context.Conte return fc, nil } +func (ec *executionContext) _NLSLayerGroup_id(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerGroup) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerGroup_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(gqlmodel.ID) + fc.Result = res + return ec.marshalNID2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐID(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerGroup_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerGroup", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerGroup_layerType(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerGroup) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerGroup_layerType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.LayerType, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerGroup_layerType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerGroup", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerGroup_sceneId(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerGroup) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerGroup_sceneId(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SceneID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(gqlmodel.ID) + fc.Result = res + return ec.marshalNID2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐID(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerGroup_sceneId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerGroup", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerGroup_children(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerGroup) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerGroup_children(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Children, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]gqlmodel.NLSLayer) + fc.Result = res + return ec.marshalNNLSLayer2ᚕgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNLSLayer(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerGroup_children(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerGroup", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerGroup_childrenIds(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerGroup) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerGroup_childrenIds(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ChildrenIds, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]gqlmodel.ID) + fc.Result = res + return ec.marshalNID2ᚕgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐIDᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerGroup_childrenIds(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerGroup", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerGroup_config(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerGroup) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerGroup_config(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Config, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(gqlmodel.JSON) + fc.Result = res + return ec.marshalOJSON2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐJSON(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerGroup_config(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerGroup", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type JSON does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerGroup_title(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerGroup) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerGroup_title(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Title, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerGroup_title(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerGroup", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerGroup_visible(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerGroup) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerGroup_visible(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Visible, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerGroup_visible(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerGroup", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerGroup_infobox(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerGroup) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerGroup_infobox(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Infobox, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*gqlmodel.Infobox) + fc.Result = res + return ec.marshalOInfobox2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐInfobox(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerGroup_infobox(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerGroup", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "sceneId": + return ec.fieldContext_Infobox_sceneId(ctx, field) + case "layerId": + return ec.fieldContext_Infobox_layerId(ctx, field) + case "propertyId": + return ec.fieldContext_Infobox_propertyId(ctx, field) + case "fields": + return ec.fieldContext_Infobox_fields(ctx, field) + case "linkedDatasetId": + return ec.fieldContext_Infobox_linkedDatasetId(ctx, field) + case "layer": + return ec.fieldContext_Infobox_layer(ctx, field) + case "property": + return ec.fieldContext_Infobox_property(ctx, field) + case "linkedDataset": + return ec.fieldContext_Infobox_linkedDataset(ctx, field) + case "merged": + return ec.fieldContext_Infobox_merged(ctx, field) + case "scene": + return ec.fieldContext_Infobox_scene(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Infobox", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerGroup_tags(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerGroup) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerGroup_tags(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Tags, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]gqlmodel.LayerTag) + fc.Result = res + return ec.marshalNLayerTag2ᚕgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐLayerTagᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerGroup_tags(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerGroup", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerGroup_scene(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerGroup) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerGroup_scene(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.NLSLayerGroup().Scene(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*gqlmodel.Scene) + fc.Result = res + return ec.marshalOScene2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐScene(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerGroup_scene(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerGroup", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Scene_id(ctx, field) + case "projectId": + return ec.fieldContext_Scene_projectId(ctx, field) + case "teamId": + return ec.fieldContext_Scene_teamId(ctx, field) + case "propertyId": + return ec.fieldContext_Scene_propertyId(ctx, field) + case "createdAt": + return ec.fieldContext_Scene_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Scene_updatedAt(ctx, field) + case "rootLayerId": + return ec.fieldContext_Scene_rootLayerId(ctx, field) + case "widgets": + return ec.fieldContext_Scene_widgets(ctx, field) + case "plugins": + return ec.fieldContext_Scene_plugins(ctx, field) + case "widgetAlignSystem": + return ec.fieldContext_Scene_widgetAlignSystem(ctx, field) + case "project": + return ec.fieldContext_Scene_project(ctx, field) + case "team": + return ec.fieldContext_Scene_team(ctx, field) + case "property": + return ec.fieldContext_Scene_property(ctx, field) + case "rootLayer": + return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) + case "stories": + return ec.fieldContext_Scene_stories(ctx, field) + case "styles": + return ec.fieldContext_Scene_styles(ctx, field) + case "datasetSchemas": + return ec.fieldContext_Scene_datasetSchemas(ctx, field) + case "tagIds": + return ec.fieldContext_Scene_tagIds(ctx, field) + case "tags": + return ec.fieldContext_Scene_tags(ctx, field) + case "clusters": + return ec.fieldContext_Scene_clusters(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Scene", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerSimple_id(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerSimple) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerSimple_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(gqlmodel.ID) + fc.Result = res + return ec.marshalNID2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐID(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerSimple_id(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerSimple", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerSimple_layerType(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerSimple) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerSimple_layerType(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.LayerType, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerSimple_layerType(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerSimple", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerSimple_sceneId(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerSimple) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerSimple_sceneId(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.SceneID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(gqlmodel.ID) + fc.Result = res + return ec.marshalNID2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐID(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerSimple_sceneId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerSimple", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerSimple_config(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerSimple) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerSimple_config(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Config, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(gqlmodel.JSON) + fc.Result = res + return ec.marshalOJSON2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐJSON(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerSimple_config(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerSimple", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type JSON does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerSimple_title(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerSimple) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerSimple_title(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Title, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerSimple_title(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerSimple", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerSimple_visible(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerSimple) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerSimple_visible(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Visible, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerSimple_visible(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerSimple", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerSimple_infobox(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerSimple) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerSimple_infobox(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Infobox, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*gqlmodel.Infobox) + fc.Result = res + return ec.marshalOInfobox2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐInfobox(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerSimple_infobox(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerSimple", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "sceneId": + return ec.fieldContext_Infobox_sceneId(ctx, field) + case "layerId": + return ec.fieldContext_Infobox_layerId(ctx, field) + case "propertyId": + return ec.fieldContext_Infobox_propertyId(ctx, field) + case "fields": + return ec.fieldContext_Infobox_fields(ctx, field) + case "linkedDatasetId": + return ec.fieldContext_Infobox_linkedDatasetId(ctx, field) + case "layer": + return ec.fieldContext_Infobox_layer(ctx, field) + case "property": + return ec.fieldContext_Infobox_property(ctx, field) + case "linkedDataset": + return ec.fieldContext_Infobox_linkedDataset(ctx, field) + case "merged": + return ec.fieldContext_Infobox_merged(ctx, field) + case "scene": + return ec.fieldContext_Infobox_scene(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Infobox", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerSimple_tags(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerSimple) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerSimple_tags(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Tags, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]gqlmodel.LayerTag) + fc.Result = res + return ec.marshalNLayerTag2ᚕgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐLayerTagᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerSimple_tags(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerSimple", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") + }, + } + return fc, nil +} + +func (ec *executionContext) _NLSLayerSimple_scene(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.NLSLayerSimple) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NLSLayerSimple_scene(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.NLSLayerSimple().Scene(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*gqlmodel.Scene) + fc.Result = res + return ec.marshalOScene2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐScene(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NLSLayerSimple_scene(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NLSLayerSimple", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Scene_id(ctx, field) + case "projectId": + return ec.fieldContext_Scene_projectId(ctx, field) + case "teamId": + return ec.fieldContext_Scene_teamId(ctx, field) + case "propertyId": + return ec.fieldContext_Scene_propertyId(ctx, field) + case "createdAt": + return ec.fieldContext_Scene_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Scene_updatedAt(ctx, field) + case "rootLayerId": + return ec.fieldContext_Scene_rootLayerId(ctx, field) + case "widgets": + return ec.fieldContext_Scene_widgets(ctx, field) + case "plugins": + return ec.fieldContext_Scene_plugins(ctx, field) + case "widgetAlignSystem": + return ec.fieldContext_Scene_widgetAlignSystem(ctx, field) + case "project": + return ec.fieldContext_Scene_project(ctx, field) + case "team": + return ec.fieldContext_Scene_team(ctx, field) + case "property": + return ec.fieldContext_Scene_property(ctx, field) + case "rootLayer": + return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) + case "stories": + return ec.fieldContext_Scene_stories(ctx, field) + case "styles": + return ec.fieldContext_Scene_styles(ctx, field) + case "datasetSchemas": + return ec.fieldContext_Scene_datasetSchemas(ctx, field) + case "tagIds": + return ec.fieldContext_Scene_tagIds(ctx, field) + case "tags": + return ec.fieldContext_Scene_tags(ctx, field) + case "clusters": + return ec.fieldContext_Scene_clusters(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Scene", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.PageInfo) (ret graphql.Marshaler) { fc, err := ec.fieldContext_PageInfo_startCursor(ctx, field) if err != nil { @@ -31232,6 +32871,8 @@ func (ec *executionContext) fieldContext_Plugin_scene(ctx context.Context, field return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -33567,6 +35208,8 @@ func (ec *executionContext) fieldContext_Project_scene(ctx context.Context, fiel return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -39173,6 +40816,8 @@ func (ec *executionContext) fieldContext_Query_scene(ctx context.Context, field return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -39740,6 +41385,8 @@ func (ec *executionContext) fieldContext_RemoveClusterPayload_scene(ctx context. return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -40010,9 +41657,203 @@ func (ec *executionContext) _RemoveLayerPayload_layerId(ctx context.Context, fie return ec.marshalNID2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐID(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_RemoveLayerPayload_layerId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_RemoveLayerPayload_layerId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "RemoveLayerPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _RemoveLayerPayload_parentLayer(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.RemoveLayerPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_RemoveLayerPayload_parentLayer(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.ParentLayer, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*gqlmodel.LayerGroup) + fc.Result = res + return ec.marshalNLayerGroup2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐLayerGroup(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_RemoveLayerPayload_parentLayer(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "RemoveLayerPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_LayerGroup_id(ctx, field) + case "sceneId": + return ec.fieldContext_LayerGroup_sceneId(ctx, field) + case "name": + return ec.fieldContext_LayerGroup_name(ctx, field) + case "isVisible": + return ec.fieldContext_LayerGroup_isVisible(ctx, field) + case "propertyId": + return ec.fieldContext_LayerGroup_propertyId(ctx, field) + case "pluginId": + return ec.fieldContext_LayerGroup_pluginId(ctx, field) + case "extensionId": + return ec.fieldContext_LayerGroup_extensionId(ctx, field) + case "infobox": + return ec.fieldContext_LayerGroup_infobox(ctx, field) + case "parentId": + return ec.fieldContext_LayerGroup_parentId(ctx, field) + case "linkedDatasetSchemaId": + return ec.fieldContext_LayerGroup_linkedDatasetSchemaId(ctx, field) + case "root": + return ec.fieldContext_LayerGroup_root(ctx, field) + case "layerIds": + return ec.fieldContext_LayerGroup_layerIds(ctx, field) + case "tags": + return ec.fieldContext_LayerGroup_tags(ctx, field) + case "parent": + return ec.fieldContext_LayerGroup_parent(ctx, field) + case "property": + return ec.fieldContext_LayerGroup_property(ctx, field) + case "plugin": + return ec.fieldContext_LayerGroup_plugin(ctx, field) + case "extension": + return ec.fieldContext_LayerGroup_extension(ctx, field) + case "linkedDatasetSchema": + return ec.fieldContext_LayerGroup_linkedDatasetSchema(ctx, field) + case "layers": + return ec.fieldContext_LayerGroup_layers(ctx, field) + case "scene": + return ec.fieldContext_LayerGroup_scene(ctx, field) + case "scenePlugin": + return ec.fieldContext_LayerGroup_scenePlugin(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type LayerGroup", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _RemoveMemberFromTeamPayload_team(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.RemoveMemberFromTeamPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_RemoveMemberFromTeamPayload_team(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Team, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*gqlmodel.Team) + fc.Result = res + return ec.marshalNTeam2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐTeam(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_RemoveMemberFromTeamPayload_team(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "RemoveMemberFromTeamPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Team_id(ctx, field) + case "name": + return ec.fieldContext_Team_name(ctx, field) + case "members": + return ec.fieldContext_Team_members(ctx, field) + case "personal": + return ec.fieldContext_Team_personal(ctx, field) + case "policyId": + return ec.fieldContext_Team_policyId(ctx, field) + case "policy": + return ec.fieldContext_Team_policy(ctx, field) + case "assets": + return ec.fieldContext_Team_assets(ctx, field) + case "projects": + return ec.fieldContext_Team_projects(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _RemoveNLSLayerPayload_layerId(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.RemoveNLSLayerPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_RemoveNLSLayerPayload_layerId(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.LayerID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(gqlmodel.ID) + fc.Result = res + return ec.marshalNID2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐID(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_RemoveNLSLayerPayload_layerId(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "RemoveLayerPayload", + Object: "RemoveNLSLayerPayload", Field: field, IsMethod: false, IsResolver: false, @@ -40023,156 +41864,6 @@ func (ec *executionContext) fieldContext_RemoveLayerPayload_layerId(ctx context. return fc, nil } -func (ec *executionContext) _RemoveLayerPayload_parentLayer(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.RemoveLayerPayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_RemoveLayerPayload_parentLayer(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.ParentLayer, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*gqlmodel.LayerGroup) - fc.Result = res - return ec.marshalNLayerGroup2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐLayerGroup(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_RemoveLayerPayload_parentLayer(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "RemoveLayerPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_LayerGroup_id(ctx, field) - case "sceneId": - return ec.fieldContext_LayerGroup_sceneId(ctx, field) - case "name": - return ec.fieldContext_LayerGroup_name(ctx, field) - case "isVisible": - return ec.fieldContext_LayerGroup_isVisible(ctx, field) - case "propertyId": - return ec.fieldContext_LayerGroup_propertyId(ctx, field) - case "pluginId": - return ec.fieldContext_LayerGroup_pluginId(ctx, field) - case "extensionId": - return ec.fieldContext_LayerGroup_extensionId(ctx, field) - case "infobox": - return ec.fieldContext_LayerGroup_infobox(ctx, field) - case "parentId": - return ec.fieldContext_LayerGroup_parentId(ctx, field) - case "linkedDatasetSchemaId": - return ec.fieldContext_LayerGroup_linkedDatasetSchemaId(ctx, field) - case "root": - return ec.fieldContext_LayerGroup_root(ctx, field) - case "layerIds": - return ec.fieldContext_LayerGroup_layerIds(ctx, field) - case "tags": - return ec.fieldContext_LayerGroup_tags(ctx, field) - case "parent": - return ec.fieldContext_LayerGroup_parent(ctx, field) - case "property": - return ec.fieldContext_LayerGroup_property(ctx, field) - case "plugin": - return ec.fieldContext_LayerGroup_plugin(ctx, field) - case "extension": - return ec.fieldContext_LayerGroup_extension(ctx, field) - case "linkedDatasetSchema": - return ec.fieldContext_LayerGroup_linkedDatasetSchema(ctx, field) - case "layers": - return ec.fieldContext_LayerGroup_layers(ctx, field) - case "scene": - return ec.fieldContext_LayerGroup_scene(ctx, field) - case "scenePlugin": - return ec.fieldContext_LayerGroup_scenePlugin(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type LayerGroup", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _RemoveMemberFromTeamPayload_team(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.RemoveMemberFromTeamPayload) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_RemoveMemberFromTeamPayload_team(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Team, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*gqlmodel.Team) - fc.Result = res - return ec.marshalNTeam2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐTeam(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_RemoveMemberFromTeamPayload_team(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "RemoveMemberFromTeamPayload", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Team_id(ctx, field) - case "name": - return ec.fieldContext_Team_name(ctx, field) - case "members": - return ec.fieldContext_Team_members(ctx, field) - case "personal": - return ec.fieldContext_Team_personal(ctx, field) - case "policyId": - return ec.fieldContext_Team_policyId(ctx, field) - case "policy": - return ec.fieldContext_Team_policy(ctx, field) - case "assets": - return ec.fieldContext_Team_assets(ctx, field) - case "projects": - return ec.fieldContext_Team_projects(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Team", field.Name) - }, - } - return fc, nil -} - func (ec *executionContext) _RemoveStoryBlockPayload_blockId(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.RemoveStoryBlockPayload) (ret graphql.Marshaler) { fc, err := ec.fieldContext_RemoveStoryBlockPayload_blockId(ctx, field) if err != nil { @@ -40442,6 +42133,8 @@ func (ec *executionContext) fieldContext_RemoveStylePayload_scene(ctx context.Co return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -40660,6 +42353,8 @@ func (ec *executionContext) fieldContext_RemoveWidgetPayload_scene(ctx context.C return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -41482,6 +43177,50 @@ func (ec *executionContext) fieldContext_Scene_rootLayer(ctx context.Context, fi return fc, nil } +func (ec *executionContext) _Scene_newLayers(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.Scene) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Scene_newLayers(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Scene().NewLayers(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]gqlmodel.NLSLayer) + fc.Result = res + return ec.marshalNNLSLayer2ᚕgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNLSLayerᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Scene_newLayers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Scene", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") + }, + } + return fc, nil +} + func (ec *executionContext) _Scene_stories(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.Scene) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Scene_stories(ctx, field) if err != nil { @@ -43387,6 +45126,8 @@ func (ec *executionContext) fieldContext_Story_scene(ctx context.Context, field return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -44797,6 +46538,8 @@ func (ec *executionContext) fieldContext_StoryPage_scene(ctx context.Context, fi return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -45713,6 +47456,8 @@ func (ec *executionContext) fieldContext_TagGroup_scene(ctx context.Context, fie return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -47344,6 +49089,8 @@ func (ec *executionContext) fieldContext_UninstallPluginPayload_scene(ctx contex return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -47430,6 +49177,8 @@ func (ec *executionContext) fieldContext_UpdateClusterPayload_scene(ctx context. return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -47738,6 +49487,50 @@ func (ec *executionContext) fieldContext_UpdateMemberOfTeamPayload_team(ctx cont return fc, nil } +func (ec *executionContext) _UpdateNLSLayerPayload_layer(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.UpdateNLSLayerPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UpdateNLSLayerPayload_layer(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Layer, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(gqlmodel.NLSLayer) + fc.Result = res + return ec.marshalNNLSLayer2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNLSLayer(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UpdateNLSLayerPayload_layer(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UpdateNLSLayerPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("FieldContext.Child cannot be called on type INTERFACE") + }, + } + return fc, nil +} + func (ec *executionContext) _UpdateStylePayload_scene(ctx context.Context, field graphql.CollectedField, obj *gqlmodel.UpdateStylePayload) (ret graphql.Marshaler) { fc, err := ec.fieldContext_UpdateStylePayload_scene(ctx, field) if err != nil { @@ -47805,6 +49598,8 @@ func (ec *executionContext) fieldContext_UpdateStylePayload_scene(ctx context.Co return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -48049,6 +49844,8 @@ func (ec *executionContext) fieldContext_UpdateWidgetAlignSystemPayload_scene(ct return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -48135,6 +49932,8 @@ func (ec *executionContext) fieldContext_UpdateWidgetPayload_scene(ctx context.C return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -48285,6 +50084,8 @@ func (ec *executionContext) fieldContext_UpgradePluginPayload_scene(ctx context. return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -48503,6 +50304,8 @@ func (ec *executionContext) fieldContext_UploadPluginPayload_scene(ctx context.C return ec.fieldContext_Scene_property(ctx, field) case "rootLayer": return ec.fieldContext_Scene_rootLayer(ctx, field) + case "newLayers": + return ec.fieldContext_Scene_newLayers(ctx, field) case "stories": return ec.fieldContext_Scene_stories(ctx, field) case "styles": @@ -52067,6 +53870,66 @@ func (ec *executionContext) unmarshalInputAddMemberToTeamInput(ctx context.Conte return it, nil } +func (ec *executionContext) unmarshalInputAddNLSLayerSimpleInput(ctx context.Context, obj interface{}) (gqlmodel.AddNLSLayerSimpleInput, error) { + var it gqlmodel.AddNLSLayerSimpleInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"parentLayerId", "layerType", "sceneID", "config", "index"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "parentLayerId": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("parentLayerId")) + it.ParentLayerID, err = ec.unmarshalNID2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐID(ctx, v) + if err != nil { + return it, err + } + case "layerType": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("layerType")) + it.LayerType, err = ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + case "sceneID": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sceneID")) + it.SceneID, err = ec.unmarshalNID2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐID(ctx, v) + if err != nil { + return it, err + } + case "config": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("config")) + it.Config, err = ec.unmarshalOJSON2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐJSON(ctx, v) + if err != nil { + return it, err + } + case "index": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("index")) + it.Index, err = ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputAddPropertyItemInput(ctx context.Context, obj interface{}) (gqlmodel.AddPropertyItemInput, error) { var it gqlmodel.AddPropertyItemInput asMap := map[string]interface{}{} @@ -54059,6 +55922,34 @@ func (ec *executionContext) unmarshalInputRemoveMyAuthInput(ctx context.Context, return it, nil } +func (ec *executionContext) unmarshalInputRemoveNLSLayerInput(ctx context.Context, obj interface{}) (gqlmodel.RemoveNLSLayerInput, error) { + var it gqlmodel.RemoveNLSLayerInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"layerId"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "layerId": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("layerId")) + it.LayerID, err = ec.unmarshalNID2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐID(ctx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputRemovePropertyFieldInput(ctx context.Context, obj interface{}) (gqlmodel.RemovePropertyFieldInput, error) { var it gqlmodel.RemovePropertyFieldInput asMap := map[string]interface{}{} @@ -54727,6 +56618,50 @@ func (ec *executionContext) unmarshalInputUpdateMemberOfTeamInput(ctx context.Co return it, nil } +func (ec *executionContext) unmarshalInputUpdateNLSLayerInput(ctx context.Context, obj interface{}) (gqlmodel.UpdateNLSLayerInput, error) { + var it gqlmodel.UpdateNLSLayerInput + asMap := map[string]interface{}{} + for k, v := range obj.(map[string]interface{}) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"layerId", "name", "visible"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "layerId": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("layerId")) + it.LayerID, err = ec.unmarshalNID2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐID(ctx, v) + if err != nil { + return it, err + } + case "name": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + it.Name, err = ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + case "visible": + var err error + + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("visible")) + it.Visible, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputUpdateProjectInput(ctx context.Context, obj interface{}) (gqlmodel.UpdateProjectInput, error) { var it gqlmodel.UpdateProjectInput asMap := map[string]interface{}{} @@ -55825,6 +57760,29 @@ func (ec *executionContext) _LayerTag(ctx context.Context, sel ast.SelectionSet, } } +func (ec *executionContext) _NLSLayer(ctx context.Context, sel ast.SelectionSet, obj gqlmodel.NLSLayer) graphql.Marshaler { + switch obj := (obj).(type) { + case nil: + return graphql.Null + case gqlmodel.NLSLayerSimple: + return ec._NLSLayerSimple(ctx, sel, &obj) + case *gqlmodel.NLSLayerSimple: + if obj == nil { + return graphql.Null + } + return ec._NLSLayerSimple(ctx, sel, obj) + case gqlmodel.NLSLayerGroup: + return ec._NLSLayerGroup(ctx, sel, &obj) + case *gqlmodel.NLSLayerGroup: + if obj == nil { + return graphql.Null + } + return ec._NLSLayerGroup(ctx, sel, obj) + default: + panic(fmt.Errorf("unexpected type %T", obj)) + } +} + func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj gqlmodel.Node) graphql.Marshaler { switch obj := (obj).(type) { case nil: @@ -56169,6 +58127,34 @@ func (ec *executionContext) _AddMemberToTeamPayload(ctx context.Context, sel ast return out } +var addNLSLayerSimplePayloadImplementors = []string{"AddNLSLayerSimplePayload"} + +func (ec *executionContext) _AddNLSLayerSimplePayload(ctx context.Context, sel ast.SelectionSet, obj *gqlmodel.AddNLSLayerSimplePayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, addNLSLayerSimplePayloadImplementors) + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("AddNLSLayerSimplePayload") + case "layers": + + out.Values[i] = ec._AddNLSLayerSimplePayload_layers(ctx, field, obj) + + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + var addStylePayloadImplementors = []string{"AddStylePayload"} func (ec *executionContext) _AddStylePayload(ctx context.Context, sel ast.SelectionSet, obj *gqlmodel.AddStylePayload) graphql.Marshaler { @@ -59858,6 +61844,24 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) return ec._Mutation_detachTagFromLayer(ctx, field) }) + case "addNLSLayerSimple": + + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_addNLSLayerSimple(ctx, field) + }) + + case "removeNLSLayer": + + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_removeNLSLayer(ctx, field) + }) + + case "updateNLSLayer": + + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateNLSLayer(ctx, field) + }) + case "installPlugin": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { @@ -60250,6 +62254,196 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) return out } +var nLSLayerGroupImplementors = []string{"NLSLayerGroup", "NLSLayer"} + +func (ec *executionContext) _NLSLayerGroup(ctx context.Context, sel ast.SelectionSet, obj *gqlmodel.NLSLayerGroup) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, nLSLayerGroupImplementors) + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("NLSLayerGroup") + case "id": + + out.Values[i] = ec._NLSLayerGroup_id(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "layerType": + + out.Values[i] = ec._NLSLayerGroup_layerType(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "sceneId": + + out.Values[i] = ec._NLSLayerGroup_sceneId(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "children": + + out.Values[i] = ec._NLSLayerGroup_children(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "childrenIds": + + out.Values[i] = ec._NLSLayerGroup_childrenIds(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "config": + + out.Values[i] = ec._NLSLayerGroup_config(ctx, field, obj) + + case "title": + + out.Values[i] = ec._NLSLayerGroup_title(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "visible": + + out.Values[i] = ec._NLSLayerGroup_visible(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "infobox": + + out.Values[i] = ec._NLSLayerGroup_infobox(ctx, field, obj) + + case "tags": + + out.Values[i] = ec._NLSLayerGroup_tags(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "scene": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._NLSLayerGroup_scene(ctx, field, obj) + return res + } + + out.Concurrently(i, func() graphql.Marshaler { + return innerFunc(ctx) + + }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + +var nLSLayerSimpleImplementors = []string{"NLSLayerSimple", "NLSLayer"} + +func (ec *executionContext) _NLSLayerSimple(ctx context.Context, sel ast.SelectionSet, obj *gqlmodel.NLSLayerSimple) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, nLSLayerSimpleImplementors) + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("NLSLayerSimple") + case "id": + + out.Values[i] = ec._NLSLayerSimple_id(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "layerType": + + out.Values[i] = ec._NLSLayerSimple_layerType(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "sceneId": + + out.Values[i] = ec._NLSLayerSimple_sceneId(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "config": + + out.Values[i] = ec._NLSLayerSimple_config(ctx, field, obj) + + case "title": + + out.Values[i] = ec._NLSLayerSimple_title(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "visible": + + out.Values[i] = ec._NLSLayerSimple_visible(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "infobox": + + out.Values[i] = ec._NLSLayerSimple_infobox(ctx, field, obj) + + case "tags": + + out.Values[i] = ec._NLSLayerSimple_tags(ctx, field, obj) + + if out.Values[i] == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + case "scene": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._NLSLayerSimple_scene(ctx, field, obj) + return res + } + + out.Concurrently(i, func() graphql.Marshaler { + return innerFunc(ctx) + + }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + var pageInfoImplementors = []string{"PageInfo"} func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, obj *gqlmodel.PageInfo) graphql.Marshaler { @@ -62694,6 +64888,34 @@ func (ec *executionContext) _RemoveMemberFromTeamPayload(ctx context.Context, se return out } +var removeNLSLayerPayloadImplementors = []string{"RemoveNLSLayerPayload"} + +func (ec *executionContext) _RemoveNLSLayerPayload(ctx context.Context, sel ast.SelectionSet, obj *gqlmodel.RemoveNLSLayerPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, removeNLSLayerPayloadImplementors) + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("RemoveNLSLayerPayload") + case "layerId": + + out.Values[i] = ec._RemoveNLSLayerPayload_layerId(ctx, field, obj) + + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + var removeStoryBlockPayloadImplementors = []string{"RemoveStoryBlockPayload"} func (ec *executionContext) _RemoveStoryBlockPayload(ctx context.Context, sel ast.SelectionSet, obj *gqlmodel.RemoveStoryBlockPayload) graphql.Marshaler { @@ -62982,6 +65204,26 @@ func (ec *executionContext) _Scene(ctx context.Context, sel ast.SelectionSet, ob return res } + out.Concurrently(i, func() graphql.Marshaler { + return innerFunc(ctx) + + }) + case "newLayers": + field := field + + innerFunc := func(ctx context.Context) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Scene_newLayers(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + } + out.Concurrently(i, func() graphql.Marshaler { return innerFunc(ctx) @@ -64560,6 +66802,34 @@ func (ec *executionContext) _UpdateMemberOfTeamPayload(ctx context.Context, sel return out } +var updateNLSLayerPayloadImplementors = []string{"UpdateNLSLayerPayload"} + +func (ec *executionContext) _UpdateNLSLayerPayload(ctx context.Context, sel ast.SelectionSet, obj *gqlmodel.UpdateNLSLayerPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, updateNLSLayerPayloadImplementors) + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("UpdateNLSLayerPayload") + case "layer": + + out.Values[i] = ec._UpdateNLSLayerPayload_layer(ctx, field, obj) + + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + var updateStylePayloadImplementors = []string{"UpdateStylePayload"} func (ec *executionContext) _UpdateStylePayload(ctx context.Context, sel ast.SelectionSet, obj *gqlmodel.UpdateStylePayload) graphql.Marshaler { @@ -65502,6 +67772,11 @@ func (ec *executionContext) unmarshalNAddMemberToTeamInput2githubᚗcomᚋreeart return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalNAddNLSLayerSimpleInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐAddNLSLayerSimpleInput(ctx context.Context, v interface{}) (gqlmodel.AddNLSLayerSimpleInput, error) { + res, err := ec.unmarshalInputAddNLSLayerSimpleInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) unmarshalNAddPropertyItemInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐAddPropertyItemInput(ctx context.Context, v interface{}) (gqlmodel.AddPropertyItemInput, error) { res, err := ec.unmarshalInputAddPropertyItemInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -66670,7 +68945,238 @@ func (ec *executionContext) marshalNLayerTag2ᚕgithubᚗcomᚋreearthᚋreearth if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalNLayerTag2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐLayerTag(ctx, sel, v[i]) + ret[i] = ec.marshalNLayerTag2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐLayerTag(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNLayerTagItem2ᚕᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐLayerTagItemᚄ(ctx context.Context, sel ast.SelectionSet, v []*gqlmodel.LayerTagItem) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNLayerTagItem2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐLayerTagItem(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNLayerTagItem2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐLayerTagItem(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.LayerTagItem) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._LayerTagItem(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNLinkDatasetToPropertyValueInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐLinkDatasetToPropertyValueInput(ctx context.Context, v interface{}) (gqlmodel.LinkDatasetToPropertyValueInput, error) { + res, err := ec.unmarshalInputLinkDatasetToPropertyValueInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNListOperation2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐListOperation(ctx context.Context, v interface{}) (gqlmodel.ListOperation, error) { + var res gqlmodel.ListOperation + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNListOperation2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐListOperation(ctx context.Context, sel ast.SelectionSet, v gqlmodel.ListOperation) graphql.Marshaler { + return v +} + +func (ec *executionContext) marshalNMe2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMe(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.Me) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Me(ctx, sel, v) +} + +func (ec *executionContext) marshalNMergedInfoboxField2ᚕᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedInfoboxFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []*gqlmodel.MergedInfoboxField) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNMergedInfoboxField2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedInfoboxField(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNMergedInfoboxField2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedInfoboxField(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MergedInfoboxField) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._MergedInfoboxField(ctx, sel, v) +} + +func (ec *executionContext) marshalNMergedPropertyField2ᚕᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedPropertyFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []*gqlmodel.MergedPropertyField) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNMergedPropertyField2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedPropertyField(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNMergedPropertyField2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedPropertyField(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MergedPropertyField) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._MergedPropertyField(ctx, sel, v) +} + +func (ec *executionContext) marshalNMergedPropertyGroup2ᚕᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedPropertyGroupᚄ(ctx context.Context, sel ast.SelectionSet, v []*gqlmodel.MergedPropertyGroup) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNMergedPropertyGroup2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedPropertyGroup(ctx, sel, v[i]) } if isLen1 { f(i) @@ -66690,140 +69196,99 @@ func (ec *executionContext) marshalNLayerTag2ᚕgithubᚗcomᚋreearthᚋreearth return ret } -func (ec *executionContext) marshalNLayerTagItem2ᚕᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐLayerTagItemᚄ(ctx context.Context, sel ast.SelectionSet, v []*gqlmodel.LayerTagItem) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalNLayerTagItem2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐLayerTagItem(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) +func (ec *executionContext) marshalNMergedPropertyGroup2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedPropertyGroup(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MergedPropertyGroup) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") } - + return graphql.Null } - wg.Wait() + return ec._MergedPropertyGroup(ctx, sel, v) +} - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } +func (ec *executionContext) unmarshalNMoveInfoboxFieldInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveInfoboxFieldInput(ctx context.Context, v interface{}) (gqlmodel.MoveInfoboxFieldInput, error) { + res, err := ec.unmarshalInputMoveInfoboxFieldInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} - return ret +func (ec *executionContext) unmarshalNMoveLayerInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveLayerInput(ctx context.Context, v interface{}) (gqlmodel.MoveLayerInput, error) { + res, err := ec.unmarshalInputMoveLayerInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNLayerTagItem2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐLayerTagItem(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.LayerTagItem) graphql.Marshaler { +func (ec *executionContext) unmarshalNMovePropertyItemInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMovePropertyItemInput(ctx context.Context, v interface{}) (gqlmodel.MovePropertyItemInput, error) { + res, err := ec.unmarshalInputMovePropertyItemInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) unmarshalNMoveStoryBlockInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryBlockInput(ctx context.Context, v interface{}) (gqlmodel.MoveStoryBlockInput, error) { + res, err := ec.unmarshalInputMoveStoryBlockInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNMoveStoryBlockPayload2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryBlockPayload(ctx context.Context, sel ast.SelectionSet, v gqlmodel.MoveStoryBlockPayload) graphql.Marshaler { + return ec._MoveStoryBlockPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNMoveStoryBlockPayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryBlockPayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MoveStoryBlockPayload) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } - return ec._LayerTagItem(ctx, sel, v) + return ec._MoveStoryBlockPayload(ctx, sel, v) } -func (ec *executionContext) unmarshalNLinkDatasetToPropertyValueInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐLinkDatasetToPropertyValueInput(ctx context.Context, v interface{}) (gqlmodel.LinkDatasetToPropertyValueInput, error) { - res, err := ec.unmarshalInputLinkDatasetToPropertyValueInput(ctx, v) +func (ec *executionContext) unmarshalNMoveStoryInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryInput(ctx context.Context, v interface{}) (gqlmodel.MoveStoryInput, error) { + res, err := ec.unmarshalInputMoveStoryInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) unmarshalNListOperation2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐListOperation(ctx context.Context, v interface{}) (gqlmodel.ListOperation, error) { - var res gqlmodel.ListOperation - err := res.UnmarshalGQL(v) +func (ec *executionContext) unmarshalNMoveStoryPageInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPageInput(ctx context.Context, v interface{}) (gqlmodel.MoveStoryPageInput, error) { + res, err := ec.unmarshalInputMoveStoryPageInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNListOperation2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐListOperation(ctx context.Context, sel ast.SelectionSet, v gqlmodel.ListOperation) graphql.Marshaler { - return v +func (ec *executionContext) marshalNMoveStoryPagePayload2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPagePayload(ctx context.Context, sel ast.SelectionSet, v gqlmodel.MoveStoryPagePayload) graphql.Marshaler { + return ec._MoveStoryPagePayload(ctx, sel, &v) } -func (ec *executionContext) marshalNMe2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMe(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.Me) graphql.Marshaler { +func (ec *executionContext) marshalNMoveStoryPagePayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPagePayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MoveStoryPagePayload) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } - return ec._Me(ctx, sel, v) + return ec._MoveStoryPagePayload(ctx, sel, v) } -func (ec *executionContext) marshalNMergedInfoboxField2ᚕᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedInfoboxFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []*gqlmodel.MergedInfoboxField) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalNMergedInfoboxField2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedInfoboxField(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() +func (ec *executionContext) marshalNMoveStoryPayload2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPayload(ctx context.Context, sel ast.SelectionSet, v gqlmodel.MoveStoryPayload) graphql.Marshaler { + return ec._MoveStoryPayload(ctx, sel, &v) +} - for _, e := range ret { - if e == graphql.Null { - return graphql.Null +func (ec *executionContext) marshalNMoveStoryPayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MoveStoryPayload) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") } + return graphql.Null } - - return ret + return ec._MoveStoryPayload(ctx, sel, v) } -func (ec *executionContext) marshalNMergedInfoboxField2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedInfoboxField(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MergedInfoboxField) graphql.Marshaler { +func (ec *executionContext) marshalNNLSLayer2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNLSLayer(ctx context.Context, sel ast.SelectionSet, v gqlmodel.NLSLayer) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } - return ec._MergedInfoboxField(ctx, sel, v) + return ec._NLSLayer(ctx, sel, v) } -func (ec *executionContext) marshalNMergedPropertyField2ᚕᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedPropertyFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []*gqlmodel.MergedPropertyField) graphql.Marshaler { +func (ec *executionContext) marshalNNLSLayer2ᚕgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNLSLayer(ctx context.Context, sel ast.SelectionSet, v []gqlmodel.NLSLayer) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 @@ -66847,7 +69312,7 @@ func (ec *executionContext) marshalNMergedPropertyField2ᚕᚖgithubᚗcomᚋree if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalNMergedPropertyField2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedPropertyField(ctx, sel, v[i]) + ret[i] = ec.marshalONLSLayer2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNLSLayer(ctx, sel, v[i]) } if isLen1 { f(i) @@ -66858,26 +69323,10 @@ func (ec *executionContext) marshalNMergedPropertyField2ᚕᚖgithubᚗcomᚋree } wg.Wait() - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - return ret } -func (ec *executionContext) marshalNMergedPropertyField2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedPropertyField(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MergedPropertyField) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._MergedPropertyField(ctx, sel, v) -} - -func (ec *executionContext) marshalNMergedPropertyGroup2ᚕᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedPropertyGroupᚄ(ctx context.Context, sel ast.SelectionSet, v []*gqlmodel.MergedPropertyGroup) graphql.Marshaler { +func (ec *executionContext) marshalNNLSLayer2ᚕgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNLSLayerᚄ(ctx context.Context, sel ast.SelectionSet, v []gqlmodel.NLSLayer) graphql.Marshaler { ret := make(graphql.Array, len(v)) var wg sync.WaitGroup isLen1 := len(v) == 1 @@ -66901,7 +69350,7 @@ func (ec *executionContext) marshalNMergedPropertyGroup2ᚕᚖgithubᚗcomᚋree if !isLen1 { defer wg.Done() } - ret[i] = ec.marshalNMergedPropertyGroup2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedPropertyGroup(ctx, sel, v[i]) + ret[i] = ec.marshalNNLSLayer2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNLSLayer(ctx, sel, v[i]) } if isLen1 { f(i) @@ -66921,86 +69370,14 @@ func (ec *executionContext) marshalNMergedPropertyGroup2ᚕᚖgithubᚗcomᚋree return ret } -func (ec *executionContext) marshalNMergedPropertyGroup2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMergedPropertyGroup(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MergedPropertyGroup) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._MergedPropertyGroup(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNMoveInfoboxFieldInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveInfoboxFieldInput(ctx context.Context, v interface{}) (gqlmodel.MoveInfoboxFieldInput, error) { - res, err := ec.unmarshalInputMoveInfoboxFieldInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) unmarshalNMoveLayerInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveLayerInput(ctx context.Context, v interface{}) (gqlmodel.MoveLayerInput, error) { - res, err := ec.unmarshalInputMoveLayerInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) unmarshalNMovePropertyItemInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMovePropertyItemInput(ctx context.Context, v interface{}) (gqlmodel.MovePropertyItemInput, error) { - res, err := ec.unmarshalInputMovePropertyItemInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) unmarshalNMoveStoryBlockInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryBlockInput(ctx context.Context, v interface{}) (gqlmodel.MoveStoryBlockInput, error) { - res, err := ec.unmarshalInputMoveStoryBlockInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNMoveStoryBlockPayload2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryBlockPayload(ctx context.Context, sel ast.SelectionSet, v gqlmodel.MoveStoryBlockPayload) graphql.Marshaler { - return ec._MoveStoryBlockPayload(ctx, sel, &v) -} - -func (ec *executionContext) marshalNMoveStoryBlockPayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryBlockPayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MoveStoryBlockPayload) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._MoveStoryBlockPayload(ctx, sel, v) -} - -func (ec *executionContext) unmarshalNMoveStoryInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryInput(ctx context.Context, v interface{}) (gqlmodel.MoveStoryInput, error) { - res, err := ec.unmarshalInputMoveStoryInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) unmarshalNMoveStoryPageInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPageInput(ctx context.Context, v interface{}) (gqlmodel.MoveStoryPageInput, error) { - res, err := ec.unmarshalInputMoveStoryPageInput(ctx, v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNMoveStoryPagePayload2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPagePayload(ctx context.Context, sel ast.SelectionSet, v gqlmodel.MoveStoryPagePayload) graphql.Marshaler { - return ec._MoveStoryPagePayload(ctx, sel, &v) -} - -func (ec *executionContext) marshalNMoveStoryPagePayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPagePayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MoveStoryPagePayload) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._MoveStoryPagePayload(ctx, sel, v) -} - -func (ec *executionContext) marshalNMoveStoryPayload2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPayload(ctx context.Context, sel ast.SelectionSet, v gqlmodel.MoveStoryPayload) graphql.Marshaler { - return ec._MoveStoryPayload(ctx, sel, &v) -} - -func (ec *executionContext) marshalNMoveStoryPayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐMoveStoryPayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.MoveStoryPayload) graphql.Marshaler { +func (ec *executionContext) marshalNNLSLayerSimple2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNLSLayerSimple(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.NLSLayerSimple) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } - return ec._MoveStoryPayload(ctx, sel, v) + return ec._NLSLayerSimple(ctx, sel, v) } func (ec *executionContext) marshalNNode2ᚕgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNode(ctx context.Context, sel ast.SelectionSet, v []gqlmodel.Node) graphql.Marshaler { @@ -67748,6 +70125,11 @@ func (ec *executionContext) unmarshalNRemoveMyAuthInput2githubᚗcomᚋreearth return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalNRemoveNLSLayerInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐRemoveNLSLayerInput(ctx context.Context, v interface{}) (gqlmodel.RemoveNLSLayerInput, error) { + res, err := ec.unmarshalInputRemoveNLSLayerInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) unmarshalNRemovePropertyFieldInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐRemovePropertyFieldInput(ctx context.Context, v interface{}) (gqlmodel.RemovePropertyFieldInput, error) { res, err := ec.unmarshalInputRemovePropertyFieldInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -68496,6 +70878,11 @@ func (ec *executionContext) unmarshalNUpdateMemberOfTeamInput2githubᚗcomᚋree return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalNUpdateNLSLayerInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐUpdateNLSLayerInput(ctx context.Context, v interface{}) (gqlmodel.UpdateNLSLayerInput, error) { + res, err := ec.unmarshalInputUpdateNLSLayerInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) unmarshalNUpdateProjectInput2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐUpdateProjectInput(ctx context.Context, v interface{}) (gqlmodel.UpdateProjectInput, error) { res, err := ec.unmarshalInputUpdateProjectInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -68978,6 +71365,13 @@ func (ec *executionContext) marshalOAddMemberToTeamPayload2ᚖgithubᚗcomᚋree return ec._AddMemberToTeamPayload(ctx, sel, v) } +func (ec *executionContext) marshalOAddNLSLayerSimplePayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐAddNLSLayerSimplePayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.AddNLSLayerSimplePayload) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._AddNLSLayerSimplePayload(ctx, sel, v) +} + func (ec *executionContext) marshalOAddStylePayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐAddStylePayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.AddStylePayload) graphql.Marshaler { if v == nil { return graphql.Null @@ -69339,6 +71733,22 @@ func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.Sele return res } +func (ec *executionContext) unmarshalOJSON2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐJSON(ctx context.Context, v interface{}) (gqlmodel.JSON, error) { + if v == nil { + return nil, nil + } + var res gqlmodel.JSON + err := res.UnmarshalGQL(v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOJSON2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐJSON(ctx context.Context, sel ast.SelectionSet, v gqlmodel.JSON) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return v +} + func (ec *executionContext) unmarshalOLang2ᚖgolangᚗorgᚋxᚋtextᚋlanguageᚐTag(ctx context.Context, v interface{}) (*language.Tag, error) { if v == nil { return nil, nil @@ -69472,6 +71882,13 @@ func (ec *executionContext) marshalOMoveLayerPayload2ᚖgithubᚗcomᚋreearth return ec._MoveLayerPayload(ctx, sel, v) } +func (ec *executionContext) marshalONLSLayer2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNLSLayer(ctx context.Context, sel ast.SelectionSet, v gqlmodel.NLSLayer) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._NLSLayer(ctx, sel, v) +} + func (ec *executionContext) marshalONode2githubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐNode(ctx context.Context, sel ast.SelectionSet, v gqlmodel.Node) graphql.Marshaler { if v == nil { return graphql.Null @@ -69767,6 +72184,13 @@ func (ec *executionContext) marshalORemoveMemberFromTeamPayload2ᚖgithubᚗcom return ec._RemoveMemberFromTeamPayload(ctx, sel, v) } +func (ec *executionContext) marshalORemoveNLSLayerPayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐRemoveNLSLayerPayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.RemoveNLSLayerPayload) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._RemoveNLSLayerPayload(ctx, sel, v) +} + func (ec *executionContext) marshalORemoveStylePayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐRemoveStylePayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.RemoveStylePayload) graphql.Marshaler { if v == nil { return graphql.Null @@ -69966,6 +72390,13 @@ func (ec *executionContext) marshalOUpdateMemberOfTeamPayload2ᚖgithubᚗcomᚋ return ec._UpdateMemberOfTeamPayload(ctx, sel, v) } +func (ec *executionContext) marshalOUpdateNLSLayerPayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐUpdateNLSLayerPayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.UpdateNLSLayerPayload) graphql.Marshaler { + if v == nil { + return graphql.Null + } + return ec._UpdateNLSLayerPayload(ctx, sel, v) +} + func (ec *executionContext) marshalOUpdateStylePayload2ᚖgithubᚗcomᚋreearthᚋreearthᚋserverᚋinternalᚋadapterᚋgqlᚋgqlmodelᚐUpdateStylePayload(ctx context.Context, sel ast.SelectionSet, v *gqlmodel.UpdateStylePayload) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/server/internal/adapter/gql/gqlmodel/convert_nlslayer.go b/server/internal/adapter/gql/gqlmodel/convert_nlslayer.go new file mode 100644 index 0000000000..ad198adef1 --- /dev/null +++ b/server/internal/adapter/gql/gqlmodel/convert_nlslayer.go @@ -0,0 +1,78 @@ +package gqlmodel + +import ( + "github.com/reearth/reearth/server/pkg/id" + "github.com/reearth/reearth/server/pkg/nlslayer" + "github.com/reearth/reearthx/util" +) + +func ToNLSLayerSimple(l *nlslayer.NLSLayerSimple, parent *id.NLSLayerID) *NLSLayerSimple { + if l == nil { + return nil + } + + return &NLSLayerSimple{ + ID: IDFrom(l.ID()), + SceneID: IDFrom(l.Scene()), + Title: l.Title(), + Visible: l.IsVisible(), + Infobox: nil, // Temporarily + LayerType: string(l.LayerType()), + Config: JSON(*l.Config()), + Tags: ToLayerTagList(l.Tags(), l.Scene()), + } +} + +func ToNLSConfig(p JSON) *nlslayer.Config { + co := make(nlslayer.Config) + + for key, value := range p { + co[key] = value + } + return &co +} + +func ToNLSLayerType(p string) nlslayer.LayerType { + lt, err := nlslayer.NewLayerType(p) + if err != nil { + return nlslayer.LayerType("") + } + return lt +} + +func ToNLSLayerGroup(l *nlslayer.NLSLayerGroup, parent *id.NLSLayerID) *NLSLayerGroup { + if l == nil { + return nil + } + + return &NLSLayerGroup{ + ID: IDFrom(l.ID()), + SceneID: IDFrom(l.Scene()), + Title: l.Title(), + Visible: l.IsVisible(), + Config: JSON(*l.Config()), + Infobox: nil, // Temporarily + Tags: ToLayerTagList(l.Tags(), l.Scene()), + ChildrenIds: util.Map(l.Children().Layers(), IDFrom[id.NLSLayer]), + } +} + +func ToNLSLayer(l nlslayer.NLSLayer, parent *id.NLSLayerID) NLSLayer { + if l == nil { + return nil + } + + switch la := l.(type) { + case *nlslayer.NLSLayerSimple: + return ToNLSLayerSimple(la, parent) + case *nlslayer.NLSLayerGroup: + return ToNLSLayerGroup(la, parent) + } + return nil +} + +func ToNLSLayers(layers nlslayer.NLSLayerList, parent *id.NLSLayerID) []NLSLayer { + return util.Map(layers, func(l *nlslayer.NLSLayer) NLSLayer { + return ToNLSLayer(*l, parent) + }) +} diff --git a/server/internal/adapter/gql/gqlmodel/models_gen.go b/server/internal/adapter/gql/gqlmodel/models_gen.go index b018fb6b81..f75866dd86 100644 --- a/server/internal/adapter/gql/gqlmodel/models_gen.go +++ b/server/internal/adapter/gql/gqlmodel/models_gen.go @@ -22,6 +22,10 @@ type LayerTag interface { IsLayerTag() } +type NLSLayer interface { + IsNLSLayer() +} + type Node interface { IsNode() } @@ -108,6 +112,18 @@ type AddMemberToTeamPayload struct { Team *Team `json:"team"` } +type AddNLSLayerSimpleInput struct { + ParentLayerID ID `json:"parentLayerId"` + LayerType string `json:"layerType"` + SceneID ID `json:"sceneID"` + Config JSON `json:"config"` + Index *int `json:"index"` +} + +type AddNLSLayerSimplePayload struct { + Layers *NLSLayerSimple `json:"layers"` +} + type AddPropertyItemInput struct { PropertyID ID `json:"propertyId"` SchemaGroupID ID `json:"schemaGroupId"` @@ -751,6 +767,36 @@ type MoveStoryPayload struct { Stories []*Story `json:"stories"` } +type NLSLayerGroup struct { + ID ID `json:"id"` + LayerType string `json:"layerType"` + SceneID ID `json:"sceneId"` + Children []NLSLayer `json:"children"` + ChildrenIds []ID `json:"childrenIds"` + Config JSON `json:"config"` + Title string `json:"title"` + Visible bool `json:"visible"` + Infobox *Infobox `json:"infobox"` + Tags []LayerTag `json:"tags"` + Scene *Scene `json:"scene"` +} + +func (NLSLayerGroup) IsNLSLayer() {} + +type NLSLayerSimple struct { + ID ID `json:"id"` + LayerType string `json:"layerType"` + SceneID ID `json:"sceneId"` + Config JSON `json:"config"` + Title string `json:"title"` + Visible bool `json:"visible"` + Infobox *Infobox `json:"infobox"` + Tags []LayerTag `json:"tags"` + Scene *Scene `json:"scene"` +} + +func (NLSLayerSimple) IsNLSLayer() {} + type PageInfo struct { StartCursor *usecasex.Cursor `json:"startCursor"` EndCursor *usecasex.Cursor `json:"endCursor"` @@ -1087,6 +1133,14 @@ type RemoveMyAuthInput struct { Auth string `json:"auth"` } +type RemoveNLSLayerInput struct { + LayerID ID `json:"layerId"` +} + +type RemoveNLSLayerPayload struct { + LayerID ID `json:"layerId"` +} + type RemovePropertyFieldInput struct { PropertyID ID `json:"propertyId"` SchemaGroupID *ID `json:"schemaGroupId"` @@ -1156,6 +1210,7 @@ type Scene struct { Team *Team `json:"team"` Property *Property `json:"property"` RootLayer *LayerGroup `json:"rootLayer"` + NewLayers []NLSLayer `json:"newLayers"` Stories []*Story `json:"stories"` Styles []*Style `json:"styles"` DatasetSchemas *DatasetSchemaConnection `json:"datasetSchemas"` @@ -1418,6 +1473,16 @@ type UpdateMemberOfTeamPayload struct { Team *Team `json:"team"` } +type UpdateNLSLayerInput struct { + LayerID ID `json:"layerId"` + Name *string `json:"name"` + Visible *bool `json:"visible"` +} + +type UpdateNLSLayerPayload struct { + Layer NLSLayer `json:"layer"` +} + type UpdateProjectInput struct { ProjectID ID `json:"projectId"` Name *string `json:"name"` diff --git a/server/internal/adapter/gql/resolver_mutation_nlslayer.go b/server/internal/adapter/gql/resolver_mutation_nlslayer.go new file mode 100644 index 0000000000..1bca4c6bf1 --- /dev/null +++ b/server/internal/adapter/gql/resolver_mutation_nlslayer.go @@ -0,0 +1,66 @@ +package gql + +import ( + "context" + + "github.com/reearth/reearth/server/internal/adapter/gql/gqlmodel" + "github.com/reearth/reearth/server/internal/usecase/interfaces" + "github.com/reearth/reearth/server/pkg/id" +) + +func (r *mutationResolver) AddNLSLayerSimple(ctx context.Context, input gqlmodel.AddNLSLayerSimpleInput) (*gqlmodel.AddNLSLayerSimplePayload, error) { + lid, err := gqlmodel.ToID[id.NLSLayer](input.ParentLayerID) + if err != nil { + return nil, err + } + + layer, parent, err := usecases(ctx).NLSLayer.AddLayerSimple(ctx, interfaces.AddNLSLayerSimpleInput{ + ParentLayerID: lid, + Index: input.Index, + LayerType: gqlmodel.ToNLSLayerType(input.LayerType), + Config: gqlmodel.ToNLSConfig(input.Config), + }, getOperator(ctx)) + if err != nil { + return nil, err + } + + return &gqlmodel.AddNLSLayerSimplePayload{ + Layers: gqlmodel.ToNLSLayerSimple(layer, parent.IDRef()), + }, nil +} + +func (r *mutationResolver) RemoveNLSLayer(ctx context.Context, input gqlmodel.RemoveNLSLayerInput) (*gqlmodel.RemoveNLSLayerPayload, error) { + lid, err := gqlmodel.ToID[id.NLSLayer](input.LayerID) + if err != nil { + return nil, err + } + + id, _, err := usecases(ctx).NLSLayer.Remove(ctx, lid, getOperator(ctx)) + if err != nil { + return nil, err + } + + return &gqlmodel.RemoveNLSLayerPayload{ + LayerID: gqlmodel.IDFrom(id), + }, nil +} + +func (r *mutationResolver) UpdateNLSLayer(ctx context.Context, input gqlmodel.UpdateNLSLayerInput) (*gqlmodel.UpdateNLSLayerPayload, error) { + lid, err := gqlmodel.ToID[id.NLSLayer](input.LayerID) + if err != nil { + return nil, err + } + + layer, err := usecases(ctx).NLSLayer.Update(ctx, interfaces.UpdateNLSLayerInput{ + LayerID: lid, + Name: input.Name, + Visible: input.Visible, + }, getOperator(ctx)) + if err != nil { + return nil, err + } + + return &gqlmodel.UpdateNLSLayerPayload{ + Layer: gqlmodel.ToNLSLayer(layer, nil), + }, nil +} diff --git a/server/internal/adapter/gql/resolver_nlslayer.go b/server/internal/adapter/gql/resolver_nlslayer.go new file mode 100644 index 0000000000..2cee632c2a --- /dev/null +++ b/server/internal/adapter/gql/resolver_nlslayer.go @@ -0,0 +1,27 @@ +package gql + +import ( + "context" + + "github.com/reearth/reearth/server/internal/adapter/gql/gqlmodel" +) + +func (r *Resolver) NLSLayerSimple() NLSLayerSimpleResolver { + return &nlsLayerSimpleResolver{r} +} + +type nlsLayerSimpleResolver struct{ *Resolver } + +func (r *nlsLayerSimpleResolver) Scene(ctx context.Context, obj *gqlmodel.NLSLayerSimple) (*gqlmodel.Scene, error) { + return dataloaders(ctx).Scene.Load(obj.SceneID) +} + +func (r *Resolver) NLSLayerGroup() NLSLayerGroupResolver { + return &nlsLayerGroupResolver{r} +} + +type nlsLayerGroupResolver struct{ *Resolver } + +func (r *nlsLayerGroupResolver) Scene(ctx context.Context, obj *gqlmodel.NLSLayerGroup) (*gqlmodel.Scene, error) { + return dataloaders(ctx).Scene.Load(obj.SceneID) +} diff --git a/server/internal/adapter/gql/resolver_scene.go b/server/internal/adapter/gql/resolver_scene.go index e91721312e..157e66c9cf 100644 --- a/server/internal/adapter/gql/resolver_scene.go +++ b/server/internal/adapter/gql/resolver_scene.go @@ -53,6 +53,21 @@ func (r *sceneResolver) RootLayer(ctx context.Context, obj *gqlmodel.Scene) (*gq return layerGroup, nil } +func (r *sceneResolver) NewLayers(ctx context.Context, obj *gqlmodel.Scene) ([]gqlmodel.NLSLayer, error) { + sid, err := gqlmodel.ToID[id.Scene](obj.ID) + if err != nil { + return nil, err + } + + nlslayer, err := usecases(ctx).NLSLayer.FetchByScene(ctx, sid, getOperator(ctx)) + if err != nil { + return nil, err + } + + res := gqlmodel.ToNLSLayers(nlslayer, nil) + return res, nil +} + func (r *sceneResolver) DatasetSchemas(ctx context.Context, obj *gqlmodel.Scene, first *int, last *int, after *usecasex.Cursor, before *usecasex.Cursor) (*gqlmodel.DatasetSchemaConnection, error) { return loaders(ctx).Dataset.FindSchemaByScene(ctx, obj.ID, first, last, before, after) } diff --git a/server/internal/infrastructure/memory/container.go b/server/internal/infrastructure/memory/container.go index 43cc389e5f..d32e05d535 100644 --- a/server/internal/infrastructure/memory/container.go +++ b/server/internal/infrastructure/memory/container.go @@ -14,6 +14,7 @@ func New() *repo.Container { DatasetSchema: NewDatasetSchema(), Dataset: NewDataset(), Layer: NewLayer(), + NLSLayer: NewNLSLayer(), Plugin: NewPlugin(), Project: NewProject(), PropertySchema: NewPropertySchema(), diff --git a/server/internal/infrastructure/memory/nlslayer.go b/server/internal/infrastructure/memory/nlslayer.go new file mode 100644 index 0000000000..37bcc93e93 --- /dev/null +++ b/server/internal/infrastructure/memory/nlslayer.go @@ -0,0 +1,243 @@ +package memory + +import ( + "context" + "sync" + + "github.com/reearth/reearth/server/internal/usecase/repo" + "github.com/reearth/reearth/server/pkg/id" + "github.com/reearth/reearth/server/pkg/nlslayer" + "github.com/reearth/reearthx/rerror" +) + +type NLSLayer struct { + lock sync.Mutex + data map[id.NLSLayerID]nlslayer.NLSLayer + f repo.SceneFilter +} + +func NewNLSLayer() *NLSLayer { + return &NLSLayer{ + data: map[id.NLSLayerID]nlslayer.NLSLayer{}, + } +} + +func NewNLSLayerWith(items ...nlslayer.NLSLayer) repo.NLSLayer { + r := NewNLSLayer() + ctx := context.Background() + for _, i := range items { + _ = r.Save(ctx, i) + } + return r +} + +func (r *NLSLayer) Filtered(f repo.SceneFilter) repo.NLSLayer { + return &NLSLayer{ + // note data is shared between the source repo and mutex cannot work well + data: r.data, + f: r.f.Merge(f), + } +} + +func (r *NLSLayer) FindByID(ctx context.Context, id id.NLSLayerID) (nlslayer.NLSLayer, error) { + r.lock.Lock() + defer r.lock.Unlock() + + res, ok := r.data[id] + if ok && r.f.CanRead(res.Scene()) { + return res, nil + } + return nil, rerror.ErrNotFound +} + +func (r *NLSLayer) FindByIDs(ctx context.Context, ids id.NLSLayerIDList) (nlslayer.NLSLayerList, error) { + r.lock.Lock() + defer r.lock.Unlock() + + result := nlslayer.NLSLayerList{} + for _, id := range ids { + if d, ok := r.data[id]; ok && r.f.CanRead(d.Scene()) { + result = append(result, &d) + continue + } + result = append(result, nil) + } + return result, nil +} + +func (r *NLSLayer) FindNLSLayerGroupByIDs(ctx context.Context, ids id.NLSLayerIDList) (nlslayer.NLSLayerGroupList, error) { + r.lock.Lock() + defer r.lock.Unlock() + + result := nlslayer.NLSLayerGroupList{} + for _, id := range ids { + if d, ok := r.data[id]; ok { + if lg := nlslayer.NLSLayerGroupFromLayer(d); lg != nil && r.f.CanRead(lg.Scene()) { + result = append(result, lg) + continue + } + result = append(result, nil) + } + } + return result, nil +} + +func (r *NLSLayer) FindNLSLayerGroupByID(ctx context.Context, id id.NLSLayerID) (*nlslayer.NLSLayerGroup, error) { + r.lock.Lock() + defer r.lock.Unlock() + + d, ok := r.data[id] + if !ok { + return &nlslayer.NLSLayerGroup{}, nil + } + if lg := nlslayer.NLSLayerGroupFromLayer(d); lg != nil && r.f.CanRead(lg.Scene()) { + return lg, nil + } + return nil, rerror.ErrNotFound +} + +func (r *NLSLayer) FindNLSLayerSimpleByIDs(ctx context.Context, ids id.NLSLayerIDList) (nlslayer.NLSLayerSimpleList, error) { + r.lock.Lock() + defer r.lock.Unlock() + + result := nlslayer.NLSLayerSimpleList{} + for _, id := range ids { + if d, ok := r.data[id]; ok { + if li := nlslayer.NLSLayerSimpleFromLayer(d); li != nil && r.f.CanRead(li.Scene()) { + result = append(result, li) + continue + } + result = append(result, nil) + } + } + return result, nil +} + +func (r *NLSLayer) FindNLSLayerSimpleByID(ctx context.Context, id id.NLSLayerID) (*nlslayer.NLSLayerSimple, error) { + r.lock.Lock() + defer r.lock.Unlock() + + d, ok := r.data[id] + if !ok { + return &nlslayer.NLSLayerSimple{}, nil + } + if li := nlslayer.NLSLayerSimpleFromLayer(d); li != nil && r.f.CanRead(li.Scene()) { + return li, nil + } + return nil, rerror.ErrNotFound +} + +func (r *NLSLayer) Save(ctx context.Context, l nlslayer.NLSLayer) error { + if !r.f.CanWrite(l.Scene()) { + return repo.ErrOperationDenied + } + + r.lock.Lock() + defer r.lock.Unlock() + + r.data[l.ID()] = l + return nil +} + +func (r *NLSLayer) FindParentsByIDs(_ context.Context, ids id.NLSLayerIDList) (nlslayer.NLSLayerGroupList, error) { + r.lock.Lock() + defer r.lock.Unlock() + + res := nlslayer.NLSLayerGroupList{} + for _, l := range r.data { + if lg := nlslayer.ToNLSLayerGroup(l); lg != nil && r.f.CanRead(l.Scene()) { + for _, cl := range lg.Children().Layers() { + if ids.Has(cl) { + res = append(res, lg) + } + } + } + } + + return res, nil +} + +func (r *NLSLayer) FindParentByID(ctx context.Context, id id.NLSLayerID) (*nlslayer.NLSLayerGroup, error) { + r.lock.Lock() + defer r.lock.Unlock() + + for _, l := range r.data { + if lg := nlslayer.ToNLSLayerGroup(l); lg != nil && r.f.CanRead(l.Scene()) { + for _, cl := range lg.Children().Layers() { + if cl == id { + return lg, nil + } + } + } + } + return nil, rerror.ErrNotFound +} + +func (r *NLSLayer) FindByScene(ctx context.Context, sceneID id.SceneID) (nlslayer.NLSLayerList, error) { + if !r.f.CanRead(sceneID) { + return nil, nil + } + + r.lock.Lock() + defer r.lock.Unlock() + + res := nlslayer.NLSLayerList{} + for _, l := range r.data { + l := l + if l.Scene() == sceneID { + res = append(res, &l) + } + } + return res, nil +} + +func (r *NLSLayer) SaveAll(ctx context.Context, ll nlslayer.NLSLayerList) error { + r.lock.Lock() + defer r.lock.Unlock() + + for _, l := range ll { + layer := *l + if r.f.CanWrite(layer.Scene()) { + r.data[layer.ID()] = layer + } + } + return nil +} + +func (r *NLSLayer) Remove(ctx context.Context, id id.NLSLayerID) error { + r.lock.Lock() + defer r.lock.Unlock() + + if l, ok := r.data[id]; ok && l != nil && r.f.CanWrite(l.Scene()) { + delete(r.data, id) + } + return nil +} + +func (r *NLSLayer) RemoveAll(ctx context.Context, ids id.NLSLayerIDList) error { + r.lock.Lock() + defer r.lock.Unlock() + + for _, id := range ids { + if l, ok := r.data[id]; ok && l != nil && r.f.CanWrite(l.Scene()) { + delete(r.data, id) + } + } + return nil +} + +func (r *NLSLayer) RemoveByScene(ctx context.Context, sceneID id.SceneID) error { + if !r.f.CanWrite(sceneID) { + return nil + } + + r.lock.Lock() + defer r.lock.Unlock() + + for lid, p := range r.data { + if p.Scene() == sceneID { + delete(r.data, lid) + } + } + return nil +} diff --git a/server/internal/infrastructure/mongo/container.go b/server/internal/infrastructure/mongo/container.go index 2a6c91ab25..2bc7f171d1 100644 --- a/server/internal/infrastructure/mongo/container.go +++ b/server/internal/infrastructure/mongo/container.go @@ -42,6 +42,7 @@ func New(ctx context.Context, db *mongo.Database, account *accountrepo.Container DatasetSchema: NewDatasetSchema(client), Dataset: NewDataset(client), Layer: NewLayer(client), + NLSLayer: NewNLSLayer(client), Plugin: NewPlugin(client), Project: NewProject(client), PropertySchema: NewPropertySchema(client), diff --git a/server/internal/infrastructure/mongo/mongodoc/nlslayer.go b/server/internal/infrastructure/mongo/mongodoc/nlslayer.go new file mode 100644 index 0000000000..e6370f6256 --- /dev/null +++ b/server/internal/infrastructure/mongo/mongodoc/nlslayer.go @@ -0,0 +1,204 @@ +package mongodoc + +import ( + "errors" + + "github.com/reearth/reearth/server/pkg/id" + "github.com/reearth/reearth/server/pkg/nlslayer" + "github.com/reearth/reearth/server/pkg/scene" + "golang.org/x/exp/slices" +) + +type NLSLayerDocument struct { + ID string + Title string + Visible bool + Scene string + LayerType string + Infobox *LayerInfoboxDocument + Simple *NLSLayerSimpleDocument + Group *NLSLayerGroupDocument + Tags LayerTagListDocument +} + +type NLSLayerSimpleDocument struct { + Config map[string]any +} + +type NLSLayerGroupDocument struct { + Children []string + Root bool + Config map[string]any +} + +type NLSLayerConsumer = Consumer[*NLSLayerDocument, nlslayer.NLSLayer] + +func NewNLSLayerConsumer(scenes []id.SceneID) *NLSLayerConsumer { + return NewConsumer[*NLSLayerDocument, nlslayer.NLSLayer](func(a nlslayer.NLSLayer) bool { + return scenes == nil || slices.Contains(scenes, a.Scene()) + }) +} + +func NewNLSLayer(l nlslayer.NLSLayer) (*NLSLayerDocument, string) { + var group *NLSLayerGroupDocument + var simple *NLSLayerSimpleDocument + var infobox *LayerInfoboxDocument + + if lg := nlslayer.NLSLayerGroupFromLayer(l); lg != nil { + group = &NLSLayerGroupDocument{ + Children: lg.Children().Strings(), + Root: lg.IsRoot(), + Config: *lg.Config(), + } + } + + if ls := nlslayer.NLSLayerSimpleFromLayer(l); ls != nil { + simple = &NLSLayerSimpleDocument{ + Config: *ls.Config(), + } + } + + if ib := l.Infobox(); ib != nil { + ibfields := ib.Fields() + fields := make([]LayerInfoboxFieldDocument, 0, len(ibfields)) + for _, f := range ibfields { + fields = append(fields, LayerInfoboxFieldDocument{ + ID: f.ID().String(), + Plugin: f.Plugin().String(), + Extension: string(f.Extension()), + Property: f.Property().String(), + }) + } + infobox = &LayerInfoboxDocument{ + Property: ib.Property().String(), + Fields: fields, + } + } + + id := l.ID().String() + return &NLSLayerDocument{ + ID: id, + Title: l.Title(), + Visible: l.IsVisible(), + Scene: l.Scene().String(), + Infobox: infobox, + LayerType: string(l.LayerType()), + Group: group, + Simple: simple, + Tags: NewLayerTagList(l.Tags()), + }, id +} + +func NewNLSLayers(layers nlslayer.NLSLayerList, f scene.IDList) ([]interface{}, []string) { + res := make([]interface{}, 0, len(layers)) + ids := make([]string, 0, len(layers)) + for _, d := range layers { + if d == nil { + continue + } + d2 := *d + if d2 == nil || f != nil && !f.Has(d2.Scene()) { + continue + } + r, id := NewNLSLayer(d2) + res = append(res, r) + ids = append(ids, id) + } + return res, ids +} + +func (d *NLSLayerDocument) Model() (nlslayer.NLSLayer, error) { + if d.Simple != nil { + li, err := d.ModelSimple() + if err != nil { + return nil, err + } + return li, nil + } + if d.Group != nil { + lg, err := d.ModelGroup() + if err != nil { + return nil, err + } + return lg, nil + } + return nil, errors.New("invalid layer") +} + +func (d *NLSLayerDocument) ModelSimple() (*nlslayer.NLSLayerSimple, error) { + lid, err := id.NLSLayerIDFrom(d.ID) + if err != nil { + return nil, err + } + sid, err := id.SceneIDFrom(d.Scene) + if err != nil { + return nil, err + } + ib, err2 := ToModelInfobox(d.Infobox) + if err2 != nil { + return nil, err + } + + return nlslayer.NewNLSLayerSimple(). + ID(lid). + Title(d.Title). + LayerType(NewNLSLayerType(d.LayerType)). + IsVisible(d.Visible). + Infobox(ib). + Scene(sid). + Tags(d.Tags.Model()). + // Simple + Config(NewNLSLayerConfig(d.Simple.Config)). + Build() +} + +func (d *NLSLayerDocument) ModelGroup() (*nlslayer.NLSLayerGroup, error) { + lid, err := id.NLSLayerIDFrom(d.ID) + if err != nil { + return nil, err + } + sid, err := id.SceneIDFrom(d.Scene) + if err != nil { + return nil, err + } + ib, err2 := ToModelInfobox(d.Infobox) + if err2 != nil { + return nil, err2 + } + + ids := make([]id.NLSLayerID, 0, len(d.Group.Children)) + for _, lgid := range d.Group.Children { + lid, err := id.NLSLayerIDFrom(lgid) + if err != nil { + return nil, err + } + ids = append(ids, lid) + } + + return nlslayer.NewNLSLayerGroup(). + ID(lid). + Title(d.Title). + LayerType(NewNLSLayerType(d.LayerType)). + IsVisible(d.Visible). + Infobox(ib). + Scene(sid). + Tags(d.Tags.Model()). + // group + Root(d.Group != nil && d.Group.Root). + Layers(nlslayer.NewIDList(ids)). + Config(NewNLSLayerConfig(d.Simple.Config)). + Build() +} + +func NewNLSLayerType(p string) nlslayer.LayerType { + lt, err := nlslayer.NewLayerType(p) + if err != nil { + return nlslayer.LayerType("") + } + return lt +} + +func NewNLSLayerConfig(c map[string]any) *nlslayer.Config { + config := nlslayer.Config(c) + return &config +} diff --git a/server/internal/infrastructure/mongo/nlslayer.go b/server/internal/infrastructure/mongo/nlslayer.go new file mode 100644 index 0000000000..bc92136450 --- /dev/null +++ b/server/internal/infrastructure/mongo/nlslayer.go @@ -0,0 +1,291 @@ +package mongo + +import ( + "context" + + "go.mongodb.org/mongo-driver/bson" + + "github.com/reearth/reearth/server/internal/infrastructure/mongo/mongodoc" + "github.com/reearth/reearth/server/internal/usecase/repo" + "github.com/reearth/reearth/server/pkg/id" + "github.com/reearth/reearth/server/pkg/nlslayer" + "github.com/reearth/reearthx/mongox" + "github.com/reearth/reearthx/rerror" + "github.com/samber/lo" +) + +var ( + nlsLayerIndexes = []string{ + "scene", + "id,scene", + "tags.id", + "tags.tags.id", + "scene,infobox.fields", + "group.children", + "group.children,scene", + "infobox.property", + "infobox.property,scene", + "infobox.fields.property", + "infobox.fields.property,scene", + } + nlsLayerUniqueIndexes = []string{"id"} +) + +type NLSLayer struct { + client *mongox.ClientCollection + f repo.SceneFilter +} + +func NewNLSLayer(client *mongox.Client) *NLSLayer { + return &NLSLayer{ + client: client.WithCollection("nlsLayer"), + } +} + +func (r *NLSLayer) Init(ctx context.Context) error { + return createIndexes(ctx, r.client, nlsLayerIndexes, nlsLayerUniqueIndexes) +} + +func (r *NLSLayer) Filtered(f repo.SceneFilter) repo.NLSLayer { + return &NLSLayer{ + client: r.client, + f: r.f.Merge(f), + } +} + +func (r *NLSLayer) FindByID(ctx context.Context, id id.NLSLayerID) (nlslayer.NLSLayer, error) { + return r.findOne(ctx, bson.M{ + "id": id.String(), + }) +} + +func (r *NLSLayer) FindByIDs(ctx context.Context, ids id.NLSLayerIDList) (nlslayer.NLSLayerList, error) { + if len(ids) == 0 { + return nil, nil + } + + filter := bson.M{ + "id": bson.M{ + "$in": ids.Strings(), + }, + } + dst := make([]*nlslayer.NLSLayer, 0, len(ids)) + res, err := r.find(ctx, dst, filter) + if err != nil { + return nil, err + } + return filterNLSLayers(ids, res), nil +} + +func (r *NLSLayer) FindNLSLayerSimpleByID(ctx context.Context, id id.NLSLayerID) (*nlslayer.NLSLayerSimple, error) { + return r.findNLSLayerSimpleOne(ctx, bson.M{ + "id": id.String(), + }) +} + +func (r *NLSLayer) FindNLSLayerSimpleByIDs(ctx context.Context, ids id.NLSLayerIDList) (nlslayer.NLSLayerSimpleList, error) { + filter := bson.M{ + "id": bson.M{ + "$in": ids.Strings(), + }, + } + dst := make([]*nlslayer.NLSLayerSimple, 0, len(ids)) + res, err := r.findNLSLayerSimples(ctx, dst, filter) + if err != nil { + return nil, err + } + return filterNLSLayerSimples(ids, res), nil +} + +func (r *NLSLayer) FindNLSLayerGroupByID(ctx context.Context, id id.NLSLayerID) (*nlslayer.NLSLayerGroup, error) { + return r.findNLSLayerGroupOne(ctx, bson.M{ + "id": id.String(), + }) +} + +func (r *NLSLayer) FindNLSLayerGroupByIDs(ctx context.Context, ids id.NLSLayerIDList) (nlslayer.NLSLayerGroupList, error) { + filter := bson.M{ + "id": bson.M{ + "$in": ids.Strings(), + }, + } + dst := make([]*nlslayer.NLSLayerGroup, 0, len(ids)) + res, err := r.findNLSLayerGroups(ctx, dst, filter) + if err != nil { + return nil, err + } + return filterNLSLayerGroups(ids, res), nil +} + +func (r *NLSLayer) FindParentByID(ctx context.Context, id id.NLSLayerID) (*nlslayer.NLSLayerGroup, error) { + return r.findNLSLayerGroupOne(ctx, bson.M{ + "group.children": id.String(), + }) +} + +func (r *NLSLayer) FindParentsByIDs(ctx context.Context, ids id.NLSLayerIDList) (nlslayer.NLSLayerGroupList, error) { + return r.findNLSLayerGroups(ctx, nil, bson.M{ + "group.children": bson.M{"$in": ids.Strings()}, + }) +} + +func (r *NLSLayer) FindByScene(ctx context.Context, id id.SceneID) (nlslayer.NLSLayerList, error) { + if !r.f.CanRead(id) { + return nil, nil + } + return r.find(ctx, nil, bson.M{ + "scene": id.String(), + }) +} + +func (r *NLSLayer) Save(ctx context.Context, layer nlslayer.NLSLayer) error { + if !r.f.CanWrite(layer.Scene()) { + return repo.ErrOperationDenied + } + doc, id := mongodoc.NewNLSLayer(layer) + return r.client.SaveOne(ctx, id, doc) +} + +func (r *NLSLayer) SaveAll(ctx context.Context, layers nlslayer.NLSLayerList) error { + if len(layers) == 0 { + return nil + } + docs, ids := mongodoc.NewNLSLayers(layers, r.f.Writable) + return r.client.SaveAll(ctx, ids, docs) +} + +func (r *NLSLayer) Remove(ctx context.Context, id id.NLSLayerID) error { + return r.client.RemoveOne(ctx, r.writeFilter(bson.M{"id": id.String()})) +} + +func (r *NLSLayer) RemoveAll(ctx context.Context, ids id.NLSLayerIDList) error { + if len(ids) == 0 { + return nil + } + return r.client.RemoveAll(ctx, r.writeFilter(bson.M{ + "id": bson.M{"$in": ids.Strings()}, + })) +} + +func (r *NLSLayer) RemoveByScene(ctx context.Context, sceneID id.SceneID) error { + if !r.f.CanWrite(sceneID) { + return nil + } + filter := bson.D{ + {Key: "scene", Value: sceneID.String()}, + } + _, err := r.client.Client().DeleteMany(ctx, filter) + if err != nil { + return rerror.ErrInternalByWithContext(ctx, err) + } + return nil +} + +func (r *NLSLayer) findOne(ctx context.Context, filter interface{}) (nlslayer.NLSLayer, error) { + c := mongodoc.NewNLSLayerConsumer(r.f.Readable) + if err := r.client.FindOne(ctx, filter, c); err != nil { + return nil, err + } + if len(c.Result) == 0 { + return nil, rerror.ErrNotFound + } + return c.Result[0], nil +} + +func filterNLSLayers(ids []id.NLSLayerID, rows []*nlslayer.NLSLayer) nlslayer.NLSLayerList { + res := make([]*nlslayer.NLSLayer, 0, len(ids)) + for _, id := range ids { + var r2 *nlslayer.NLSLayer + for _, r := range rows { + if r == nil { + continue + } + if r3 := *r; r3 != nil && r3.ID() == id { + r2 = &r3 + break + } + } + res = append(res, r2) + } + return res +} + +func (r *NLSLayer) find(ctx context.Context, dst nlslayer.NLSLayerList, filter interface{}) (nlslayer.NLSLayerList, error) { + c := mongodoc.NewNLSLayerConsumer(r.f.Readable) + if err := r.client.Find(ctx, filter, c); err != nil { + return nil, err + } + return lo.ToSlicePtr(c.Result), nil +} + +func (r *NLSLayer) findNLSLayerSimpleOne(ctx context.Context, filter interface{}) (*nlslayer.NLSLayerSimple, error) { + c := mongodoc.NewNLSLayerConsumer(r.f.Readable) + if err := r.client.FindOne(ctx, filter, c); err != nil { + return nil, err + } + if len(c.Result) == 0 { + return nil, rerror.ErrNotFound + } + return nlslayer.ToNLSLayerSimple(c.Result[0]), nil +} + +func (r *NLSLayer) findNLSLayerGroupOne(ctx context.Context, filter interface{}) (*nlslayer.NLSLayerGroup, error) { + c := mongodoc.NewNLSLayerConsumer(r.f.Readable) + if err := r.client.FindOne(ctx, filter, c); err != nil { + return nil, err + } + if len(c.Result) == 0 { + return nil, rerror.ErrNotFound + } + return nlslayer.ToNLSLayerGroup(c.Result[0]), nil +} + +func (r *NLSLayer) findNLSLayerSimples(ctx context.Context, dst nlslayer.NLSLayerSimpleList, filter interface{}) (nlslayer.NLSLayerSimpleList, error) { + c := mongodoc.NewNLSLayerConsumer(r.f.Readable) + if err := r.client.Find(ctx, filter, c); err != nil { + return nil, err + } + return nlslayer.NLSLayerList(lo.ToSlicePtr(c.Result)).ToLayerItemList(), nil +} + +func (r *NLSLayer) findNLSLayerGroups(ctx context.Context, dst nlslayer.NLSLayerGroupList, filter interface{}) (nlslayer.NLSLayerGroupList, error) { + c := mongodoc.NewNLSLayerConsumer(r.f.Readable) + if err := r.client.Find(ctx, filter, c); err != nil { + return nil, err + } + return nlslayer.NLSLayerList(lo.ToSlicePtr(c.Result)).ToNLSLayerGroupList(), nil +} + +func filterNLSLayerSimples(ids []id.NLSLayerID, rows []*nlslayer.NLSLayerSimple) []*nlslayer.NLSLayerSimple { + res := make([]*nlslayer.NLSLayerSimple, 0, len(ids)) + for _, id := range ids { + var r2 *nlslayer.NLSLayerSimple + for _, r := range rows { + if r != nil && r.ID() == id { + r2 = r + break + } + } + res = append(res, r2) + } + return res +} + +func filterNLSLayerGroups(ids []id.NLSLayerID, rows []*nlslayer.NLSLayerGroup) []*nlslayer.NLSLayerGroup { + res := make([]*nlslayer.NLSLayerGroup, 0, len(ids)) + for _, id := range ids { + var r2 *nlslayer.NLSLayerGroup + for _, r := range rows { + if r != nil && r.ID() == id { + r2 = r + break + } + } + res = append(res, r2) + } + return res +} + +func (r *NLSLayer) writeFilter(filter interface{}) interface{} { + return applySceneFilter(filter, r.f.Writable) +} diff --git a/server/internal/usecase/interactor/common.go b/server/internal/usecase/interactor/common.go index b2a5f41d33..303e74c1b1 100644 --- a/server/internal/usecase/interactor/common.go +++ b/server/internal/usecase/interactor/common.go @@ -40,6 +40,7 @@ func NewContainer(r *repo.Container, g *gateway.Container, Asset: NewAsset(r, g), Dataset: NewDataset(r, g), Layer: NewLayer(r), + NLSLayer: NewNLSLayer(r), Plugin: NewPlugin(r, g), Project: NewProject(r, g), Property: NewProperty(r, g), diff --git a/server/internal/usecase/interactor/nlslayer.go b/server/internal/usecase/interactor/nlslayer.go new file mode 100644 index 0000000000..0d8af9a2a5 --- /dev/null +++ b/server/internal/usecase/interactor/nlslayer.go @@ -0,0 +1,216 @@ +package interactor + +import ( + "context" + "errors" + + "github.com/reearth/reearth/server/internal/usecase" + "github.com/reearth/reearth/server/internal/usecase/interfaces" + "github.com/reearth/reearth/server/internal/usecase/repo" + "github.com/reearth/reearth/server/pkg/id" + "github.com/reearth/reearth/server/pkg/nlslayer" + "github.com/reearth/reearth/server/pkg/nlslayer/nlslayerops" + "github.com/reearth/reearthx/rerror" + "github.com/reearth/reearthx/usecasex" +) + +type NLSLayer struct { + common + commonSceneLock + nlslayerRepo repo.NLSLayer + sceneLockRepo repo.SceneLock + transaction usecasex.Transaction +} + +func NewNLSLayer(r *repo.Container) interfaces.NLSLayer { + return &NLSLayer{ + commonSceneLock: commonSceneLock{sceneLockRepo: r.SceneLock}, + nlslayerRepo: r.NLSLayer, + sceneLockRepo: r.SceneLock, + transaction: r.Transaction, + } +} + +func (i *NLSLayer) Fetch(ctx context.Context, ids id.NLSLayerIDList, operator *usecase.Operator) (nlslayer.NLSLayerList, error) { + return i.nlslayerRepo.FindByIDs(ctx, ids) +} + +func (i *NLSLayer) FetchLayerSimple(ctx context.Context, ids id.NLSLayerIDList, operator *usecase.Operator) (nlslayer.NLSLayerSimpleList, error) { + return i.nlslayerRepo.FindNLSLayerSimpleByIDs(ctx, ids) +} + +func (i *NLSLayer) FetchParent(ctx context.Context, pid id.NLSLayerID, operator *usecase.Operator) (*nlslayer.NLSLayerGroup, error) { + return i.nlslayerRepo.FindParentByID(ctx, pid) +} + +func (i *NLSLayer) FetchByScene(ctx context.Context, sid id.SceneID, _ *usecase.Operator) (nlslayer.NLSLayerList, error) { + return i.nlslayerRepo.FindByScene(ctx, sid) +} + +func (i *NLSLayer) AddLayerSimple(ctx context.Context, inp interfaces.AddNLSLayerSimpleInput, operator *usecase.Operator) (_ *nlslayer.NLSLayerSimple, _ *nlslayer.NLSLayerGroup, err error) { + tx, err := i.transaction.Begin(ctx) + if err != nil { + return + } + + ctx = tx.Context() + defer func() { + if err2 := tx.End(ctx); err == nil && err2 != nil { + err = err2 + } + }() + + parentLayer, err := i.nlslayerRepo.FindNLSLayerGroupByID(ctx, inp.ParentLayerID) + if err != nil { + return nil, nil, err + } + + // check scene lock + if err := i.CheckSceneLock(ctx, parentLayer.Scene()); err != nil { + return nil, nil, err + } + + layerSimple, err := nlslayerops.LayerSimple{ + SceneID: parentLayer.Scene(), + Config: inp.Config, + LayerType: inp.LayerType, + Index: inp.Index, + }.Initialize() + if err != nil { + return nil, nil, err + } + + err = i.nlslayerRepo.Save(ctx, layerSimple) + if err != nil { + return nil, nil, err + } + err = i.nlslayerRepo.Save(ctx, parentLayer) + if err != nil { + return nil, nil, err + } + + tx.Commit() + return layerSimple, parentLayer, nil +} + +func (i *NLSLayer) fetchAllChildren(ctx context.Context, l nlslayer.NLSLayer) ([]id.NLSLayerID, error) { + lidl := nlslayer.ToNLSLayerGroup(l).Children().Layers() + layers, err := i.nlslayerRepo.FindByIDs(ctx, lidl) + if err != nil { + return nil, err + } + for _, ll := range layers { + lg := nlslayer.ToNLSLayerGroup(*ll) + if lg != nil { + childrenLayers, err := i.fetchAllChildren(ctx, lg) + if err != nil { + return nil, err + } + lidl = append(lidl, childrenLayers...) + + } + } + return lidl, nil +} + +func (i *NLSLayer) Remove(ctx context.Context, lid id.NLSLayerID, operator *usecase.Operator) (_ id.NLSLayerID, _ *nlslayer.NLSLayerGroup, err error) { + tx, err := i.transaction.Begin(ctx) + if err != nil { + return + } + + ctx = tx.Context() + defer func() { + if err2 := tx.End(ctx); err == nil && err2 != nil { + err = err2 + } + }() + + l, err := i.nlslayerRepo.FindByID(ctx, lid) + if err != nil { + return lid, nil, err + } + if err := i.CanWriteScene(l.Scene(), operator); err != nil { + return lid, nil, err + } + + if err := i.CheckSceneLock(ctx, l.Scene()); err != nil { + return lid, nil, err + } + + parentLayer, err := i.nlslayerRepo.FindParentByID(ctx, lid) + if err != nil && err != rerror.ErrNotFound { + return lid, nil, err + } + if parentLayer != nil { + if l.Scene() != parentLayer.Scene() { + return lid, nil, errors.New("invalid layer") + } + } + + if parentLayer != nil { + return lid, nil, interfaces.ErrCannotRemoveLayerToLinkedLayerGroup + } + if parentLayer != nil { + parentLayer.Children().RemoveLayer(lid) + err = i.nlslayerRepo.Save(ctx, parentLayer) + if err != nil { + return lid, nil, err + } + } + layers, err := i.fetchAllChildren(ctx, l) + if err != nil { + return lid, nil, err + } + layers = append(layers, l.ID()) + err = i.nlslayerRepo.RemoveAll(ctx, layers) + if err != nil { + return lid, nil, err + } + + tx.Commit() + return lid, parentLayer, nil +} + +func (i *NLSLayer) Update(ctx context.Context, inp interfaces.UpdateNLSLayerInput, operator *usecase.Operator) (_ nlslayer.NLSLayer, err error) { + tx, err := i.transaction.Begin(ctx) + if err != nil { + return + } + + ctx = tx.Context() + defer func() { + if err2 := tx.End(ctx); err == nil && err2 != nil { + err = err2 + } + }() + + layer, err := i.nlslayerRepo.FindByID(ctx, inp.LayerID) + if err != nil { + return nil, err + } + if err := i.CanWriteScene(layer.Scene(), operator); err != nil { + return nil, err + } + + // check scene lock + if err := i.CheckSceneLock(ctx, layer.Scene()); err != nil { + return nil, err + } + + if inp.Name != nil { + layer.Rename(*inp.Name) + } + + if inp.Visible != nil { + layer.SetVisible(*inp.Visible) + } + + err = i.nlslayerRepo.Save(ctx, layer) + if err != nil { + return nil, err + } + + tx.Commit() + return layer, nil +} diff --git a/server/internal/usecase/interfaces/common.go b/server/internal/usecase/interfaces/common.go index 723bab7255..018f3c2081 100644 --- a/server/internal/usecase/interfaces/common.go +++ b/server/internal/usecase/interfaces/common.go @@ -24,6 +24,7 @@ type Container struct { Asset Asset Dataset Dataset Layer Layer + NLSLayer NLSLayer Plugin Plugin Project Project Property Property diff --git a/server/internal/usecase/interfaces/nlslayer.go b/server/internal/usecase/interfaces/nlslayer.go new file mode 100644 index 0000000000..cdf998e6e1 --- /dev/null +++ b/server/internal/usecase/interfaces/nlslayer.go @@ -0,0 +1,32 @@ +package interfaces + +import ( + "context" + + "github.com/reearth/reearth/server/internal/usecase" + "github.com/reearth/reearth/server/pkg/id" + "github.com/reearth/reearth/server/pkg/nlslayer" +) + +type AddNLSLayerSimpleInput struct { + ParentLayerID id.NLSLayerID + Index *int + LayerType nlslayer.LayerType + Config *nlslayer.Config +} + +type UpdateNLSLayerInput struct { + LayerID id.NLSLayerID + Name *string + Visible *bool +} + +type NLSLayer interface { + Fetch(context.Context, id.NLSLayerIDList, *usecase.Operator) (nlslayer.NLSLayerList, error) + FetchByScene(context.Context, id.SceneID, *usecase.Operator) (nlslayer.NLSLayerList, error) + FetchLayerSimple(context.Context, id.NLSLayerIDList, *usecase.Operator) (nlslayer.NLSLayerSimpleList, error) + FetchParent(context.Context, id.NLSLayerID, *usecase.Operator) (*nlslayer.NLSLayerGroup, error) + AddLayerSimple(context.Context, AddNLSLayerSimpleInput, *usecase.Operator) (*nlslayer.NLSLayerSimple, *nlslayer.NLSLayerGroup, error) + Remove(context.Context, id.NLSLayerID, *usecase.Operator) (id.NLSLayerID, *nlslayer.NLSLayerGroup, error) + Update(context.Context, UpdateNLSLayerInput, *usecase.Operator) (nlslayer.NLSLayer, error) +} diff --git a/server/internal/usecase/repo/container.go b/server/internal/usecase/repo/container.go index e042aea7b3..8775dc533f 100644 --- a/server/internal/usecase/repo/container.go +++ b/server/internal/usecase/repo/container.go @@ -23,6 +23,7 @@ type Container struct { DatasetSchema DatasetSchema Dataset Dataset Layer Layer + NLSLayer NLSLayer Lock Lock Plugin Plugin Project Project @@ -59,6 +60,7 @@ func (c *Container) Filtered(workspace WorkspaceFilter, scene SceneFilter) *Cont DatasetSchema: c.DatasetSchema.Filtered(scene), Dataset: c.Dataset.Filtered(scene), Layer: c.Layer.Filtered(scene), + NLSLayer: c.NLSLayer.Filtered(scene), Lock: c.Lock, Plugin: c.Plugin.Filtered(scene), Policy: c.Policy, diff --git a/server/internal/usecase/repo/nlslayer.go b/server/internal/usecase/repo/nlslayer.go new file mode 100644 index 0000000000..5fca222601 --- /dev/null +++ b/server/internal/usecase/repo/nlslayer.go @@ -0,0 +1,38 @@ +package repo + +import ( + "context" + + "github.com/reearth/reearth/server/pkg/id" + "github.com/reearth/reearth/server/pkg/nlslayer" +) + +type NLSLayer interface { + Filtered(SceneFilter) NLSLayer + FindByID(context.Context, id.NLSLayerID) (nlslayer.NLSLayer, error) + FindByIDs(context.Context, id.NLSLayerIDList) (nlslayer.NLSLayerList, error) + FindNLSLayerSimpleByID(context.Context, id.NLSLayerID) (*nlslayer.NLSLayerSimple, error) + FindNLSLayerSimpleByIDs(context.Context, id.NLSLayerIDList) (nlslayer.NLSLayerSimpleList, error) + FindNLSLayerGroupByID(context.Context, id.NLSLayerID) (*nlslayer.NLSLayerGroup, error) + FindNLSLayerGroupByIDs(context.Context, id.NLSLayerIDList) (nlslayer.NLSLayerGroupList, error) + FindParentByID(context.Context, id.NLSLayerID) (*nlslayer.NLSLayerGroup, error) + FindParentsByIDs(context.Context, id.NLSLayerIDList) (nlslayer.NLSLayerGroupList, error) + FindByScene(context.Context, id.SceneID) (nlslayer.NLSLayerList, error) + Save(context.Context, nlslayer.NLSLayer) error + SaveAll(context.Context, nlslayer.NLSLayerList) error + Remove(context.Context, id.NLSLayerID) error + RemoveAll(context.Context, id.NLSLayerIDList) error + RemoveByScene(context.Context, id.SceneID) error +} + +func NLSLayerLoaderFrom(r NLSLayer) nlslayer.Loader { + return func(ctx context.Context, ids ...id.NLSLayerID) (nlslayer.NLSLayerList, error) { + return r.FindByIDs(ctx, ids) + } +} + +func NLSLayerLoaderBySceneFrom(r NLSLayer) nlslayer.LoaderByScene { + return func(ctx context.Context, s id.SceneID) (nlslayer.NLSLayerList, error) { + return r.FindByScene(ctx, s) + } +} diff --git a/server/pkg/id/id.go b/server/pkg/id/id.go index d9a04e01ab..f550cc707b 100644 --- a/server/pkg/id/id.go +++ b/server/pkg/id/id.go @@ -10,6 +10,7 @@ type DatasetSchema struct{} type Cluster struct{} type InfoboxField struct{} type Layer struct{} +type NLSLayer struct{} type PluginExtension struct{} type Project struct{} type Property struct{} @@ -31,6 +32,7 @@ func (DatasetSchema) Type() string { return "datasetSchema" } func (Cluster) Type() string { return "cluster" } func (InfoboxField) Type() string { return "infoboxField" } func (Layer) Type() string { return "layer" } +func (NLSLayer) Type() string { return "nlsLayer" } func (PluginExtension) Type() string { return "pluginExtension" } func (Project) Type() string { return "project" } func (Property) Type() string { return "property" } @@ -52,6 +54,7 @@ type DatasetSchemaID = idx.ID[DatasetSchema] type ClusterID = idx.ID[Cluster] type InfoboxFieldID = idx.ID[InfoboxField] type LayerID = idx.ID[Layer] +type NLSLayerID = idx.ID[NLSLayer] type ProjectID = idx.ID[Project] type PropertyID = idx.ID[Property] type PropertyItemID = idx.ID[PropertyItem] @@ -74,6 +77,7 @@ var NewDatasetSchemaID = idx.New[DatasetSchema] var NewClusterID = idx.New[Cluster] var NewInfoboxFieldID = idx.New[InfoboxField] var NewLayerID = idx.New[Layer] +var NewNLSLayerID = idx.New[NLSLayer] var NewProjectID = idx.New[Project] var NewPropertyID = idx.New[Property] var NewPropertyItemID = idx.New[PropertyItem] @@ -90,6 +94,7 @@ var MustDatasetSchemaID = idx.Must[DatasetSchema] var MustClusterID = idx.Must[Cluster] var MustInfoboxFieldID = idx.Must[InfoboxField] var MustLayerID = idx.Must[Layer] +var MustNLSLayerID = idx.Must[NLSLayer] var MustProjectID = idx.Must[Project] var MustPropertyID = idx.Must[Property] var MustPropertyItemID = idx.Must[PropertyItem] @@ -108,6 +113,7 @@ var DatasetSchemaIDFrom = idx.From[DatasetSchema] var ClusterIDFrom = idx.From[Cluster] var InfoboxFieldIDFrom = idx.From[InfoboxField] var LayerIDFrom = idx.From[Layer] +var NLSLayerIDFrom = idx.From[NLSLayer] var ProjectIDFrom = idx.From[Project] var PropertyIDFrom = idx.From[Property] var PropertyItemIDFrom = idx.From[PropertyItem] @@ -126,6 +132,7 @@ var DatasetSchemaIDFromRef = idx.FromRef[DatasetSchema] var ClusterIDFromRef = idx.FromRef[Cluster] var InfoboxFieldIDFromRef = idx.FromRef[InfoboxField] var LayerIDFromRef = idx.FromRef[Layer] +var NLSLayerIDFromRef = idx.FromRef[NLSLayer] var ProjectIDFromRef = idx.FromRef[Project] var PropertyIDFromRef = idx.FromRef[Property] var PropertyItemIDFromRef = idx.FromRef[PropertyItem] @@ -148,6 +155,7 @@ type DatasetSchemaIDList = idx.List[DatasetSchema] type ClusterIDList = idx.List[Cluster] type InfoboxFieldIDList = idx.List[InfoboxField] type LayerIDList = idx.List[Layer] +type NLSLayerIDList = idx.List[NLSLayer] type ProjectIDList = idx.List[Project] type PropertyIDList = idx.List[Property] type PropertyItemIDList = idx.List[PropertyItem] @@ -166,6 +174,7 @@ var DatasetSchemaIDListFrom = idx.ListFrom[DatasetSchema] var ClusterIDListFrom = idx.ListFrom[Cluster] var InfoboxFieldIDListFrom = idx.ListFrom[InfoboxField] var LayerIDListFrom = idx.ListFrom[Layer] +var NLSLayerIDListFrom = idx.ListFrom[NLSLayer] var ProjectIDListFrom = idx.ListFrom[Project] var PropertyIDListFrom = idx.ListFrom[Property] var PropertyItemIDListFrom = idx.ListFrom[PropertyItem] @@ -184,6 +193,7 @@ type DatasetSchemaIDSet = idx.Set[DatasetSchema] type ClusterIDSet = idx.Set[Cluster] type InfoboxFieldIDSet = idx.Set[InfoboxField] type LayerIDSet = idx.Set[Layer] +type NLSLayerIDSet = idx.Set[NLSLayer] type ProjectIDSet = idx.Set[Project] type PropertyIDSet = idx.Set[Property] type PropertyItemIDSet = idx.Set[PropertyItem] @@ -202,6 +212,7 @@ var NewDatasetSchemaIDSet = idx.NewSet[DatasetSchema] var NewClusterIDSet = idx.NewSet[Cluster] var NewInfoboxFieldIDSet = idx.NewSet[InfoboxField] var NewLayerIDSet = idx.NewSet[Layer] +var NewNLSLayerIDSet = idx.NewSet[NLSLayer] var NewProjectIDSet = idx.NewSet[Project] var NewPropertyIDSet = idx.NewSet[Property] var NewPropertyItemIDSet = idx.NewSet[PropertyItem] diff --git a/server/pkg/layer/infobox.go b/server/pkg/layer/infobox.go index d14c0b4dd9..40d6a382a3 100644 --- a/server/pkg/layer/infobox.go +++ b/server/pkg/layer/infobox.go @@ -189,3 +189,27 @@ func (i *Infobox) ValidateProperties(pm property.Map) error { return nil } + +func (i *Infobox) Clone() *Infobox { + if i == nil { + return nil + } + + clonedFields := make([]*InfoboxField, len(i.fields)) + for idx, field := range i.fields { + if field != nil { + clonedFields[idx] = field.Clone() + } + } + + clonedIDs := make(map[InfoboxFieldID]struct{}) + for id, val := range i.ids { + clonedIDs[id] = val + } + + return &Infobox{ + property: i.property, + fields: clonedFields, + ids: clonedIDs, + } +} diff --git a/server/pkg/layer/infobox_field.go b/server/pkg/layer/infobox_field.go index 5e695d3eaa..6c4e3c0cda 100644 --- a/server/pkg/layer/infobox_field.go +++ b/server/pkg/layer/infobox_field.go @@ -59,3 +59,16 @@ func (i *InfoboxField) UpgradePlugin(id plugin.ID) { } i.plugin = id } + +func (i *InfoboxField) Clone() *InfoboxField { + if i == nil { + return nil + } + + return &InfoboxField{ + id: i.id, + plugin: i.plugin, + extension: i.extension, + property: i.property, + } +} diff --git a/server/pkg/nlslayer/builder.go b/server/pkg/nlslayer/builder.go new file mode 100644 index 0000000000..fc470c5d59 --- /dev/null +++ b/server/pkg/nlslayer/builder.go @@ -0,0 +1,37 @@ +package nlslayer + +type Builder struct { + base layerBase +} + +func New() *Builder { + return &Builder{base: layerBase{}} +} + +func (b *Builder) Group() *NLSLayerGroupBuilder { + return NewNLSLayerGroup().base(b.base) +} + +func (b *Builder) Simple() *NLSLayerSimpleBuilder { + return NewNLSLayerSimple().base(b.base) +} + +func (b *Builder) ID(id ID) *Builder { + b.base.id = id + return b +} + +func (b *Builder) NewID() *Builder { + b.base.id = NewID() + return b +} + +func (b *Builder) Scene(s SceneID) *Builder { + b.base.scene = s + return b +} + +func (b *Builder) LayerType(t LayerType) *Builder { + b.base.layerType = t + return b +} diff --git a/server/pkg/nlslayer/cloner.go b/server/pkg/nlslayer/cloner.go new file mode 100644 index 0000000000..c9651d82f6 --- /dev/null +++ b/server/pkg/nlslayer/cloner.go @@ -0,0 +1,5 @@ +package nlslayer + +type Cloner interface { + Clone() Cloner +} diff --git a/server/pkg/nlslayer/config.go b/server/pkg/nlslayer/config.go new file mode 100644 index 0000000000..65a927ee29 --- /dev/null +++ b/server/pkg/nlslayer/config.go @@ -0,0 +1,11 @@ +package nlslayer + +type Config map[string]any + +func (c Config) Clone() Config { + cloned := make(Config) + for key, value := range c { + cloned[key] = value + } + return cloned +} diff --git a/server/pkg/nlslayer/group.go b/server/pkg/nlslayer/group.go new file mode 100644 index 0000000000..2a0142e90a --- /dev/null +++ b/server/pkg/nlslayer/group.go @@ -0,0 +1,138 @@ +package nlslayer + +import ( + pl "github.com/reearth/reearth/server/pkg/layer" +) + +type NLSLayerGroup struct { + layerBase + children *IDList + config *Config + root bool +} + +func (l *NLSLayerGroup) ID() ID { + return l.layerBase.ID() +} + +func (l *NLSLayerGroup) IDRef() *ID { + if l == nil { + return nil + } + return l.layerBase.IDRef() +} + +func (l *NLSLayerGroup) LayerType() LayerType { + return l.layerBase.LayerType() +} + +func (l *NLSLayerGroup) Scene() SceneID { + return l.layerBase.scene +} + +func (l *NLSLayerGroup) Title() string { + return l.layerBase.Title() +} + +func (l *NLSLayerGroup) IsVisible() bool { + if l == nil { + return false + } + return l.layerBase.visible +} + +func (l *NLSLayerGroup) HasInfobox() bool { + if l == nil { + return false + } + return l.layerBase.infobox != nil +} + +func (l *NLSLayerGroup) Infobox() *pl.Infobox { + if l == nil { + return nil + } + return l.layerBase.infobox +} + +func (l *NLSLayerGroup) Tags() *pl.TagList { + if l == nil { + return nil + } + if l.layerBase.tags == nil { + l.layerBase.tags = pl.NewTagList(nil) + } + return l.layerBase.tags +} + +func (l *NLSLayerGroup) SetVisible(visible bool) { + if l == nil { + return + } + l.layerBase.visible = visible +} + +func (l *NLSLayerGroup) SetInfobox(infobox *pl.Infobox) { + if l == nil { + return + } + l.layerBase.infobox = infobox +} + +func (l *NLSLayerGroup) Children() *IDList { + if l == nil { + return nil + } + if l.children == nil { + l.children = NewIDList(nil) + } + return l.children +} + +func (l *NLSLayerGroup) LayerRef() *NLSLayer { + if l == nil { + return nil + } + var layer NLSLayer = l + return &layer +} + +func (l *NLSLayerGroup) Config() *Config { + if l == nil { + return &Config{} + } + return l.config +} + +func (l *NLSLayerGroup) IsRoot() bool { + if l == nil { + return false + } + return l.root +} + +func (l *NLSLayerGroup) Clone() Cloner { + if l == nil { + return nil + } + + clonedBase := l.layerBase.Clone() + + var clonedChildren *IDList + if l.children != nil { + clonedChildren = l.children.Clone() + } + + var clonedConfig *Config + if l.config != nil { + clonedConfigItem := l.config.Clone() + clonedConfig = &clonedConfigItem + } + + return &NLSLayerGroup{ + layerBase: *clonedBase, + children: clonedChildren, + config: clonedConfig, + root: l.root, + } +} diff --git a/server/pkg/nlslayer/group_builder.go b/server/pkg/nlslayer/group_builder.go new file mode 100644 index 0000000000..2861cf76f1 --- /dev/null +++ b/server/pkg/nlslayer/group_builder.go @@ -0,0 +1,107 @@ +package nlslayer + +import ( + pl "github.com/reearth/reearth/server/pkg/layer" +) + +func NLSLayerGroupFromLayer(l NLSLayer) *NLSLayerGroup { + li, ok := l.(*NLSLayerGroup) + if !ok { + return nil + } + return li +} + +func NLSLayerGroupFromLayerRef(l *NLSLayer) *NLSLayerGroup { + if l == nil { + return nil + } + li, ok := (*l).(*NLSLayerGroup) + if !ok { + return nil + } + return li +} + +type NLSLayerGroupBuilder struct { + l *NLSLayerGroup +} + +func NewNLSLayerGroup() *NLSLayerGroupBuilder { + return &NLSLayerGroupBuilder{l: &NLSLayerGroup{layerBase: layerBase{}}} +} + +func (b *NLSLayerGroupBuilder) Build() (*NLSLayerGroup, error) { + if b.l.id.IsNil() { + return nil, ErrInvalidID + } + return b.l, nil +} + +func (b *NLSLayerGroupBuilder) MustBuild() *NLSLayerGroup { + group, err := b.Build() + if err != nil { + panic(err) + } + return group +} + +func (b *NLSLayerGroupBuilder) base(layer layerBase) *NLSLayerGroupBuilder { + b.l.layerBase = layer + return b +} + +func (b *NLSLayerGroupBuilder) ID(id ID) *NLSLayerGroupBuilder { + b.l.id = id + return b +} + +func (b *NLSLayerGroupBuilder) NewID() *NLSLayerGroupBuilder { + b.l.id = NewID() + return b +} + +func (b *NLSLayerGroupBuilder) LayerType(t LayerType) *NLSLayerGroupBuilder { + b.l.layerType = t + return b +} + +func (b *NLSLayerGroupBuilder) Scene(s SceneID) *NLSLayerGroupBuilder { + b.l.scene = s + return b +} + +func (b *NLSLayerGroupBuilder) Layers(ll *IDList) *NLSLayerGroupBuilder { + b.l.children = ll + return b +} + +func (b *NLSLayerGroupBuilder) Config(c *Config) *NLSLayerGroupBuilder { + b.l.config = c + return b +} + +func (b *NLSLayerGroupBuilder) Title(t string) *NLSLayerGroupBuilder { + b.l.title = t + return b +} + +func (b *NLSLayerGroupBuilder) Root(r bool) *NLSLayerGroupBuilder { + b.l.root = r + return b +} + +func (b *NLSLayerGroupBuilder) IsVisible(i bool) *NLSLayerGroupBuilder { + b.l.visible = i + return b +} + +func (b *NLSLayerGroupBuilder) Infobox(infobox *pl.Infobox) *NLSLayerGroupBuilder { + b.l.infobox = infobox + return b +} + +func (b *NLSLayerGroupBuilder) Tags(tags *pl.TagList) *NLSLayerGroupBuilder { + b.l.tags = tags + return b +} diff --git a/server/pkg/nlslayer/id.go b/server/pkg/nlslayer/id.go new file mode 100644 index 0000000000..1a4a957084 --- /dev/null +++ b/server/pkg/nlslayer/id.go @@ -0,0 +1,21 @@ +package nlslayer + +import ( + "sort" + + "github.com/reearth/reearth/server/pkg/id" +) + +type ID = id.NLSLayerID +type SceneID = id.SceneID +type LayerID = id.LayerID + +var NewID = id.NewNLSLayerID + +var ErrInvalidID = id.ErrInvalidID + +func sortIDs(a []ID) { + sort.SliceStable(a, func(i, j int) bool { + return a[i].Compare(a[j]) < 0 + }) +} diff --git a/server/pkg/nlslayer/id_list.go b/server/pkg/nlslayer/id_list.go new file mode 100644 index 0000000000..c695738572 --- /dev/null +++ b/server/pkg/nlslayer/id_list.go @@ -0,0 +1,223 @@ +// moved from github.com/reearth/reearth/server/pkg/layer +package nlslayer + +import "github.com/reearth/reearth/server/pkg/id" + +type IDList struct { + layers id.NLSLayerIDList + // for checking duplication + layerIDs map[ID]struct{} +} + +func NewIDList(layers []ID) *IDList { + ll := IDList{} + if len(layers) == 0 { + return &ll + } + + ll.layers = append([]ID{}, layers...) + ll.layerIDs = make(map[ID]struct{}, len(layers)) + for _, l := range layers { + ll.layerIDs[l] = struct{}{} + } + return &ll +} + +func (l *IDList) Layers() []ID { + if l == nil { + return nil + } + result := append([]ID{}, l.layers...) + return result +} + +func (l *IDList) HasLayer(id ID) bool { + if l == nil || len(l.layerIDs) == 0 { + return false + } + _, ok := l.layerIDs[id] + return ok +} + +func (l *IDList) LayerAt(index int) ID { + if l == nil || index < 0 || len(l.layers) <= index { + return ID{} + } + return l.layers[index] +} + +func (l *IDList) AtRef(index int) *ID { + if l == nil || index < 0 || len(l.layers) <= index { + return nil + } + return &l.layers[index] +} + +func (l *IDList) FindLayerIndex(id ID) int { + if l == nil { + return -1 + } + for i, l := range l.layers { + if l == id { + return i + } + } + return -1 +} + +func (l *IDList) LayerCount() int { + if l == nil { + return 0 + } + return len(l.layers) +} + +func (l *IDList) AddLayer(lid ID, index int) { + if l == nil || l.HasLayer(lid) { + return + } + if l.layerIDs == nil { + l.layerIDs = make(map[ID]struct{}) + } + + l.layerIDs[lid] = struct{}{} + + le := len(l.layers) + if index < 0 || le <= index { + l.layers = append(l.layers, lid) + } else { + l.layers = append(l.layers[:index], append([]ID{lid}, l.layers[index:]...)...) + } +} + +func (l *IDList) AppendLayers(lid ...ID) *IDList { + if l == nil { + return NewIDList(lid) + } + for _, i := range lid { + l.AddLayer(i, -1) + } + return l +} + +func (l *IDList) Merge(l2 *IDList) { + l.AppendLayers(l2.layers...) +} + +func (l *IDList) Clone() (l2 *IDList) { + if l == nil { + return l2 + } + return NewIDList(l.layers) +} + +func (l *IDList) AddOrMoveLayer(lid ID, index int) { + if l == nil { + return + } + + le := len(l.layers) + if index < 0 || le <= index { + index = le + } + + if l.HasLayer(lid) { + l.MoveLayer(lid, index) + return + } + l.layers = append(l.layers[:index], append([]ID{lid}, l.layers[index:]...)...) + l.layerIDs[lid] = struct{}{} +} + +func (l *IDList) MoveLayer(id ID, toIndex int) { + if l == nil { + return + } + + for fromIndex, layer := range l.layers { + if layer == id { + l.MoveLayerAt(fromIndex, toIndex) + return + } + } +} + +func (l *IDList) MoveLayerAt(fromIndex int, toIndex int) { + if l == nil || len(l.layers) == 0 { + return + } + + le := len(l.layers) + if fromIndex < 0 || le <= fromIndex { + return + } + if toIndex < 0 || le <= toIndex { + toIndex = le - 1 + } + if fromIndex == toIndex { + return + } + + f := l.layers[fromIndex] + l.layers = append(l.layers[:fromIndex], l.layers[fromIndex+1:]...) + newSlice := make([]ID, toIndex+1) + copy(newSlice, l.layers[:toIndex]) + newSlice[toIndex] = f + l.layers = append(newSlice, l.layers[toIndex:]...) +} + +func (l *IDList) RemoveLayer(ids ...ID) int { + if l == nil { + return 0 + } + removed := 0 + for i := 0; i < len(l.layers); i++ { + layer := l.layers[i] + for _, id := range ids { + if layer == id { + l.RemoveLayerAt(i) + removed++ + i-- + break + } + } + } + return removed +} + +func (l *IDList) RemoveLayerAt(index int) { + if l == nil || len(l.layers) == 0 { + return + } + + le := len(l.layers) + if index < 0 || le <= index { + return + } + + layer := l.layers[index] + var layers []ID + if index == le { + layers = []ID{} + } else { + layers = l.layers[index+1:] + } + l.layers = append(l.layers[:index], layers...) + delete(l.layerIDs, layer) +} + +func (l *IDList) Empty() { + if l == nil { + return + } + + l.layers = nil + l.layerIDs = nil +} + +func (l *IDList) Strings() []string { + if l == nil { + return nil + } + return l.layers.Strings() +} diff --git a/server/pkg/nlslayer/layer_type.go b/server/pkg/nlslayer/layer_type.go new file mode 100644 index 0000000000..8dd80c0044 --- /dev/null +++ b/server/pkg/nlslayer/layer_type.go @@ -0,0 +1,30 @@ +package nlslayer + +import ( + "github.com/pkg/errors" +) + +type LayerType string + +const ( + Simple = "simple" + Group = "group" +) + +func NewLayerType(value string) (LayerType, error) { + switch value { + case Simple, Group: + return LayerType(value), nil + default: + return "", errors.New("value must be 'simple' or 'b'") + } +} + +func (d *LayerType) IsValidLayerType() bool { + switch *d { + case Simple, Group: + return true + default: + return false + } +} diff --git a/server/pkg/nlslayer/loader.go b/server/pkg/nlslayer/loader.go new file mode 100644 index 0000000000..10b5097bf2 --- /dev/null +++ b/server/pkg/nlslayer/loader.go @@ -0,0 +1,83 @@ +package nlslayer + +import ( + "context" + "errors" + + "github.com/samber/lo" +) + +type Loader func(context.Context, ...ID) (NLSLayerList, error) +type LoaderByScene func(context.Context, SceneID) (NLSLayerList, error) + +var WalkerSkipChildren = errors.New("LAYER_WALKER_SKIP_CHILDREN") + +func LoaderFrom(data []NLSLayer) Loader { + return func(ctx context.Context, ids ...ID) (NLSLayerList, error) { + res := make([]*NLSLayer, 0, len(ids)) + for _, i := range ids { + found := false + for _, d := range data { + if i == d.ID() { + res = append(res, &d) + found = true + break + } + } + if !found { + res = append(res, nil) + } + } + return res, nil + } +} + +func LoaderFromMap(data map[ID]NLSLayer) Loader { + return func(ctx context.Context, ids ...ID) (NLSLayerList, error) { + res := make([]*NLSLayer, 0, len(ids)) + for _, i := range ids { + if d, ok := data[i]; ok { + res = append(res, &d) + } else { + res = append(res, nil) + } + } + return res, nil + } +} + +func (l Loader) Walk(ctx context.Context, walker func(NLSLayer, NLSLayerGroupList) error, init []ID) error { + var walk func(ids []ID, parents NLSLayerGroupList) error + walk = func(ids []ID, parents NLSLayerGroupList) error { + loaded, err := l(ctx, ids...) + if err != nil { + return err + } + for _, l := range loaded.Deref() { + if l == nil { + continue + } + if err := walker(l, parents); err == WalkerSkipChildren { + continue + } else if err != nil { + return err + } + if lg := ToNLSLayerGroup(l); lg != nil && lg.Children().LayerCount() > 0 { + if err := walk(lg.Children().Layers(), append(parents, lg)); err != nil { + return err + } + } + } + return nil + } + return walk(init, nil) +} + +func LoaderBySceneFrom(data ...NLSLayer) LoaderByScene { + return func(ctx context.Context, id SceneID) (NLSLayerList, error) { + res := lo.Filter(data, func(l NLSLayer, _ int) bool { + return l.Scene() == id + }) + return ListFrom(res), nil + } +} diff --git a/server/pkg/nlslayer/nlslayer.go b/server/pkg/nlslayer/nlslayer.go new file mode 100644 index 0000000000..864651c8d3 --- /dev/null +++ b/server/pkg/nlslayer/nlslayer.go @@ -0,0 +1,161 @@ +package nlslayer + +import ( + pl "github.com/reearth/reearth/server/pkg/layer" +) + +type NLSLayer interface { + Cloner + ID() ID + LayerType() LayerType + Scene() SceneID + Title() string + IsVisible() bool + SetVisible(bool) + HasInfobox() bool + Infobox() *pl.Infobox + SetInfobox(*pl.Infobox) + Tags() *pl.TagList + Rename(string) +} + +func ToNLSLayerGroup(l NLSLayer) *NLSLayerGroup { + if lg, ok := l.(*NLSLayerGroup); ok { + return lg + } + return nil +} + +func ToNLSLayerGroupRef(l *NLSLayer) *NLSLayerGroup { + if l == nil { + return nil + } + l2 := *l + if lg, ok := l2.(*NLSLayerGroup); ok { + return lg + } + return nil +} + +func ToNLSLayerSimple(l NLSLayer) *NLSLayerSimple { + if li, ok := l.(*NLSLayerSimple); ok { + return li + } + return nil +} + +func ToLayerSimpleRef(l *NLSLayer) *NLSLayerSimple { + if l == nil { + return nil + } + l2 := *l + if li, ok := l2.(*NLSLayerSimple); ok { + return li + } + return nil +} + +type layerBase struct { + id ID + layerType LayerType + scene SceneID + title string + visible bool + infobox *pl.Infobox + tags *pl.TagList +} + +func (l *layerBase) ID() ID { + return l.id +} + +func (l *layerBase) IDRef() *ID { + if l == nil { + return nil + } + return l.id.Ref() +} + +func (l *layerBase) LayerType() LayerType { + if l == nil { + return "" + } + return l.layerType +} + +func (l *layerBase) Scene() SceneID { + return l.scene +} + +func (l *layerBase) Title() string { + if l == nil { + return "" + } + return l.title +} + +func (l *layerBase) IsVisible() bool { + if l == nil { + return false + } + return l.visible +} + +func (l *layerBase) HasInfobox() bool { + if l == nil { + return false + } + return l.infobox != nil +} + +func (l *layerBase) Infobox() *pl.Infobox { + if l == nil { + return nil + } + return l.infobox +} + +func (l *layerBase) SetVisible(visible bool) { + if l == nil { + return + } + l.visible = visible +} + +func (l *layerBase) SetInfobox(infobox *pl.Infobox) { + if l == nil { + return + } + l.infobox = infobox +} + +func (l *layerBase) Rename(name string) { + if l == nil { + return + } + l.title = name +} + +func (l *layerBase) Clone() *layerBase { + if l == nil { + return nil + } + + cloned := &layerBase{ + id: l.id, + layerType: l.layerType, + scene: l.scene, + title: l.title, + visible: l.visible, + } + + if l.infobox != nil { + cloned.infobox = l.infobox.Clone() + } + + if l.tags != nil { + cloned.tags = l.tags.Clone() + } + + return cloned +} diff --git a/server/pkg/nlslayer/nlslayer_list.go b/server/pkg/nlslayer/nlslayer_list.go new file mode 100644 index 0000000000..11c96631f3 --- /dev/null +++ b/server/pkg/nlslayer/nlslayer_list.go @@ -0,0 +1,297 @@ +package nlslayer + +import "github.com/samber/lo" + +type NLSLayerList []*NLSLayer + +func ListFrom(l []NLSLayer) []*NLSLayer { + return lo.ToSlicePtr(l) +} + +func (ll NLSLayerList) Last() *NLSLayer { + if len(ll) == 0 { + return nil + } + return ll[len(ll)-1] +} + +func (ll NLSLayerList) IDs() *IDList { + if len(ll) == 0 { + return nil + } + ids := make([]ID, 0, len(ll)) + for _, l := range ll.Deref() { + ids = append(ids, l.ID()) + } + return NewIDList(ids) +} + +func (ll NLSLayerList) Pick(il *IDList) NLSLayerList { + if il == nil { + return nil + } + + layers := make(NLSLayerList, 0, il.LayerCount()) + for _, lid := range il.Layers() { + if l := ll.Find(lid); l != nil { + layers = append(layers, l) + } + } + return layers +} + +func (ll NLSLayerList) Find(lid ID) *NLSLayer { + for _, l := range ll { + if l == nil { + continue + } + if (*l).ID() == lid { + return l + } + } + return nil +} + +func (ll NLSLayerList) ToLayerItemList() NLSLayerSimpleList { + res := make(NLSLayerSimpleList, 0, len(ll)) + for _, l := range ll { + if li := NLSLayerSimpleFromLayerRef(l); li != nil { + res = append(res, li) + } + } + return res +} + +func (ll NLSLayerList) ToNLSLayerGroupList() NLSLayerGroupList { + res := make(NLSLayerGroupList, 0, len(ll)) + for _, l := range ll { + if lg := NLSLayerGroupFromLayerRef(l); lg != nil { + res = append(res, lg) + } + } + return res +} + +func (ll NLSLayerList) SeparateLayerItemAndGroup() (NLSLayerSimpleList, NLSLayerGroupList) { + resi := make(NLSLayerSimpleList, 0, len(ll)) + resg := make(NLSLayerGroupList, 0, len(ll)) + for _, l := range ll { + if lg := NLSLayerGroupFromLayerRef(l); lg != nil { + resg = append(resg, lg) + } else if li := NLSLayerSimpleFromLayerRef(l); li != nil { + resi = append(resi, li) + } + } + return resi, resg +} + +func (ll NLSLayerList) Deref() []NLSLayer { + if ll == nil { + return nil + } + res := make([]NLSLayer, 0, len(ll)) + for _, l := range ll { + if l != nil { + res = append(res, *l) + } else { + res = append(res, nil) + } + } + return res +} + +func (ll NLSLayerList) Loader() Loader { + return LoaderFrom(ll.Deref()) +} + +func (ll NLSLayerList) Map() Map { + m := make(Map, len(ll)) + m.Add(ll...) + return m +} + +func (ll NLSLayerList) Remove(lids ...ID) NLSLayerList { + if ll == nil { + return nil + } + + res := make(NLSLayerList, 0, len(ll)) + + for _, l := range ll { + if l == nil { + continue + } + hit := false + for _, lid := range lids { + if (*l).ID() == lid { + hit = true + break + } + } + if !hit { + res = append(res, l) + } + } + + return res +} + +func (ll NLSLayerList) AddUnique(newList ...*NLSLayer) NLSLayerList { + res := append(NLSLayerList{}, ll...) + + for _, l := range newList { + if l == nil { + continue + } + if res.Find((*l).ID()) != nil { + continue + } + res = append(res, l) + } + + return res +} + +type NLSLayerSimpleList []*NLSLayerSimple + +func (ll NLSLayerSimpleList) ToLayerList() NLSLayerList { + res := make(NLSLayerList, 0, len(ll)) + for _, l := range ll { + var layer NLSLayer = l + res = append(res, &layer) + } + return res +} + +func (ll NLSLayerSimpleList) Last() *NLSLayerSimple { + if len(ll) == 0 { + return nil + } + return ll[len(ll)-1] +} + +type NLSLayerGroupList []*NLSLayerGroup + +func (ll NLSLayerGroupList) ToLayerList() NLSLayerList { + res := make(NLSLayerList, 0, len(ll)) + for _, l := range ll { + var layer NLSLayer = l + res = append(res, &layer) + } + return res +} + +func (ll NLSLayerGroupList) Last() *NLSLayerGroup { + if len(ll) == 0 { + return nil + } + return ll[len(ll)-1] +} + +type Map map[ID]*NLSLayer + +func MapFrom(l NLSLayer) Map { + return NLSLayerList{&l}.Map() +} + +func (m Map) Add(layers ...*NLSLayer) Map { + if m == nil { + m = map[ID]*NLSLayer{} + } + for _, l := range layers { + if l == nil { + continue + } + l2 := *l + m[l2.ID()] = l + } + return m +} + +func (m Map) NLSLayerList() NLSLayerList { + if m == nil { + return nil + } + list := make(NLSLayerList, 0, len(m)) + for _, l := range m { + list = append(list, l) + } + return list +} + +func (m Map) Clone() Map { + if m == nil { + return Map{} + } + m2 := make(Map, len(m)) + for k, v := range m { + clonedObj := (*v).Clone() + clonedLayer, ok := clonedObj.(NLSLayer) + if ok { + m2[k] = &clonedLayer + } else { + m2[k] = nil + } + } + return m2 +} + +func (m Map) Merge(m2 Map) Map { + if m == nil { + return m2.Clone() + } + m3 := m.Clone() + if m2 == nil { + return m3 + } + + return m3.Add(m2.NLSLayerList()...) +} + +func (m Map) Pick(il *IDList) NLSLayerList { + if il == nil { + return nil + } + + layers := make(NLSLayerList, 0, il.LayerCount()) + for _, lid := range il.Layers() { + if l := m[lid]; l != nil { + layers = append(layers, l) + } + } + return layers +} + +func (m Map) NLSLayer(i ID) NLSLayer { + if l := m[i]; l != nil { + return *l + } + return nil +} + +func (m Map) Item(i ID) *NLSLayerSimple { + if l := ToNLSLayerSimple(m.NLSLayer(i)); l != nil { + return l + } + return nil +} + +func (m Map) Group(i ID) *NLSLayerGroup { + if l := ToNLSLayerGroup(m.NLSLayer(i)); l != nil { + return l + } + return nil +} + +func (m Map) Keys() []ID { + keys := make([]ID, 0, len(m)) + for k := range m { + keys = append(keys, k) + } + sortIDs(keys) + return keys +} + +func (m Map) Len() int { + return len(m) +} diff --git a/server/pkg/nlslayer/nlslayerops/intializer.go b/server/pkg/nlslayer/nlslayerops/intializer.go new file mode 100644 index 0000000000..91ba45190b --- /dev/null +++ b/server/pkg/nlslayer/nlslayerops/intializer.go @@ -0,0 +1,36 @@ +package nlslayerops + +import ( + "github.com/pkg/errors" + "github.com/reearth/reearth/server/pkg/nlslayer" +) + +type LayerSimple struct { + SceneID nlslayer.SceneID + LayerType nlslayer.LayerType + Config *nlslayer.Config + Index *int +} + +func (i LayerSimple) Initialize() (*nlslayer.NLSLayerSimple, error) { + builder := nlslayer.NewNLSLayerSimple().NewID().Scene(i.SceneID).LayerType(i.LayerType) + + var err error + if i.Config != nil { + builder.Config(i.Config) + } + + var layerSimple *nlslayer.NLSLayerSimple + + if i.LayerType.IsValidLayerType() { + layerSimple, err = builder.Build() + + if err != nil { + return nil, err + } + } else { + return nil, errors.New("layer type must be 'simple' or 'group'") + } + + return layerSimple, nil +} diff --git a/server/pkg/nlslayer/simple.go b/server/pkg/nlslayer/simple.go new file mode 100644 index 0000000000..4461cccaec --- /dev/null +++ b/server/pkg/nlslayer/simple.go @@ -0,0 +1,116 @@ +package nlslayer + +import ( + pl "github.com/reearth/reearth/server/pkg/layer" +) + +type NLSLayerSimple struct { + layerBase + config *Config +} + +func (l *NLSLayerSimple) ID() ID { + return l.layerBase.ID() +} + +func (l *NLSLayerSimple) IDRef() *ID { + if l == nil { + return nil + } + return l.layerBase.IDRef() +} + +func (l *NLSLayerSimple) LayerType() LayerType { + return l.layerBase.LayerType() +} + +func (l *NLSLayerSimple) Scene() SceneID { + return l.layerBase.scene +} + +func (l *NLSLayerSimple) LinkedDataset() *pl.DatasetID { + return nil +} + +func (l *NLSLayerSimple) Title() string { + return l.layerBase.Title() +} + +func (l *NLSLayerSimple) IsVisible() bool { + if l == nil { + return false + } + return l.layerBase.visible +} + +func (l *NLSLayerSimple) HasInfobox() bool { + if l == nil { + return false + } + return l.layerBase.infobox != nil +} + +func (l *NLSLayerSimple) Infobox() *pl.Infobox { + if l == nil { + return nil + } + return l.layerBase.infobox +} + +func (l *NLSLayerSimple) SetVisible(visible bool) { + if l == nil { + return + } + l.layerBase.visible = visible +} + +func (l *NLSLayerSimple) SetInfobox(infobox *pl.Infobox) { + if l == nil { + return + } + l.layerBase.infobox = infobox +} + +func (l *NLSLayerSimple) Tags() *pl.TagList { + if l == nil { + return nil + } + if l.layerBase.tags == nil { + l.layerBase.tags = pl.NewTagList(nil) + } + return l.layerBase.tags +} + +func (l *NLSLayerSimple) LayerRef() *NLSLayer { + if l == nil { + return nil + } + var layer NLSLayer = l + return &layer +} + +func (l *NLSLayerSimple) Config() *Config { + if l == nil { + return nil + } + return l.config +} + +func (l *NLSLayerSimple) Clone() Cloner { + if l == nil { + return nil + } + + clonedBase := l.layerBase.Clone() + + var clonedConfig *Config + if l.config != nil { + clonedConfigItem := l.config.Clone() + clonedConfig = &clonedConfigItem + } + + return &NLSLayerSimple{ + layerBase: *clonedBase, + config: clonedConfig, + } +} diff --git a/server/pkg/nlslayer/simple_builder.go b/server/pkg/nlslayer/simple_builder.go new file mode 100644 index 0000000000..bdb0856d11 --- /dev/null +++ b/server/pkg/nlslayer/simple_builder.go @@ -0,0 +1,97 @@ +package nlslayer + +import ( + pl "github.com/reearth/reearth/server/pkg/layer" +) + +func NLSLayerSimpleFromLayer(l NLSLayer) *NLSLayerSimple { + li, ok := l.(*NLSLayerSimple) + if !ok { + return nil + } + return li +} + +func NLSLayerSimpleFromLayerRef(l *NLSLayer) *NLSLayerSimple { + if l == nil { + return nil + } + li, ok := (*l).(*NLSLayerSimple) + if !ok { + return nil + } + return li +} + +type NLSLayerSimpleBuilder struct { + l *NLSLayerSimple +} + +func NewNLSLayerSimple() *NLSLayerSimpleBuilder { + return &NLSLayerSimpleBuilder{l: &NLSLayerSimple{layerBase: layerBase{}}} +} + +func (b *NLSLayerSimpleBuilder) Build() (*NLSLayerSimple, error) { + if b.l.id.IsNil() { + return nil, ErrInvalidID + } + return b.l, nil +} + +func (b *NLSLayerSimpleBuilder) MustBuild() *NLSLayerSimple { + Simple, err := b.Build() + if err != nil { + panic(err) + } + return Simple +} + +func (b *NLSLayerSimpleBuilder) base(layer layerBase) *NLSLayerSimpleBuilder { + b.l.layerBase = layer + return b +} + +func (b *NLSLayerSimpleBuilder) ID(id ID) *NLSLayerSimpleBuilder { + b.l.id = id + return b +} + +func (b *NLSLayerSimpleBuilder) NewID() *NLSLayerSimpleBuilder { + b.l.id = NewID() + return b +} + +func (b *NLSLayerSimpleBuilder) LayerType(t LayerType) *NLSLayerSimpleBuilder { + b.l.layerType = t + return b +} + +func (b *NLSLayerSimpleBuilder) Scene(s SceneID) *NLSLayerSimpleBuilder { + b.l.scene = s + return b +} + +func (b *NLSLayerSimpleBuilder) Title(t string) *NLSLayerSimpleBuilder { + b.l.title = t + return b +} + +func (b *NLSLayerSimpleBuilder) IsVisible(i bool) *NLSLayerSimpleBuilder { + b.l.visible = i + return b +} + +func (b *NLSLayerSimpleBuilder) Infobox(infobox *pl.Infobox) *NLSLayerSimpleBuilder { + b.l.infobox = infobox + return b +} + +func (b *NLSLayerSimpleBuilder) Tags(tags *pl.TagList) *NLSLayerSimpleBuilder { + b.l.tags = tags + return b +} + +func (b *NLSLayerSimpleBuilder) Config(c *Config) *NLSLayerSimpleBuilder { + b.l.config = c + return b +}