From 619086260e30611bc7f8a27526bd76f024239dbc Mon Sep 17 00:00:00 2001 From: Gil Mizrahi Date: Tue, 30 Apr 2024 11:44:54 +0300 Subject: [PATCH] use the v3 engine metadata.json instead of maintaining a local one (#445) ### What The v3-engine metadata.json we maintain is this repo keeps getting out of date. This PR removes it completely, and uses a configuration that is maintain in v3 engine instead, which is used in tests, which means it is maintained. --- justfile | 2 +- static/postgres/chinook-metadata.json | 1389 ------------------------- 2 files changed, 1 insertion(+), 1390 deletions(-) delete mode 100644 static/postgres/chinook-metadata.json diff --git a/justfile b/justfile index 19ac4eb7f..d64f4acdc 100644 --- a/justfile +++ b/justfile @@ -233,7 +233,7 @@ run-engine: start-dependencies cargo run \ --manifest-path {{ HGE_V3_DIR }}/Cargo.toml \ --bin engine -- \ - --metadata-path ./static/postgres/chinook-metadata.json \ + --metadata-path {{ HGE_V3_DIR }}/crates/engine/tests/schema.json \ --authn-config-path ./static/auth_config.json # run a standard request to check the service correctly integrates with the engine. diff --git a/static/postgres/chinook-metadata.json b/static/postgres/chinook-metadata.json deleted file mode 100644 index 4aa77947f..000000000 --- a/static/postgres/chinook-metadata.json +++ /dev/null @@ -1,1389 +0,0 @@ -[ - { - "definition": { - "name": "db", - "url": { - "singleUrl": { - "value": "http://localhost:8080" - } - }, - "schema": { - "version": "v0.1", - "schema": { - "scalar_types": { - "varchar": { - "aggregate_functions": {}, - "comparison_operators": { - "_neq": { - "argument_type": { - "type": "named", - "name": "varchar" - }, - "type": "custom" - }, - "_gt": { - "argument_type": { - "type": "named", - "name": "varchar" - }, - "type": "custom" - }, - "_gte": { - "argument_type": { - "type": "named", - "name": "varchar" - }, - "type": "custom" - }, - "_lt": { - "argument_type": { - "type": "named", - "name": "varchar" - }, - "type": "custom" - }, - "_lte": { - "argument_type": { - "type": "named", - "name": "varchar" - }, - "type": "custom" - }, - "_like": { - "argument_type": { - "type": "named", - "name": "varchar" - }, - "type": "custom" - }, - "_ilike": { - "argument_type": { - "type": "named", - "name": "varchar" - }, - "type": "custom" - }, - "_nlike": { - "argument_type": { - "type": "named", - "name": "varchar" - }, - "type": "custom" - }, - "_nilike": { - "argument_type": { - "type": "named", - "name": "varchar" - }, - "type": "custom" - }, - "_regex": { - "argument_type": { - "type": "named", - "name": "varchar" - }, - "type": "custom" - }, - "_iregex": { - "argument_type": { - "type": "named", - "name": "varchar" - }, - "type": "custom" - }, - "_nregex": { - "argument_type": { - "type": "named", - "name": "varchar" - }, - "type": "custom" - }, - "_niregex": { - "argument_type": { - "type": "named", - "name": "varchar" - }, - "type": "custom" - }, - "_similar": { - "argument_type": { - "type": "named", - "name": "varchar" - }, - "type": "custom" - }, - "_nsimilar": { - "argument_type": { - "type": "named", - "name": "varchar" - }, - "type": "custom" - }, - "_eq": { - "type": "equal" - } - }, - "update_operators": {} - }, - "int4": { - "aggregate_functions": { - "min": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int4" - } - } - }, - "max": { - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "int4" - } - } - } - }, - "comparison_operators": { - "_gt": { - "argument_type": { - "type": "named", - "name": "int4" - }, - "type": "custom" - }, - "_gte": { - "argument_type": { - "type": "named", - "name": "int4" - }, - "type": "custom" - }, - "_lt": { - "argument_type": { - "type": "named", - "name": "int4" - }, - "type": "custom" - }, - "_lte": { - "argument_type": { - "type": "named", - "name": "int4" - }, - "type": "custom" - }, - "_neq": { - "argument_type": { - "type": "named", - "name": "int4" - }, - "type": "custom" - }, - "_eq": { - "type": "equal" - } - }, - "update_operators": {} - } - }, - "object_types": { - "Artist": { - "description": "An artist", - "fields": { - "ArtistId": { - "description": "The artist's primary key", - "arguments": {}, - "type": { - "type": "named", - "name": "int4" - } - }, - "Name": { - "description": "The artist's name", - "arguments": {}, - "type": { - "type": "named", - "name": "varchar" - } - } - } - }, - "Album": { - "description": "An album", - "fields": { - "AlbumId": { - "description": "The album's primary key", - "arguments": {}, - "type": { - "type": "named", - "name": "int4" - } - }, - "Title": { - "description": "The album's title", - "arguments": {}, - "type": { - "type": "named", - "name": "varchar" - } - }, - "ArtistId": { - "description": "The album's artist ID", - "arguments": {}, - "type": { - "type": "named", - "name": "int4" - } - } - } - }, - "Track": { - "description": "A track", - "fields": { - "TrackId": { - "description": "The track's primary key", - "arguments": {}, - "type": { - "type": "named", - "name": "int4" - } - }, - "Name": { - "description": "The track's name", - "arguments": {}, - "type": { - "type": "named", - "name": "varchar" - } - }, - "AlbumId": { - "description": "The track's album ID", - "arguments": {}, - "type": { - "type": "named", - "name": "int4" - } - } - } - }, - "artist_below_id": { - "description": "An artist", - "fields": { - "ArtistId": { - "description": "The artist's primary key", - "arguments": {}, - "type": { - "type": "named", - "name": "int4" - } - }, - "Name": { - "description": "The artist's name", - "arguments": {}, - "type": { - "type": "named", - "name": "varchar" - } - } - } - }, - "v1_insert_custom_dog_object": { - "description": "A dog", - "fields": { - "name": { - "description": "The dog's name", - "arguments": {}, - "type": { - "type": "named", - "name": "text" - } - }, - "birthday": { - "description": "The dog's birthday", - "arguments": {}, - "type": { - "type": "named", - "name": "date" - } - }, - "height_cm": { - "description": "The dog's height in centimeters", - "arguments": {}, - "type": { - "type": "named", - "name": "numeric" - } - }, - "adopter_name": { - "description": "The dog's adopter's name", - "arguments": {}, - "type": { - "type": "named", - "name": "text" - } - } - } - }, - "custom_dog": { - "description": "A dog", - "fields": { - "id": { - "description": "The dog's id", - "arguments": {}, - "type": { - "type": "named", - "name": "int8" - } - }, - "name": { - "description": "The dog's name", - "arguments": {}, - "type": { - "type": "named", - "name": "text" - } - }, - "birthday": { - "description": "The dog's birthday", - "arguments": {}, - "type": { - "type": "named", - "name": "date" - } - }, - "height_cm": { - "description": "The dog's height in centimeters", - "arguments": {}, - "type": { - "type": "named", - "name": "numeric" - } - }, - "height_in": { - "description": "The dog's height in inches", - "arguments": {}, - "type": { - "type": "named", - "name": "numeric" - } - }, - "adopter_name": { - "description": "The dog's adopter's name", - "arguments": {}, - "type": { - "type": "named", - "name": "text" - } - } - } - } - }, - "collections": [ - { - "name": "Artist", - "description": "A collection of artists", - "arguments": {}, - "type": "Artist", - "deletable": false, - "uniqueness_constraints": { - "ArtistById": { - "unique_columns": ["ArtistId"] - } - }, - "foreign_keys": {} - }, - { - "name": "Album", - "description": "A collection of albums", - "arguments": {}, - "type": "Album", - "deletable": false, - "uniqueness_constraints": { - "AlbumById": { - "unique_columns": ["AlbumId"] - } - }, - "foreign_keys": {} - }, - { - "name": "Track", - "description": "A collection of tracks", - "arguments": {}, - "type": "Track", - "deletable": false, - "uniqueness_constraints": { - "TrackById": { - "unique_columns": ["TrackId"] - } - }, - "foreign_keys": {} - }, - { - "name": "artist_below_id", - "description": "A collection of artists below a certain id", - "arguments": { - "id": { - "description": "The ceiling id", - "type": { - "type": "named", - "name": "int4" - } - } - }, - "type": "Artist", - "deletable": false, - "uniqueness_constraints": {}, - "foreign_keys": {} - } - ], - "functions": [], - "procedures": [ - { - "name": "insert_artist", - "description": "Insert an artist", - "arguments": { - "id": { - "description": "The id of the artist to insert", - "type": { - "type": "named", - "name": "Int!" - } - }, - "name": { - "description": "The name of the artist to insert", - "type": { - "type": "named", - "name": "String!" - } - } - }, - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "array", - "element_type": { - "type": "named", - "name": "Artist" - } - } - } - }, - { - "name": "v1_insert_custom_dog", - "description": "Insert a dog", - "arguments": { - "_object": { - "description": "The dog to insert", - "type": { - "type": "named", - "name": "v1_insert_custom_dog_object" - } - } - }, - "result_type": { - "type": "nullable", - "underlying_type": { - "type": "array", - "element_type": { - "type": "named", - "name": "custom_dog" - } - } - } - } - ] - }, - "capabilities": { - "version": "0.1.0", - "capabilities": { - "query": { - "aggregates": {}, - "variables": {}, - "explain": {} - }, - "mutation": { - "transactional": {}, - "explain": {} - }, - "relationships": { - "relation_comparisons": {}, - "order_by_aggregate": {} - } - } - } - } - }, - "version": "v1", - "kind": "DataConnectorLink" - }, - { - "definition": { - "name": "v1_insert_custom_dog_object", - "fields": [ - { - "name": "name", - "type": "String!" - }, - { - "name": "birthday", - "type": "String" - }, - { - "name": "adopter_name", - "type": "String" - }, - { - "name": "height_cm", - "type": "Int!" - } - ], - "graphql": { - "typeName": "v1_insert_custom_dog_object", - "inputTypeName": "v1_insert_custom_dog_objectInput" - } - }, - "version": "v1", - "kind": "ObjectType" - }, - { - "definition": { - "name": "custom_dog", - "fields": [ - { - "name": "id", - "type": "Int" - }, - { - "name": "name", - "type": "String" - }, - { - "name": "birthday", - "type": "String" - }, - { - "name": "adopter_name", - "type": "String" - }, - { - "name": "height_cm", - "type": "Int" - }, - { - "name": "height_in", - "type": "Int" - } - ], - "graphql": { - "typeName": "custom_dog" - } - }, - "version": "v1", - "kind": "ObjectType" - }, - { - "definition": { - "name": "Artist", - "fields": [ - { - "name": "ArtistId", - "type": "Int" - }, - { - "name": "Name", - "type": "String" - } - ], - "graphql": { - "typeName": "Artist" - } - }, - "version": "v1", - "kind": "ObjectType" - }, - { - "definition": { - "name": "Album", - "fields": [ - { - "name": "AlbumId", - "type": "Int" - }, - { - "name": "Title", - "type": "String" - }, - { - "name": "ArtistId", - "type": "Int" - } - ], - "graphql": { - "typeName": "Album" - } - }, - "version": "v1", - "kind": "ObjectType" - }, - { - "definition": { - "name": "Track", - "fields": [ - { - "name": "TrackId", - "type": "Int" - }, - { - "name": "Name", - "type": "String" - }, - { - "name": "AlbumId", - "type": "Int" - } - ], - "graphql": { - "typeName": "Track" - } - }, - "version": "v1", - "kind": "ObjectType" - }, - { - "definition": { - "name": "artist_below_id", - "fields": [ - { - "name": "ArtistId", - "type": "Int" - }, - { - "name": "Name", - "type": "String" - } - ], - "graphql": { - "typeName": "ArtistBelowId" - } - }, - "version": "v1", - "kind": "ObjectType" - }, - { - "definition": { - "name": "Artists", - "objectType": "Artist", - "source": { - "dataConnectorName": "db", - "collection": "Artist", - "typeMapping": { - "Artist": { - "fieldMapping": { - "ArtistId": { - "column": "ArtistId" - }, - "Name": { - "column": "Name" - } - } - } - } - }, - "graphql": { - "selectUniques": [ - { - "queryRootField": "ArtistByID", - "uniqueIdentifier": ["ArtistId"] - } - ], - "selectMany": { - "queryRootField": "Artist" - }, - "filterExpressionType": "Artist_Where_Exp", - "orderByExpressionType": "Artist_Order_By" - }, - "filterableFields": [ - { - "fieldName": "ArtistId", - "operators": { - "enableAll": true - } - }, - { - "fieldName": "Name", - "operators": { - "enableAll": true - } - } - ], - "orderableFields": [ - { - "fieldName": "ArtistId", - "orderByDirections": { - "enableAll": true - } - }, - { - "fieldName": "Name", - "orderByDirections": { - "enableAll": true - } - } - ] - }, - "version": "v1", - "kind": "Model" - }, - { - "definition": { - "name": "Albums", - "objectType": "Album", - "source": { - "dataConnectorName": "db", - "collection": "Album", - "typeMapping": { - "Album": { - "fieldMapping": { - "AlbumId": { - "column": "AlbumId" - }, - "Title": { - "column": "Title" - }, - "ArtistId": { - "column": "ArtistId" - } - } - } - } - }, - "graphql": { - "selectUniques": [ - { - "queryRootField": "AlbumByID", - "uniqueIdentifier": ["AlbumId"] - } - ], - "selectMany": { - "queryRootField": "Album" - }, - "filterExpressionType": "Album_Where_Exp", - "orderByExpressionType": "Album_Order_By" - }, - "filterableFields": [ - { - "fieldName": "AlbumId", - "operators": { - "enableAll": true - } - }, - { - "fieldName": "Title", - "operators": { - "enableAll": true - } - }, - { - "fieldName": "ArtistId", - "operators": { - "enableAll": true - } - } - ], - "orderableFields": [ - { - "fieldName": "AlbumId", - "orderByDirections": { - "enableAll": true - } - }, - { - "fieldName": "Title", - "orderByDirections": { - "enableAll": true - } - }, - { - "fieldName": "ArtistId", - "orderByDirections": { - "enableAll": true - } - } - ] - }, - "version": "v1", - "kind": "Model" - }, - { - "definition": { - "name": "Tracks", - "objectType": "Track", - "source": { - "dataConnectorName": "db", - "collection": "Track", - "typeMapping": { - "Track": { - "fieldMapping": { - "TrackId": { - "column": "TrackId" - }, - "Name": { - "column": "Name" - }, - "AlbumId": { - "column": "AlbumId" - } - } - } - } - }, - "graphql": { - "selectUniques": [ - { - "queryRootField": "TrackByID", - "uniqueIdentifier": ["TrackId"] - } - ], - "selectMany": { - "queryRootField": "Track" - }, - "filterExpressionType": "Track_Where_Exp", - "orderByExpressionType": "Track_Order_By" - }, - "filterableFields": [ - { - "fieldName": "TrackId", - "operators": { - "enableAll": true - } - }, - { - "fieldName": "Name", - "operators": { - "enableAll": true - } - }, - { - "fieldName": "AlbumId", - "operators": { - "enableAll": true - } - } - ], - "orderableFields": [ - { - "fieldName": "TrackId", - "orderByDirections": { - "enableAll": true - } - }, - { - "fieldName": "Name", - "orderByDirections": { - "enableAll": true - } - }, - { - "fieldName": "AlbumId", - "orderByDirections": { - "enableAll": true - } - } - ] - }, - "version": "v1", - "kind": "Model" - }, - { - "definition": { - "name": "artist_below_id", - "objectType": "artist_below_id", - "arguments": [ - { - "name": "id", - "type": "Int!" - } - ], - "source": { - "dataConnectorName": "db", - "collection": "artist_below_id", - "typeMapping": { - "Artist": { - "fieldMapping": { - "ArtistId": { - "column": "ArtistId" - }, - "Name": { - "column": "Name" - } - } - } - }, - "argumentMapping": { - "id": "id" - } - }, - "graphql": { - "selectUniques": [], - "selectMany": { - "queryRootField": "artist_below_id" - }, - "filterExpressionType": "artist_below_id_Where_Exp", - "orderByExpressionType": "artist_below_id_Order_By", - "argumentsInputType": "artist_below_id_Args" - }, - "filterableFields": [ - { - "fieldName": "ArtistId", - "operators": { - "enableAll": true - } - }, - { - "fieldName": "Name", - "operators": { - "enableAll": true - } - } - ], - "orderableFields": [ - { - "fieldName": "ArtistId", - "orderByDirections": { - "enableAll": true - } - }, - { - "fieldName": "Name", - "orderByDirections": { - "enableAll": true - } - } - ] - }, - "version": "v1", - "kind": "Model" - }, - { - "kind": "CommandPermissions", - "version": "v1", - "definition": { - "commandName": "v1_insert_custom_dog", - "permissions": [ - { - "role": "admin", - "allowExecution": true - } - ] - } - }, - { - "kind": "Command", - "version": "v1", - "definition": { - "name": "v1_insert_custom_dog", - "arguments": [ - { - "name": "_object", - "type": "v1_insert_custom_dog_object" - } - ], - "outputType": "[custom_dog]", - "source": { - "dataConnectorName": "db", - "dataConnectorCommand": { - "procedure": "v1_insert_custom_dog" - }, - "typeMapping": { - "custom_dog": { - "fieldMapping": { - "id": { - "column": "id" - }, - "name": { - "column": "name" - }, - "birthday": { - "column": "birthday" - }, - "height_cm": { - "column": "height_cm" - }, - "height_in": { - "column": "height_in" - }, - "adopter_name": { - "column": "adopter_name" - } - } - } - }, - "argumentMapping": { - "_object": "_object" - } - }, - "graphql": { - "rootFieldName": "v1_insert_custom_dog", - "rootFieldKind": "Mutation" - } - } - }, - { - "kind": "CommandPermissions", - "version": "v1", - "definition": { - "commandName": "insert_artist", - "permissions": [ - { - "role": "admin", - "allowExecution": true - }, - { - "role": "user", - "allowExecution": true - } - ] - } - }, - { - "kind": "Command", - "version": "v1", - "definition": { - "name": "insert_artist", - "arguments": [ - { - "name": "id", - "type": "Int!" - }, - { - "name": "name", - "type": "String!" - } - ], - "outputType": "[Artist]", - "source": { - "dataConnectorName": "db", - "dataConnectorCommand": { - "procedure": "insert_artist" - }, - "typeMapping": { - "Artist": { - "fieldMapping": { - "ArtistId": { - "column": "ArtistId" - }, - "Name": { - "column": "Name" - } - } - } - }, - "argumentMapping": { - "id": "id", - "name": "name" - } - }, - "graphql": { - "rootFieldName": "insert_artist", - "rootFieldKind": "Mutation" - } - } - }, - { - "definition": { - "typeName": "custom_dog", - "permissions": [ - { - "role": "admin", - "output": { - "allowedFields": [ - "id", - "name", - "birthday", - "adopter_name", - "height_cm", - "height_in" - ] - } - } - ] - }, - "version": "v1", - "kind": "TypePermissions" - }, - { - "definition": { - "typeName": "Artist", - "permissions": [ - { - "role": "admin", - "output": { - "allowedFields": ["ArtistId", "Name"] - } - } - ] - }, - "version": "v1", - "kind": "TypePermissions" - }, - { - "definition": { - "typeName": "Album", - "permissions": [ - { - "role": "admin", - "output": { - "allowedFields": ["AlbumId", "Title", "ArtistId"] - } - } - ] - }, - "version": "v1", - "kind": "TypePermissions" - }, - { - "definition": { - "typeName": "Track", - "permissions": [ - { - "role": "admin", - "output": { - "allowedFields": ["TrackId", "Name", "AlbumId"] - } - } - ] - }, - "version": "v1", - "kind": "TypePermissions" - }, - { - "definition": { - "typeName": "artist_below_id", - "permissions": [ - { - "role": "admin", - "output": { - "allowedFields": ["ArtistId", "Name"] - } - } - ] - }, - "version": "v1", - "kind": "TypePermissions" - }, - { - "definition": { - "modelName": "Artists", - "permissions": [ - { - "role": "admin", - "select": { - "filter": null - } - } - ] - }, - "version": "v1", - "kind": "ModelPermissions" - }, - { - "definition": { - "modelName": "Albums", - "permissions": [ - { - "role": "admin", - "select": { - "filter": null - } - } - ] - }, - "version": "v1", - "kind": "ModelPermissions" - }, - { - "definition": { - "modelName": "Tracks", - "permissions": [ - { - "role": "admin", - "select": { - "filter": null - } - } - ] - }, - "version": "v1", - "kind": "ModelPermissions" - }, - { - "definition": { - "modelName": "artist_below_id", - "permissions": [ - { - "role": "admin", - "select": { - "filter": null - } - } - ] - }, - "version": "v1", - "kind": "ModelPermissions" - }, - { - "definition": { - "source": "Artist", - "name": "Albums", - "target": { - "model": { - "name": "Albums", - "relationshipType": "Array" - } - }, - "mapping": [ - { - "source": { - "fieldPath": [ - { - "fieldName": "ArtistId" - } - ] - }, - "target": { - "modelField": [ - { - "fieldName": "ArtistId" - } - ] - } - } - ] - }, - "version": "v1", - "kind": "Relationship" - }, - { - "definition": { - "source": "Album", - "name": "Tracks", - "target": { - "model": { - "name": "Tracks", - "relationshipType": "Array" - } - }, - "mapping": [ - { - "source": { - "fieldPath": [ - { - "fieldName": "AlbumId" - } - ] - }, - "target": { - "modelField": [ - { - "fieldName": "AlbumId" - } - ] - } - } - ] - }, - "version": "v1", - "kind": "Relationship" - }, - { - "definition": { - "source": "Album", - "name": "Artist", - "target": { - "model": { - "name": "Artists", - "relationshipType": "Object" - } - }, - "mapping": [ - { - "source": { - "fieldPath": [ - { - "fieldName": "ArtistId" - } - ] - }, - "target": { - "modelField": [ - { - "fieldName": "ArtistId" - } - ] - } - } - ] - }, - "version": "v1", - "kind": "Relationship" - }, - { - "definition": { - "source": "Track", - "name": "Album", - "target": { - "model": { - "name": "Albums", - "relationshipType": "Object" - } - }, - "mapping": [ - { - "source": { - "fieldPath": [ - { - "fieldName": "AlbumId" - } - ] - }, - "target": { - "modelField": [ - { - "fieldName": "AlbumId" - } - ] - } - } - ] - }, - "version": "v1", - "kind": "Relationship" - }, - { - "definition": { - "dataConnectorName": "db", - "dataConnectorScalarType": "int4", - "representation": "Int", - "graphql": { - "comparisonExpressionTypeName": "int4_comparison" - } - }, - "version": "v1", - "kind": "DataConnectorScalarRepresentation" - }, - { - "definition": { - "dataConnectorName": "db", - "representation": "String", - "dataConnectorScalarType": "varchar", - "graphql": { - "comparisonExpressionTypeName": "varchar_comparison" - } - }, - "version": "v1", - "kind": "DataConnectorScalarRepresentation" - } -]