diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..8ddc99f4 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.hml linguist-language=yaml \ No newline at end of file diff --git a/arion-compose/e2e-testing.nix b/arion-compose/e2e-testing.nix index 745b3f5c..2c2822c2 100644 --- a/arion-compose/e2e-testing.nix +++ b/arion-compose/e2e-testing.nix @@ -20,7 +20,7 @@ in connector = import ./services/connector.nix { inherit pkgs; - configuration-dir = ../fixtures/connector/chinook; + configuration-dir = ../fixtures/hasura/chinook/connector/chinook; database-uri = "mongodb://mongodb/chinook"; port = connector-port; service.depends_on.mongodb.condition = "service_healthy"; @@ -38,7 +38,7 @@ in inherit pkgs; port = engine-port; connectors.chinook = "http://connector:${connector-port}"; - ddn-dirs = [ ../fixtures/ddn/chinook ]; + ddn-dirs = [ ../fixtures/hasura/chinook/metadata ]; service.depends_on = { auth-hook.condition = "service_started"; }; diff --git a/arion-compose/integration-test-services.nix b/arion-compose/integration-test-services.nix index 48f81327..1d6b7921 100644 --- a/arion-compose/integration-test-services.nix +++ b/arion-compose/integration-test-services.nix @@ -21,7 +21,7 @@ in { connector = import ./services/connector.nix { inherit pkgs otlp-endpoint; - configuration-dir = ../fixtures/connector/sample_mflix; + configuration-dir = ../fixtures/hasura/sample_mflix/connector/sample_mflix; database-uri = "mongodb://mongodb/sample_mflix"; port = connector-port; hostPort = hostPort connector-port; @@ -32,7 +32,7 @@ in connector-chinook = import ./services/connector.nix { inherit pkgs otlp-endpoint; - configuration-dir = ../fixtures/connector/chinook; + configuration-dir = ../fixtures/hasura/chinook/connector/chinook; database-uri = "mongodb://mongodb/chinook"; port = connector-chinook-port; hostPort = hostPort connector-chinook-port; @@ -62,9 +62,9 @@ in sample_mflix = "http://connector:${connector-port}"; }; ddn-dirs = [ - ../fixtures/ddn/chinook - ../fixtures/ddn/sample_mflix - ../fixtures/ddn/remote-relationships_chinook-sample_mflix + ../fixtures/hasura/chinook/metadata + ../fixtures/hasura/sample_mflix/metadata + ../fixtures/hasura/common/metadata ]; service.depends_on = { auth-hook.condition = "service_started"; diff --git a/arion-compose/ndc-test.nix b/arion-compose/ndc-test.nix index eb1d6bf3..4f39e3b7 100644 --- a/arion-compose/ndc-test.nix +++ b/arion-compose/ndc-test.nix @@ -14,7 +14,7 @@ in # command = ["test" "--snapshots-dir" "/snapshots" "--seed" "1337_1337_1337_1337_1337_1337_13"]; # Replay and test the recorded snapshots # command = ["replay" "--snapshots-dir" "/snapshots"]; - configuration-dir = ../fixtures/connector/chinook; + configuration-dir = ../fixtures/hasura/chinook/connector/chinook; database-uri = "mongodb://mongodb:${mongodb-port}/chinook"; service.depends_on.mongodb.condition = "service_healthy"; # Run the container as the current user so when it writes to the snapshots directory it doesn't write as root diff --git a/arion-compose/services/connector.nix b/arion-compose/services/connector.nix index 8c87042b..a65e2c7e 100644 --- a/arion-compose/services/connector.nix +++ b/arion-compose/services/connector.nix @@ -12,7 +12,7 @@ , profile ? "dev" # Rust crate profile, usually either "dev" or "release" , hostPort ? null , command ? ["serve"] -, configuration-dir ? ../../fixtures/connector/sample_mflix +, configuration-dir ? ../../fixtures/hasura/sample_mflix/connector/sample_mflix , database-uri ? "mongodb://mongodb/sample_mflix" , service ? { } # additional options to customize this service configuration , otlp-endpoint ? null diff --git a/arion-compose/services/engine.nix b/arion-compose/services/engine.nix index 6375a742..b520948b 100644 --- a/arion-compose/services/engine.nix +++ b/arion-compose/services/engine.nix @@ -6,7 +6,7 @@ # a `DataConnectorLink.definition.name` value in one of the given `ddn-dirs` # to correctly match up configuration to connector instances. , connectors ? { sample_mflix = "http://connector:7130"; } -, ddn-dirs ? [ ../../fixtures/ddn/subgraphs/sample_mflix ] +, ddn-dirs ? [ ../../fixtures/hasura/sample_mflix/metadata ] , auth-webhook ? { url = "http://auth-hook:3050/validate-request"; } , otlp-endpoint ? "http://jaeger:4317" , service ? { } # additional options to customize this service configuration @@ -65,6 +65,7 @@ let auth-config = pkgs.writeText "auth_config.json" (builtins.toJSON { version = "v1"; definition = { + allowRoleEmulationBy = "admin"; mode.webhook = { url = auth-webhook.url; method = "Post"; diff --git a/fixtures/hasura/.devcontainer/devcontainer.json b/fixtures/hasura/.devcontainer/devcontainer.json new file mode 100644 index 00000000..ea38082b --- /dev/null +++ b/fixtures/hasura/.devcontainer/devcontainer.json @@ -0,0 +1,17 @@ +{ + "customizations": { + "vscode": { + "extensions": [ + "HasuraHQ.hasura" + ], + "settings": { + "terminal.integrated.shell.linux": "/bin/bash", + "terminal.integrated.shellArgs.linux": [ + "-l" + ] + } + } + }, + "name": "Hasura DDN Codespace", + "postCreateCommand": "curl -L https://graphql-engine-cdn.hasura.io/ddn/cli/v2/get.sh | bash" +} diff --git a/fixtures/hasura/.hasura/context.yaml b/fixtures/hasura/.hasura/context.yaml new file mode 100644 index 00000000..b23b1ec5 --- /dev/null +++ b/fixtures/hasura/.hasura/context.yaml @@ -0,0 +1,2 @@ +context: + supergraph: ../supergraph.yaml diff --git a/fixtures/hasura/.vscode/extensions.json b/fixtures/hasura/.vscode/extensions.json new file mode 100644 index 00000000..18cf1245 --- /dev/null +++ b/fixtures/hasura/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "HasuraHQ.hasura" + ] +} diff --git a/fixtures/hasura/.vscode/launch.json b/fixtures/hasura/.vscode/launch.json new file mode 100644 index 00000000..3d7bb31d --- /dev/null +++ b/fixtures/hasura/.vscode/launch.json @@ -0,0 +1,13 @@ +{ + "configurations": [ + { + "cwd": "${workspaceFolder}", + "name": "DDN Dev", + "preLaunchTask": "dev", + "program": "${workspaceFolder}", + "request": "launch", + "type": "node" + } + ], + "version": "0.2.0" +} diff --git a/fixtures/hasura/.vscode/tasks.json b/fixtures/hasura/.vscode/tasks.json new file mode 100644 index 00000000..fd278591 --- /dev/null +++ b/fixtures/hasura/.vscode/tasks.json @@ -0,0 +1,26 @@ +{ + "tasks": [ + { + "args": [ + "watch", + "--dir", + "." + ], + "command": "ddn", + "label": "watch", + "options": { + "cwd": "${workspaceFolder}" + }, + "presentation": { + "clear": true, + "close": false, + "focus": true, + "panel": "new", + "reveal": "always" + }, + "problemMatcher": [], + "type": "shell" + } + ], + "version": "2.0.0" +} diff --git a/fixtures/hasura/README.md b/fixtures/hasura/README.md new file mode 100644 index 00000000..4b95bb9b --- /dev/null +++ b/fixtures/hasura/README.md @@ -0,0 +1,35 @@ +# MongoDB Connector Hasura fixtures + +This directory contains example DDN and connector configuration which is used to +run integration tests in this repo, and supports local development. + +Instead of having docker compose configurations in this directory, supporting +services are run using arion configurations defined at the top level of the +repo. Before running ddn commands bring up services with: + +```sh +arion up -d +``` + +## Cheat Sheet + +We have two subgraphs, and two connector configurations. So a lot of these +commands are repeated for each subgraph + connector combination. + +Run introspection to update connector configuration: + +```sh +$ ddn connector introspect --connector sample_mflix/connector/sample_mflix/connector.yaml + +$ ddn connector introspect --connector chinook/connector/chinook/connector.yaml +``` + +Update Hasura metadata based on connector configuration +(after restarting connectors with `arion up -d` if there were changes from +introspection): + +```sh +$ ddn connector-link update sample_mflix --subgraph sample_mflix/subgraph.yaml --env-file sample_mflix/.env.sample_mflix --add-all-resources + +$ ddn connector-link update chinook --subgraph chinook/subgraph.yaml --env-file chinook/.env.chinook --add-all-resources +``` diff --git a/fixtures/hasura/chinook/.env.chinook b/fixtures/hasura/chinook/.env.chinook new file mode 100644 index 00000000..b52c724f --- /dev/null +++ b/fixtures/hasura/chinook/.env.chinook @@ -0,0 +1 @@ +CHINOOK_CONNECTOR_URL='http://localhost:7131' diff --git a/fixtures/ddn/chinook/commands/.gitkeep b/fixtures/hasura/chinook/connector/chinook/.configuration_metadata similarity index 100% rename from fixtures/ddn/chinook/commands/.gitkeep rename to fixtures/hasura/chinook/connector/chinook/.configuration_metadata diff --git a/fixtures/hasura/chinook/connector/chinook/.ddnignore b/fixtures/hasura/chinook/connector/chinook/.ddnignore new file mode 100644 index 00000000..4c49bd78 --- /dev/null +++ b/fixtures/hasura/chinook/connector/chinook/.ddnignore @@ -0,0 +1 @@ +.env diff --git a/fixtures/hasura/chinook/connector/chinook/.env b/fixtures/hasura/chinook/connector/chinook/.env new file mode 100644 index 00000000..ee57a147 --- /dev/null +++ b/fixtures/hasura/chinook/connector/chinook/.env @@ -0,0 +1 @@ +MONGODB_DATABASE_URI="mongodb://localhost/chinook" diff --git a/fixtures/hasura/chinook/connector/chinook/configuration.json b/fixtures/hasura/chinook/connector/chinook/configuration.json new file mode 100644 index 00000000..e2c0aaab --- /dev/null +++ b/fixtures/hasura/chinook/connector/chinook/configuration.json @@ -0,0 +1,7 @@ +{ + "introspectionOptions": { + "sampleSize": 100, + "noValidatorSchema": false, + "allSchemaNullable": false + } +} diff --git a/fixtures/hasura/chinook/connector/chinook/connector.yaml b/fixtures/hasura/chinook/connector/chinook/connector.yaml new file mode 100644 index 00000000..078bf6e8 --- /dev/null +++ b/fixtures/hasura/chinook/connector/chinook/connector.yaml @@ -0,0 +1,8 @@ +kind: Connector +version: v1 +definition: + name: chinook + subgraph: chinook + source: hasura/mongodb:v0.1.0 + context: . + envFile: .env diff --git a/fixtures/connector/chinook/native_mutations/insert_artist.json b/fixtures/hasura/chinook/connector/chinook/native_mutations/insert_artist.json similarity index 100% rename from fixtures/connector/chinook/native_mutations/insert_artist.json rename to fixtures/hasura/chinook/connector/chinook/native_mutations/insert_artist.json diff --git a/fixtures/connector/chinook/schema/Album.json b/fixtures/hasura/chinook/connector/chinook/schema/Album.json similarity index 100% rename from fixtures/connector/chinook/schema/Album.json rename to fixtures/hasura/chinook/connector/chinook/schema/Album.json diff --git a/fixtures/connector/chinook/schema/Artist.json b/fixtures/hasura/chinook/connector/chinook/schema/Artist.json similarity index 100% rename from fixtures/connector/chinook/schema/Artist.json rename to fixtures/hasura/chinook/connector/chinook/schema/Artist.json diff --git a/fixtures/connector/chinook/schema/Customer.json b/fixtures/hasura/chinook/connector/chinook/schema/Customer.json similarity index 100% rename from fixtures/connector/chinook/schema/Customer.json rename to fixtures/hasura/chinook/connector/chinook/schema/Customer.json diff --git a/fixtures/connector/chinook/schema/Employee.json b/fixtures/hasura/chinook/connector/chinook/schema/Employee.json similarity index 100% rename from fixtures/connector/chinook/schema/Employee.json rename to fixtures/hasura/chinook/connector/chinook/schema/Employee.json diff --git a/fixtures/connector/chinook/schema/Genre.json b/fixtures/hasura/chinook/connector/chinook/schema/Genre.json similarity index 100% rename from fixtures/connector/chinook/schema/Genre.json rename to fixtures/hasura/chinook/connector/chinook/schema/Genre.json diff --git a/fixtures/connector/chinook/schema/Invoice.json b/fixtures/hasura/chinook/connector/chinook/schema/Invoice.json similarity index 100% rename from fixtures/connector/chinook/schema/Invoice.json rename to fixtures/hasura/chinook/connector/chinook/schema/Invoice.json diff --git a/fixtures/connector/chinook/schema/InvoiceLine.json b/fixtures/hasura/chinook/connector/chinook/schema/InvoiceLine.json similarity index 100% rename from fixtures/connector/chinook/schema/InvoiceLine.json rename to fixtures/hasura/chinook/connector/chinook/schema/InvoiceLine.json diff --git a/fixtures/connector/chinook/schema/MediaType.json b/fixtures/hasura/chinook/connector/chinook/schema/MediaType.json similarity index 100% rename from fixtures/connector/chinook/schema/MediaType.json rename to fixtures/hasura/chinook/connector/chinook/schema/MediaType.json diff --git a/fixtures/connector/chinook/schema/Playlist.json b/fixtures/hasura/chinook/connector/chinook/schema/Playlist.json similarity index 100% rename from fixtures/connector/chinook/schema/Playlist.json rename to fixtures/hasura/chinook/connector/chinook/schema/Playlist.json diff --git a/fixtures/connector/chinook/schema/PlaylistTrack.json b/fixtures/hasura/chinook/connector/chinook/schema/PlaylistTrack.json similarity index 100% rename from fixtures/connector/chinook/schema/PlaylistTrack.json rename to fixtures/hasura/chinook/connector/chinook/schema/PlaylistTrack.json diff --git a/fixtures/connector/chinook/schema/Track.json b/fixtures/hasura/chinook/connector/chinook/schema/Track.json similarity index 100% rename from fixtures/connector/chinook/schema/Track.json rename to fixtures/hasura/chinook/connector/chinook/schema/Track.json diff --git a/fixtures/ddn/chinook/dataconnectors/chinook-types.hml b/fixtures/hasura/chinook/metadata/chinook-types.hml similarity index 63% rename from fixtures/ddn/chinook/dataconnectors/chinook-types.hml rename to fixtures/hasura/chinook/metadata/chinook-types.hml index 8be96015..8a8c6de0 100644 --- a/fixtures/ddn/chinook/dataconnectors/chinook-types.hml +++ b/fixtures/hasura/chinook/metadata/chinook-types.hml @@ -24,7 +24,43 @@ definition: dataConnectorScalarType: Int representation: Int graphql: - comparisonExpressionTypeName: IntComparisonExp + comparisonExpressionTypeName: Chinook_IntComparisonExp + +--- +kind: ScalarType +version: v1 +definition: + name: Chinook_Double + graphql: + typeName: Chinook_Double + +--- +kind: DataConnectorScalarRepresentation +version: v1 +definition: + dataConnectorName: chinook + dataConnectorScalarType: Double + representation: Double + graphql: + comparisonExpressionTypeName: Chinook_DoubleComparisonExp + +--- +kind: ScalarType +version: v1 +definition: + name: Decimal + graphql: + typeName: Chinook_Decimal + +--- +kind: DataConnectorScalarRepresentation +version: v1 +definition: + dataConnectorName: chinook + dataConnectorScalarType: Decimal + representation: Decimal + graphql: + comparisonExpressionTypeName: Chinook_DecimalComparisonExp --- kind: DataConnectorScalarRepresentation @@ -34,7 +70,7 @@ definition: dataConnectorScalarType: String representation: String graphql: - comparisonExpressionTypeName: StringComparisonExp + comparisonExpressionTypeName: Chinook_StringComparisonExp --- kind: ScalarType @@ -54,12 +90,3 @@ definition: graphql: comparisonExpressionTypeName: Chinook_ExtendedJsonComparisonExp ---- -kind: DataConnectorScalarRepresentation -version: v1 -definition: - dataConnectorName: chinook - dataConnectorScalarType: Float - representation: Float - graphql: - comparisonExpressionTypeName: FloatComparisonExp diff --git a/fixtures/ddn/chinook/dataconnectors/chinook.hml b/fixtures/hasura/chinook/metadata/chinook.hml similarity index 77% rename from fixtures/ddn/chinook/dataconnectors/chinook.hml rename to fixtures/hasura/chinook/metadata/chinook.hml index f708402f..86f633b4 100644 --- a/fixtures/ddn/chinook/dataconnectors/chinook.hml +++ b/fixtures/hasura/chinook/metadata/chinook.hml @@ -3,8 +3,11 @@ version: v1 definition: name: chinook url: - singleUrl: - value: http://localhost:7130 + readWriteUrls: + read: + valueFromEnv: CHINOOK_CONNECTOR_URL + write: + valueFromEnv: CHINOOK_CONNECTOR_URL schema: version: v0.1 schema: @@ -23,7 +26,9 @@ definition: argument_type: type: named name: BinData - Boolean: + Bool: + representation: + type: boolean aggregate_functions: count: result_type: @@ -36,8 +41,10 @@ definition: type: custom argument_type: type: named - name: Boolean + name: Bool Date: + representation: + type: timestamp aggregate_functions: count: result_type: @@ -94,6 +101,8 @@ definition: type: named name: DbPointer Decimal: + representation: + type: bigdecimal aggregate_functions: avg: result_type: @@ -143,15 +152,14 @@ definition: argument_type: type: named name: Decimal - ExtendedJSON: - aggregate_functions: {} - comparison_operators: {} - Float: + Double: + representation: + type: float64 aggregate_functions: avg: result_type: type: named - name: Float + name: Double count: result_type: type: named @@ -159,15 +167,15 @@ definition: max: result_type: type: named - name: Float + name: Double min: result_type: type: named - name: Float + name: Double sum: result_type: type: named - name: Float + name: Double comparison_operators: _eq: type: equal @@ -175,28 +183,35 @@ definition: type: custom argument_type: type: named - name: Float + name: Double _gte: type: custom argument_type: type: named - name: Float + name: Double _lt: type: custom argument_type: type: named - name: Float + name: Double _lte: type: custom argument_type: type: named - name: Float + name: Double _neq: type: custom argument_type: type: named - name: Float + name: Double + ExtendedJSON: + representation: + type: json + aggregate_functions: {} + comparison_operators: {} Int: + representation: + type: int32 aggregate_functions: avg: result_type: @@ -261,6 +276,8 @@ definition: name: Int comparison_operators: {} Long: + representation: + type: int64 aggregate_functions: avg: result_type: @@ -353,6 +370,8 @@ definition: type: named name: "Null" ObjectId: + representation: + type: string aggregate_functions: count: result_type: @@ -374,6 +393,8 @@ definition: name: Int comparison_operators: {} String: + representation: + type: string aggregate_functions: count: result_type: @@ -497,6 +518,7 @@ definition: name: Undefined object_types: Album: + description: Object type for collection Album fields: _id: type: @@ -515,6 +537,7 @@ definition: type: named name: String Artist: + description: Object type for collection Artist fields: _id: type: @@ -526,9 +549,12 @@ definition: name: Int Name: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String Customer: + description: Object type for collection Customer fields: _id: type: @@ -536,20 +562,28 @@ definition: name: ObjectId Address: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String City: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String Company: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String Country: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String CustomerId: type: type: named @@ -560,8 +594,10 @@ definition: name: String Fax: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String FirstName: type: type: named @@ -572,23 +608,30 @@ definition: name: String Phone: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String PostalCode: type: type: nullable underlying_type: type: named - name: ExtendedJSON + name: String State: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String SupportRepId: type: - type: named - name: Int + type: nullable + underlying_type: + type: named + name: Int Employee: + description: Object type for collection Employee fields: _id: type: @@ -596,52 +639,70 @@ definition: name: ObjectId Address: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String BirthDate: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String City: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String Country: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String Email: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String EmployeeId: type: type: named name: Int Fax: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String FirstName: type: type: named name: String HireDate: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String LastName: type: type: named name: String Phone: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String PostalCode: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String ReportsTo: type: type: nullable @@ -650,13 +711,18 @@ definition: name: Int State: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String Title: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String Genre: + description: Object type for collection Genre fields: _id: type: @@ -667,10 +733,23 @@ definition: type: named name: Int Name: + type: + type: nullable + underlying_type: + type: named + name: String + InsertArtist: + fields: + "n": type: type: named - name: String + name: Int + ok: + type: + type: named + name: Double Invoice: + description: Object type for collection Invoice fields: _id: type: @@ -678,26 +757,34 @@ definition: name: ObjectId BillingAddress: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String BillingCity: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String BillingCountry: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String BillingPostalCode: type: type: nullable underlying_type: type: named - name: ExtendedJSON + name: String BillingState: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String CustomerId: type: type: named @@ -713,8 +800,9 @@ definition: Total: type: type: named - name: Float + name: Decimal InvoiceLine: + description: Object type for collection InvoiceLine fields: _id: type: @@ -739,8 +827,9 @@ definition: UnitPrice: type: type: named - name: Float + name: Decimal MediaType: + description: Object type for collection MediaType fields: _id: type: @@ -752,9 +841,12 @@ definition: name: Int Name: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String Playlist: + description: Object type for collection Playlist fields: _id: type: @@ -762,13 +854,16 @@ definition: name: ObjectId Name: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String PlaylistId: type: type: named name: Int PlaylistTrack: + description: Object type for collection PlaylistTrack fields: _id: type: @@ -783,6 +878,7 @@ definition: type: named name: Int Track: + description: Object type for collection Track fields: _id: type: @@ -790,20 +886,28 @@ definition: name: ObjectId AlbumId: type: - type: named - name: Int + type: nullable + underlying_type: + type: named + name: Int Bytes: type: - type: named - name: Int + type: nullable + underlying_type: + type: named + name: Int Composer: type: - type: named - name: String + type: nullable + underlying_type: + type: named + name: String GenreId: type: - type: named - name: Int + type: nullable + underlying_type: + type: named + name: Int MediaTypeId: type: type: named @@ -823,13 +927,7 @@ definition: UnitPrice: type: type: named - name: Float - InsertArtist: - fields: - ok: - type: { type: named, name: Double } - n: - type: { type: named, name: Int } + name: Decimal collections: - name: Album arguments: {} @@ -922,18 +1020,29 @@ definition: functions: [] procedures: - name: insertArtist - description: Example of a database update using a native procedure - result_type: { type: named, name: InsertArtist } + description: Example of a database update using a native mutation arguments: - id: { type: { type: named, name: Int } } - name: { type: { type: named, name: String } } + id: + type: + type: named + name: Int + name: + type: + type: named + name: String + result_type: + type: named + name: InsertArtist capabilities: - version: 0.1.1 + version: 0.1.4 capabilities: query: aggregates: {} variables: {} explain: {} + nested_fields: + filter_by: {} + order_by: {} mutation: {} - relationships: {} - + relationships: + relation_comparisons: {} diff --git a/fixtures/ddn/chinook/dataconnectors/.gitkeep b/fixtures/hasura/chinook/metadata/commands/.gitkeep similarity index 100% rename from fixtures/ddn/chinook/dataconnectors/.gitkeep rename to fixtures/hasura/chinook/metadata/commands/.gitkeep diff --git a/fixtures/ddn/chinook/commands/InsertArtist.hml b/fixtures/hasura/chinook/metadata/commands/InsertArtist.hml similarity index 82% rename from fixtures/ddn/chinook/commands/InsertArtist.hml rename to fixtures/hasura/chinook/metadata/commands/InsertArtist.hml index 9dd323da..a538819c 100644 --- a/fixtures/ddn/chinook/commands/InsertArtist.hml +++ b/fixtures/hasura/chinook/metadata/commands/InsertArtist.hml @@ -1,12 +1,13 @@ +--- kind: Command version: v1 definition: name: insertArtist description: Example of a database update using a native mutation - outputType: InsertArtist + outputType: InsertArtist! arguments: - name: id - type: Int! + type: Int! - name: name type: String! source: @@ -28,7 +29,7 @@ definition: permissions: - role: admin allowExecution: true - + --- kind: ObjectType version: v1 @@ -36,17 +37,22 @@ definition: name: InsertArtist graphql: typeName: InsertArtist + inputTypeName: InsertArtistInput fields: - name: ok - type: Float! + type: Chinook_Double! - name: n type: Int! dataConnectorTypeMapping: - dataConnectorName: chinook dataConnectorObjectType: InsertArtist fieldMapping: - ok: { column: { name: ok } } - n: { column: { name: n } } + ok: + column: + name: ok + n: + column: + name: n --- kind: TypePermissions @@ -59,3 +65,4 @@ definition: allowedFields: - ok - n + diff --git a/fixtures/ddn/chinook/models/Album.hml b/fixtures/hasura/chinook/metadata/models/Album.hml similarity index 97% rename from fixtures/ddn/chinook/models/Album.hml rename to fixtures/hasura/chinook/metadata/models/Album.hml index a17cf54c..be6847fa 100644 --- a/fixtures/ddn/chinook/models/Album.hml +++ b/fixtures/hasura/chinook/metadata/models/Album.hml @@ -31,6 +31,7 @@ definition: title: column: name: Title + description: Object type for collection Album --- kind: TypePermissions diff --git a/fixtures/ddn/chinook/models/Artist.hml b/fixtures/hasura/chinook/metadata/models/Artist.hml similarity index 96% rename from fixtures/ddn/chinook/models/Artist.hml rename to fixtures/hasura/chinook/metadata/models/Artist.hml index b88dccf6..aadf44bb 100644 --- a/fixtures/ddn/chinook/models/Artist.hml +++ b/fixtures/hasura/chinook/metadata/models/Artist.hml @@ -9,7 +9,7 @@ definition: - name: artistId type: Int! - name: name - type: String! + type: String graphql: typeName: Artist inputTypeName: ArtistInput @@ -26,6 +26,7 @@ definition: name: column: name: Name + description: Object type for collection Artist --- kind: TypePermissions diff --git a/fixtures/ddn/chinook/models/Customer.hml b/fixtures/hasura/chinook/metadata/models/Customer.hml similarity index 95% rename from fixtures/ddn/chinook/models/Customer.hml rename to fixtures/hasura/chinook/metadata/models/Customer.hml index a579f1ca..10233562 100644 --- a/fixtures/ddn/chinook/models/Customer.hml +++ b/fixtures/hasura/chinook/metadata/models/Customer.hml @@ -7,31 +7,31 @@ definition: - name: id type: Chinook_ObjectId! - name: address - type: String! + type: String - name: city - type: String! + type: String - name: company - type: String! + type: String - name: country - type: String! + type: String - name: customerId type: Int! - name: email type: String! - name: fax - type: String! + type: String - name: firstName type: String! - name: lastName type: String! - name: phone - type: String! + type: String - name: postalCode - type: Chinook_ExtendedJson + type: String - name: state - type: String! + type: String - name: supportRepId - type: Int! + type: Int graphql: typeName: Customer inputTypeName: CustomerInput @@ -81,6 +81,7 @@ definition: supportRepId: column: name: SupportRepId + description: Object type for collection Customer --- kind: TypePermissions diff --git a/fixtures/ddn/chinook/models/Employee.hml b/fixtures/hasura/chinook/metadata/models/Employee.hml similarity index 95% rename from fixtures/ddn/chinook/models/Employee.hml rename to fixtures/hasura/chinook/metadata/models/Employee.hml index 5615c097..79af5edb 100644 --- a/fixtures/ddn/chinook/models/Employee.hml +++ b/fixtures/hasura/chinook/metadata/models/Employee.hml @@ -7,35 +7,35 @@ definition: - name: id type: Chinook_ObjectId! - name: address - type: String! + type: String - name: birthDate - type: String! + type: String - name: city - type: String! + type: String - name: country - type: String! + type: String - name: email - type: String! + type: String - name: employeeId type: Int! - name: fax - type: String! + type: String - name: firstName type: String! - name: hireDate - type: String! + type: String - name: lastName type: String! - name: phone - type: String! + type: String - name: postalCode - type: String! + type: String - name: reportsTo type: Int - name: state - type: String! + type: String - name: title - type: String! + type: String graphql: typeName: Employee inputTypeName: EmployeeInput @@ -91,6 +91,7 @@ definition: title: column: name: Title + description: Object type for collection Employee --- kind: TypePermissions diff --git a/fixtures/ddn/chinook/models/Genre.hml b/fixtures/hasura/chinook/metadata/models/Genre.hml similarity index 96% rename from fixtures/ddn/chinook/models/Genre.hml rename to fixtures/hasura/chinook/metadata/models/Genre.hml index 916ab2e1..bdc3cbee 100644 --- a/fixtures/ddn/chinook/models/Genre.hml +++ b/fixtures/hasura/chinook/metadata/models/Genre.hml @@ -9,7 +9,7 @@ definition: - name: genreId type: Int! - name: name - type: String! + type: String graphql: typeName: Genre inputTypeName: GenreInput @@ -26,6 +26,7 @@ definition: name: column: name: Name + description: Object type for collection Genre --- kind: TypePermissions diff --git a/fixtures/ddn/chinook/models/Invoice.hml b/fixtures/hasura/chinook/metadata/models/Invoice.hml similarity index 95% rename from fixtures/ddn/chinook/models/Invoice.hml rename to fixtures/hasura/chinook/metadata/models/Invoice.hml index 50b6558d..8cd0391a 100644 --- a/fixtures/ddn/chinook/models/Invoice.hml +++ b/fixtures/hasura/chinook/metadata/models/Invoice.hml @@ -7,15 +7,15 @@ definition: - name: id type: Chinook_ObjectId! - name: billingAddress - type: String! + type: String - name: billingCity - type: String! + type: String - name: billingCountry - type: String! + type: String - name: billingPostalCode - type: Chinook_ExtendedJson + type: String - name: billingState - type: String! + type: String - name: customerId type: Int! - name: invoiceDate @@ -23,7 +23,7 @@ definition: - name: invoiceId type: Int! - name: total - type: Float! + type: Decimal! graphql: typeName: Invoice inputTypeName: InvoiceInput @@ -61,6 +61,7 @@ definition: total: column: name: Total + description: Object type for collection Invoice --- kind: TypePermissions diff --git a/fixtures/ddn/chinook/models/InvoiceLine.hml b/fixtures/hasura/chinook/metadata/models/InvoiceLine.hml similarity index 97% rename from fixtures/ddn/chinook/models/InvoiceLine.hml rename to fixtures/hasura/chinook/metadata/models/InvoiceLine.hml index 39513adc..19d790c9 100644 --- a/fixtures/ddn/chinook/models/InvoiceLine.hml +++ b/fixtures/hasura/chinook/metadata/models/InvoiceLine.hml @@ -15,7 +15,7 @@ definition: - name: trackId type: Int! - name: unitPrice - type: Float! + type: Decimal! graphql: typeName: InvoiceLine inputTypeName: InvoiceLineInput @@ -41,6 +41,7 @@ definition: unitPrice: column: name: UnitPrice + description: Object type for collection InvoiceLine --- kind: TypePermissions diff --git a/fixtures/ddn/chinook/models/MediaType.hml b/fixtures/hasura/chinook/metadata/models/MediaType.hml similarity index 96% rename from fixtures/ddn/chinook/models/MediaType.hml rename to fixtures/hasura/chinook/metadata/models/MediaType.hml index e01e6657..65c462f7 100644 --- a/fixtures/ddn/chinook/models/MediaType.hml +++ b/fixtures/hasura/chinook/metadata/models/MediaType.hml @@ -9,7 +9,7 @@ definition: - name: mediaTypeId type: Int! - name: name - type: String! + type: String graphql: typeName: MediaType inputTypeName: MediaTypeInput @@ -26,6 +26,7 @@ definition: name: column: name: Name + description: Object type for collection MediaType --- kind: TypePermissions diff --git a/fixtures/ddn/chinook/models/Playlist.hml b/fixtures/hasura/chinook/metadata/models/Playlist.hml similarity index 96% rename from fixtures/ddn/chinook/models/Playlist.hml rename to fixtures/hasura/chinook/metadata/models/Playlist.hml index 6479bbe4..6e474e8e 100644 --- a/fixtures/ddn/chinook/models/Playlist.hml +++ b/fixtures/hasura/chinook/metadata/models/Playlist.hml @@ -7,7 +7,7 @@ definition: - name: id type: Chinook_ObjectId! - name: name - type: String! + type: String - name: playlistId type: Int! graphql: @@ -26,6 +26,7 @@ definition: playlistId: column: name: PlaylistId + description: Object type for collection Playlist --- kind: TypePermissions diff --git a/fixtures/ddn/chinook/models/PlaylistTrack.hml b/fixtures/hasura/chinook/metadata/models/PlaylistTrack.hml similarity index 97% rename from fixtures/ddn/chinook/models/PlaylistTrack.hml rename to fixtures/hasura/chinook/metadata/models/PlaylistTrack.hml index 1ce858c7..ec0efc74 100644 --- a/fixtures/ddn/chinook/models/PlaylistTrack.hml +++ b/fixtures/hasura/chinook/metadata/models/PlaylistTrack.hml @@ -26,6 +26,7 @@ definition: trackId: column: name: TrackId + description: Object type for collection PlaylistTrack --- kind: TypePermissions diff --git a/fixtures/ddn/chinook/models/Track.hml b/fixtures/hasura/chinook/metadata/models/Track.hml similarity index 96% rename from fixtures/ddn/chinook/models/Track.hml rename to fixtures/hasura/chinook/metadata/models/Track.hml index 83c8a7ae..3910420c 100644 --- a/fixtures/ddn/chinook/models/Track.hml +++ b/fixtures/hasura/chinook/metadata/models/Track.hml @@ -7,13 +7,13 @@ definition: - name: id type: Chinook_ObjectId! - name: albumId - type: Int! + type: Int - name: bytes - type: Int! + type: Int - name: composer - type: String! + type: String - name: genreId - type: Int! + type: Int - name: mediaTypeId type: Int! - name: milliseconds @@ -23,7 +23,7 @@ definition: - name: trackId type: Int! - name: unitPrice - type: Float! + type: Decimal! graphql: typeName: Track inputTypeName: TrackInput @@ -61,6 +61,7 @@ definition: unitPrice: column: name: UnitPrice + description: Object type for collection Track --- kind: TypePermissions diff --git a/fixtures/ddn/chinook/relationships/album_tracks.hml b/fixtures/hasura/chinook/metadata/relationships/album_tracks.hml similarity index 100% rename from fixtures/ddn/chinook/relationships/album_tracks.hml rename to fixtures/hasura/chinook/metadata/relationships/album_tracks.hml diff --git a/fixtures/ddn/chinook/relationships/artist_albums.hml b/fixtures/hasura/chinook/metadata/relationships/artist_albums.hml similarity index 100% rename from fixtures/ddn/chinook/relationships/artist_albums.hml rename to fixtures/hasura/chinook/metadata/relationships/artist_albums.hml diff --git a/fixtures/ddn/chinook/relationships/customer_invoices.hml b/fixtures/hasura/chinook/metadata/relationships/customer_invoices.hml similarity index 100% rename from fixtures/ddn/chinook/relationships/customer_invoices.hml rename to fixtures/hasura/chinook/metadata/relationships/customer_invoices.hml diff --git a/fixtures/ddn/chinook/relationships/employee_customers.hml b/fixtures/hasura/chinook/metadata/relationships/employee_customers.hml similarity index 100% rename from fixtures/ddn/chinook/relationships/employee_customers.hml rename to fixtures/hasura/chinook/metadata/relationships/employee_customers.hml diff --git a/fixtures/ddn/chinook/relationships/employee_employees.hml b/fixtures/hasura/chinook/metadata/relationships/employee_employees.hml similarity index 100% rename from fixtures/ddn/chinook/relationships/employee_employees.hml rename to fixtures/hasura/chinook/metadata/relationships/employee_employees.hml diff --git a/fixtures/ddn/chinook/relationships/genre_tracks.hml b/fixtures/hasura/chinook/metadata/relationships/genre_tracks.hml similarity index 100% rename from fixtures/ddn/chinook/relationships/genre_tracks.hml rename to fixtures/hasura/chinook/metadata/relationships/genre_tracks.hml diff --git a/fixtures/ddn/chinook/relationships/invoice_lines.hml b/fixtures/hasura/chinook/metadata/relationships/invoice_lines.hml similarity index 100% rename from fixtures/ddn/chinook/relationships/invoice_lines.hml rename to fixtures/hasura/chinook/metadata/relationships/invoice_lines.hml diff --git a/fixtures/ddn/chinook/relationships/media_type_tracks.hml b/fixtures/hasura/chinook/metadata/relationships/media_type_tracks.hml similarity index 100% rename from fixtures/ddn/chinook/relationships/media_type_tracks.hml rename to fixtures/hasura/chinook/metadata/relationships/media_type_tracks.hml diff --git a/fixtures/ddn/chinook/relationships/playlist_tracks.hml b/fixtures/hasura/chinook/metadata/relationships/playlist_tracks.hml similarity index 100% rename from fixtures/ddn/chinook/relationships/playlist_tracks.hml rename to fixtures/hasura/chinook/metadata/relationships/playlist_tracks.hml diff --git a/fixtures/ddn/chinook/relationships/track_invoice_lines.hml b/fixtures/hasura/chinook/metadata/relationships/track_invoice_lines.hml similarity index 100% rename from fixtures/ddn/chinook/relationships/track_invoice_lines.hml rename to fixtures/hasura/chinook/metadata/relationships/track_invoice_lines.hml diff --git a/fixtures/hasura/chinook/subgraph.yaml b/fixtures/hasura/chinook/subgraph.yaml new file mode 100644 index 00000000..fef4fcb2 --- /dev/null +++ b/fixtures/hasura/chinook/subgraph.yaml @@ -0,0 +1,8 @@ +kind: Subgraph +version: v1 +definition: + generator: + rootPath: . + includePaths: + - metadata + name: chinook diff --git a/fixtures/ddn/remote-relationships_chinook-sample_mflix/album_movie.hml b/fixtures/hasura/common/metadata/relationships/album_movie.hml similarity index 100% rename from fixtures/ddn/remote-relationships_chinook-sample_mflix/album_movie.hml rename to fixtures/hasura/common/metadata/relationships/album_movie.hml diff --git a/fixtures/hasura/engine/.env.engine b/fixtures/hasura/engine/.env.engine new file mode 100644 index 00000000..14d6bfc3 --- /dev/null +++ b/fixtures/hasura/engine/.env.engine @@ -0,0 +1,5 @@ +METADATA_PATH=/md/open_dd.json +AUTHN_CONFIG_PATH=/md/auth_config.json +INTROSPECTION_METADATA_FILE=/md/metadata.json +OTLP_ENDPOINT=http://local.hasura.dev:4317 +ENABLE_CORS=true diff --git a/fixtures/hasura/engine/auth_config.json b/fixtures/hasura/engine/auth_config.json new file mode 100644 index 00000000..8a73e5b4 --- /dev/null +++ b/fixtures/hasura/engine/auth_config.json @@ -0,0 +1 @@ +{"version":"v1","definition":{"allowRoleEmulationBy":"admin","mode":{"webhook":{"url":"http://auth_hook:3050/validate-request","method":"Post"}}}} \ No newline at end of file diff --git a/fixtures/hasura/engine/metadata.json b/fixtures/hasura/engine/metadata.json new file mode 100644 index 00000000..84b41230 --- /dev/null +++ b/fixtures/hasura/engine/metadata.json @@ -0,0 +1 @@ +{"subgraphs":[{"name":"globals","objects":[{"definition":{"apolloFederation":null,"mutation":{"rootOperationTypeName":"Mutation"},"query":{"aggregate":null,"argumentsInput":{"fieldName":"args"},"filterInput":{"fieldName":"where","operatorNames":{"and":"_and","isNull":"_is_null","not":"_not","or":"_or"}},"limitInput":{"fieldName":"limit"},"offsetInput":{"fieldName":"offset"},"orderByInput":{"enumDirectionValues":{"asc":"Asc","desc":"Desc"},"enumTypeNames":[{"directions":["Asc","Desc"],"typeName":"OrderBy"}],"fieldName":"order_by"},"rootOperationTypeName":"Query"}},"kind":"GraphqlConfig","version":"v1"},{"definition":{"allowRoleEmulationBy":"admin","mode":{"webhook":{"method":"Post","url":"http://auth_hook:3050/validate-request"}}},"kind":"AuthConfig","version":"v1"},{"date":"2024-07-09","kind":"CompatibilityConfig"}]}],"version":"v2"} \ No newline at end of file diff --git a/fixtures/hasura/engine/open_dd.json b/fixtures/hasura/engine/open_dd.json new file mode 100644 index 00000000..508184df --- /dev/null +++ b/fixtures/hasura/engine/open_dd.json @@ -0,0 +1 @@ +{"version":"v3","subgraphs":[{"name":"globals","objects":[{"kind":"GraphqlConfig","version":"v1","definition":{"query":{"rootOperationTypeName":"Query","argumentsInput":{"fieldName":"args"},"limitInput":{"fieldName":"limit"},"offsetInput":{"fieldName":"offset"},"filterInput":{"fieldName":"where","operatorNames":{"and":"_and","or":"_or","not":"_not","isNull":"_is_null"}},"orderByInput":{"fieldName":"order_by","enumDirectionValues":{"asc":"Asc","desc":"Desc"},"enumTypeNames":[{"directions":["Asc","Desc"],"typeName":"OrderBy"}]},"aggregate":null},"mutation":{"rootOperationTypeName":"Mutation"},"apolloFederation":null}}]}],"flags":{"require_graphql_config":true}} \ No newline at end of file diff --git a/fixtures/ddn/sample_mflix/dataconnectors/.gitkeep b/fixtures/hasura/globals/.env.globals.cloud similarity index 100% rename from fixtures/ddn/sample_mflix/dataconnectors/.gitkeep rename to fixtures/hasura/globals/.env.globals.cloud diff --git a/fixtures/hasura/globals/.env.globals.local b/fixtures/hasura/globals/.env.globals.local new file mode 100644 index 00000000..e69de29b diff --git a/fixtures/hasura/globals/auth-config.cloud.hml b/fixtures/hasura/globals/auth-config.cloud.hml new file mode 100644 index 00000000..1080ecc3 --- /dev/null +++ b/fixtures/hasura/globals/auth-config.cloud.hml @@ -0,0 +1,8 @@ +kind: AuthConfig +version: v1 +definition: + allowRoleEmulationBy: admin + mode: + webhook: + url: http://auth-hook.default:8080/webhook/ddn?role=admin + method: Post diff --git a/fixtures/hasura/globals/auth-config.local.hml b/fixtures/hasura/globals/auth-config.local.hml new file mode 100644 index 00000000..367e5064 --- /dev/null +++ b/fixtures/hasura/globals/auth-config.local.hml @@ -0,0 +1,8 @@ +kind: AuthConfig +version: v1 +definition: + allowRoleEmulationBy: admin + mode: + webhook: + url: http://auth_hook:3050/validate-request + method: Post diff --git a/fixtures/hasura/globals/compatibility-config.hml b/fixtures/hasura/globals/compatibility-config.hml new file mode 100644 index 00000000..80856ac1 --- /dev/null +++ b/fixtures/hasura/globals/compatibility-config.hml @@ -0,0 +1,2 @@ +kind: CompatibilityConfig +date: "2024-07-09" diff --git a/fixtures/hasura/globals/graphql-config.hml b/fixtures/hasura/globals/graphql-config.hml new file mode 100644 index 00000000..d5b9d9f6 --- /dev/null +++ b/fixtures/hasura/globals/graphql-config.hml @@ -0,0 +1,30 @@ +kind: GraphqlConfig +version: v1 +definition: + query: + rootOperationTypeName: Query + argumentsInput: + fieldName: args + limitInput: + fieldName: limit + offsetInput: + fieldName: offset + filterInput: + fieldName: where + operatorNames: + and: _and + or: _or + not: _not + isNull: _is_null + orderByInput: + fieldName: order_by + enumDirectionValues: + asc: Asc + desc: Desc + enumTypeNames: + - directions: + - Asc + - Desc + typeName: OrderBy + mutation: + rootOperationTypeName: Mutation diff --git a/fixtures/hasura/globals/subgraph.cloud.yaml b/fixtures/hasura/globals/subgraph.cloud.yaml new file mode 100644 index 00000000..dea2c3d4 --- /dev/null +++ b/fixtures/hasura/globals/subgraph.cloud.yaml @@ -0,0 +1,11 @@ +kind: Subgraph +version: v1 +definition: + generator: + rootPath: . + envFile: .env.globals.cloud + includePaths: + - auth-config.cloud.hml + - compatibility-config.hml + - graphql-config.hml + name: globals diff --git a/fixtures/hasura/globals/subgraph.local.yaml b/fixtures/hasura/globals/subgraph.local.yaml new file mode 100644 index 00000000..d5e4d000 --- /dev/null +++ b/fixtures/hasura/globals/subgraph.local.yaml @@ -0,0 +1,11 @@ +kind: Subgraph +version: v1 +definition: + generator: + rootPath: . + envFile: .env.globals.local + includePaths: + - auth-config.local.hml + - compatibility-config.hml + - graphql-config.hml + name: globals diff --git a/fixtures/hasura/hasura.yaml b/fixtures/hasura/hasura.yaml new file mode 100644 index 00000000..b4d4e478 --- /dev/null +++ b/fixtures/hasura/hasura.yaml @@ -0,0 +1 @@ +version: v2 diff --git a/fixtures/hasura/sample_mflix/.env.sample_mflix b/fixtures/hasura/sample_mflix/.env.sample_mflix new file mode 100644 index 00000000..e003fd5a --- /dev/null +++ b/fixtures/hasura/sample_mflix/.env.sample_mflix @@ -0,0 +1 @@ +SAMPLE_MFLIX_CONNECTOR_URL='http://localhost:7130' diff --git a/fixtures/hasura/sample_mflix/connector/sample_mflix/.configuration_metadata b/fixtures/hasura/sample_mflix/connector/sample_mflix/.configuration_metadata new file mode 100644 index 00000000..e69de29b diff --git a/fixtures/hasura/sample_mflix/connector/sample_mflix/.ddnignore b/fixtures/hasura/sample_mflix/connector/sample_mflix/.ddnignore new file mode 100644 index 00000000..4c49bd78 --- /dev/null +++ b/fixtures/hasura/sample_mflix/connector/sample_mflix/.ddnignore @@ -0,0 +1 @@ +.env diff --git a/fixtures/hasura/sample_mflix/connector/sample_mflix/.env b/fixtures/hasura/sample_mflix/connector/sample_mflix/.env new file mode 100644 index 00000000..fea5fc4a --- /dev/null +++ b/fixtures/hasura/sample_mflix/connector/sample_mflix/.env @@ -0,0 +1 @@ +MONGODB_DATABASE_URI="mongodb://localhost/sample_mflix" diff --git a/fixtures/hasura/sample_mflix/connector/sample_mflix/configuration.json b/fixtures/hasura/sample_mflix/connector/sample_mflix/configuration.json new file mode 100644 index 00000000..e2c0aaab --- /dev/null +++ b/fixtures/hasura/sample_mflix/connector/sample_mflix/configuration.json @@ -0,0 +1,7 @@ +{ + "introspectionOptions": { + "sampleSize": 100, + "noValidatorSchema": false, + "allSchemaNullable": false + } +} diff --git a/fixtures/hasura/sample_mflix/connector/sample_mflix/connector.yaml b/fixtures/hasura/sample_mflix/connector/sample_mflix/connector.yaml new file mode 100644 index 00000000..052dfcd6 --- /dev/null +++ b/fixtures/hasura/sample_mflix/connector/sample_mflix/connector.yaml @@ -0,0 +1,8 @@ +kind: Connector +version: v1 +definition: + name: sample_mflix + subgraph: sample_mflix + source: hasura/mongodb:v0.1.0 + context: . + envFile: .env diff --git a/fixtures/connector/sample_mflix/native_queries/hello.json b/fixtures/hasura/sample_mflix/connector/sample_mflix/native_queries/hello.json similarity index 100% rename from fixtures/connector/sample_mflix/native_queries/hello.json rename to fixtures/hasura/sample_mflix/connector/sample_mflix/native_queries/hello.json diff --git a/fixtures/connector/sample_mflix/native_queries/title_word_requency.json b/fixtures/hasura/sample_mflix/connector/sample_mflix/native_queries/title_word_requency.json similarity index 100% rename from fixtures/connector/sample_mflix/native_queries/title_word_requency.json rename to fixtures/hasura/sample_mflix/connector/sample_mflix/native_queries/title_word_requency.json diff --git a/fixtures/connector/sample_mflix/schema/comments.json b/fixtures/hasura/sample_mflix/connector/sample_mflix/schema/comments.json similarity index 100% rename from fixtures/connector/sample_mflix/schema/comments.json rename to fixtures/hasura/sample_mflix/connector/sample_mflix/schema/comments.json diff --git a/fixtures/connector/sample_mflix/schema/movies.json b/fixtures/hasura/sample_mflix/connector/sample_mflix/schema/movies.json similarity index 90% rename from fixtures/connector/sample_mflix/schema/movies.json rename to fixtures/hasura/sample_mflix/connector/sample_mflix/schema/movies.json index bb96aee5..96784456 100644 --- a/fixtures/connector/sample_mflix/schema/movies.json +++ b/fixtures/hasura/sample_mflix/connector/sample_mflix/schema/movies.json @@ -43,7 +43,9 @@ }, "fullplot": { "type": { - "scalar": "string" + "nullable": { + "scalar": "string" + } } }, "genres": { @@ -60,8 +62,10 @@ }, "languages": { "type": { - "arrayOf": { - "scalar": "string" + "nullable": { + "arrayOf": { + "scalar": "string" + } } } }, @@ -86,12 +90,16 @@ }, "plot": { "type": { - "scalar": "string" + "nullable": { + "scalar": "string" + } } }, "poster": { "type": { - "scalar": "string" + "nullable": { + "scalar": "string" + } } }, "rated": { @@ -103,12 +111,16 @@ }, "released": { "type": { - "scalar": "date" + "nullable": { + "scalar": "date" + } } }, "runtime": { "type": { - "scalar": "int" + "nullable": { + "scalar": "int" + } } }, "title": { @@ -118,7 +130,9 @@ }, "tomatoes": { "type": { - "object": "movies_tomatoes" + "nullable": { + "object": "movies_tomatoes" + } } }, "type": { @@ -128,8 +142,10 @@ }, "writers": { "type": { - "arrayOf": { - "scalar": "string" + "nullable": { + "arrayOf": { + "scalar": "string" + } } } }, @@ -252,9 +268,7 @@ "fields": { "meter": { "type": { - "nullable": { - "scalar": "int" - } + "scalar": "int" } }, "numReviews": { @@ -264,9 +278,7 @@ }, "rating": { "type": { - "nullable": { - "scalar": "double" - } + "scalar": "double" } } } @@ -275,7 +287,9 @@ "fields": { "meter": { "type": { - "scalar": "int" + "nullable": { + "scalar": "int" + } } }, "numReviews": { @@ -285,12 +299,10 @@ }, "rating": { "type": { - "nullable": { - "scalar": "double" - } + "scalar": "double" } } } } } -} +} \ No newline at end of file diff --git a/fixtures/connector/sample_mflix/schema/sessions.json b/fixtures/hasura/sample_mflix/connector/sample_mflix/schema/sessions.json similarity index 100% rename from fixtures/connector/sample_mflix/schema/sessions.json rename to fixtures/hasura/sample_mflix/connector/sample_mflix/schema/sessions.json diff --git a/fixtures/connector/sample_mflix/schema/theaters.json b/fixtures/hasura/sample_mflix/connector/sample_mflix/schema/theaters.json similarity index 100% rename from fixtures/connector/sample_mflix/schema/theaters.json rename to fixtures/hasura/sample_mflix/connector/sample_mflix/schema/theaters.json diff --git a/fixtures/connector/sample_mflix/schema/users.json b/fixtures/hasura/sample_mflix/connector/sample_mflix/schema/users.json similarity index 72% rename from fixtures/connector/sample_mflix/schema/users.json rename to fixtures/hasura/sample_mflix/connector/sample_mflix/schema/users.json index 71e27cec..ec2b7149 100644 --- a/fixtures/connector/sample_mflix/schema/users.json +++ b/fixtures/hasura/sample_mflix/connector/sample_mflix/schema/users.json @@ -27,8 +27,18 @@ "type": { "scalar": "string" } + }, + "preferences": { + "type": { + "nullable": { + "object": "users_preferences" + } + } } } + }, + "users_preferences": { + "fields": {} } } } \ No newline at end of file diff --git a/fixtures/ddn/sample_mflix/commands/Hello.hml b/fixtures/hasura/sample_mflix/metadata/commands/Hello.hml similarity index 94% rename from fixtures/ddn/sample_mflix/commands/Hello.hml rename to fixtures/hasura/sample_mflix/metadata/commands/Hello.hml index 9e58d38c..b0c1cc4b 100644 --- a/fixtures/ddn/sample_mflix/commands/Hello.hml +++ b/fixtures/hasura/sample_mflix/metadata/commands/Hello.hml @@ -1,9 +1,10 @@ +--- kind: Command version: v1 definition: name: hello description: Basic test of native queries - outputType: String + outputType: String! arguments: - name: name type: String! @@ -25,3 +26,4 @@ definition: permissions: - role: admin allowExecution: true + diff --git a/fixtures/ddn/sample_mflix/models/Comments.hml b/fixtures/hasura/sample_mflix/metadata/models/Comments.hml similarity index 100% rename from fixtures/ddn/sample_mflix/models/Comments.hml rename to fixtures/hasura/sample_mflix/metadata/models/Comments.hml diff --git a/fixtures/ddn/sample_mflix/models/Movies.hml b/fixtures/hasura/sample_mflix/metadata/models/Movies.hml similarity index 98% rename from fixtures/ddn/sample_mflix/models/Movies.hml rename to fixtures/hasura/sample_mflix/metadata/models/Movies.hml index a4c6f5de..29ff1c52 100644 --- a/fixtures/ddn/sample_mflix/models/Movies.hml +++ b/fixtures/hasura/sample_mflix/metadata/models/Movies.hml @@ -39,7 +39,7 @@ definition: - name: id type: Int! - name: rating - type: ExtendedJson + type: Double! - name: votes type: Int! graphql: @@ -73,7 +73,7 @@ definition: - name: numReviews type: Int! - name: rating - type: ExtendedJson + type: Double! graphql: typeName: MoviesTomatoesCritic inputTypeName: MoviesTomatoesCriticInput @@ -101,11 +101,11 @@ definition: name: MoviesTomatoesViewer fields: - name: meter - type: Int! + type: Int - name: numReviews type: Int! - name: rating - type: ExtendedJson + type: Double! graphql: typeName: MoviesTomatoesViewer inputTypeName: MoviesTomatoesViewerInput @@ -190,7 +190,7 @@ definition: - name: awards type: MoviesAwards! - name: cast - type: "[String!]!" + type: "[String!]" - name: countries type: "[String!]!" - name: directors @@ -202,7 +202,7 @@ definition: - name: imdb type: MoviesImdb! - name: languages - type: "[String!]!" + type: "[String!]" - name: lastupdated type: String! - name: metacritic @@ -216,9 +216,9 @@ definition: - name: rated type: String - name: released - type: Date! + type: Date - name: runtime - type: Int! + type: Int - name: title type: String! - name: tomatoes @@ -226,7 +226,7 @@ definition: - name: type type: String! - name: writers - type: "[String!]!" + type: "[String!]" - name: year type: Int! graphql: diff --git a/fixtures/ddn/sample_mflix/models/Sessions.hml b/fixtures/hasura/sample_mflix/metadata/models/Sessions.hml similarity index 100% rename from fixtures/ddn/sample_mflix/models/Sessions.hml rename to fixtures/hasura/sample_mflix/metadata/models/Sessions.hml diff --git a/fixtures/ddn/sample_mflix/models/Theaters.hml b/fixtures/hasura/sample_mflix/metadata/models/Theaters.hml similarity index 99% rename from fixtures/ddn/sample_mflix/models/Theaters.hml rename to fixtures/hasura/sample_mflix/metadata/models/Theaters.hml index 0c534319..7620bb60 100644 --- a/fixtures/ddn/sample_mflix/models/Theaters.hml +++ b/fixtures/hasura/sample_mflix/metadata/models/Theaters.hml @@ -43,7 +43,7 @@ definition: name: TheatersLocationGeo fields: - name: coordinates - type: "[Float!]!" + type: "[Double!]!" - name: type type: String! graphql: diff --git a/fixtures/ddn/sample_mflix/models/TitleWordFrequency.hml b/fixtures/hasura/sample_mflix/metadata/models/TitleWordFrequency.hml similarity index 96% rename from fixtures/ddn/sample_mflix/models/TitleWordFrequency.hml rename to fixtures/hasura/sample_mflix/metadata/models/TitleWordFrequency.hml index a1a58c7e..19d781e2 100644 --- a/fixtures/ddn/sample_mflix/models/TitleWordFrequency.hml +++ b/fixtures/hasura/sample_mflix/metadata/models/TitleWordFrequency.hml @@ -77,6 +77,7 @@ definition: uniqueIdentifier: - word orderByExpressionType: TitleWordFrequencyOrderBy + description: words appearing in movie titles with counts --- kind: ModelPermissions diff --git a/fixtures/ddn/sample_mflix/models/Users.hml b/fixtures/hasura/sample_mflix/metadata/models/Users.hml similarity index 75% rename from fixtures/ddn/sample_mflix/models/Users.hml rename to fixtures/hasura/sample_mflix/metadata/models/Users.hml index 48ba8510..ae9324b7 100644 --- a/fixtures/ddn/sample_mflix/models/Users.hml +++ b/fixtures/hasura/sample_mflix/metadata/models/Users.hml @@ -12,6 +12,8 @@ definition: type: String! - name: password type: String! + - name: preferences + type: UsersPreferences graphql: typeName: Users inputTypeName: UsersInput @@ -31,6 +33,9 @@ definition: password: column: name: password + preferences: + column: + name: preferences --- kind: TypePermissions @@ -45,6 +50,7 @@ definition: - email - name - password + - preferences - role: user output: allowedFields: @@ -73,6 +79,9 @@ definition: - fieldName: password operators: enableAll: true + - fieldName: preferences + operators: + enableAll: true graphql: typeName: UsersBoolExp @@ -99,6 +108,9 @@ definition: - fieldName: password orderByDirections: enableAll: true + - fieldName: preferences + orderByDirections: + enableAll: true graphql: selectMany: queryRootField: users @@ -119,9 +131,33 @@ definition: filter: null - role: user select: - filter: + filter: fieldComparison: field: id operator: _eq - value: + value: sessionVariable: x-hasura-user-id + +--- +kind: ObjectType +version: v1 +definition: + name: UsersPreferences + fields: [] + graphql: + typeName: SampleMflix_UsersPreferences + inputTypeName: SampleMflix_UsersPreferencesInput + dataConnectorTypeMapping: + - dataConnectorName: sample_mflix + dataConnectorObjectType: users_preferences + +--- +kind: TypePermissions +version: v1 +definition: + typeName: UsersPreferences + permissions: + - role: admin + output: + allowedFields: [] + diff --git a/fixtures/ddn/sample_mflix/relationships/movie_comments.hml b/fixtures/hasura/sample_mflix/metadata/relationships/movie_comments.hml similarity index 100% rename from fixtures/ddn/sample_mflix/relationships/movie_comments.hml rename to fixtures/hasura/sample_mflix/metadata/relationships/movie_comments.hml diff --git a/fixtures/ddn/sample_mflix/relationships/user_comments.hml b/fixtures/hasura/sample_mflix/metadata/relationships/user_comments.hml similarity index 100% rename from fixtures/ddn/sample_mflix/relationships/user_comments.hml rename to fixtures/hasura/sample_mflix/metadata/relationships/user_comments.hml diff --git a/fixtures/ddn/sample_mflix/dataconnectors/sample_mflix-types.hml b/fixtures/hasura/sample_mflix/metadata/sample_mflix-types.hml similarity index 88% rename from fixtures/ddn/sample_mflix/dataconnectors/sample_mflix-types.hml rename to fixtures/hasura/sample_mflix/metadata/sample_mflix-types.hml index dd8459ea..423f0a71 100644 --- a/fixtures/ddn/sample_mflix/dataconnectors/sample_mflix-types.hml +++ b/fixtures/hasura/sample_mflix/metadata/sample_mflix-types.hml @@ -6,14 +6,6 @@ definition: graphql: typeName: ObjectId ---- -kind: ScalarType -version: v1 -definition: - name: Date - graphql: - typeName: Date - --- kind: DataConnectorScalarRepresentation version: v1 @@ -24,6 +16,14 @@ definition: graphql: comparisonExpressionTypeName: ObjectIdComparisonExp +--- +kind: ScalarType +version: v1 +definition: + name: Date + graphql: + typeName: Date + --- kind: DataConnectorScalarRepresentation version: v1 @@ -72,12 +72,22 @@ definition: graphql: comparisonExpressionTypeName: ExtendedJsonComparisonExp +--- +kind: ScalarType +version: v1 +definition: + name: Double + graphql: + typeName: Double + --- kind: DataConnectorScalarRepresentation version: v1 definition: dataConnectorName: sample_mflix - dataConnectorScalarType: Float - representation: Float + dataConnectorScalarType: Double + representation: Double graphql: - comparisonExpressionTypeName: FloatComparisonExp + comparisonExpressionTypeName: DoubleComparisonExp + + diff --git a/fixtures/ddn/sample_mflix/dataconnectors/sample_mflix.hml b/fixtures/hasura/sample_mflix/metadata/sample_mflix.hml similarity index 89% rename from fixtures/ddn/sample_mflix/dataconnectors/sample_mflix.hml rename to fixtures/hasura/sample_mflix/metadata/sample_mflix.hml index 762746bb..66d3e245 100644 --- a/fixtures/ddn/sample_mflix/dataconnectors/sample_mflix.hml +++ b/fixtures/hasura/sample_mflix/metadata/sample_mflix.hml @@ -3,8 +3,11 @@ version: v1 definition: name: sample_mflix url: - singleUrl: - value: http://localhost:7131 + readWriteUrls: + read: + valueFromEnv: SAMPLE_MFLIX_CONNECTOR_URL + write: + valueFromEnv: SAMPLE_MFLIX_CONNECTOR_URL schema: version: v0.1 schema: @@ -23,7 +26,9 @@ definition: argument_type: type: named name: BinData - Boolean: + Bool: + representation: + type: boolean aggregate_functions: count: result_type: @@ -36,8 +41,10 @@ definition: type: custom argument_type: type: named - name: Boolean + name: Bool Date: + representation: + type: timestamp aggregate_functions: count: result_type: @@ -94,6 +101,8 @@ definition: type: named name: DbPointer Decimal: + representation: + type: bigdecimal aggregate_functions: avg: result_type: @@ -143,15 +152,14 @@ definition: argument_type: type: named name: Decimal - ExtendedJSON: - aggregate_functions: {} - comparison_operators: {} - Float: + Double: + representation: + type: float64 aggregate_functions: avg: result_type: type: named - name: Float + name: Double count: result_type: type: named @@ -159,15 +167,15 @@ definition: max: result_type: type: named - name: Float + name: Double min: result_type: type: named - name: Float + name: Double sum: result_type: type: named - name: Float + name: Double comparison_operators: _eq: type: equal @@ -175,28 +183,35 @@ definition: type: custom argument_type: type: named - name: Float + name: Double _gte: type: custom argument_type: type: named - name: Float + name: Double _lt: type: custom argument_type: type: named - name: Float + name: Double _lte: type: custom argument_type: type: named - name: Float + name: Double _neq: type: custom argument_type: type: named - name: Float + name: Double + ExtendedJSON: + representation: + type: json + aggregate_functions: {} + comparison_operators: {} Int: + representation: + type: int32 aggregate_functions: avg: result_type: @@ -261,6 +276,8 @@ definition: name: Int comparison_operators: {} Long: + representation: + type: int64 aggregate_functions: avg: result_type: @@ -353,6 +370,8 @@ definition: type: named name: "Null" ObjectId: + representation: + type: string aggregate_functions: count: result_type: @@ -374,6 +393,8 @@ definition: name: Int comparison_operators: {} String: + representation: + type: string aggregate_functions: count: result_type: @@ -496,6 +517,22 @@ definition: type: named name: Undefined object_types: + Hello: + fields: + __value: + type: + type: named + name: String + TitleWordFrequency: + fields: + _id: + type: + type: named + name: String + count: + type: + type: named + name: Int comments: fields: _id: @@ -534,10 +571,12 @@ definition: name: movies_awards cast: type: - type: array - element_type: - type: named - name: String + type: nullable + underlying_type: + type: array + element_type: + type: named + name: String countries: type: type: array @@ -568,10 +607,12 @@ definition: name: movies_imdb languages: type: - type: array - element_type: - type: named - name: String + type: nullable + underlying_type: + type: array + element_type: + type: named + name: String lastupdated: type: type: named @@ -608,12 +649,16 @@ definition: name: String released: type: - type: named - name: Date + type: nullable + underlying_type: + type: named + name: Date runtime: type: - type: named - name: Int + type: nullable + underlying_type: + type: named + name: Int title: type: type: named @@ -630,10 +675,12 @@ definition: name: String writers: type: - type: array - element_type: - type: named - name: String + type: nullable + underlying_type: + type: array + element_type: + type: named + name: String year: type: type: named @@ -660,10 +707,8 @@ definition: name: Int rating: type: - type: nullable - underlying_type: - type: named - name: Double + type: named + name: Double votes: type: type: named @@ -738,26 +783,24 @@ definition: name: Int rating: type: - type: nullable - underlying_type: - type: named - name: Double + type: named + name: Double movies_tomatoes_viewer: fields: meter: type: - type: named - name: Int + type: nullable + underlying_type: + type: named + name: Int numReviews: type: type: named name: Int rating: type: - type: nullable - underlying_type: - type: named - name: Double + type: named + name: Double sessions: fields: _id: @@ -827,7 +870,7 @@ definition: type: array element_type: type: named - name: Float + name: Double type: type: type: named @@ -850,10 +893,14 @@ definition: type: type: named name: String - TitleWordFrequency: - fields: - _id: { type: { type: named, name: String } } - count: { type: { type: named, name: Int } } + preferences: + type: + type: nullable + underlying_type: + type: named + name: users_preferences + users_preferences: + fields: {} collections: - name: comments arguments: {} @@ -887,35 +934,45 @@ definition: unique_columns: - _id foreign_keys: {} - - name: users + - name: title_word_frequency + description: words appearing in movie titles with counts arguments: {} - type: users + type: TitleWordFrequency uniqueness_constraints: - users_id: + title_word_frequency_id: unique_columns: - _id foreign_keys: {} - - name: title_word_frequency + - name: users arguments: {} - type: TitleWordFrequency + type: users uniqueness_constraints: - title_word_frequency_id: + users_id: unique_columns: - _id foreign_keys: {} functions: - name: hello description: Basic test of native queries - result_type: { type: named, name: String } arguments: - name: { type: { type: named, name: String } } + name: + type: + type: named + name: String + result_type: + type: named + name: String procedures: [] capabilities: - version: 0.1.1 + version: 0.1.4 capabilities: query: aggregates: {} variables: {} explain: {} + nested_fields: + filter_by: {} + order_by: {} mutation: {} - relationships: {} + relationships: + relation_comparisons: {} diff --git a/fixtures/hasura/sample_mflix/subgraph.yaml b/fixtures/hasura/sample_mflix/subgraph.yaml new file mode 100644 index 00000000..6b571d44 --- /dev/null +++ b/fixtures/hasura/sample_mflix/subgraph.yaml @@ -0,0 +1,8 @@ +kind: Subgraph +version: v1 +definition: + generator: + rootPath: . + includePaths: + - metadata + name: sample_mflix diff --git a/fixtures/hasura/supergraph.yaml b/fixtures/hasura/supergraph.yaml new file mode 100644 index 00000000..94840e70 --- /dev/null +++ b/fixtures/hasura/supergraph.yaml @@ -0,0 +1,7 @@ +kind: Supergraph +version: v2 +definition: + subgraphs: + - globals/subgraph.local.yaml + - chinook/subgraph.local.yaml + - sample_mflix/subgraph.local.yaml