diff --git a/CHANGELOG.md b/CHANGELOG.md index 158cd3ad155..017218e565d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - server: log locking DB queries during source catalog migration - server: fix to allow remote schema response to contain an "extensions" field (#7143) - console: add comments to tracked functions +- metadata SDK: add type definitions for config v3 ### Bug fixes and improvements (Add entries below in the order of server, console, cli, docs, others) diff --git a/contrib/metadata-types/config.yaml b/contrib/metadata-types/config.yaml index 3f0ecd0eb86..352dd9a5a44 100644 --- a/contrib/metadata-types/config.yaml +++ b/contrib/metadata-types/config.yaml @@ -5,11 +5,11 @@ selected_input_language: Typescript # Glob patterns for the target input files of selected language input_files: # Paths can be either a string, or an array of strings - JsonSchema: './src/types/**.schema.json' - Typescript: './src/types/**.ts' + # JsonSchema: './src/types/**.schema.json' + Typescript: "./src/types/**.ts" # Output file directory -output_directory: './generated' +output_directory: "./generated" # Quicktype config per-language # Config is an object of type "rendererOptions" @@ -32,10 +32,10 @@ quicktype_config: # objective-c: ~ # pike: ~ python: - python-version: '3.7' + python-version: "3.7" # ruby: ~ # rust: ~ schema: ~ # swift: ~ - typescript: - # just-types: true + # typescript: + # just-types: true diff --git a/contrib/metadata-types/generated/HasuraMetadataV2.go b/contrib/metadata-types/generated/HasuraMetadataV2.go index 178ea8b952a..a42aea22e66 100644 --- a/contrib/metadata-types/generated/HasuraMetadataV2.go +++ b/contrib/metadata-types/generated/HasuraMetadataV2.go @@ -988,15 +988,15 @@ type ObjectField struct { // // https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/manage-metadata.html#replace-metadata type HasuraMetadataV2 struct { - Actions []Action `json:"actions"` - Allowlist []AllowList `json:"allowlist"` - CronTriggers []CronTrigger `json:"cron_triggers"` - CustomTypes *CustomTypes `json:"custom_types,omitempty"` - Functions []CustomFunction `json:"functions"` - QueryCollections []QueryCollectionEntry `json:"query_collections"` - RemoteSchemas []RemoteSchema `json:"remote_schemas"` - Tables []TableEntry `json:"tables"` - Version float64 `json:"version"` + Actions []Action `json:"actions,omitempty"` + Allowlist []AllowList `json:"allowlist,omitempty"` + CronTriggers []CronTrigger `json:"cron_triggers,omitempty"` + CustomTypes *CustomTypes `json:"custom_types,omitempty"` + Functions []CustomFunction `json:"functions,omitempty"` + QueryCollections []QueryCollectionEntry `json:"query_collections,omitempty"` + RemoteSchemas []RemoteSchema `json:"remote_schemas,omitempty"` + Tables []TableEntry `json:"tables"` + Version float64 `json:"version"` } // @@ -1005,7 +1005,7 @@ type Action struct { Comment *string `json:"comment,omitempty"` // Comment Definition ActionDefinition `json:"definition"` // Definition of the action Name string `json:"name"` // Name of the action - Permissions *Permissions `json:"permissions,omitempty"`// Permissions of the action + Permissions []Permission `json:"permissions,omitempty"`// Permissions of the action } // Definition of the action @@ -1013,10 +1013,10 @@ type Action struct { // // https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#actiondefinition type ActionDefinition struct { - Arguments []InputArgument `json:"arguments"` + Arguments []InputArgument `json:"arguments,omitempty"` ForwardClientHeaders *bool `json:"forward_client_headers,omitempty"` Handler string `json:"handler"` // A String value which supports templating environment variables enclosed in {{ and }}.; Template example: https://{{ACTION_API_DOMAIN}}/create-user - Headers []Header `json:"headers"` + Headers []Header `json:"headers,omitempty"` Kind *string `json:"kind,omitempty"` OutputType *string `json:"output_type,omitempty"` Type *ActionDefinitionType `json:"type,omitempty"` @@ -1040,8 +1040,7 @@ type Header struct { ValueFromEnv *string `json:"value_from_env,omitempty"`// Name of the environment variable which holds the value of the header } -// Permissions of the action -type Permissions struct { +type Permission struct { Role string `json:"role"` } @@ -1076,10 +1075,10 @@ type RetryConfST struct { } type CustomTypes struct { - Enums []EnumType `json:"enums"` - InputObjects []InputObjectType `json:"input_objects"` - Objects []ObjectType `json:"objects"` - Scalars []ScalarType `json:"scalars"` + Enums []EnumType `json:"enums,omitempty"` + InputObjects []InputObjectType `json:"input_objects,omitempty"` + Objects []ObjectType `json:"objects,omitempty"` + Scalars []ScalarType `json:"scalars,omitempty"` } // @@ -1117,10 +1116,10 @@ type InputObjectField struct { // // https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objecttype type ObjectType struct { - Description *string `json:"description,omitempty"`// Description of the Input object type - Fields []InputObjectField `json:"fields"` // Fields of the Input object type - Name string `json:"name"` // Name of the Input object type - Relationships []CustomTypeObjectRelationship `json:"relationships"` // Relationships of the Object type to tables + Description *string `json:"description,omitempty"` // Description of the Input object type + Fields []InputObjectField `json:"fields"` // Fields of the Input object type + Name string `json:"name"` // Name of the Input object type + Relationships []CustomTypeObjectRelationship `json:"relationships,omitempty"`// Relationships of the Object type to tables } // @@ -1200,7 +1199,7 @@ type RemoteSchema struct { // https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#remoteschemadef type RemoteSchemaDef struct { ForwardClientHeaders *bool `json:"forward_client_headers,omitempty"` - Headers []Header `json:"headers"` + Headers []Header `json:"headers,omitempty"` TimeoutSeconds *float64 `json:"timeout_seconds,omitempty"` URL *string `json:"url,omitempty"` URLFromEnv *string `json:"url_from_env,omitempty"` @@ -1208,18 +1207,18 @@ type RemoteSchemaDef struct { // Representation of a table in metadata, 'tables.yaml' and 'metadata.json' type TableEntry struct { - ArrayRelationships []ArrayRelationship `json:"array_relationships"` - ComputedFields []ComputedField `json:"computed_fields"` - Configuration *TableConfig `json:"configuration,omitempty"`// Configuration for the table/view; ; https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config - DeletePermissions []DeletePermissionEntry `json:"delete_permissions"` - EventTriggers []EventTrigger `json:"event_triggers"` - InsertPermissions []InsertPermissionEntry `json:"insert_permissions"` - IsEnum *bool `json:"is_enum,omitempty"` - ObjectRelationships []ObjectRelationship `json:"object_relationships"` - RemoteRelationships []RemoteRelationship `json:"remote_relationships"` - SelectPermissions []SelectPermissionEntry `json:"select_permissions"` - Table QualifiedTable `json:"table"` - UpdatePermissions []UpdatePermissionEntry `json:"update_permissions"` + ArrayRelationships []ArrayRelationship `json:"array_relationships,omitempty"` + ComputedFields []ComputedField `json:"computed_fields,omitempty"` + Configuration *TableConfig `json:"configuration,omitempty"` // Configuration for the table/view; ; https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config + DeletePermissions []DeletePermissionEntry `json:"delete_permissions,omitempty"` + EventTriggers []EventTrigger `json:"event_triggers,omitempty"` + InsertPermissions []InsertPermissionEntry `json:"insert_permissions,omitempty"` + IsEnum *bool `json:"is_enum,omitempty"` + ObjectRelationships []ObjectRelationship `json:"object_relationships,omitempty"` + RemoteRelationships []RemoteRelationship `json:"remote_relationships,omitempty"` + SelectPermissions []SelectPermissionEntry `json:"select_permissions,omitempty"` + Table QualifiedTable `json:"table"` + UpdatePermissions []UpdatePermissionEntry `json:"update_permissions,omitempty"` } // @@ -1283,6 +1282,7 @@ type ComputedFieldDefinition struct { // https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config type TableConfig struct { CustomColumnNames map[string]string `json:"custom_column_names,omitempty"`// Customise the column names + CustomName *string `json:"custom_name,omitempty"` // Customise the table name CustomRootFields *CustomRootFields `json:"custom_root_fields,omitempty"` // Customise the root fields } @@ -1324,7 +1324,7 @@ type DeletePermission struct { // https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#create-event-trigger type EventTrigger struct { Definition EventTriggerDefinition `json:"definition"` // The SQL function - Headers []Header `json:"headers"` // The SQL function + Headers []Header `json:"headers,omitempty"` // The SQL function Name string `json:"name"` // Name of the event trigger RetryConf RetryConf `json:"retry_conf"` // The SQL function Webhook *string `json:"webhook,omitempty"` // The SQL function @@ -1437,7 +1437,7 @@ type SelectPermissionEntry struct { type SelectPermission struct { AllowAggregations *bool `json:"allow_aggregations,omitempty"`// Toggle allowing aggregate queries Columns *EventTriggerColumns `json:"columns"` // Only these columns are selectable (or all when '*' is specified) - ComputedFields []string `json:"computed_fields"` // Only these computed fields are selectable + ComputedFields []string `json:"computed_fields,omitempty"` // Only these computed fields are selectable Filter map[string]*Filter `json:"filter,omitempty"` // Only the rows where this precondition holds true are selectable Limit *int64 `json:"limit,omitempty"` // The maximum number of rows that can be returned } diff --git a/contrib/metadata-types/generated/HasuraMetadataV2.hs b/contrib/metadata-types/generated/HasuraMetadataV2.hs index 18bb4ef06e7..a521698dcee 100644 --- a/contrib/metadata-types/generated/HasuraMetadataV2.hs +++ b/contrib/metadata-types/generated/HasuraMetadataV2.hs @@ -74,7 +74,7 @@ module QuickType , InputArgument (..) , HasuraMetadataV2 (..) , Header (..) - , Permissions (..) + , Permission (..) , Definition (..) , RemoteFieldValue (..) , ActionDefinitionType (..) @@ -204,7 +204,7 @@ data Action = Action { commentAction :: Maybe Text , definitionAction :: ActionDefinition , nameAction :: Text - , permissionsAction :: Maybe Permissions + , permissionsAction :: Maybe (Vector Permission) } deriving (Show) {-| Definition of the action @@ -260,9 +260,8 @@ data Header = Header , valueFromEnvHeader :: Maybe Text } deriving (Show) -{-| Permissions of the action -} -data Permissions = Permissions - { rolePermissions :: Text +data Permission = Permission + { rolePermission :: Text } deriving (Show) {-| @@ -734,11 +733,15 @@ https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/tab customColumnNames: Customise the column names +customName: +Customise the table name + customRootFields: Customise the root fields -} data TableConfig = TableConfig { customColumnNamesTableConfig :: Maybe (HashMap Text Text) + , customNameTableConfig :: Maybe Text , customRootFieldsTableConfig :: Maybe CustomRootFields } deriving (Show) @@ -1500,14 +1503,14 @@ instance FromJSON Header where <*> v .:? "value" <*> v .:? "value_from_env" -instance ToJSON Permissions where - toJSON (Permissions rolePermissions) = +instance ToJSON Permission where + toJSON (Permission rolePermission) = object - [ "role" .= rolePermissions + [ "role" .= rolePermission ] -instance FromJSON Permissions where - parseJSON (Object v) = Permissions +instance FromJSON Permission where + parseJSON (Object v) = Permission <$> v .: "role" instance ToJSON AllowList where @@ -1927,15 +1930,17 @@ instance FromJSON ComputedFieldDefinition where <*> v .:? "table_argument" instance ToJSON TableConfig where - toJSON (TableConfig customColumnNamesTableConfig customRootFieldsTableConfig) = + toJSON (TableConfig customColumnNamesTableConfig customNameTableConfig customRootFieldsTableConfig) = object [ "custom_column_names" .= customColumnNamesTableConfig + , "custom_name" .= customNameTableConfig , "custom_root_fields" .= customRootFieldsTableConfig ] instance FromJSON TableConfig where parseJSON (Object v) = TableConfig <$> v .:? "custom_column_names" + <*> v .:? "custom_name" <*> v .:? "custom_root_fields" instance ToJSON CustomRootFields where diff --git a/contrib/metadata-types/generated/HasuraMetadataV2.json b/contrib/metadata-types/generated/HasuraMetadataV2.json index dae4a04bee1..13a2196cd60 100644 --- a/contrib/metadata-types/generated/HasuraMetadataV2.json +++ b/contrib/metadata-types/generated/HasuraMetadataV2.json @@ -71,6 +71,11 @@ "title": "TableConfig", "type": "object", "properties": { + "custom_name": { + "description": "Customise the table name", + "type": "string", + "title": "custom_name" + }, "custom_root_fields": { "description": "Customise the root fields", "$ref": "#/definitions/CustomRootFields", @@ -1672,16 +1677,19 @@ }, "permissions": { "description": "Permissions of the action", - "type": "object", - "properties": { - "role": { - "type": "string", - "title": "role" - } + "type": "array", + "items": { + "type": "object", + "properties": { + "role": { + "type": "string", + "title": "role" + } + }, + "required": [ + "role" + ] }, - "required": [ - "role" - ], "title": "permissions" } }, diff --git a/contrib/metadata-types/generated/HasuraMetadataV2.py b/contrib/metadata-types/generated/HasuraMetadataV2.py index c29f4dcc82c..ea6850b78c6 100644 --- a/contrib/metadata-types/generated/HasuraMetadataV2.py +++ b/contrib/metadata-types/generated/HasuraMetadataV2.py @@ -321,15 +321,14 @@ class ActionDefinition: @dataclass -class Permissions: - """Permissions of the action""" +class Permission: role: str @staticmethod - def from_dict(obj: Any) -> 'Permissions': + def from_dict(obj: Any) -> 'Permission': assert isinstance(obj, dict) role = from_str(obj.get("role")) - return Permissions(role) + return Permission(role) def to_dict(self) -> dict: result: dict = {} @@ -349,7 +348,7 @@ class Action: """Comment""" comment: Optional[str] = None """Permissions of the action""" - permissions: Optional[Permissions] = None + permissions: Optional[List[Permission]] = None @staticmethod def from_dict(obj: Any) -> 'Action': @@ -357,7 +356,7 @@ class Action: definition = ActionDefinition.from_dict(obj.get("definition")) name = from_str(obj.get("name")) comment = from_union([from_str, from_none], obj.get("comment")) - permissions = from_union([Permissions.from_dict, from_none], obj.get("permissions")) + permissions = from_union([lambda x: from_list(Permission.from_dict, x), from_none], obj.get("permissions")) return Action(definition, name, comment, permissions) def to_dict(self) -> dict: @@ -365,7 +364,7 @@ class Action: result["definition"] = to_class(ActionDefinition, self.definition) result["name"] = from_str(self.name) result["comment"] = from_union([from_str, from_none], self.comment) - result["permissions"] = from_union([lambda x: to_class(Permissions, x), from_none], self.permissions) + result["permissions"] = from_union([lambda x: from_list(lambda x: to_class(Permission, x), x), from_none], self.permissions) return result @@ -1166,6 +1165,8 @@ class TableConfig: """ """Customise the column names""" custom_column_names: Optional[Dict[str, str]] = None + """Customise the table name""" + custom_name: Optional[str] = None """Customise the root fields""" custom_root_fields: Optional[CustomRootFields] = None @@ -1173,12 +1174,14 @@ class TableConfig: def from_dict(obj: Any) -> 'TableConfig': assert isinstance(obj, dict) custom_column_names = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("custom_column_names")) + custom_name = from_union([from_str, from_none], obj.get("custom_name")) custom_root_fields = from_union([CustomRootFields.from_dict, from_none], obj.get("custom_root_fields")) - return TableConfig(custom_column_names, custom_root_fields) + return TableConfig(custom_column_names, custom_name, custom_root_fields) def to_dict(self) -> dict: result: dict = {} result["custom_column_names"] = from_union([lambda x: from_dict(from_str, x), from_none], self.custom_column_names) + result["custom_name"] = from_union([from_str, from_none], self.custom_name) result["custom_root_fields"] = from_union([lambda x: to_class(CustomRootFields, x), from_none], self.custom_root_fields) return result diff --git a/contrib/metadata-types/generated/HasuraMetadataV2.yaml b/contrib/metadata-types/generated/HasuraMetadataV2.yaml index 7eb9cdb0d5b..150d35356e9 100644 --- a/contrib/metadata-types/generated/HasuraMetadataV2.yaml +++ b/contrib/metadata-types/generated/HasuraMetadataV2.yaml @@ -54,6 +54,10 @@ definitions: title: TableConfig type: object properties: + custom_name: + description: Customise the table name + type: string + title: custom_name custom_root_fields: description: Customise the root fields $ref: '#/definitions/CustomRootFields' @@ -1334,13 +1338,15 @@ definitions: title: comment permissions: description: Permissions of the action - type: object - properties: - role: - type: string - title: role - required: - - role + type: array + items: + type: object + properties: + role: + type: string + title: role + required: + - role title: permissions required: - definition diff --git a/contrib/metadata-types/generated/HasuraMetadataV3.go b/contrib/metadata-types/generated/HasuraMetadataV3.go new file mode 100644 index 00000000000..3cf20e25f5c --- /dev/null +++ b/contrib/metadata-types/generated/HasuraMetadataV3.go @@ -0,0 +1,2449 @@ +// This file was generated from JSON Schema using quicktype, do not modify it directly. +// To parse and unparse this JSON data, add this code to your project and do: +// +// pGColumn, err := UnmarshalPGColumn(bytes) +// bytes, err = pGColumn.Marshal() +// +// computedFieldName, err := UnmarshalComputedFieldName(bytes) +// bytes, err = computedFieldName.Marshal() +// +// roleName, err := UnmarshalRoleName(bytes) +// bytes, err = roleName.Marshal() +// +// triggerName, err := UnmarshalTriggerName(bytes) +// bytes, err = triggerName.Marshal() +// +// remoteRelationshipName, err := UnmarshalRemoteRelationshipName(bytes) +// bytes, err = remoteRelationshipName.Marshal() +// +// remoteSchemaName, err := UnmarshalRemoteSchemaName(bytes) +// bytes, err = remoteSchemaName.Marshal() +// +// collectionName, err := UnmarshalCollectionName(bytes) +// bytes, err = collectionName.Marshal() +// +// graphQLName, err := UnmarshalGraphQLName(bytes) +// bytes, err = graphQLName.Marshal() +// +// graphQLType, err := UnmarshalGraphQLType(bytes) +// bytes, err = graphQLType.Marshal() +// +// relationshipName, err := UnmarshalRelationshipName(bytes) +// bytes, err = relationshipName.Marshal() +// +// actionName, err := UnmarshalActionName(bytes) +// bytes, err = actionName.Marshal() +// +// webhookURL, err := UnmarshalWebhookURL(bytes) +// bytes, err = webhookURL.Marshal() +// +// tableName, err := UnmarshalTableName(bytes) +// bytes, err = tableName.Marshal() +// +// qualifiedTable, err := UnmarshalQualifiedTable(bytes) +// bytes, err = qualifiedTable.Marshal() +// +// tableConfig, err := UnmarshalTableConfig(bytes) +// bytes, err = tableConfig.Marshal() +// +// tableEntry, err := UnmarshalTableEntry(bytes) +// bytes, err = tableEntry.Marshal() +// +// customRootFields, err := UnmarshalCustomRootFields(bytes) +// bytes, err = customRootFields.Marshal() +// +// customColumnNames, err := UnmarshalCustomColumnNames(bytes) +// bytes, err = customColumnNames.Marshal() +// +// functionName, err := UnmarshalFunctionName(bytes) +// bytes, err = functionName.Marshal() +// +// qualifiedFunction, err := UnmarshalQualifiedFunction(bytes) +// bytes, err = qualifiedFunction.Marshal() +// +// customFunction, err := UnmarshalCustomFunction(bytes) +// bytes, err = customFunction.Marshal() +// +// functionConfiguration, err := UnmarshalFunctionConfiguration(bytes) +// bytes, err = functionConfiguration.Marshal() +// +// objectRelationship, err := UnmarshalObjectRelationship(bytes) +// bytes, err = objectRelationship.Marshal() +// +// objRelUsing, err := UnmarshalObjRelUsing(bytes) +// bytes, err = objRelUsing.Marshal() +// +// objRelUsingManualMapping, err := UnmarshalObjRelUsingManualMapping(bytes) +// bytes, err = objRelUsingManualMapping.Marshal() +// +// arrayRelationship, err := UnmarshalArrayRelationship(bytes) +// bytes, err = arrayRelationship.Marshal() +// +// arrRelUsing, err := UnmarshalArrRelUsing(bytes) +// bytes, err = arrRelUsing.Marshal() +// +// arrRelUsingFKeyOn, err := UnmarshalArrRelUsingFKeyOn(bytes) +// bytes, err = arrRelUsingFKeyOn.Marshal() +// +// arrRelUsingManualMapping, err := UnmarshalArrRelUsingManualMapping(bytes) +// bytes, err = arrRelUsingManualMapping.Marshal() +// +// columnPresetsExpression, err := UnmarshalColumnPresetsExpression(bytes) +// bytes, err = columnPresetsExpression.Marshal() +// +// insertPermissionEntry, err := UnmarshalInsertPermissionEntry(bytes) +// bytes, err = insertPermissionEntry.Marshal() +// +// insertPermission, err := UnmarshalInsertPermission(bytes) +// bytes, err = insertPermission.Marshal() +// +// selectPermissionEntry, err := UnmarshalSelectPermissionEntry(bytes) +// bytes, err = selectPermissionEntry.Marshal() +// +// selectPermission, err := UnmarshalSelectPermission(bytes) +// bytes, err = selectPermission.Marshal() +// +// updatePermissionEntry, err := UnmarshalUpdatePermissionEntry(bytes) +// bytes, err = updatePermissionEntry.Marshal() +// +// updatePermission, err := UnmarshalUpdatePermission(bytes) +// bytes, err = updatePermission.Marshal() +// +// deletePermissionEntry, err := UnmarshalDeletePermissionEntry(bytes) +// bytes, err = deletePermissionEntry.Marshal() +// +// deletePermission, err := UnmarshalDeletePermission(bytes) +// bytes, err = deletePermission.Marshal() +// +// computedField, err := UnmarshalComputedField(bytes) +// bytes, err = computedField.Marshal() +// +// computedFieldDefinition, err := UnmarshalComputedFieldDefinition(bytes) +// bytes, err = computedFieldDefinition.Marshal() +// +// eventTrigger, err := UnmarshalEventTrigger(bytes) +// bytes, err = eventTrigger.Marshal() +// +// eventTriggerDefinition, err := UnmarshalEventTriggerDefinition(bytes) +// bytes, err = eventTriggerDefinition.Marshal() +// +// eventTriggerColumns, err := UnmarshalEventTriggerColumns(bytes) +// bytes, err = eventTriggerColumns.Marshal() +// +// operationSpec, err := UnmarshalOperationSpec(bytes) +// bytes, err = operationSpec.Marshal() +// +// headerFromValue, err := UnmarshalHeaderFromValue(bytes) +// bytes, err = headerFromValue.Marshal() +// +// headerFromEnv, err := UnmarshalHeaderFromEnv(bytes) +// bytes, err = headerFromEnv.Marshal() +// +// retryConf, err := UnmarshalRetryConf(bytes) +// bytes, err = retryConf.Marshal() +// +// cronTrigger, err := UnmarshalCronTrigger(bytes) +// bytes, err = cronTrigger.Marshal() +// +// retryConfST, err := UnmarshalRetryConfST(bytes) +// bytes, err = retryConfST.Marshal() +// +// remoteSchema, err := UnmarshalRemoteSchema(bytes) +// bytes, err = remoteSchema.Marshal() +// +// remoteSchemaDef, err := UnmarshalRemoteSchemaDef(bytes) +// bytes, err = remoteSchemaDef.Marshal() +// +// remoteRelationship, err := UnmarshalRemoteRelationship(bytes) +// bytes, err = remoteRelationship.Marshal() +// +// remoteRelationshipDef, err := UnmarshalRemoteRelationshipDef(bytes) +// bytes, err = remoteRelationshipDef.Marshal() +// +// remoteField, err := UnmarshalRemoteField(bytes) +// bytes, err = remoteField.Marshal() +// +// inputArguments, err := UnmarshalInputArguments(bytes) +// bytes, err = inputArguments.Marshal() +// +// queryCollectionEntry, err := UnmarshalQueryCollectionEntry(bytes) +// bytes, err = queryCollectionEntry.Marshal() +// +// queryCollection, err := UnmarshalQueryCollection(bytes) +// bytes, err = queryCollection.Marshal() +// +// allowList, err := UnmarshalAllowList(bytes) +// bytes, err = allowList.Marshal() +// +// customTypes, err := UnmarshalCustomTypes(bytes) +// bytes, err = customTypes.Marshal() +// +// inputObjectType, err := UnmarshalInputObjectType(bytes) +// bytes, err = inputObjectType.Marshal() +// +// inputObjectField, err := UnmarshalInputObjectField(bytes) +// bytes, err = inputObjectField.Marshal() +// +// objectType, err := UnmarshalObjectType(bytes) +// bytes, err = objectType.Marshal() +// +// objectField, err := UnmarshalObjectField(bytes) +// bytes, err = objectField.Marshal() +// +// customTypeObjectRelationship, err := UnmarshalCustomTypeObjectRelationship(bytes) +// bytes, err = customTypeObjectRelationship.Marshal() +// +// scalarType, err := UnmarshalScalarType(bytes) +// bytes, err = scalarType.Marshal() +// +// enumType, err := UnmarshalEnumType(bytes) +// bytes, err = enumType.Marshal() +// +// enumValue, err := UnmarshalEnumValue(bytes) +// bytes, err = enumValue.Marshal() +// +// action, err := UnmarshalAction(bytes) +// bytes, err = action.Marshal() +// +// actionDefinition, err := UnmarshalActionDefinition(bytes) +// bytes, err = actionDefinition.Marshal() +// +// inputArgument, err := UnmarshalInputArgument(bytes) +// bytes, err = inputArgument.Marshal() +// +// hasuraMetadataV2, err := UnmarshalHasuraMetadataV2(bytes) +// bytes, err = hasuraMetadataV2.Marshal() +// +// fromEnv, err := UnmarshalFromEnv(bytes) +// bytes, err = fromEnv.Marshal() +// +// pGConfiguration, err := UnmarshalPGConfiguration(bytes) +// bytes, err = pGConfiguration.Marshal() +// +// mSSQLConfiguration, err := UnmarshalMSSQLConfiguration(bytes) +// bytes, err = mSSQLConfiguration.Marshal() +// +// bigQueryConfiguration, err := UnmarshalBigQueryConfiguration(bytes) +// bytes, err = bigQueryConfiguration.Marshal() +// +// pGSourceConnectionInfo, err := UnmarshalPGSourceConnectionInfo(bytes) +// bytes, err = pGSourceConnectionInfo.Marshal() +// +// mSSQLSourceConnectionInfo, err := UnmarshalMSSQLSourceConnectionInfo(bytes) +// bytes, err = mSSQLSourceConnectionInfo.Marshal() +// +// pGConnectionParameters, err := UnmarshalPGConnectionParameters(bytes) +// bytes, err = pGConnectionParameters.Marshal() +// +// pGPoolSettings, err := UnmarshalPGPoolSettings(bytes) +// bytes, err = pGPoolSettings.Marshal() +// +// pGCERTSettings, err := UnmarshalPGCERTSettings(bytes) +// bytes, err = pGCERTSettings.Marshal() +// +// mSSQLPoolSettings, err := UnmarshalMSSQLPoolSettings(bytes) +// bytes, err = mSSQLPoolSettings.Marshal() +// +// backendKind, err := UnmarshalBackendKind(bytes) +// bytes, err = backendKind.Marshal() +// +// baseSource, err := UnmarshalBaseSource(bytes) +// bytes, err = baseSource.Marshal() +// +// pGSource, err := UnmarshalPGSource(bytes) +// bytes, err = pGSource.Marshal() +// +// mSSQLSource, err := UnmarshalMSSQLSource(bytes) +// bytes, err = mSSQLSource.Marshal() +// +// bigQuerySource, err := UnmarshalBigQuerySource(bytes) +// bytes, err = bigQuerySource.Marshal() +// +// source, err := UnmarshalSource(bytes) +// bytes, err = source.Marshal() +// +// aPILimits, err := UnmarshalAPILimits(bytes) +// bytes, err = aPILimits.Marshal() +// +// depthLimit, err := UnmarshalDepthLimit(bytes) +// bytes, err = depthLimit.Marshal() +// +// rateLimit, err := UnmarshalRateLimit(bytes) +// bytes, err = rateLimit.Marshal() +// +// rateLimitRule, err := UnmarshalRateLimitRule(bytes) +// bytes, err = rateLimitRule.Marshal() +// +// nodeLimit, err := UnmarshalNodeLimit(bytes) +// bytes, err = nodeLimit.Marshal() +// +// rESTEndpoint, err := UnmarshalRESTEndpoint(bytes) +// bytes, err = rESTEndpoint.Marshal() +// +// rESTEndpointDefinition, err := UnmarshalRESTEndpointDefinition(bytes) +// bytes, err = rESTEndpointDefinition.Marshal() +// +// inheritedRole, err := UnmarshalInheritedRole(bytes) +// bytes, err = inheritedRole.Marshal() +// +// hasuraMetadataV3, err := UnmarshalHasuraMetadataV3(bytes) +// bytes, err = hasuraMetadataV3.Marshal() +// +// recordStringAny, err := UnmarshalRecordStringAny(bytes) +// bytes, err = recordStringAny.Marshal() + +package hasura_metadata + +import "bytes" +import "errors" +import "encoding/json" + +type PGColumn string + +func UnmarshalPGColumn(data []byte) (PGColumn, error) { + var r PGColumn + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *PGColumn) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type ComputedFieldName string + +func UnmarshalComputedFieldName(data []byte) (ComputedFieldName, error) { + var r ComputedFieldName + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *ComputedFieldName) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type RoleName string + +func UnmarshalRoleName(data []byte) (RoleName, error) { + var r RoleName + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *RoleName) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type TriggerName string + +func UnmarshalTriggerName(data []byte) (TriggerName, error) { + var r TriggerName + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *TriggerName) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type RemoteRelationshipName string + +func UnmarshalRemoteRelationshipName(data []byte) (RemoteRelationshipName, error) { + var r RemoteRelationshipName + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *RemoteRelationshipName) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type RemoteSchemaName string + +func UnmarshalRemoteSchemaName(data []byte) (RemoteSchemaName, error) { + var r RemoteSchemaName + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *RemoteSchemaName) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type CollectionName string + +func UnmarshalCollectionName(data []byte) (CollectionName, error) { + var r CollectionName + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *CollectionName) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type GraphQLName string + +func UnmarshalGraphQLName(data []byte) (GraphQLName, error) { + var r GraphQLName + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *GraphQLName) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type GraphQLType string + +func UnmarshalGraphQLType(data []byte) (GraphQLType, error) { + var r GraphQLType + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *GraphQLType) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type RelationshipName string + +func UnmarshalRelationshipName(data []byte) (RelationshipName, error) { + var r RelationshipName + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *RelationshipName) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type ActionName string + +func UnmarshalActionName(data []byte) (ActionName, error) { + var r ActionName + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *ActionName) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type WebhookURL string + +func UnmarshalWebhookURL(data []byte) (WebhookURL, error) { + var r WebhookURL + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *WebhookURL) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalTableName(data []byte) (TableName, error) { + var r TableName + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *TableName) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalQualifiedTable(data []byte) (QualifiedTable, error) { + var r QualifiedTable + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *QualifiedTable) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalTableConfig(data []byte) (TableConfig, error) { + var r TableConfig + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *TableConfig) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalTableEntry(data []byte) (TableEntry, error) { + var r TableEntry + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *TableEntry) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalCustomRootFields(data []byte) (CustomRootFields, error) { + var r CustomRootFields + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *CustomRootFields) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type CustomColumnNames map[string]string + +func UnmarshalCustomColumnNames(data []byte) (CustomColumnNames, error) { + var r CustomColumnNames + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *CustomColumnNames) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalFunctionName(data []byte) (FunctionName, error) { + var r FunctionName + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *FunctionName) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalQualifiedFunction(data []byte) (QualifiedFunction, error) { + var r QualifiedFunction + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *QualifiedFunction) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalCustomFunction(data []byte) (CustomFunction, error) { + var r CustomFunction + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *CustomFunction) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalFunctionConfiguration(data []byte) (FunctionConfiguration, error) { + var r FunctionConfiguration + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *FunctionConfiguration) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalObjectRelationship(data []byte) (ObjectRelationship, error) { + var r ObjectRelationship + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *ObjectRelationship) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalObjRelUsing(data []byte) (ObjRelUsing, error) { + var r ObjRelUsing + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *ObjRelUsing) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalObjRelUsingManualMapping(data []byte) (ObjRelUsingManualMapping, error) { + var r ObjRelUsingManualMapping + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *ObjRelUsingManualMapping) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalArrayRelationship(data []byte) (ArrayRelationship, error) { + var r ArrayRelationship + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *ArrayRelationship) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalArrRelUsing(data []byte) (ArrRelUsing, error) { + var r ArrRelUsing + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *ArrRelUsing) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalArrRelUsingFKeyOn(data []byte) (ArrRelUsingFKeyOn, error) { + var r ArrRelUsingFKeyOn + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *ArrRelUsingFKeyOn) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalArrRelUsingManualMapping(data []byte) (ArrRelUsingManualMapping, error) { + var r ArrRelUsingManualMapping + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *ArrRelUsingManualMapping) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type ColumnPresetsExpression map[string]string + +func UnmarshalColumnPresetsExpression(data []byte) (ColumnPresetsExpression, error) { + var r ColumnPresetsExpression + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *ColumnPresetsExpression) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalInsertPermissionEntry(data []byte) (InsertPermissionEntry, error) { + var r InsertPermissionEntry + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *InsertPermissionEntry) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalInsertPermission(data []byte) (InsertPermission, error) { + var r InsertPermission + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *InsertPermission) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalSelectPermissionEntry(data []byte) (SelectPermissionEntry, error) { + var r SelectPermissionEntry + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *SelectPermissionEntry) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalSelectPermission(data []byte) (SelectPermission, error) { + var r SelectPermission + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *SelectPermission) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalUpdatePermissionEntry(data []byte) (UpdatePermissionEntry, error) { + var r UpdatePermissionEntry + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *UpdatePermissionEntry) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalUpdatePermission(data []byte) (UpdatePermission, error) { + var r UpdatePermission + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *UpdatePermission) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalDeletePermissionEntry(data []byte) (DeletePermissionEntry, error) { + var r DeletePermissionEntry + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *DeletePermissionEntry) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalDeletePermission(data []byte) (DeletePermission, error) { + var r DeletePermission + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *DeletePermission) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalComputedField(data []byte) (ComputedField, error) { + var r ComputedField + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *ComputedField) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalComputedFieldDefinition(data []byte) (ComputedFieldDefinition, error) { + var r ComputedFieldDefinition + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *ComputedFieldDefinition) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalEventTrigger(data []byte) (EventTrigger, error) { + var r EventTrigger + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *EventTrigger) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalEventTriggerDefinition(data []byte) (EventTriggerDefinition, error) { + var r EventTriggerDefinition + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *EventTriggerDefinition) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalEventTriggerColumns(data []byte) (EventTriggerColumns, error) { + var r EventTriggerColumns + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *EventTriggerColumns) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalOperationSpec(data []byte) (OperationSpec, error) { + var r OperationSpec + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *OperationSpec) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalHeaderFromValue(data []byte) (HeaderFromValue, error) { + var r HeaderFromValue + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *HeaderFromValue) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalHeaderFromEnv(data []byte) (HeaderFromEnv, error) { + var r HeaderFromEnv + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *HeaderFromEnv) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalRetryConf(data []byte) (RetryConf, error) { + var r RetryConf + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *RetryConf) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalCronTrigger(data []byte) (CronTrigger, error) { + var r CronTrigger + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *CronTrigger) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalRetryConfST(data []byte) (RetryConfST, error) { + var r RetryConfST + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *RetryConfST) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalRemoteSchema(data []byte) (RemoteSchema, error) { + var r RemoteSchema + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *RemoteSchema) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalRemoteSchemaDef(data []byte) (RemoteSchemaDef, error) { + var r RemoteSchemaDef + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *RemoteSchemaDef) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalRemoteRelationship(data []byte) (RemoteRelationship, error) { + var r RemoteRelationship + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *RemoteRelationship) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalRemoteRelationshipDef(data []byte) (RemoteRelationshipDef, error) { + var r RemoteRelationshipDef + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *RemoteRelationshipDef) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type RemoteField map[string]RemoteFieldValue + +func UnmarshalRemoteField(data []byte) (RemoteField, error) { + var r RemoteField + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *RemoteField) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type InputArguments map[string]string + +func UnmarshalInputArguments(data []byte) (InputArguments, error) { + var r InputArguments + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *InputArguments) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalQueryCollectionEntry(data []byte) (QueryCollectionEntry, error) { + var r QueryCollectionEntry + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *QueryCollectionEntry) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalQueryCollection(data []byte) (QueryCollection, error) { + var r QueryCollection + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *QueryCollection) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalAllowList(data []byte) (AllowList, error) { + var r AllowList + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *AllowList) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalCustomTypes(data []byte) (CustomTypes, error) { + var r CustomTypes + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *CustomTypes) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalInputObjectType(data []byte) (InputObjectType, error) { + var r InputObjectType + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *InputObjectType) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalInputObjectField(data []byte) (InputObjectField, error) { + var r InputObjectField + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *InputObjectField) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalObjectType(data []byte) (ObjectType, error) { + var r ObjectType + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *ObjectType) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalObjectField(data []byte) (ObjectField, error) { + var r ObjectField + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *ObjectField) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalCustomTypeObjectRelationship(data []byte) (CustomTypeObjectRelationship, error) { + var r CustomTypeObjectRelationship + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *CustomTypeObjectRelationship) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalScalarType(data []byte) (ScalarType, error) { + var r ScalarType + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *ScalarType) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalEnumType(data []byte) (EnumType, error) { + var r EnumType + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *EnumType) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalEnumValue(data []byte) (EnumValue, error) { + var r EnumValue + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *EnumValue) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalAction(data []byte) (Action, error) { + var r Action + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *Action) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalActionDefinition(data []byte) (ActionDefinition, error) { + var r ActionDefinition + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *ActionDefinition) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalInputArgument(data []byte) (InputArgument, error) { + var r InputArgument + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *InputArgument) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalHasuraMetadataV2(data []byte) (HasuraMetadataV2, error) { + var r HasuraMetadataV2 + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *HasuraMetadataV2) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalFromEnv(data []byte) (FromEnv, error) { + var r FromEnv + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *FromEnv) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalPGConfiguration(data []byte) (PGConfiguration, error) { + var r PGConfiguration + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *PGConfiguration) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalMSSQLConfiguration(data []byte) (MSSQLConfiguration, error) { + var r MSSQLConfiguration + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *MSSQLConfiguration) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalBigQueryConfiguration(data []byte) (BigQueryConfiguration, error) { + var r BigQueryConfiguration + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *BigQueryConfiguration) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalPGSourceConnectionInfo(data []byte) (PGSourceConnectionInfo, error) { + var r PGSourceConnectionInfo + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *PGSourceConnectionInfo) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalMSSQLSourceConnectionInfo(data []byte) (MSSQLSourceConnectionInfo, error) { + var r MSSQLSourceConnectionInfo + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *MSSQLSourceConnectionInfo) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalPGConnectionParameters(data []byte) (PGConnectionParameters, error) { + var r PGConnectionParameters + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *PGConnectionParameters) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalPGPoolSettings(data []byte) (PGPoolSettings, error) { + var r PGPoolSettings + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *PGPoolSettings) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalPGCERTSettings(data []byte) (PGCERTSettings, error) { + var r PGCERTSettings + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *PGCERTSettings) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalMSSQLPoolSettings(data []byte) (MSSQLPoolSettings, error) { + var r MSSQLPoolSettings + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *MSSQLPoolSettings) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalBackendKind(data []byte) (BackendKind, error) { + var r BackendKind + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *BackendKind) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalBaseSource(data []byte) (BaseSource, error) { + var r BaseSource + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *BaseSource) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalPGSource(data []byte) (PGSource, error) { + var r PGSource + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *PGSource) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalMSSQLSource(data []byte) (MSSQLSource, error) { + var r MSSQLSource + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *MSSQLSource) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalBigQuerySource(data []byte) (BigQuerySource, error) { + var r BigQuerySource + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *BigQuerySource) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalSource(data []byte) (Source, error) { + var r Source + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *Source) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalAPILimits(data []byte) (APILimits, error) { + var r APILimits + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *APILimits) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalDepthLimit(data []byte) (DepthLimit, error) { + var r DepthLimit + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *DepthLimit) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalRateLimit(data []byte) (RateLimit, error) { + var r RateLimit + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *RateLimit) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalRateLimitRule(data []byte) (RateLimitRule, error) { + var r RateLimitRule + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *RateLimitRule) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalNodeLimit(data []byte) (NodeLimit, error) { + var r NodeLimit + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *NodeLimit) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalRESTEndpoint(data []byte) (RESTEndpoint, error) { + var r RESTEndpoint + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *RESTEndpoint) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalRESTEndpointDefinition(data []byte) (RESTEndpointDefinition, error) { + var r RESTEndpointDefinition + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *RESTEndpointDefinition) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalInheritedRole(data []byte) (InheritedRole, error) { + var r InheritedRole + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *InheritedRole) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +func UnmarshalHasuraMetadataV3(data []byte) (HasuraMetadataV3, error) { + var r HasuraMetadataV3 + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *HasuraMetadataV3) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +type RecordStringAny map[string]interface{} + +func UnmarshalRecordStringAny(data []byte) (RecordStringAny, error) { + var r RecordStringAny + err := json.Unmarshal(data, &r) + return r, err +} + +func (r *RecordStringAny) Marshal() ([]byte, error) { + return json.Marshal(r) +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromvalue +type HeaderFromValue struct { + Name string `json:"name"` // Name of the header + Value string `json:"value"`// Value of the header +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromenv +type HeaderFromEnv struct { + Name string `json:"name"` // Name of the header + ValueFromEnv string `json:"value_from_env"`// Name of the environment variable which holds the value of the header +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objectfield +type ObjectField struct { + Description *string `json:"description,omitempty"`// Description of the Input object type + Name string `json:"name"` // Name of the Input object type + Type string `json:"type"` // GraphQL type of the Input object type +} + +// Type used in exported 'metadata.json' and replace metadata endpoint +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/manage-metadata.html#replace-metadata +type HasuraMetadataV2 struct { + Actions []Action `json:"actions,omitempty"` + Allowlist []AllowList `json:"allowlist,omitempty"` + CronTriggers []CronTrigger `json:"cron_triggers,omitempty"` + CustomTypes *CustomTypes `json:"custom_types,omitempty"` + Functions []CustomFunction `json:"functions,omitempty"` + QueryCollections []QueryCollectionEntry `json:"query_collections,omitempty"` + RemoteSchemas []RemoteSchema `json:"remote_schemas,omitempty"` + Tables []TableEntry `json:"tables"` + Version float64 `json:"version"` +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#args-syntax +type Action struct { + Comment *string `json:"comment,omitempty"` // Comment + Definition ActionDefinition `json:"definition"` // Definition of the action + Name string `json:"name"` // Name of the action + Permissions []Permission `json:"permissions,omitempty"`// Permissions of the action +} + +// Definition of the action +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#actiondefinition +type ActionDefinition struct { + Arguments []InputArgument `json:"arguments,omitempty"` + ForwardClientHeaders *bool `json:"forward_client_headers,omitempty"` + Handler string `json:"handler"` // A String value which supports templating environment variables enclosed in {{ and }}.; Template example: https://{{ACTION_API_DOMAIN}}/create-user + Headers []Header `json:"headers,omitempty"` + Kind *string `json:"kind,omitempty"` + OutputType *string `json:"output_type,omitempty"` + Type *ActionDefinitionType `json:"type,omitempty"` +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#inputargument +type InputArgument struct { + Name string `json:"name"` + Type string `json:"type"` +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromvalue +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromenv +type Header struct { + Name string `json:"name"` // Name of the header + Value *string `json:"value,omitempty"` // Value of the header + ValueFromEnv *string `json:"value_from_env,omitempty"`// Name of the environment variable which holds the value of the header +} + +type Permission struct { + Role string `json:"role"` +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/query-collections.html#add-collection-to-allowlist-syntax +type AllowList struct { + Collection string `json:"collection"`// Name of a query collection to be added to the allow-list +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/scheduled-triggers.html#create-cron-trigger +type CronTrigger struct { + Comment *string `json:"comment,omitempty"` // Custom comment. + Headers []Header `json:"headers"` // List of headers to be sent with the webhook + IncludeInMetadata bool `json:"include_in_metadata"` // Flag to indicate whether a trigger should be included in the metadata. When a cron; trigger is included in the metadata, the user will be able to export it when the metadata; of the graphql-engine is exported. + Name string `json:"name"` // Name of the cron trigger + Payload map[string]interface{} `json:"payload,omitempty"` // Any JSON payload which will be sent when the webhook is invoked. + RetryConf *RetryConfST `json:"retry_conf,omitempty"`// Retry configuration if scheduled invocation delivery fails + Schedule string `json:"schedule"` // Cron expression at which the trigger should be invoked. + Webhook string `json:"webhook"` // URL of the webhook +} + +// Retry configuration if scheduled invocation delivery fails +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/scheduled-triggers.html#retryconfst +type RetryConfST struct { + NumRetries *int64 `json:"num_retries,omitempty"` // Number of times to retry delivery.; Default: 0 + RetryIntervalSeconds *int64 `json:"retry_interval_seconds,omitempty"`// Number of seconds to wait between each retry.; Default: 10 + TimeoutSeconds *int64 `json:"timeout_seconds,omitempty"` // Number of seconds to wait for response before timing out.; Default: 60 + ToleranceSeconds *int64 `json:"tolerance_seconds,omitempty"` // Number of seconds between scheduled time and actual delivery time that is acceptable. If; the time difference is more than this, then the event is dropped.; Default: 21600 (6 hours) +} + +type CustomTypes struct { + Enums []EnumType `json:"enums,omitempty"` + InputObjects []InputObjectType `json:"input_objects,omitempty"` + Objects []ObjectType `json:"objects,omitempty"` + Scalars []ScalarType `json:"scalars,omitempty"` +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#enumtype +type EnumType struct { + Description *string `json:"description,omitempty"`// Description of the Enum type + Name string `json:"name"` // Name of the Enum type + Values []EnumValue `json:"values"` // Values of the Enum type +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#enumvalue +type EnumValue struct { + Description *string `json:"description,omitempty"` // Description of the Enum value + IsDeprecated *bool `json:"is_deprecated,omitempty"`// If set to true, the enum value is marked as deprecated + Value string `json:"value"` // Value of the Enum type +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#inputobjecttype +type InputObjectType struct { + Description *string `json:"description,omitempty"`// Description of the Input object type + Fields []InputObjectField `json:"fields"` // Fields of the Input object type + Name string `json:"name"` // Name of the Input object type +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#inputobjectfield +type InputObjectField struct { + Description *string `json:"description,omitempty"`// Description of the Input object type + Name string `json:"name"` // Name of the Input object type + Type string `json:"type"` // GraphQL type of the Input object type +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objecttype +type ObjectType struct { + Description *string `json:"description,omitempty"` // Description of the Input object type + Fields []InputObjectField `json:"fields"` // Fields of the Input object type + Name string `json:"name"` // Name of the Input object type + Relationships []CustomTypeObjectRelationship `json:"relationships,omitempty"`// Relationships of the Object type to tables +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objectrelationship +type CustomTypeObjectRelationship struct { + FieldMapping map[string]string `json:"field_mapping"`// Mapping of fields of object type to columns of remote table + Name string `json:"name"` // Name of the relationship, shouldn’t conflict with existing field names + RemoteTable *TableName `json:"remote_table"` // The table to which relationship is defined + Type CustomTypeObjectRelationshipType `json:"type"` // Type of the relationship +} + +type QualifiedTable struct { + Name string `json:"name"` + Schema string `json:"schema"` +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#scalartype +type ScalarType struct { + Description *string `json:"description,omitempty"`// Description of the Scalar type + Name string `json:"name"` // Name of the Scalar type +} + +// A custom SQL function to add to the GraphQL schema with configuration. +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-functions.html#args-syntax +type CustomFunction struct { + Configuration *FunctionConfiguration `json:"configuration,omitempty"`// Configuration for the SQL function + Function *FunctionName `json:"function"` // Name of the SQL function +} + +// Configuration for the SQL function +// +// Configuration for a CustomFunction +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-functions.html#function-configuration +type FunctionConfiguration struct { + SessionArgument *string `json:"session_argument,omitempty"`// Function argument which accepts session info JSON; Currently, only functions which satisfy the following constraints can be exposed over the; GraphQL API (terminology from Postgres docs):; - Function behaviour: ONLY `STABLE` or `IMMUTABLE`; - Return type: MUST be `SETOF `; - Argument modes: ONLY `IN` +} + +type QualifiedFunction struct { + Name string `json:"name"` + Schema string `json:"schema"` +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/query-collections.html#args-syntax +type QueryCollectionEntry struct { + Comment *string `json:"comment,omitempty"`// Comment + Definition Definition `json:"definition"` // List of queries + Name string `json:"name"` // Name of the query collection +} + +// List of queries +type Definition struct { + Queries []QueryCollection `json:"queries"` +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#collectionquery +type QueryCollection struct { + Name string `json:"name"` + Query string `json:"query"` +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-schemas.html#add-remote-schema +type RemoteSchema struct { + Comment *string `json:"comment,omitempty"`// Comment + Definition RemoteSchemaDef `json:"definition"` // Name of the remote schema + Name string `json:"name"` // Name of the remote schema +} + +// Name of the remote schema +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#remoteschemadef +type RemoteSchemaDef struct { + ForwardClientHeaders *bool `json:"forward_client_headers,omitempty"` + Headers []Header `json:"headers,omitempty"` + TimeoutSeconds *float64 `json:"timeout_seconds,omitempty"` + URL *string `json:"url,omitempty"` + URLFromEnv *string `json:"url_from_env,omitempty"` +} + +// Representation of a table in metadata, 'tables.yaml' and 'metadata.json' +type TableEntry struct { + ArrayRelationships []ArrayRelationship `json:"array_relationships,omitempty"` + ComputedFields []ComputedField `json:"computed_fields,omitempty"` + Configuration *TableConfig `json:"configuration,omitempty"` // Configuration for the table/view; ; https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config + DeletePermissions []DeletePermissionEntry `json:"delete_permissions,omitempty"` + EventTriggers []EventTrigger `json:"event_triggers,omitempty"` + InsertPermissions []InsertPermissionEntry `json:"insert_permissions,omitempty"` + IsEnum *bool `json:"is_enum,omitempty"` + ObjectRelationships []ObjectRelationship `json:"object_relationships,omitempty"` + RemoteRelationships []RemoteRelationship `json:"remote_relationships,omitempty"` + SelectPermissions []SelectPermissionEntry `json:"select_permissions,omitempty"` + Table QualifiedTable `json:"table"` + UpdatePermissions []UpdatePermissionEntry `json:"update_permissions,omitempty"` +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#create-array-relationship-syntax +type ArrayRelationship struct { + Comment *string `json:"comment,omitempty"`// Comment + Name string `json:"name"` // Name of the new relationship + Using ArrRelUsing `json:"using"` // Use one of the available ways to define an array relationship +} + +// Use one of the available ways to define an array relationship +// +// Use one of the available ways to define an object relationship +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusing +type ArrRelUsing struct { + ForeignKeyConstraintOn *ArrRelUsingFKeyOn `json:"foreign_key_constraint_on,omitempty"`// The column with foreign key constraint + ManualConfiguration *ArrRelUsingManualMapping `json:"manual_configuration,omitempty"` // Manual mapping of table and columns +} + +// The column with foreign key constraint +// +// The column with foreign key constraint +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusingfkeyon +type ArrRelUsingFKeyOn struct { + Column string `json:"column"` + Table *TableName `json:"table"` +} + +// Manual mapping of table and columns +// +// Manual mapping of table and columns +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusingmanualmapping +type ArrRelUsingManualMapping struct { + ColumnMapping map[string]string `json:"column_mapping"`// Mapping of columns from current table to remote table + RemoteTable *TableName `json:"remote_table"` // The table to which the relationship has to be established +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/computed-field.html#args-syntax +type ComputedField struct { + Comment *string `json:"comment,omitempty"`// Comment + Definition ComputedFieldDefinition `json:"definition"` // The computed field definition + Name string `json:"name"` // Name of the new computed field +} + +// The computed field definition +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/computed-field.html#computedfielddefinition +type ComputedFieldDefinition struct { + Function *FunctionName `json:"function"` // The SQL function + SessionArgument *string `json:"session_argument,omitempty"`// Name of the argument which accepts the Hasura session object as a JSON/JSONB value. If; omitted, the Hasura session object is not passed to the function + TableArgument *string `json:"table_argument,omitempty"` // Name of the argument which accepts a table row type. If omitted, the first argument is; considered a table argument +} + +// Configuration for the table/view +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config +type TableConfig struct { + CustomColumnNames map[string]string `json:"custom_column_names,omitempty"`// Customise the column names + CustomName *string `json:"custom_name,omitempty"` // Customise the table name + CustomRootFields *CustomRootFields `json:"custom_root_fields,omitempty"` // Customise the root fields +} + +// Customise the root fields +// +// Customise the root fields +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#custom-root-fields +type CustomRootFields struct { + Delete *string `json:"delete,omitempty"` // Customise the `delete_` root field + DeleteByPk *string `json:"delete_by_pk,omitempty"` // Customise the `delete__by_pk` root field + Insert *string `json:"insert,omitempty"` // Customise the `insert_` root field + InsertOne *string `json:"insert_one,omitempty"` // Customise the `insert__one` root field + Select *string `json:"select,omitempty"` // Customise the `` root field + SelectAggregate *string `json:"select_aggregate,omitempty"`// Customise the `_aggregate` root field + SelectByPk *string `json:"select_by_pk,omitempty"` // Customise the `_by_pk` root field + Update *string `json:"update,omitempty"` // Customise the `update_` root field + UpdateByPk *string `json:"update_by_pk,omitempty"` // Customise the `update__by_pk` root field +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-delete-permission-syntax +type DeletePermissionEntry struct { + Comment *string `json:"comment,omitempty"`// Comment + Permission DeletePermission `json:"permission"` // The permission definition + Role string `json:"role"` // Role +} + +// The permission definition +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#deletepermission +type DeletePermission struct { + Filter map[string]*Filter `json:"filter,omitempty"`// Only the rows where this precondition holds true are updatable +} + +// NOTE: The metadata type doesn't QUITE match the 'create' arguments here +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#create-event-trigger +type EventTrigger struct { + Definition EventTriggerDefinition `json:"definition"` // The SQL function + Headers []Header `json:"headers,omitempty"` // The SQL function + Name string `json:"name"` // Name of the event trigger + RetryConf RetryConf `json:"retry_conf"` // The SQL function + Webhook *string `json:"webhook,omitempty"` // The SQL function + WebhookFromEnv *string `json:"webhook_from_env,omitempty"` +} + +// The SQL function +type EventTriggerDefinition struct { + Delete *OperationSpec `json:"delete,omitempty"`// ; https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec + EnableManual bool `json:"enable_manual"` + Insert *OperationSpec `json:"insert,omitempty"`// ; https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec + Update *OperationSpec `json:"update,omitempty"`// ; https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec +type OperationSpec struct { + Columns *EventTriggerColumns `json:"columns"`// ; https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#eventtriggercolumns + Payload *EventTriggerColumns `json:"payload"`// ; https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#eventtriggercolumns +} + +// The SQL function +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#retryconf +type RetryConf struct { + IntervalSEC *int64 `json:"interval_sec,omitempty"`// Number of seconds to wait between each retry.; Default: 10 + NumRetries *int64 `json:"num_retries,omitempty"` // Number of times to retry delivery.; Default: 0 + TimeoutSEC *int64 `json:"timeout_sec,omitempty"` // Number of seconds to wait for response before timing out.; Default: 60 +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#args-syntax +type InsertPermissionEntry struct { + Comment *string `json:"comment,omitempty"`// Comment + Permission InsertPermission `json:"permission"` // The permission definition + Role string `json:"role"` // Role +} + +// The permission definition +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#insertpermission +type InsertPermission struct { + BackendOnly *bool `json:"backend_only,omitempty"`// When set to true the mutation is accessible only if x-hasura-use-backend-only-permissions; session variable exists; and is set to true and request is made with x-hasura-admin-secret set if any auth is; configured + Check map[string]*Filter `json:"check,omitempty"` // This expression has to hold true for every new row that is inserted + Columns *EventTriggerColumns `json:"columns"` // Can insert into only these columns (or all when '*' is specified) + Set map[string]string `json:"set,omitempty"` // Preset values for columns that can be sourced from session variables or static values +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#args-syntax +type ObjectRelationship struct { + Comment *string `json:"comment,omitempty"`// Comment + Name string `json:"name"` // Name of the new relationship + Using ObjRelUsing `json:"using"` // Use one of the available ways to define an object relationship +} + +// Use one of the available ways to define an object relationship +// +// Use one of the available ways to define an object relationship +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#objrelusing +type ObjRelUsing struct { + ForeignKeyConstraintOn *string `json:"foreign_key_constraint_on,omitempty"`// The column with foreign key constraint + ManualConfiguration *ObjRelUsingManualMapping `json:"manual_configuration,omitempty"` // Manual mapping of table and columns +} + +// Manual mapping of table and columns +// +// Manual mapping of table and columns +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#objrelusingmanualmapping +type ObjRelUsingManualMapping struct { + ColumnMapping map[string]string `json:"column_mapping"`// Mapping of columns from current table to remote table + RemoteTable *TableName `json:"remote_table"` // The table to which the relationship has to be established +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-relationships.html#args-syntax +type RemoteRelationship struct { + Definition RemoteRelationshipDef `json:"definition"`// Definition object + Name string `json:"name"` // Name of the remote relationship +} + +// Definition object +type RemoteRelationshipDef struct { + HasuraFields []string `json:"hasura_fields"`// Column(s) in the table that is used for joining with remote schema field.; All join keys in remote_field must appear here. + RemoteField map[string]RemoteFieldValue `json:"remote_field"` // The schema tree ending at the field in remote schema which needs to be joined with. + RemoteSchema string `json:"remote_schema"`// Name of the remote schema to join with +} + +type RemoteFieldValue struct { + Arguments map[string]string `json:"arguments"` + Field map[string]RemoteFieldValue `json:"field,omitempty"`// A recursive tree structure that points to the field in the remote schema that needs to be; joined with.; It is recursive because the remote field maybe nested deeply in the remote schema.; ; https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-relationships.html#remotefield +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-select-permission-syntax +type SelectPermissionEntry struct { + Comment *string `json:"comment,omitempty"`// Comment + Permission SelectPermission `json:"permission"` // The permission definition + Role string `json:"role"` // Role +} + +// The permission definition +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#selectpermission +type SelectPermission struct { + AllowAggregations *bool `json:"allow_aggregations,omitempty"`// Toggle allowing aggregate queries + Columns *EventTriggerColumns `json:"columns"` // Only these columns are selectable (or all when '*' is specified) + ComputedFields []string `json:"computed_fields,omitempty"` // Only these computed fields are selectable + Filter map[string]*Filter `json:"filter,omitempty"` // Only the rows where this precondition holds true are selectable + Limit *int64 `json:"limit,omitempty"` // The maximum number of rows that can be returned +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-update-permission-syntax +type UpdatePermissionEntry struct { + Comment *string `json:"comment,omitempty"`// Comment + Permission UpdatePermission `json:"permission"` // The permission definition + Role string `json:"role"` // Role +} + +// The permission definition +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#updatepermission +type UpdatePermission struct { + Check map[string]*Filter `json:"check,omitempty"` // Postcondition which must be satisfied by rows which have been updated + Columns *EventTriggerColumns `json:"columns"` // Only these columns are selectable (or all when '*' is specified) + Filter map[string]*Filter `json:"filter,omitempty"`// Only the rows where this precondition holds true are updatable + Set map[string]string `json:"set,omitempty"` // Preset values for columns that can be sourced from session variables or static values +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconnectionparameters +type PGConnectionParameters struct { + Database string `json:"database"` // The database name + Host string `json:"host"` // The name of the host to connect to + Password *string `json:"password,omitempty"`// The Postgres user’s password + Port float64 `json:"port"` // The port number to connect with, at the server host + Username string `json:"username"` // The Postgres user to be connected +} + +type BaseSource struct { + Functions []CustomFunction `json:"functions,omitempty"` + Name string `json:"name"` + Tables []TableEntry `json:"tables"` +} + +type PGSource struct { + Configuration PGConfiguration `json:"configuration"` + Functions []CustomFunction `json:"functions,omitempty"` + Kind PGSourceKind `json:"kind"` + Name string `json:"name"` + Tables []TableEntry `json:"tables"` +} + +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconfiguration +type PGConfiguration struct { + ConnectionInfo PGSourceConnectionInfo `json:"connection_info"` // Connection parameters for the source + ReadReplicas []PGSourceConnectionInfo `json:"read_replicas,omitempty"`// Optional list of read replica configuration (supported only in cloud/enterprise versions) +} + +// Connection parameters for the source +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgsourceconnectioninfo +type PGSourceConnectionInfo struct { + DatabaseURL *DatabaseURL `json:"database_url"` // The database connection URL as a string, as an environment variable, or as connection; parameters. + IsolationLevel *IsolationLevel `json:"isolation_level,omitempty"` // The transaction isolation level in which the queries made to the source will be run with; (default: read-committed). + PoolSettings *PGPoolSettings `json:"pool_settings,omitempty"` // Connection pool settings + SSLConfiguration *PGCERTSettings `json:"ssl_configuration,omitempty"` // The client SSL certificate settings for the database (Only available in Cloud). + UsePreparedStatements *bool `json:"use_prepared_statements,omitempty"`// If set to true the server prepares statement before executing on the source database; (default: false). For more details, refer to the Postgres docs +} + +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#fromenv +// +// Environment variable which stores the client certificate. +// +// Environment variable which stores the client private key. +// +// Environment variable which stores trusted certificate authorities. +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconnectionparameters +type PGConnectionParametersClass struct { + FromEnv *string `json:"from_env,omitempty"`// Name of the environment variable + Database *string `json:"database,omitempty"`// The database name + Host *string `json:"host,omitempty"` // The name of the host to connect to + Password *string `json:"password,omitempty"`// The Postgres user’s password + Port *float64 `json:"port,omitempty"` // The port number to connect with, at the server host + Username *string `json:"username,omitempty"`// The Postgres user to be connected +} + +// Connection pool settings +// +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgpoolsettings +type PGPoolSettings struct { + ConnectionLifetime *float64 `json:"connection_lifetime,omitempty"`// Time from connection creation after which the connection should be destroyed and a new; one created. A value of 0 indicates we should never destroy an active connection. If 0 is; passed, memory from large query results may not be reclaimed. (default: 600 sec) + IdleTimeout *float64 `json:"idle_timeout,omitempty"` // The idle timeout (in seconds) per connection (default: 180) + MaxConnections *float64 `json:"max_connections,omitempty"` // Maximum number of connections to be kept in the pool (default: 50) + PoolTimeout *float64 `json:"pool_timeout,omitempty"` // Maximum time to wait while acquiring a Postgres connection from the pool, in seconds; (default: forever) + Retries *float64 `json:"retries,omitempty"` // Number of retries to perform (default: 1) +} + +// The client SSL certificate settings for the database (Only available in Cloud). +// +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgcertsettings +type PGCERTSettings struct { + Sslcert FromEnv `json:"sslcert"` // Environment variable which stores the client certificate. + Sslkey FromEnv `json:"sslkey"` // Environment variable which stores the client private key. + Sslmode string `json:"sslmode"` // The SSL connection mode. See the libpq ssl support docs; for more details. + Sslpassword *Sslpassword `json:"sslpassword"`// Password in the case where the sslkey is encrypted. + Sslrootcert FromEnv `json:"sslrootcert"`// Environment variable which stores trusted certificate authorities. +} + +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#fromenv +// +// Environment variable which stores the client certificate. +// +// Environment variable which stores the client private key. +// +// Environment variable which stores trusted certificate authorities. +type FromEnv struct { + FromEnv string `json:"from_env"`// Name of the environment variable +} + +type MSSQLSource struct { + Configuration MSSQLConfiguration `json:"configuration"` + Functions []CustomFunction `json:"functions,omitempty"` + Kind MSSQLSourceKind `json:"kind"` + Name string `json:"name"` + Tables []TableEntry `json:"tables"` +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo +type MSSQLConfiguration struct { + ConnectionInfo MSSQLSourceConnectionInfo `json:"connection_info"`// Connection parameters for the source +} + +// Connection parameters for the source +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo +type MSSQLSourceConnectionInfo struct { + ConnectionString *Sslpassword `json:"connection_string"` // The database connection string, or as an environment variable + PoolSettings *MSSQLPoolSettings `json:"pool_settings,omitempty"`// Connection pool settings +} + +// Connection pool settings +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlpoolsettings +type MSSQLPoolSettings struct { + IdleTimeout *float64 `json:"idle_timeout,omitempty"` // The idle timeout (in seconds) per connection (default: 180) + MaxConnections *float64 `json:"max_connections,omitempty"`// Maximum number of connections to be kept in the pool (default: 50) +} + +type BigQuerySource struct { + Configuration BigQueryConfiguration `json:"configuration"` + Functions []CustomFunction `json:"functions,omitempty"` + Kind BigQuerySourceKind `json:"kind"` + Name string `json:"name"` + Tables []TableEntry `json:"tables"` +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#bigqueryconfiguration +type BigQueryConfiguration struct { + Datasets *Datasets `json:"datasets"` // List of BigQuery datasets + ProjectID *Sslpassword `json:"project_id"` // Project Id for BigQuery database + ServiceAccount *ServiceAccount `json:"service_account"`// Service account for BigQuery database +} + +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#fromenv +// +// Environment variable which stores the client certificate. +// +// Environment variable which stores the client private key. +// +// Environment variable which stores trusted certificate authorities. +type RecordStringAnyClass struct { + FromEnv *string `json:"from_env,omitempty"`// Name of the environment variable +} + +type HasuraMetadataV3 struct { + Actions []Action `json:"actions,omitempty"` + Allowlist []AllowList `json:"allowlist,omitempty"` + APILimits *APILimits `json:"api_limits,omitempty"` + CronTriggers []CronTrigger `json:"cron_triggers,omitempty"` + CustomTypes *CustomTypes `json:"custom_types,omitempty"` + InheritedRoles []InheritedRole `json:"inherited_roles,omitempty"` + QueryCollections []QueryCollectionEntry `json:"query_collections,omitempty"` + RemoteSchemas []RemoteSchema `json:"remote_schemas,omitempty"` + RESTEndpoints []RESTEndpoint `json:"rest_endpoints"` + Sources []Source `json:"sources"` + Version float64 `json:"version"` +} + +type APILimits struct { + DepthLimit *DepthLimit `json:"depth_limit,omitempty"` + Disabled bool `json:"disabled"` + NodeLimit *NodeLimit `json:"node_limit,omitempty"` + RateLimit *RateLimit `json:"rate_limit,omitempty"` +} + +type DepthLimit struct { + Global float64 `json:"global"` + PerRole map[string]float64 `json:"per_role"` +} + +type NodeLimit struct { + Global float64 `json:"global"` + PerRole map[string]float64 `json:"per_role"` +} + +type RateLimit struct { + Global RateLimitRule `json:"global"` + PerRole map[string]RateLimitRule `json:"per_role"` +} + +type RateLimitRule struct { + MaxReqsPerMin float64 `json:"max_reqs_per_min"` + UniqueParams *UniqueParams `json:"unique_params"` +} + +type InheritedRole struct { + RoleName string `json:"role_name"` + RoleSet []string `json:"role_set"` +} + +type RESTEndpoint struct { + Comment *string `json:"comment,omitempty"` + Definition RESTEndpointDefinition `json:"definition"` + Methods []Method `json:"methods"` + Name string `json:"name"` + URL string `json:"url"` +} + +type RESTEndpointDefinition struct { + Query QueryClass `json:"query"` +} + +type QueryClass struct { + CollectionName string `json:"collection_name"` + QueryName string `json:"query_name"` +} + +type Source struct { + Configuration Configuration `json:"configuration"` + Functions []CustomFunction `json:"functions,omitempty"` + Kind BackendKind `json:"kind"` + Name string `json:"name"` + Tables []TableEntry `json:"tables"` +} + +// +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconfiguration +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#bigqueryconfiguration +type Configuration struct { + ConnectionInfo *SourceConnectionInfo `json:"connection_info,omitempty"`// Connection parameters for the source + ReadReplicas []PGSourceConnectionInfo `json:"read_replicas,omitempty"` // Optional list of read replica configuration (supported only in cloud/enterprise versions) + Datasets *Datasets `json:"datasets"` // List of BigQuery datasets + ProjectID *Sslpassword `json:"project_id"` // Project Id for BigQuery database + ServiceAccount *ServiceAccount `json:"service_account"` // Service account for BigQuery database +} + +// Connection parameters for the source +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgsourceconnectioninfo +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo +type SourceConnectionInfo struct { + DatabaseURL *DatabaseURL `json:"database_url"` // The database connection URL as a string, as an environment variable, or as connection; parameters. + IsolationLevel *IsolationLevel `json:"isolation_level,omitempty"` // The transaction isolation level in which the queries made to the source will be run with; (default: read-committed). + PoolSettings *PoolSettings `json:"pool_settings,omitempty"` // Connection pool settings + SSLConfiguration *PGCERTSettings `json:"ssl_configuration,omitempty"` // The client SSL certificate settings for the database (Only available in Cloud). + UsePreparedStatements *bool `json:"use_prepared_statements,omitempty"`// If set to true the server prepares statement before executing on the source database; (default: false). For more details, refer to the Postgres docs + ConnectionString *Sslpassword `json:"connection_string"` // The database connection string, or as an environment variable +} + +// Connection pool settings +// +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgpoolsettings +// +// +// https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlpoolsettings +type PoolSettings struct { + ConnectionLifetime *float64 `json:"connection_lifetime,omitempty"`// Time from connection creation after which the connection should be destroyed and a new; one created. A value of 0 indicates we should never destroy an active connection. If 0 is; passed, memory from large query results may not be reclaimed. (default: 600 sec) + IdleTimeout *float64 `json:"idle_timeout,omitempty"` // The idle timeout (in seconds) per connection (default: 180) + MaxConnections *float64 `json:"max_connections,omitempty"` // Maximum number of connections to be kept in the pool (default: 50) + PoolTimeout *float64 `json:"pool_timeout,omitempty"` // Maximum time to wait while acquiring a Postgres connection from the pool, in seconds; (default: forever) + Retries *float64 `json:"retries,omitempty"` // Number of retries to perform (default: 1) +} + +type ActionDefinitionType string +const ( + Mutation ActionDefinitionType = "mutation" + Query ActionDefinitionType = "query" +) + +// Type of the relationship +type CustomTypeObjectRelationshipType string +const ( + Array CustomTypeObjectRelationshipType = "array" + Object CustomTypeObjectRelationshipType = "object" +) + +type Columns string +const ( + Empty Columns = "*" +) + +// The transaction isolation level in which the queries made to the source will be run with +// (default: read-committed). +type IsolationLevel string +const ( + ReadCommitted IsolationLevel = "read-committed" + RepeatableRead IsolationLevel = "repeatable-read" + Serializable IsolationLevel = "serializable" +) + +type PGSourceKind string +const ( + KindCitus PGSourceKind = "citus" + KindPostgres PGSourceKind = "postgres" +) + +type MSSQLSourceKind string +const ( + KindMssql MSSQLSourceKind = "mssql" +) + +type BigQuerySourceKind string +const ( + KindBigquery BigQuerySourceKind = "bigquery" +) + +type UniqueParamsEnum string +const ( + IP UniqueParamsEnum = "IP" +) + +type Method string +const ( + Patch Method = "PATCH" + Post Method = "POST" + Put Method = "PUT" +) + +type BackendKind string +const ( + BackendKindBigquery BackendKind = "bigquery" + BackendKindCitus BackendKind = "citus" + BackendKindMssql BackendKind = "mssql" + BackendKindPostgres BackendKind = "postgres" +) + +type TableName struct { + QualifiedTable *QualifiedTable + String *string +} + +func (x *TableName) UnmarshalJSON(data []byte) error { + x.QualifiedTable = nil + var c QualifiedTable + object, err := unmarshalUnion(data, nil, nil, nil, &x.String, false, nil, true, &c, false, nil, false, nil, false) + if err != nil { + return err + } + if object { + x.QualifiedTable = &c + } + return nil +} + +func (x *TableName) MarshalJSON() ([]byte, error) { + return marshalUnion(nil, nil, nil, x.String, false, nil, x.QualifiedTable != nil, x.QualifiedTable, false, nil, false, nil, false) +} + +type FunctionName struct { + QualifiedFunction *QualifiedFunction + String *string +} + +func (x *FunctionName) UnmarshalJSON(data []byte) error { + x.QualifiedFunction = nil + var c QualifiedFunction + object, err := unmarshalUnion(data, nil, nil, nil, &x.String, false, nil, true, &c, false, nil, false, nil, false) + if err != nil { + return err + } + if object { + x.QualifiedFunction = &c + } + return nil +} + +func (x *FunctionName) MarshalJSON() ([]byte, error) { + return marshalUnion(nil, nil, nil, x.String, false, nil, x.QualifiedFunction != nil, x.QualifiedFunction, false, nil, false, nil, false) +} + +type Filter struct { + AnythingMap map[string]interface{} + Double *float64 + String *string +} + +func (x *Filter) UnmarshalJSON(data []byte) error { + x.AnythingMap = nil + object, err := unmarshalUnion(data, nil, &x.Double, nil, &x.String, false, nil, false, nil, true, &x.AnythingMap, false, nil, false) + if err != nil { + return err + } + if object { + } + return nil +} + +func (x *Filter) MarshalJSON() ([]byte, error) { + return marshalUnion(nil, x.Double, nil, x.String, false, nil, false, nil, x.AnythingMap != nil, x.AnythingMap, false, nil, false) +} + +type EventTriggerColumns struct { + Enum *Columns + StringArray []string +} + +func (x *EventTriggerColumns) UnmarshalJSON(data []byte) error { + x.StringArray = nil + x.Enum = nil + object, err := unmarshalUnion(data, nil, nil, nil, nil, true, &x.StringArray, false, nil, false, nil, true, &x.Enum, false) + if err != nil { + return err + } + if object { + } + return nil +} + +func (x *EventTriggerColumns) MarshalJSON() ([]byte, error) { + return marshalUnion(nil, nil, nil, nil, x.StringArray != nil, x.StringArray, false, nil, false, nil, x.Enum != nil, x.Enum, false) +} + +// The database connection URL as a string, as an environment variable, or as connection +// parameters. +type DatabaseURL struct { + PGConnectionParametersClass *PGConnectionParametersClass + String *string +} + +func (x *DatabaseURL) UnmarshalJSON(data []byte) error { + x.PGConnectionParametersClass = nil + var c PGConnectionParametersClass + object, err := unmarshalUnion(data, nil, nil, nil, &x.String, false, nil, true, &c, false, nil, false, nil, false) + if err != nil { + return err + } + if object { + x.PGConnectionParametersClass = &c + } + return nil +} + +func (x *DatabaseURL) MarshalJSON() ([]byte, error) { + return marshalUnion(nil, nil, nil, x.String, false, nil, x.PGConnectionParametersClass != nil, x.PGConnectionParametersClass, false, nil, false, nil, false) +} + +type Sslpassword struct { + FromEnv *FromEnv + String *string +} + +func (x *Sslpassword) UnmarshalJSON(data []byte) error { + x.FromEnv = nil + var c FromEnv + object, err := unmarshalUnion(data, nil, nil, nil, &x.String, false, nil, true, &c, false, nil, false, nil, false) + if err != nil { + return err + } + if object { + x.FromEnv = &c + } + return nil +} + +func (x *Sslpassword) MarshalJSON() ([]byte, error) { + return marshalUnion(nil, nil, nil, x.String, false, nil, x.FromEnv != nil, x.FromEnv, false, nil, false, nil, false) +} + +// List of BigQuery datasets +type Datasets struct { + FromEnv *FromEnv + StringArray []string +} + +func (x *Datasets) UnmarshalJSON(data []byte) error { + x.StringArray = nil + x.FromEnv = nil + var c FromEnv + object, err := unmarshalUnion(data, nil, nil, nil, nil, true, &x.StringArray, true, &c, false, nil, false, nil, false) + if err != nil { + return err + } + if object { + x.FromEnv = &c + } + return nil +} + +func (x *Datasets) MarshalJSON() ([]byte, error) { + return marshalUnion(nil, nil, nil, nil, x.StringArray != nil, x.StringArray, x.FromEnv != nil, x.FromEnv, false, nil, false, nil, false) +} + +// Service account for BigQuery database +type ServiceAccount struct { + RecordStringAnyClass *RecordStringAnyClass + String *string +} + +func (x *ServiceAccount) UnmarshalJSON(data []byte) error { + x.RecordStringAnyClass = nil + var c RecordStringAnyClass + object, err := unmarshalUnion(data, nil, nil, nil, &x.String, false, nil, true, &c, false, nil, false, nil, false) + if err != nil { + return err + } + if object { + x.RecordStringAnyClass = &c + } + return nil +} + +func (x *ServiceAccount) MarshalJSON() ([]byte, error) { + return marshalUnion(nil, nil, nil, x.String, false, nil, x.RecordStringAnyClass != nil, x.RecordStringAnyClass, false, nil, false, nil, false) +} + +type UniqueParams struct { + Enum *UniqueParamsEnum + StringArray []string +} + +func (x *UniqueParams) UnmarshalJSON(data []byte) error { + x.StringArray = nil + x.Enum = nil + object, err := unmarshalUnion(data, nil, nil, nil, nil, true, &x.StringArray, false, nil, false, nil, true, &x.Enum, true) + if err != nil { + return err + } + if object { + } + return nil +} + +func (x *UniqueParams) MarshalJSON() ([]byte, error) { + return marshalUnion(nil, nil, nil, nil, x.StringArray != nil, x.StringArray, false, nil, false, nil, x.Enum != nil, x.Enum, true) +} + +func unmarshalUnion(data []byte, pi **int64, pf **float64, pb **bool, ps **string, haveArray bool, pa interface{}, haveObject bool, pc interface{}, haveMap bool, pm interface{}, haveEnum bool, pe interface{}, nullable bool) (bool, error) { + if pi != nil { + *pi = nil + } + if pf != nil { + *pf = nil + } + if pb != nil { + *pb = nil + } + if ps != nil { + *ps = nil + } + + dec := json.NewDecoder(bytes.NewReader(data)) + dec.UseNumber() + tok, err := dec.Token() + if err != nil { + return false, err + } + + switch v := tok.(type) { + case json.Number: + if pi != nil { + i, err := v.Int64() + if err == nil { + *pi = &i + return false, nil + } + } + if pf != nil { + f, err := v.Float64() + if err == nil { + *pf = &f + return false, nil + } + return false, errors.New("Unparsable number") + } + return false, errors.New("Union does not contain number") + case float64: + return false, errors.New("Decoder should not return float64") + case bool: + if pb != nil { + *pb = &v + return false, nil + } + return false, errors.New("Union does not contain bool") + case string: + if haveEnum { + return false, json.Unmarshal(data, pe) + } + if ps != nil { + *ps = &v + return false, nil + } + return false, errors.New("Union does not contain string") + case nil: + if nullable { + return false, nil + } + return false, errors.New("Union does not contain null") + case json.Delim: + if v == '{' { + if haveObject { + return true, json.Unmarshal(data, pc) + } + if haveMap { + return false, json.Unmarshal(data, pm) + } + return false, errors.New("Union does not contain object") + } + if v == '[' { + if haveArray { + return false, json.Unmarshal(data, pa) + } + return false, errors.New("Union does not contain array") + } + return false, errors.New("Cannot handle delimiter") + } + return false, errors.New("Cannot unmarshal union") + +} + +func marshalUnion(pi *int64, pf *float64, pb *bool, ps *string, haveArray bool, pa interface{}, haveObject bool, pc interface{}, haveMap bool, pm interface{}, haveEnum bool, pe interface{}, nullable bool) ([]byte, error) { + if pi != nil { + return json.Marshal(*pi) + } + if pf != nil { + return json.Marshal(*pf) + } + if pb != nil { + return json.Marshal(*pb) + } + if ps != nil { + return json.Marshal(*ps) + } + if haveArray { + return json.Marshal(pa) + } + if haveObject { + return json.Marshal(pc) + } + if haveMap { + return json.Marshal(pm) + } + if haveEnum { + return json.Marshal(pe) + } + if nullable { + return json.Marshal(nil) + } + return nil, errors.New("Union must not be null") +} diff --git a/contrib/metadata-types/generated/HasuraMetadataV3.hs b/contrib/metadata-types/generated/HasuraMetadataV3.hs new file mode 100644 index 00000000000..3a7ad77b95b --- /dev/null +++ b/contrib/metadata-types/generated/HasuraMetadataV3.hs @@ -0,0 +1,3477 @@ +{-# LANGUAGE StrictData #-} +{-# LANGUAGE OverloadedStrings #-} + +module QuickType + ( PGColumn (..) + , ComputedFieldName (..) + , RoleName (..) + , TriggerName (..) + , RemoteRelationshipName (..) + , RemoteSchemaName (..) + , CollectionName (..) + , GraphQLName (..) + , GraphQLType (..) + , RelationshipName (..) + , ActionName (..) + , WebhookURL (..) + , TableName (..) + , QualifiedTable (..) + , TableConfig (..) + , TableEntry (..) + , CustomRootFields (..) + , CustomColumnNames (..) + , FunctionName (..) + , QualifiedFunction (..) + , CustomFunction (..) + , FunctionConfiguration (..) + , ObjectRelationship (..) + , ObjRelUsing (..) + , ObjRelUsingManualMapping (..) + , ArrayRelationship (..) + , ArrRelUsing (..) + , ArrRelUsingFKeyOn (..) + , ArrRelUsingManualMapping (..) + , ColumnPresetsExpression (..) + , InsertPermissionEntry (..) + , InsertPermission (..) + , SelectPermissionEntry (..) + , SelectPermission (..) + , UpdatePermissionEntry (..) + , UpdatePermission (..) + , DeletePermissionEntry (..) + , DeletePermission (..) + , ComputedField (..) + , ComputedFieldDefinition (..) + , EventTrigger (..) + , EventTriggerDefinition (..) + , EventTriggerColumns (..) + , OperationSpec (..) + , HeaderFromValue (..) + , HeaderFromEnv (..) + , RetryConf (..) + , CronTrigger (..) + , RetryConfST (..) + , RemoteSchema (..) + , RemoteSchemaDef (..) + , RemoteRelationship (..) + , RemoteRelationshipDef (..) + , RemoteField (..) + , InputArguments (..) + , QueryCollectionEntry (..) + , QueryCollection (..) + , AllowList (..) + , CustomTypes (..) + , InputObjectType (..) + , InputObjectField (..) + , ObjectType (..) + , ObjectField (..) + , CustomTypeObjectRelationship (..) + , ScalarType (..) + , EnumType (..) + , EnumValue (..) + , Action (..) + , ActionDefinition (..) + , InputArgument (..) + , HasuraMetadataV2 (..) + , FromEnv (..) + , PGConfiguration (..) + , MSSQLConfiguration (..) + , BigQueryConfiguration (..) + , PGSourceConnectionInfo (..) + , MSSQLSourceConnectionInfo (..) + , PGConnectionParameters (..) + , PGPoolSettings (..) + , PGCERTSettings (..) + , MSSQLPoolSettings (..) + , BackendKind (..) + , BaseSource (..) + , PGSource (..) + , MSSQLSource (..) + , BigQuerySource (..) + , Source (..) + , APILimits (..) + , DepthLimit (..) + , RateLimit (..) + , RateLimitRule (..) + , NodeLimit (..) + , RESTEndpoint (..) + , RESTEndpointDefinition (..) + , InheritedRole (..) + , HasuraMetadataV3 (..) + , RecordStringAny (..) + , Header (..) + , Permission (..) + , Definition (..) + , RemoteFieldValue (..) + , PGConnectionParametersClass (..) + , RecordStringAnyClass (..) + , QueryClass (..) + , Configuration (..) + , SourceConnectionInfo (..) + , PoolSettings (..) + , ActionDefinitionType (..) + , CustomTypeObjectRelationshipType (..) + , Columns (..) + , IsolationLevel (..) + , PGSourceKind (..) + , MSSQLSourceKind (..) + , BigQuerySourceKind (..) + , UniqueParamsEnum (..) + , Method (..) + , Filter (..) + , DatabaseURL (..) + , Sslpassword (..) + , Datasets (..) + , ServiceAccount (..) + , UniqueParams (..) + , decodeTopLevel + ) where + +import Data.Aeson +import Data.Aeson.Types (emptyObject) +import Data.ByteString.Lazy (ByteString) +import Data.HashMap.Strict (HashMap) +import Data.Text (Text) +import Data.Vector (Vector) + +type PGColumn = Text + +type ComputedFieldName = Text + +type RoleName = Text + +type TriggerName = Text + +type RemoteRelationshipName = Text + +type RemoteSchemaName = Text + +type CollectionName = Text + +type GraphQLName = Text + +type GraphQLType = Text + +type RelationshipName = Text + +type ActionName = Text + +type WebhookURL = Text + +type CustomColumnNames = HashMap Text Text + +type ColumnPresetsExpression = HashMap Text Text + +type RemoteField = HashMap Text RemoteFieldValue + +type InputArguments = HashMap Text Text + +type RecordStringAny = HashMap Text (Maybe Text) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromvalue + +name: +Name of the header + +value: +Value of the header +-} +data HeaderFromValue = HeaderFromValue + { nameHeaderFromValue :: Text + , valueHeaderFromValue :: Text + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromenv + +name: +Name of the header + +valueFromEnv: +Name of the environment variable which holds the value of the header +-} +data HeaderFromEnv = HeaderFromEnv + { nameHeaderFromEnv :: Text + , valueFromEnvHeaderFromEnv :: Text + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objectfield + +description: +Description of the Input object type + +name: +Name of the Input object type + +objectFieldType: +GraphQL type of the Input object type +-} +data ObjectField = ObjectField + { descriptionObjectField :: Maybe Text + , nameObjectField :: Text + , objectFieldTypeObjectField :: Text + } deriving (Show) + +{-| Type used in exported 'metadata.json' and replace metadata endpoint + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/manage-metadata.html#replace-metadata +-} +data HasuraMetadataV2 = HasuraMetadataV2 + { actionsHasuraMetadataV2 :: Maybe (Vector Action) + , allowlistHasuraMetadataV2 :: Maybe (Vector AllowList) + , cronTriggersHasuraMetadataV2 :: Maybe (Vector CronTrigger) + , customTypesHasuraMetadataV2 :: Maybe CustomTypes + , functionsHasuraMetadataV2 :: Maybe (Vector CustomFunction) + , queryCollectionsHasuraMetadataV2 :: Maybe (Vector QueryCollectionEntry) + , remoteSchemasHasuraMetadataV2 :: Maybe (Vector RemoteSchema) + , tablesHasuraMetadataV2 :: Vector TableEntry + , versionHasuraMetadataV2 :: Float + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#args-syntax + +comment: +Comment + +definition: +Definition of the action + +name: +Name of the action + +permissions: +Permissions of the action +-} +data Action = Action + { commentAction :: Maybe Text + , definitionAction :: ActionDefinition + , nameAction :: Text + , permissionsAction :: Maybe (Vector Permission) + } deriving (Show) + +{-| Definition of the action + + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#actiondefinition + +handler: +A String value which supports templating environment variables enclosed in {{ and }}. +Template example: https://{{ACTION_API_DOMAIN}}/create-user +-} +data ActionDefinition = ActionDefinition + { argumentsActionDefinition :: Maybe (Vector InputArgument) + , forwardClientHeadersActionDefinition :: Maybe Bool + , handlerActionDefinition :: Text + , headersActionDefinition :: Maybe (Vector Header) + , kindActionDefinition :: Maybe Text + , outputTypeActionDefinition :: Maybe Text + , actionDefinitionTypeActionDefinition :: Maybe ActionDefinitionType + } deriving (Show) + +data ActionDefinitionType + = MutationActionDefinitionType + | QueryActionDefinitionType + deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#inputargument +-} +data InputArgument = InputArgument + { nameInputArgument :: Text + , inputArgumentTypeInputArgument :: Text + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromvalue + + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromenv + +name: +Name of the header + +value: +Value of the header + +valueFromEnv: +Name of the environment variable which holds the value of the header +-} +data Header = Header + { nameHeader :: Text + , valueHeader :: Maybe Text + , valueFromEnvHeader :: Maybe Text + } deriving (Show) + +data Permission = Permission + { rolePermission :: Text + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/query-collections.html#add-collection-to-allowlist-syntax + +collection: +Name of a query collection to be added to the allow-list +-} +data AllowList = AllowList + { collectionAllowList :: Text + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/scheduled-triggers.html#create-cron-trigger + +comment: +Custom comment. + +headers: +List of headers to be sent with the webhook + +includeInMetadata: +Flag to indicate whether a trigger should be included in the metadata. When a cron +trigger is included in the metadata, the user will be able to export it when the metadata +of the graphql-engine is exported. + +name: +Name of the cron trigger + +payload: +Any JSON payload which will be sent when the webhook is invoked. + +retryConf: +Retry configuration if scheduled invocation delivery fails + +schedule: +Cron expression at which the trigger should be invoked. + +webhook: +URL of the webhook +-} +data CronTrigger = CronTrigger + { commentCronTrigger :: Maybe Text + , headersCronTrigger :: Vector Header + , includeInMetadataCronTrigger :: Bool + , nameCronTrigger :: Text + , payloadCronTrigger :: Maybe (HashMap Text (Maybe Text)) + , retryConfCronTrigger :: Maybe RetryConfST + , scheduleCronTrigger :: Text + , webhookCronTrigger :: Text + } deriving (Show) + +{-| Retry configuration if scheduled invocation delivery fails + + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/scheduled-triggers.html#retryconfst + +numRetries: +Number of times to retry delivery. +Default: 0 + +retryIntervalSeconds: +Number of seconds to wait between each retry. +Default: 10 + +timeoutSeconds: +Number of seconds to wait for response before timing out. +Default: 60 + +toleranceSeconds: +Number of seconds between scheduled time and actual delivery time that is acceptable. If +the time difference is more than this, then the event is dropped. +Default: 21600 (6 hours) +-} +data RetryConfST = RetryConfST + { numRetriesRetryConfST :: Maybe Int + , retryIntervalSecondsRetryConfST :: Maybe Int + , timeoutSecondsRetryConfST :: Maybe Int + , toleranceSecondsRetryConfST :: Maybe Int + } deriving (Show) + +data CustomTypes = CustomTypes + { enumsCustomTypes :: Maybe (Vector EnumType) + , inputObjectsCustomTypes :: Maybe (Vector InputObjectType) + , objectsCustomTypes :: Maybe (Vector ObjectType) + , scalarsCustomTypes :: Maybe (Vector ScalarType) + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#enumtype + +description: +Description of the Enum type + +name: +Name of the Enum type + +values: +Values of the Enum type +-} +data EnumType = EnumType + { descriptionEnumType :: Maybe Text + , nameEnumType :: Text + , valuesEnumType :: Vector EnumValue + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#enumvalue + +description: +Description of the Enum value + +isDeprecated: +If set to true, the enum value is marked as deprecated + +value: +Value of the Enum type +-} +data EnumValue = EnumValue + { descriptionEnumValue :: Maybe Text + , isDeprecatedEnumValue :: Maybe Bool + , valueEnumValue :: Text + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#inputobjecttype + +description: +Description of the Input object type + +fields: +Fields of the Input object type + +name: +Name of the Input object type +-} +data InputObjectType = InputObjectType + { descriptionInputObjectType :: Maybe Text + , fieldsInputObjectType :: Vector InputObjectField + , nameInputObjectType :: Text + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#inputobjectfield + +description: +Description of the Input object type + +name: +Name of the Input object type + +inputObjectFieldType: +GraphQL type of the Input object type +-} +data InputObjectField = InputObjectField + { descriptionInputObjectField :: Maybe Text + , nameInputObjectField :: Text + , inputObjectFieldTypeInputObjectField :: Text + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objecttype + +description: +Description of the Input object type + +fields: +Fields of the Input object type + +name: +Name of the Input object type + +relationships: +Relationships of the Object type to tables +-} +data ObjectType = ObjectType + { descriptionObjectType :: Maybe Text + , fieldsObjectType :: Vector InputObjectField + , nameObjectType :: Text + , relationshipsObjectType :: Maybe (Vector CustomTypeObjectRelationship) + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objectrelationship + +fieldMapping: +Mapping of fields of object type to columns of remote table + +name: +Name of the relationship, shouldn’t conflict with existing field names + +remoteTable: +The table to which relationship is defined + +customTypeObjectRelationshipType: +Type of the relationship +-} +data CustomTypeObjectRelationship = CustomTypeObjectRelationship + { fieldMappingCustomTypeObjectRelationship :: HashMap Text Text + , nameCustomTypeObjectRelationship :: Text + , remoteTableCustomTypeObjectRelationship :: TableName + , customTypeObjectRelationshipTypeCustomTypeObjectRelationship :: CustomTypeObjectRelationshipType + } deriving (Show) + +{-| Type of the relationship -} +data CustomTypeObjectRelationshipType + = TypeArrayCustomTypeObjectRelationshipType + | TypeObjectCustomTypeObjectRelationshipType + deriving (Show) + +data TableName + = QualifiedTableInTableName QualifiedTable + | StringInTableName Text + deriving (Show) + +data QualifiedTable = QualifiedTable + { nameQualifiedTable :: Text + , schemaQualifiedTable :: Text + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#scalartype + +description: +Description of the Scalar type + +name: +Name of the Scalar type +-} +data ScalarType = ScalarType + { descriptionScalarType :: Maybe Text + , nameScalarType :: Text + } deriving (Show) + +{-| A custom SQL function to add to the GraphQL schema with configuration. + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-functions.html#args-syntax + +configuration: +Configuration for the SQL function + +function: +Name of the SQL function +-} +data CustomFunction = CustomFunction + { configurationCustomFunction :: Maybe FunctionConfiguration + , functionCustomFunction :: FunctionName + } deriving (Show) + +{-| Configuration for the SQL function + +Configuration for a CustomFunction + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-functions.html#function-configuration + +sessionArgument: +Function argument which accepts session info JSON +Currently, only functions which satisfy the following constraints can be exposed over the +GraphQL API (terminology from Postgres docs): +- Function behaviour: ONLY `STABLE` or `IMMUTABLE` +- Return type: MUST be `SETOF ` +- Argument modes: ONLY `IN` +-} +data FunctionConfiguration = FunctionConfiguration + { sessionArgumentFunctionConfiguration :: Maybe Text + } deriving (Show) + +data FunctionName + = QualifiedFunctionInFunctionName QualifiedFunction + | StringInFunctionName Text + deriving (Show) + +data QualifiedFunction = QualifiedFunction + { nameQualifiedFunction :: Text + , schemaQualifiedFunction :: Text + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/query-collections.html#args-syntax + +comment: +Comment + +definition: +List of queries + +name: +Name of the query collection +-} +data QueryCollectionEntry = QueryCollectionEntry + { commentQueryCollectionEntry :: Maybe Text + , definitionQueryCollectionEntry :: Definition + , nameQueryCollectionEntry :: Text + } deriving (Show) + +{-| List of queries -} +data Definition = Definition + { queriesDefinition :: Vector QueryCollection + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#collectionquery +-} +data QueryCollection = QueryCollection + { nameQueryCollection :: Text + , queryQueryCollection :: Text + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-schemas.html#add-remote-schema + +comment: +Comment + +definition: +Name of the remote schema + +name: +Name of the remote schema +-} +data RemoteSchema = RemoteSchema + { commentRemoteSchema :: Maybe Text + , definitionRemoteSchema :: RemoteSchemaDef + , nameRemoteSchema :: Text + } deriving (Show) + +{-| Name of the remote schema + + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#remoteschemadef +-} +data RemoteSchemaDef = RemoteSchemaDef + { forwardClientHeadersRemoteSchemaDef :: Maybe Bool + , headersRemoteSchemaDef :: Maybe (Vector Header) + , timeoutSecondsRemoteSchemaDef :: Maybe Float + , urlRemoteSchemaDef :: Maybe Text + , urlFromEnvRemoteSchemaDef :: Maybe Text + } deriving (Show) + +{-| Representation of a table in metadata, 'tables.yaml' and 'metadata.json' + +configuration: +Configuration for the table/view + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config +-} +data TableEntry = TableEntry + { arrayRelationshipsTableEntry :: Maybe (Vector ArrayRelationship) + , computedFieldsTableEntry :: Maybe (Vector ComputedField) + , configurationTableEntry :: Maybe TableConfig + , deletePermissionsTableEntry :: Maybe (Vector DeletePermissionEntry) + , eventTriggersTableEntry :: Maybe (Vector EventTrigger) + , insertPermissionsTableEntry :: Maybe (Vector InsertPermissionEntry) + , isEnumTableEntry :: Maybe Bool + , objectRelationshipsTableEntry :: Maybe (Vector ObjectRelationship) + , remoteRelationshipsTableEntry :: Maybe (Vector RemoteRelationship) + , selectPermissionsTableEntry :: Maybe (Vector SelectPermissionEntry) + , tableTableEntry :: QualifiedTable + , updatePermissionsTableEntry :: Maybe (Vector UpdatePermissionEntry) + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#create-array-relationship-syntax + +comment: +Comment + +name: +Name of the new relationship + +using: +Use one of the available ways to define an array relationship +-} +data ArrayRelationship = ArrayRelationship + { commentArrayRelationship :: Maybe Text + , nameArrayRelationship :: Text + , usingArrayRelationship :: ArrRelUsing + } deriving (Show) + +{-| Use one of the available ways to define an array relationship + +Use one of the available ways to define an object relationship + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusing + +foreignKeyConstraintOn: +The column with foreign key constraint + +manualConfiguration: +Manual mapping of table and columns +-} +data ArrRelUsing = ArrRelUsing + { foreignKeyConstraintOnArrRelUsing :: Maybe ArrRelUsingFKeyOn + , manualConfigurationArrRelUsing :: Maybe ArrRelUsingManualMapping + } deriving (Show) + +{-| The column with foreign key constraint + +The column with foreign key constraint + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusingfkeyon +-} +data ArrRelUsingFKeyOn = ArrRelUsingFKeyOn + { columnArrRelUsingFKeyOn :: Text + , tableArrRelUsingFKeyOn :: TableName + } deriving (Show) + +{-| Manual mapping of table and columns + +Manual mapping of table and columns + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusingmanualmapping + +columnMapping: +Mapping of columns from current table to remote table + +remoteTable: +The table to which the relationship has to be established +-} +data ArrRelUsingManualMapping = ArrRelUsingManualMapping + { columnMappingArrRelUsingManualMapping :: HashMap Text Text + , remoteTableArrRelUsingManualMapping :: TableName + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/computed-field.html#args-syntax + +comment: +Comment + +definition: +The computed field definition + +name: +Name of the new computed field +-} +data ComputedField = ComputedField + { commentComputedField :: Maybe Text + , definitionComputedField :: ComputedFieldDefinition + , nameComputedField :: Text + } deriving (Show) + +{-| The computed field definition + + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/computed-field.html#computedfielddefinition + +function: +The SQL function + +sessionArgument: +Name of the argument which accepts the Hasura session object as a JSON/JSONB value. If +omitted, the Hasura session object is not passed to the function + +tableArgument: +Name of the argument which accepts a table row type. If omitted, the first argument is +considered a table argument +-} +data ComputedFieldDefinition = ComputedFieldDefinition + { functionComputedFieldDefinition :: FunctionName + , sessionArgumentComputedFieldDefinition :: Maybe Text + , tableArgumentComputedFieldDefinition :: Maybe Text + } deriving (Show) + +{-| Configuration for the table/view + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config + +customColumnNames: +Customise the column names + +customName: +Customise the table name + +customRootFields: +Customise the root fields +-} +data TableConfig = TableConfig + { customColumnNamesTableConfig :: Maybe (HashMap Text Text) + , customNameTableConfig :: Maybe Text + , customRootFieldsTableConfig :: Maybe CustomRootFields + } deriving (Show) + +{-| Customise the root fields + +Customise the root fields + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#custom-root-fields + +delete: +Customise the `delete_` root field + +deleteByPk: +Customise the `delete__by_pk` root field + +insert: +Customise the `insert_` root field + +insertOne: +Customise the `insert__one` root field + +select: +Customise the `` root field + +selectAggregate: +Customise the `_aggregate` root field + +selectByPk: +Customise the `_by_pk` root field + +update: +Customise the `update_` root field + +updateByPk: +Customise the `update__by_pk` root field +-} +data CustomRootFields = CustomRootFields + { deleteCustomRootFields :: Maybe Text + , deleteByPkCustomRootFields :: Maybe Text + , insertCustomRootFields :: Maybe Text + , insertOneCustomRootFields :: Maybe Text + , selectCustomRootFields :: Maybe Text + , selectAggregateCustomRootFields :: Maybe Text + , selectByPkCustomRootFields :: Maybe Text + , updateCustomRootFields :: Maybe Text + , updateByPkCustomRootFields :: Maybe Text + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-delete-permission-syntax + +comment: +Comment + +permission: +The permission definition + +role: +Role +-} +data DeletePermissionEntry = DeletePermissionEntry + { commentDeletePermissionEntry :: Maybe Text + , permissionDeletePermissionEntry :: DeletePermission + , roleDeletePermissionEntry :: Text + } deriving (Show) + +{-| The permission definition + + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#deletepermission + +filter: +Only the rows where this precondition holds true are updatable +-} +data DeletePermission = DeletePermission + { filterDeletePermission :: Maybe (HashMap Text Filter) + } deriving (Show) + +data Filter + = AnythingMapInFilter (HashMap Text (Maybe Text)) + | DoubleInFilter Float + | StringInFilter Text + deriving (Show) + +{-| NOTE: The metadata type doesn't QUITE match the 'create' arguments here + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#create-event-trigger + +definition: +The SQL function + +headers: +The SQL function + +name: +Name of the event trigger + +retryConf: +The SQL function + +webhook: +The SQL function +-} +data EventTrigger = EventTrigger + { definitionEventTrigger :: EventTriggerDefinition + , headersEventTrigger :: Maybe (Vector Header) + , nameEventTrigger :: Text + , retryConfEventTrigger :: RetryConf + , webhookEventTrigger :: Maybe Text + , webhookFromEnvEventTrigger :: Maybe Text + } deriving (Show) + +{-| The SQL function + +delete: + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec + +insert: + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec + +update: + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec +-} +data EventTriggerDefinition = EventTriggerDefinition + { deleteEventTriggerDefinition :: Maybe OperationSpec + , enableManualEventTriggerDefinition :: Bool + , insertEventTriggerDefinition :: Maybe OperationSpec + , updateEventTriggerDefinition :: Maybe OperationSpec + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec + +columns: + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#eventtriggercolumns + +payload: + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#eventtriggercolumns +-} +data OperationSpec = OperationSpec + { columnsOperationSpec :: EventTriggerColumns + , payloadOperationSpec :: Maybe EventTriggerColumns + } deriving (Show) + +data EventTriggerColumns + = EnumInEventTriggerColumns Columns + | StringArrayInEventTriggerColumns (Vector Text) + deriving (Show) + +data Columns + = EmptyColumns + deriving (Show) + +{-| The SQL function + + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#retryconf + +intervalSEC: +Number of seconds to wait between each retry. +Default: 10 + +numRetries: +Number of times to retry delivery. +Default: 0 + +timeoutSEC: +Number of seconds to wait for response before timing out. +Default: 60 +-} +data RetryConf = RetryConf + { intervalSECRetryConf :: Maybe Int + , numRetriesRetryConf :: Maybe Int + , timeoutSECRetryConf :: Maybe Int + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#args-syntax + +comment: +Comment + +permission: +The permission definition + +role: +Role +-} +data InsertPermissionEntry = InsertPermissionEntry + { commentInsertPermissionEntry :: Maybe Text + , permissionInsertPermissionEntry :: InsertPermission + , roleInsertPermissionEntry :: Text + } deriving (Show) + +{-| The permission definition + + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#insertpermission + +backendOnly: +When set to true the mutation is accessible only if x-hasura-use-backend-only-permissions +session variable exists +and is set to true and request is made with x-hasura-admin-secret set if any auth is +configured + +check: +This expression has to hold true for every new row that is inserted + +columns: +Can insert into only these columns (or all when '*' is specified) + +set: +Preset values for columns that can be sourced from session variables or static values +-} +data InsertPermission = InsertPermission + { backendOnlyInsertPermission :: Maybe Bool + , checkInsertPermission :: Maybe (HashMap Text Filter) + , columnsInsertPermission :: EventTriggerColumns + , setInsertPermission :: Maybe (HashMap Text Text) + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#args-syntax + +comment: +Comment + +name: +Name of the new relationship + +using: +Use one of the available ways to define an object relationship +-} +data ObjectRelationship = ObjectRelationship + { commentObjectRelationship :: Maybe Text + , nameObjectRelationship :: Text + , usingObjectRelationship :: ObjRelUsing + } deriving (Show) + +{-| Use one of the available ways to define an object relationship + +Use one of the available ways to define an object relationship + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#objrelusing + +foreignKeyConstraintOn: +The column with foreign key constraint + +manualConfiguration: +Manual mapping of table and columns +-} +data ObjRelUsing = ObjRelUsing + { foreignKeyConstraintOnObjRelUsing :: Maybe Text + , manualConfigurationObjRelUsing :: Maybe ObjRelUsingManualMapping + } deriving (Show) + +{-| Manual mapping of table and columns + +Manual mapping of table and columns + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#objrelusingmanualmapping + +columnMapping: +Mapping of columns from current table to remote table + +remoteTable: +The table to which the relationship has to be established +-} +data ObjRelUsingManualMapping = ObjRelUsingManualMapping + { columnMappingObjRelUsingManualMapping :: HashMap Text Text + , remoteTableObjRelUsingManualMapping :: TableName + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-relationships.html#args-syntax + +definition: +Definition object + +name: +Name of the remote relationship +-} +data RemoteRelationship = RemoteRelationship + { definitionRemoteRelationship :: RemoteRelationshipDef + , nameRemoteRelationship :: Text + } deriving (Show) + +{-| Definition object + +hasuraFields: +Column(s) in the table that is used for joining with remote schema field. +All join keys in remote_field must appear here. + +remoteField: +The schema tree ending at the field in remote schema which needs to be joined with. + +remoteSchema: +Name of the remote schema to join with +-} +data RemoteRelationshipDef = RemoteRelationshipDef + { hasuraFieldsRemoteRelationshipDef :: Vector Text + , remoteFieldRemoteRelationshipDef :: HashMap Text RemoteFieldValue + , remoteSchemaRemoteRelationshipDef :: Text + } deriving (Show) + +{-| field: +A recursive tree structure that points to the field in the remote schema that needs to be +joined with. +It is recursive because the remote field maybe nested deeply in the remote schema. + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-relationships.html#remotefield +-} +data RemoteFieldValue = RemoteFieldValue + { argumentsRemoteFieldValue :: HashMap Text Text + , fieldRemoteFieldValue :: Maybe (HashMap Text RemoteFieldValue) + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-select-permission-syntax + +comment: +Comment + +permission: +The permission definition + +role: +Role +-} +data SelectPermissionEntry = SelectPermissionEntry + { commentSelectPermissionEntry :: Maybe Text + , permissionSelectPermissionEntry :: SelectPermission + , roleSelectPermissionEntry :: Text + } deriving (Show) + +{-| The permission definition + + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#selectpermission + +allowAggregations: +Toggle allowing aggregate queries + +columns: +Only these columns are selectable (or all when '*' is specified) + +computedFields: +Only these computed fields are selectable + +filter: +Only the rows where this precondition holds true are selectable + +limit: +The maximum number of rows that can be returned +-} +data SelectPermission = SelectPermission + { allowAggregationsSelectPermission :: Maybe Bool + , columnsSelectPermission :: EventTriggerColumns + , computedFieldsSelectPermission :: Maybe (Vector Text) + , filterSelectPermission :: Maybe (HashMap Text Filter) + , limitSelectPermission :: Maybe Int + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-update-permission-syntax + +comment: +Comment + +permission: +The permission definition + +role: +Role +-} +data UpdatePermissionEntry = UpdatePermissionEntry + { commentUpdatePermissionEntry :: Maybe Text + , permissionUpdatePermissionEntry :: UpdatePermission + , roleUpdatePermissionEntry :: Text + } deriving (Show) + +{-| The permission definition + + +https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#updatepermission + +check: +Postcondition which must be satisfied by rows which have been updated + +columns: +Only these columns are selectable (or all when '*' is specified) + +filter: +Only the rows where this precondition holds true are updatable + +set: +Preset values for columns that can be sourced from session variables or static values +-} +data UpdatePermission = UpdatePermission + { checkUpdatePermission :: Maybe (HashMap Text Filter) + , columnsUpdatePermission :: EventTriggerColumns + , filterUpdatePermission :: Maybe (HashMap Text Filter) + , setUpdatePermission :: Maybe (HashMap Text Text) + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconnectionparameters + +database: +The database name + +host: +The name of the host to connect to + +password: +The Postgres user’s password + +port: +The port number to connect with, at the server host + +username: +The Postgres user to be connected +-} +data PGConnectionParameters = PGConnectionParameters + { databasePGConnectionParameters :: Text + , hostPGConnectionParameters :: Text + , passwordPGConnectionParameters :: Maybe Text + , portPGConnectionParameters :: Float + , usernamePGConnectionParameters :: Text + } deriving (Show) + +data BaseSource = BaseSource + { functionsBaseSource :: Maybe (Vector CustomFunction) + , nameBaseSource :: Text + , tablesBaseSource :: Vector TableEntry + } deriving (Show) + +data PGSource = PGSource + { configurationPGSource :: PGConfiguration + , functionsPGSource :: Maybe (Vector CustomFunction) + , kindPGSource :: PGSourceKind + , namePGSource :: Text + , tablesPGSource :: Vector TableEntry + } deriving (Show) + +{-| https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconfiguration + +connectionInfo: +Connection parameters for the source + +readReplicas: +Optional list of read replica configuration (supported only in cloud/enterprise versions) +-} +data PGConfiguration = PGConfiguration + { connectionInfoPGConfiguration :: PGSourceConnectionInfo + , readReplicasPGConfiguration :: Maybe (Vector PGSourceConnectionInfo) + } deriving (Show) + +{-| Connection parameters for the source + + +https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgsourceconnectioninfo + +databaseURL: +The database connection URL as a string, as an environment variable, or as connection +parameters. + +isolationLevel: +The transaction isolation level in which the queries made to the source will be run with +(default: read-committed). + +poolSettings: +Connection pool settings + +sslConfiguration: +The client SSL certificate settings for the database (Only available in Cloud). + +usePreparedStatements: +If set to true the server prepares statement before executing on the source database +(default: false). For more details, refer to the Postgres docs +-} +data PGSourceConnectionInfo = PGSourceConnectionInfo + { databaseURLPGSourceConnectionInfo :: DatabaseURL + , isolationLevelPGSourceConnectionInfo :: Maybe IsolationLevel + , poolSettingsPGSourceConnectionInfo :: Maybe PGPoolSettings + , sslConfigurationPGSourceConnectionInfo :: Maybe PGCERTSettings + , usePreparedStatementsPGSourceConnectionInfo :: Maybe Bool + } deriving (Show) + +{-| The database connection URL as a string, as an environment variable, or as connection +parameters. +-} +data DatabaseURL + = PGConnectionParametersClassInDatabaseURL PGConnectionParametersClass + | StringInDatabaseURL Text + deriving (Show) + +{-| https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#fromenv + +Environment variable which stores the client certificate. + +Environment variable which stores the client private key. + +Environment variable which stores trusted certificate authorities. + + +https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconnectionparameters + +fromEnv: +Name of the environment variable + +database: +The database name + +host: +The name of the host to connect to + +password: +The Postgres user’s password + +port: +The port number to connect with, at the server host + +username: +The Postgres user to be connected +-} +data PGConnectionParametersClass = PGConnectionParametersClass + { fromEnvPGConnectionParametersClass :: Maybe Text + , databasePGConnectionParametersClass :: Maybe Text + , hostPGConnectionParametersClass :: Maybe Text + , passwordPGConnectionParametersClass :: Maybe Text + , portPGConnectionParametersClass :: Maybe Float + , usernamePGConnectionParametersClass :: Maybe Text + } deriving (Show) + +{-| The transaction isolation level in which the queries made to the source will be run with +(default: read-committed). +-} +data IsolationLevel + = ReadCommittedIsolationLevel + | RepeatableReadIsolationLevel + | SerializableIsolationLevel + deriving (Show) + +{-| Connection pool settings + +https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgpoolsettings + +connectionLifetime: +Time from connection creation after which the connection should be destroyed and a new +one created. A value of 0 indicates we should never destroy an active connection. If 0 is +passed, memory from large query results may not be reclaimed. (default: 600 sec) + +idleTimeout: +The idle timeout (in seconds) per connection (default: 180) + +maxConnections: +Maximum number of connections to be kept in the pool (default: 50) + +poolTimeout: +Maximum time to wait while acquiring a Postgres connection from the pool, in seconds +(default: forever) + +retries: +Number of retries to perform (default: 1) +-} +data PGPoolSettings = PGPoolSettings + { connectionLifetimePGPoolSettings :: Maybe Float + , idleTimeoutPGPoolSettings :: Maybe Float + , maxConnectionsPGPoolSettings :: Maybe Float + , poolTimeoutPGPoolSettings :: Maybe Float + , retriesPGPoolSettings :: Maybe Float + } deriving (Show) + +{-| The client SSL certificate settings for the database (Only available in Cloud). + +https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgcertsettings + +sslcert: +Environment variable which stores the client certificate. + +sslkey: +Environment variable which stores the client private key. + +sslmode: +The SSL connection mode. See the libpq ssl support docs + for more details. + +sslpassword: +Password in the case where the sslkey is encrypted. + +sslrootcert: +Environment variable which stores trusted certificate authorities. +-} +data PGCERTSettings = PGCERTSettings + { sslcertPGCERTSettings :: FromEnv + , sslkeyPGCERTSettings :: FromEnv + , sslmodePGCERTSettings :: Text + , sslpasswordPGCERTSettings :: Maybe Sslpassword + , sslrootcertPGCERTSettings :: FromEnv + } deriving (Show) + +{-| https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#fromenv + +Environment variable which stores the client certificate. + +Environment variable which stores the client private key. + +Environment variable which stores trusted certificate authorities. + +fromEnv: +Name of the environment variable +-} +data FromEnv = FromEnv + { fromEnvFromEnv :: Text + } deriving (Show) + +data Sslpassword + = FromEnvInSslpassword FromEnv + | StringInSslpassword Text + deriving (Show) + +data PGSourceKind + = KindCitusPGSourceKind + | KindPostgresPGSourceKind + deriving (Show) + +data MSSQLSource = MSSQLSource + { configurationMSSQLSource :: MSSQLConfiguration + , functionsMSSQLSource :: Maybe (Vector CustomFunction) + , kindMSSQLSource :: MSSQLSourceKind + , nameMSSQLSource :: Text + , tablesMSSQLSource :: Vector TableEntry + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo + +connectionInfo: +Connection parameters for the source +-} +data MSSQLConfiguration = MSSQLConfiguration + { connectionInfoMSSQLConfiguration :: MSSQLSourceConnectionInfo + } deriving (Show) + +{-| Connection parameters for the source + + +https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo + +connectionString: +The database connection string, or as an environment variable + +poolSettings: +Connection pool settings +-} +data MSSQLSourceConnectionInfo = MSSQLSourceConnectionInfo + { connectionStringMSSQLSourceConnectionInfo :: Sslpassword + , poolSettingsMSSQLSourceConnectionInfo :: Maybe MSSQLPoolSettings + } deriving (Show) + +{-| Connection pool settings + + +https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlpoolsettings + +idleTimeout: +The idle timeout (in seconds) per connection (default: 180) + +maxConnections: +Maximum number of connections to be kept in the pool (default: 50) +-} +data MSSQLPoolSettings = MSSQLPoolSettings + { idleTimeoutMSSQLPoolSettings :: Maybe Float + , maxConnectionsMSSQLPoolSettings :: Maybe Float + } deriving (Show) + +data MSSQLSourceKind + = KindMssqlMSSQLSourceKind + deriving (Show) + +data BigQuerySource = BigQuerySource + { configurationBigQuerySource :: BigQueryConfiguration + , functionsBigQuerySource :: Maybe (Vector CustomFunction) + , kindBigQuerySource :: BigQuerySourceKind + , nameBigQuerySource :: Text + , tablesBigQuerySource :: Vector TableEntry + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#bigqueryconfiguration + +datasets: +List of BigQuery datasets + +projectID: +Project Id for BigQuery database + +serviceAccount: +Service account for BigQuery database +-} +data BigQueryConfiguration = BigQueryConfiguration + { datasetsBigQueryConfiguration :: Datasets + , projectIDBigQueryConfiguration :: Sslpassword + , serviceAccountBigQueryConfiguration :: ServiceAccount + } deriving (Show) + +{-| List of BigQuery datasets -} +data Datasets + = FromEnvInDatasets FromEnv + | StringArrayInDatasets (Vector Text) + deriving (Show) + +{-| Service account for BigQuery database -} +data ServiceAccount + = RecordStringAnyClassInServiceAccount RecordStringAnyClass + | StringInServiceAccount Text + deriving (Show) + +{-| https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#fromenv + +Environment variable which stores the client certificate. + +Environment variable which stores the client private key. + +Environment variable which stores trusted certificate authorities. + +fromEnv: +Name of the environment variable +-} +data RecordStringAnyClass = RecordStringAnyClass + { fromEnvRecordStringAnyClass :: Maybe Text + } deriving (Show) + +data BigQuerySourceKind + = KindBigqueryBigQuerySourceKind + deriving (Show) + +data HasuraMetadataV3 = HasuraMetadataV3 + { actionsHasuraMetadataV3 :: Maybe (Vector Action) + , allowlistHasuraMetadataV3 :: Maybe (Vector AllowList) + , apiLimitsHasuraMetadataV3 :: Maybe APILimits + , cronTriggersHasuraMetadataV3 :: Maybe (Vector CronTrigger) + , customTypesHasuraMetadataV3 :: Maybe CustomTypes + , inheritedRolesHasuraMetadataV3 :: Maybe (Vector InheritedRole) + , queryCollectionsHasuraMetadataV3 :: Maybe (Vector QueryCollectionEntry) + , remoteSchemasHasuraMetadataV3 :: Maybe (Vector RemoteSchema) + , restEndpointsHasuraMetadataV3 :: Vector RESTEndpoint + , sourcesHasuraMetadataV3 :: Vector Source + , versionHasuraMetadataV3 :: Float + } deriving (Show) + +data APILimits = APILimits + { depthLimitAPILimits :: Maybe DepthLimit + , disabledAPILimits :: Bool + , nodeLimitAPILimits :: Maybe NodeLimit + , rateLimitAPILimits :: Maybe RateLimit + } deriving (Show) + +data DepthLimit = DepthLimit + { globalDepthLimit :: Float + , perRoleDepthLimit :: HashMap Text Float + } deriving (Show) + +data NodeLimit = NodeLimit + { globalNodeLimit :: Float + , perRoleNodeLimit :: HashMap Text Float + } deriving (Show) + +data RateLimit = RateLimit + { globalRateLimit :: RateLimitRule + , perRoleRateLimit :: HashMap Text RateLimitRule + } deriving (Show) + +data RateLimitRule = RateLimitRule + { maxReqsPerMinRateLimitRule :: Float + , uniqueParamsRateLimitRule :: UniqueParams + } deriving (Show) + +data UniqueParams + = EnumInUniqueParams UniqueParamsEnum + | NullInUniqueParams + | StringArrayInUniqueParams (Vector Text) + deriving (Show) + +data UniqueParamsEnum + = IPUniqueParamsEnum + deriving (Show) + +data InheritedRole = InheritedRole + { roleNameInheritedRole :: Text + , roleSetInheritedRole :: Vector Text + } deriving (Show) + +data RESTEndpoint = RESTEndpoint + { commentRESTEndpoint :: Maybe Text + , definitionRESTEndpoint :: RESTEndpointDefinition + , methodsRESTEndpoint :: Vector Method + , nameRESTEndpoint :: Text + , urlRESTEndpoint :: Text + } deriving (Show) + +data RESTEndpointDefinition = RESTEndpointDefinition + { queryRESTEndpointDefinition :: QueryClass + } deriving (Show) + +data QueryClass = QueryClass + { collectionNameQueryClass :: Text + , queryNameQueryClass :: Text + } deriving (Show) + +data Method + = PatchMethod + | PostMethod + | PutMethod + deriving (Show) + +data Source = Source + { configurationSource :: Configuration + , functionsSource :: Maybe (Vector CustomFunction) + , kindSource :: BackendKind + , nameSource :: Text + , tablesSource :: Vector TableEntry + } deriving (Show) + +{-| +https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconfiguration + + +https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo + + +https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#bigqueryconfiguration + +connectionInfo: +Connection parameters for the source + +readReplicas: +Optional list of read replica configuration (supported only in cloud/enterprise versions) + +datasets: +List of BigQuery datasets + +projectID: +Project Id for BigQuery database + +serviceAccount: +Service account for BigQuery database +-} +data Configuration = Configuration + { connectionInfoConfiguration :: Maybe SourceConnectionInfo + , readReplicasConfiguration :: Maybe (Vector PGSourceConnectionInfo) + , datasetsConfiguration :: Maybe Datasets + , projectIDConfiguration :: Maybe Sslpassword + , serviceAccountConfiguration :: Maybe ServiceAccount + } deriving (Show) + +{-| Connection parameters for the source + + +https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgsourceconnectioninfo + + +https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo + +databaseURL: +The database connection URL as a string, as an environment variable, or as connection +parameters. + +isolationLevel: +The transaction isolation level in which the queries made to the source will be run with +(default: read-committed). + +poolSettings: +Connection pool settings + +sslConfiguration: +The client SSL certificate settings for the database (Only available in Cloud). + +usePreparedStatements: +If set to true the server prepares statement before executing on the source database +(default: false). For more details, refer to the Postgres docs + +connectionString: +The database connection string, or as an environment variable +-} +data SourceConnectionInfo = SourceConnectionInfo + { databaseURLSourceConnectionInfo :: Maybe DatabaseURL + , isolationLevelSourceConnectionInfo :: Maybe IsolationLevel + , poolSettingsSourceConnectionInfo :: Maybe PoolSettings + , sslConfigurationSourceConnectionInfo :: Maybe PGCERTSettings + , usePreparedStatementsSourceConnectionInfo :: Maybe Bool + , connectionStringSourceConnectionInfo :: Maybe Sslpassword + } deriving (Show) + +{-| Connection pool settings + +https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgpoolsettings + + +https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlpoolsettings + +connectionLifetime: +Time from connection creation after which the connection should be destroyed and a new +one created. A value of 0 indicates we should never destroy an active connection. If 0 is +passed, memory from large query results may not be reclaimed. (default: 600 sec) + +idleTimeout: +The idle timeout (in seconds) per connection (default: 180) + +maxConnections: +Maximum number of connections to be kept in the pool (default: 50) + +poolTimeout: +Maximum time to wait while acquiring a Postgres connection from the pool, in seconds +(default: forever) + +retries: +Number of retries to perform (default: 1) +-} +data PoolSettings = PoolSettings + { connectionLifetimePoolSettings :: Maybe Float + , idleTimeoutPoolSettings :: Maybe Float + , maxConnectionsPoolSettings :: Maybe Float + , poolTimeoutPoolSettings :: Maybe Float + , retriesPoolSettings :: Maybe Float + } deriving (Show) + +data BackendKind + = BackendKindBigqueryBackendKind + | BackendKindCitusBackendKind + | BackendKindMssqlBackendKind + | BackendKindPostgresBackendKind + deriving (Show) + +decodeTopLevel :: ByteString -> Maybe PGColumn +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe ComputedFieldName +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe RoleName +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe TriggerName +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe RemoteRelationshipName +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe RemoteSchemaName +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe CollectionName +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe GraphQLName +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe GraphQLType +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe RelationshipName +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe ActionName +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe WebhookURL +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe TableName +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe QualifiedTable +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe TableConfig +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe TableEntry +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe CustomRootFields +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe CustomColumnNames +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe FunctionName +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe QualifiedFunction +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe CustomFunction +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe FunctionConfiguration +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe ObjectRelationship +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe ObjRelUsing +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe ObjRelUsingManualMapping +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe ArrayRelationship +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe ArrRelUsing +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe ArrRelUsingFKeyOn +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe ArrRelUsingManualMapping +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe ColumnPresetsExpression +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe InsertPermissionEntry +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe InsertPermission +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe SelectPermissionEntry +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe SelectPermission +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe UpdatePermissionEntry +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe UpdatePermission +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe DeletePermissionEntry +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe DeletePermission +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe ComputedField +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe ComputedFieldDefinition +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe EventTrigger +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe EventTriggerDefinition +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe EventTriggerColumns +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe OperationSpec +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe HeaderFromValue +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe HeaderFromEnv +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe RetryConf +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe CronTrigger +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe RetryConfST +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe RemoteSchema +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe RemoteSchemaDef +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe RemoteRelationship +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe RemoteRelationshipDef +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe RemoteField +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe InputArguments +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe QueryCollectionEntry +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe QueryCollection +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe AllowList +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe CustomTypes +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe InputObjectType +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe InputObjectField +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe ObjectType +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe ObjectField +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe CustomTypeObjectRelationship +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe ScalarType +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe EnumType +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe EnumValue +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe Action +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe ActionDefinition +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe InputArgument +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe HasuraMetadataV2 +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe FromEnv +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe PGConfiguration +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe MSSQLConfiguration +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe BigQueryConfiguration +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe PGSourceConnectionInfo +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe MSSQLSourceConnectionInfo +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe PGConnectionParameters +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe PGPoolSettings +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe PGCERTSettings +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe MSSQLPoolSettings +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe BackendKind +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe BaseSource +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe PGSource +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe MSSQLSource +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe BigQuerySource +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe Source +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe APILimits +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe DepthLimit +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe RateLimit +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe RateLimitRule +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe NodeLimit +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe RESTEndpoint +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe RESTEndpointDefinition +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe InheritedRole +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe HasuraMetadataV3 +decodeTopLevel = decode + +decodeTopLevel :: ByteString -> Maybe RecordStringAny +decodeTopLevel = decode + +instance ToJSON HeaderFromValue where + toJSON (HeaderFromValue nameHeaderFromValue valueHeaderFromValue) = + object + [ "name" .= nameHeaderFromValue + , "value" .= valueHeaderFromValue + ] + +instance FromJSON HeaderFromValue where + parseJSON (Object v) = HeaderFromValue + <$> v .: "name" + <*> v .: "value" + +instance ToJSON HeaderFromEnv where + toJSON (HeaderFromEnv nameHeaderFromEnv valueFromEnvHeaderFromEnv) = + object + [ "name" .= nameHeaderFromEnv + , "value_from_env" .= valueFromEnvHeaderFromEnv + ] + +instance FromJSON HeaderFromEnv where + parseJSON (Object v) = HeaderFromEnv + <$> v .: "name" + <*> v .: "value_from_env" + +instance ToJSON ObjectField where + toJSON (ObjectField descriptionObjectField nameObjectField objectFieldTypeObjectField) = + object + [ "description" .= descriptionObjectField + , "name" .= nameObjectField + , "type" .= objectFieldTypeObjectField + ] + +instance FromJSON ObjectField where + parseJSON (Object v) = ObjectField + <$> v .:? "description" + <*> v .: "name" + <*> v .: "type" + +instance ToJSON HasuraMetadataV2 where + toJSON (HasuraMetadataV2 actionsHasuraMetadataV2 allowlistHasuraMetadataV2 cronTriggersHasuraMetadataV2 customTypesHasuraMetadataV2 functionsHasuraMetadataV2 queryCollectionsHasuraMetadataV2 remoteSchemasHasuraMetadataV2 tablesHasuraMetadataV2 versionHasuraMetadataV2) = + object + [ "actions" .= actionsHasuraMetadataV2 + , "allowlist" .= allowlistHasuraMetadataV2 + , "cron_triggers" .= cronTriggersHasuraMetadataV2 + , "custom_types" .= customTypesHasuraMetadataV2 + , "functions" .= functionsHasuraMetadataV2 + , "query_collections" .= queryCollectionsHasuraMetadataV2 + , "remote_schemas" .= remoteSchemasHasuraMetadataV2 + , "tables" .= tablesHasuraMetadataV2 + , "version" .= versionHasuraMetadataV2 + ] + +instance FromJSON HasuraMetadataV2 where + parseJSON (Object v) = HasuraMetadataV2 + <$> v .:? "actions" + <*> v .:? "allowlist" + <*> v .:? "cron_triggers" + <*> v .:? "custom_types" + <*> v .:? "functions" + <*> v .:? "query_collections" + <*> v .:? "remote_schemas" + <*> v .: "tables" + <*> v .: "version" + +instance ToJSON Action where + toJSON (Action commentAction definitionAction nameAction permissionsAction) = + object + [ "comment" .= commentAction + , "definition" .= definitionAction + , "name" .= nameAction + , "permissions" .= permissionsAction + ] + +instance FromJSON Action where + parseJSON (Object v) = Action + <$> v .:? "comment" + <*> v .: "definition" + <*> v .: "name" + <*> v .:? "permissions" + +instance ToJSON ActionDefinition where + toJSON (ActionDefinition argumentsActionDefinition forwardClientHeadersActionDefinition handlerActionDefinition headersActionDefinition kindActionDefinition outputTypeActionDefinition actionDefinitionTypeActionDefinition) = + object + [ "arguments" .= argumentsActionDefinition + , "forward_client_headers" .= forwardClientHeadersActionDefinition + , "handler" .= handlerActionDefinition + , "headers" .= headersActionDefinition + , "kind" .= kindActionDefinition + , "output_type" .= outputTypeActionDefinition + , "type" .= actionDefinitionTypeActionDefinition + ] + +instance FromJSON ActionDefinition where + parseJSON (Object v) = ActionDefinition + <$> v .:? "arguments" + <*> v .:? "forward_client_headers" + <*> v .: "handler" + <*> v .:? "headers" + <*> v .:? "kind" + <*> v .:? "output_type" + <*> v .:? "type" + +instance ToJSON ActionDefinitionType where + toJSON MutationActionDefinitionType = "mutation" + toJSON QueryActionDefinitionType = "query" + +instance FromJSON ActionDefinitionType where + parseJSON = withText "ActionDefinitionType" parseText + where + parseText "mutation" = return MutationActionDefinitionType + parseText "query" = return QueryActionDefinitionType + +instance ToJSON InputArgument where + toJSON (InputArgument nameInputArgument inputArgumentTypeInputArgument) = + object + [ "name" .= nameInputArgument + , "type" .= inputArgumentTypeInputArgument + ] + +instance FromJSON InputArgument where + parseJSON (Object v) = InputArgument + <$> v .: "name" + <*> v .: "type" + +instance ToJSON Header where + toJSON (Header nameHeader valueHeader valueFromEnvHeader) = + object + [ "name" .= nameHeader + , "value" .= valueHeader + , "value_from_env" .= valueFromEnvHeader + ] + +instance FromJSON Header where + parseJSON (Object v) = Header + <$> v .: "name" + <*> v .:? "value" + <*> v .:? "value_from_env" + +instance ToJSON Permission where + toJSON (Permission rolePermission) = + object + [ "role" .= rolePermission + ] + +instance FromJSON Permission where + parseJSON (Object v) = Permission + <$> v .: "role" + +instance ToJSON AllowList where + toJSON (AllowList collectionAllowList) = + object + [ "collection" .= collectionAllowList + ] + +instance FromJSON AllowList where + parseJSON (Object v) = AllowList + <$> v .: "collection" + +instance ToJSON CronTrigger where + toJSON (CronTrigger commentCronTrigger headersCronTrigger includeInMetadataCronTrigger nameCronTrigger payloadCronTrigger retryConfCronTrigger scheduleCronTrigger webhookCronTrigger) = + object + [ "comment" .= commentCronTrigger + , "headers" .= headersCronTrigger + , "include_in_metadata" .= includeInMetadataCronTrigger + , "name" .= nameCronTrigger + , "payload" .= payloadCronTrigger + , "retry_conf" .= retryConfCronTrigger + , "schedule" .= scheduleCronTrigger + , "webhook" .= webhookCronTrigger + ] + +instance FromJSON CronTrigger where + parseJSON (Object v) = CronTrigger + <$> v .:? "comment" + <*> v .: "headers" + <*> v .: "include_in_metadata" + <*> v .: "name" + <*> v .:? "payload" + <*> v .:? "retry_conf" + <*> v .: "schedule" + <*> v .: "webhook" + +instance ToJSON RetryConfST where + toJSON (RetryConfST numRetriesRetryConfST retryIntervalSecondsRetryConfST timeoutSecondsRetryConfST toleranceSecondsRetryConfST) = + object + [ "num_retries" .= numRetriesRetryConfST + , "retry_interval_seconds" .= retryIntervalSecondsRetryConfST + , "timeout_seconds" .= timeoutSecondsRetryConfST + , "tolerance_seconds" .= toleranceSecondsRetryConfST + ] + +instance FromJSON RetryConfST where + parseJSON (Object v) = RetryConfST + <$> v .:? "num_retries" + <*> v .:? "retry_interval_seconds" + <*> v .:? "timeout_seconds" + <*> v .:? "tolerance_seconds" + +instance ToJSON CustomTypes where + toJSON (CustomTypes enumsCustomTypes inputObjectsCustomTypes objectsCustomTypes scalarsCustomTypes) = + object + [ "enums" .= enumsCustomTypes + , "input_objects" .= inputObjectsCustomTypes + , "objects" .= objectsCustomTypes + , "scalars" .= scalarsCustomTypes + ] + +instance FromJSON CustomTypes where + parseJSON (Object v) = CustomTypes + <$> v .:? "enums" + <*> v .:? "input_objects" + <*> v .:? "objects" + <*> v .:? "scalars" + +instance ToJSON EnumType where + toJSON (EnumType descriptionEnumType nameEnumType valuesEnumType) = + object + [ "description" .= descriptionEnumType + , "name" .= nameEnumType + , "values" .= valuesEnumType + ] + +instance FromJSON EnumType where + parseJSON (Object v) = EnumType + <$> v .:? "description" + <*> v .: "name" + <*> v .: "values" + +instance ToJSON EnumValue where + toJSON (EnumValue descriptionEnumValue isDeprecatedEnumValue valueEnumValue) = + object + [ "description" .= descriptionEnumValue + , "is_deprecated" .= isDeprecatedEnumValue + , "value" .= valueEnumValue + ] + +instance FromJSON EnumValue where + parseJSON (Object v) = EnumValue + <$> v .:? "description" + <*> v .:? "is_deprecated" + <*> v .: "value" + +instance ToJSON InputObjectType where + toJSON (InputObjectType descriptionInputObjectType fieldsInputObjectType nameInputObjectType) = + object + [ "description" .= descriptionInputObjectType + , "fields" .= fieldsInputObjectType + , "name" .= nameInputObjectType + ] + +instance FromJSON InputObjectType where + parseJSON (Object v) = InputObjectType + <$> v .:? "description" + <*> v .: "fields" + <*> v .: "name" + +instance ToJSON InputObjectField where + toJSON (InputObjectField descriptionInputObjectField nameInputObjectField inputObjectFieldTypeInputObjectField) = + object + [ "description" .= descriptionInputObjectField + , "name" .= nameInputObjectField + , "type" .= inputObjectFieldTypeInputObjectField + ] + +instance FromJSON InputObjectField where + parseJSON (Object v) = InputObjectField + <$> v .:? "description" + <*> v .: "name" + <*> v .: "type" + +instance ToJSON ObjectType where + toJSON (ObjectType descriptionObjectType fieldsObjectType nameObjectType relationshipsObjectType) = + object + [ "description" .= descriptionObjectType + , "fields" .= fieldsObjectType + , "name" .= nameObjectType + , "relationships" .= relationshipsObjectType + ] + +instance FromJSON ObjectType where + parseJSON (Object v) = ObjectType + <$> v .:? "description" + <*> v .: "fields" + <*> v .: "name" + <*> v .:? "relationships" + +instance ToJSON CustomTypeObjectRelationship where + toJSON (CustomTypeObjectRelationship fieldMappingCustomTypeObjectRelationship nameCustomTypeObjectRelationship remoteTableCustomTypeObjectRelationship customTypeObjectRelationshipTypeCustomTypeObjectRelationship) = + object + [ "field_mapping" .= fieldMappingCustomTypeObjectRelationship + , "name" .= nameCustomTypeObjectRelationship + , "remote_table" .= remoteTableCustomTypeObjectRelationship + , "type" .= customTypeObjectRelationshipTypeCustomTypeObjectRelationship + ] + +instance FromJSON CustomTypeObjectRelationship where + parseJSON (Object v) = CustomTypeObjectRelationship + <$> v .: "field_mapping" + <*> v .: "name" + <*> v .: "remote_table" + <*> v .: "type" + +instance ToJSON CustomTypeObjectRelationshipType where + toJSON TypeArrayCustomTypeObjectRelationshipType = "array" + toJSON TypeObjectCustomTypeObjectRelationshipType = "object" + +instance FromJSON CustomTypeObjectRelationshipType where + parseJSON = withText "CustomTypeObjectRelationshipType" parseText + where + parseText "array" = return TypeArrayCustomTypeObjectRelationshipType + parseText "object" = return TypeObjectCustomTypeObjectRelationshipType + +instance ToJSON TableName where + toJSON (QualifiedTableInTableName x) = toJSON x + toJSON (StringInTableName x) = toJSON x + +instance FromJSON TableName where + parseJSON xs@(Object _) = (fmap QualifiedTableInTableName . parseJSON) xs + parseJSON xs@(String _) = (fmap StringInTableName . parseJSON) xs + +instance ToJSON QualifiedTable where + toJSON (QualifiedTable nameQualifiedTable schemaQualifiedTable) = + object + [ "name" .= nameQualifiedTable + , "schema" .= schemaQualifiedTable + ] + +instance FromJSON QualifiedTable where + parseJSON (Object v) = QualifiedTable + <$> v .: "name" + <*> v .: "schema" + +instance ToJSON ScalarType where + toJSON (ScalarType descriptionScalarType nameScalarType) = + object + [ "description" .= descriptionScalarType + , "name" .= nameScalarType + ] + +instance FromJSON ScalarType where + parseJSON (Object v) = ScalarType + <$> v .:? "description" + <*> v .: "name" + +instance ToJSON CustomFunction where + toJSON (CustomFunction configurationCustomFunction functionCustomFunction) = + object + [ "configuration" .= configurationCustomFunction + , "function" .= functionCustomFunction + ] + +instance FromJSON CustomFunction where + parseJSON (Object v) = CustomFunction + <$> v .:? "configuration" + <*> v .: "function" + +instance ToJSON FunctionConfiguration where + toJSON (FunctionConfiguration sessionArgumentFunctionConfiguration) = + object + [ "session_argument" .= sessionArgumentFunctionConfiguration + ] + +instance FromJSON FunctionConfiguration where + parseJSON (Object v) = FunctionConfiguration + <$> v .:? "session_argument" + +instance ToJSON FunctionName where + toJSON (QualifiedFunctionInFunctionName x) = toJSON x + toJSON (StringInFunctionName x) = toJSON x + +instance FromJSON FunctionName where + parseJSON xs@(Object _) = (fmap QualifiedFunctionInFunctionName . parseJSON) xs + parseJSON xs@(String _) = (fmap StringInFunctionName . parseJSON) xs + +instance ToJSON QualifiedFunction where + toJSON (QualifiedFunction nameQualifiedFunction schemaQualifiedFunction) = + object + [ "name" .= nameQualifiedFunction + , "schema" .= schemaQualifiedFunction + ] + +instance FromJSON QualifiedFunction where + parseJSON (Object v) = QualifiedFunction + <$> v .: "name" + <*> v .: "schema" + +instance ToJSON QueryCollectionEntry where + toJSON (QueryCollectionEntry commentQueryCollectionEntry definitionQueryCollectionEntry nameQueryCollectionEntry) = + object + [ "comment" .= commentQueryCollectionEntry + , "definition" .= definitionQueryCollectionEntry + , "name" .= nameQueryCollectionEntry + ] + +instance FromJSON QueryCollectionEntry where + parseJSON (Object v) = QueryCollectionEntry + <$> v .:? "comment" + <*> v .: "definition" + <*> v .: "name" + +instance ToJSON Definition where + toJSON (Definition queriesDefinition) = + object + [ "queries" .= queriesDefinition + ] + +instance FromJSON Definition where + parseJSON (Object v) = Definition + <$> v .: "queries" + +instance ToJSON QueryCollection where + toJSON (QueryCollection nameQueryCollection queryQueryCollection) = + object + [ "name" .= nameQueryCollection + , "query" .= queryQueryCollection + ] + +instance FromJSON QueryCollection where + parseJSON (Object v) = QueryCollection + <$> v .: "name" + <*> v .: "query" + +instance ToJSON RemoteSchema where + toJSON (RemoteSchema commentRemoteSchema definitionRemoteSchema nameRemoteSchema) = + object + [ "comment" .= commentRemoteSchema + , "definition" .= definitionRemoteSchema + , "name" .= nameRemoteSchema + ] + +instance FromJSON RemoteSchema where + parseJSON (Object v) = RemoteSchema + <$> v .:? "comment" + <*> v .: "definition" + <*> v .: "name" + +instance ToJSON RemoteSchemaDef where + toJSON (RemoteSchemaDef forwardClientHeadersRemoteSchemaDef headersRemoteSchemaDef timeoutSecondsRemoteSchemaDef urlRemoteSchemaDef urlFromEnvRemoteSchemaDef) = + object + [ "forward_client_headers" .= forwardClientHeadersRemoteSchemaDef + , "headers" .= headersRemoteSchemaDef + , "timeout_seconds" .= timeoutSecondsRemoteSchemaDef + , "url" .= urlRemoteSchemaDef + , "url_from_env" .= urlFromEnvRemoteSchemaDef + ] + +instance FromJSON RemoteSchemaDef where + parseJSON (Object v) = RemoteSchemaDef + <$> v .:? "forward_client_headers" + <*> v .:? "headers" + <*> v .:? "timeout_seconds" + <*> v .:? "url" + <*> v .:? "url_from_env" + +instance ToJSON TableEntry where + toJSON (TableEntry arrayRelationshipsTableEntry computedFieldsTableEntry configurationTableEntry deletePermissionsTableEntry eventTriggersTableEntry insertPermissionsTableEntry isEnumTableEntry objectRelationshipsTableEntry remoteRelationshipsTableEntry selectPermissionsTableEntry tableTableEntry updatePermissionsTableEntry) = + object + [ "array_relationships" .= arrayRelationshipsTableEntry + , "computed_fields" .= computedFieldsTableEntry + , "configuration" .= configurationTableEntry + , "delete_permissions" .= deletePermissionsTableEntry + , "event_triggers" .= eventTriggersTableEntry + , "insert_permissions" .= insertPermissionsTableEntry + , "is_enum" .= isEnumTableEntry + , "object_relationships" .= objectRelationshipsTableEntry + , "remote_relationships" .= remoteRelationshipsTableEntry + , "select_permissions" .= selectPermissionsTableEntry + , "table" .= tableTableEntry + , "update_permissions" .= updatePermissionsTableEntry + ] + +instance FromJSON TableEntry where + parseJSON (Object v) = TableEntry + <$> v .:? "array_relationships" + <*> v .:? "computed_fields" + <*> v .:? "configuration" + <*> v .:? "delete_permissions" + <*> v .:? "event_triggers" + <*> v .:? "insert_permissions" + <*> v .:? "is_enum" + <*> v .:? "object_relationships" + <*> v .:? "remote_relationships" + <*> v .:? "select_permissions" + <*> v .: "table" + <*> v .:? "update_permissions" + +instance ToJSON ArrayRelationship where + toJSON (ArrayRelationship commentArrayRelationship nameArrayRelationship usingArrayRelationship) = + object + [ "comment" .= commentArrayRelationship + , "name" .= nameArrayRelationship + , "using" .= usingArrayRelationship + ] + +instance FromJSON ArrayRelationship where + parseJSON (Object v) = ArrayRelationship + <$> v .:? "comment" + <*> v .: "name" + <*> v .: "using" + +instance ToJSON ArrRelUsing where + toJSON (ArrRelUsing foreignKeyConstraintOnArrRelUsing manualConfigurationArrRelUsing) = + object + [ "foreign_key_constraint_on" .= foreignKeyConstraintOnArrRelUsing + , "manual_configuration" .= manualConfigurationArrRelUsing + ] + +instance FromJSON ArrRelUsing where + parseJSON (Object v) = ArrRelUsing + <$> v .:? "foreign_key_constraint_on" + <*> v .:? "manual_configuration" + +instance ToJSON ArrRelUsingFKeyOn where + toJSON (ArrRelUsingFKeyOn columnArrRelUsingFKeyOn tableArrRelUsingFKeyOn) = + object + [ "column" .= columnArrRelUsingFKeyOn + , "table" .= tableArrRelUsingFKeyOn + ] + +instance FromJSON ArrRelUsingFKeyOn where + parseJSON (Object v) = ArrRelUsingFKeyOn + <$> v .: "column" + <*> v .: "table" + +instance ToJSON ArrRelUsingManualMapping where + toJSON (ArrRelUsingManualMapping columnMappingArrRelUsingManualMapping remoteTableArrRelUsingManualMapping) = + object + [ "column_mapping" .= columnMappingArrRelUsingManualMapping + , "remote_table" .= remoteTableArrRelUsingManualMapping + ] + +instance FromJSON ArrRelUsingManualMapping where + parseJSON (Object v) = ArrRelUsingManualMapping + <$> v .: "column_mapping" + <*> v .: "remote_table" + +instance ToJSON ComputedField where + toJSON (ComputedField commentComputedField definitionComputedField nameComputedField) = + object + [ "comment" .= commentComputedField + , "definition" .= definitionComputedField + , "name" .= nameComputedField + ] + +instance FromJSON ComputedField where + parseJSON (Object v) = ComputedField + <$> v .:? "comment" + <*> v .: "definition" + <*> v .: "name" + +instance ToJSON ComputedFieldDefinition where + toJSON (ComputedFieldDefinition functionComputedFieldDefinition sessionArgumentComputedFieldDefinition tableArgumentComputedFieldDefinition) = + object + [ "function" .= functionComputedFieldDefinition + , "session_argument" .= sessionArgumentComputedFieldDefinition + , "table_argument" .= tableArgumentComputedFieldDefinition + ] + +instance FromJSON ComputedFieldDefinition where + parseJSON (Object v) = ComputedFieldDefinition + <$> v .: "function" + <*> v .:? "session_argument" + <*> v .:? "table_argument" + +instance ToJSON TableConfig where + toJSON (TableConfig customColumnNamesTableConfig customNameTableConfig customRootFieldsTableConfig) = + object + [ "custom_column_names" .= customColumnNamesTableConfig + , "custom_name" .= customNameTableConfig + , "custom_root_fields" .= customRootFieldsTableConfig + ] + +instance FromJSON TableConfig where + parseJSON (Object v) = TableConfig + <$> v .:? "custom_column_names" + <*> v .:? "custom_name" + <*> v .:? "custom_root_fields" + +instance ToJSON CustomRootFields where + toJSON (CustomRootFields deleteCustomRootFields deleteByPkCustomRootFields insertCustomRootFields insertOneCustomRootFields selectCustomRootFields selectAggregateCustomRootFields selectByPkCustomRootFields updateCustomRootFields updateByPkCustomRootFields) = + object + [ "delete" .= deleteCustomRootFields + , "delete_by_pk" .= deleteByPkCustomRootFields + , "insert" .= insertCustomRootFields + , "insert_one" .= insertOneCustomRootFields + , "select" .= selectCustomRootFields + , "select_aggregate" .= selectAggregateCustomRootFields + , "select_by_pk" .= selectByPkCustomRootFields + , "update" .= updateCustomRootFields + , "update_by_pk" .= updateByPkCustomRootFields + ] + +instance FromJSON CustomRootFields where + parseJSON (Object v) = CustomRootFields + <$> v .:? "delete" + <*> v .:? "delete_by_pk" + <*> v .:? "insert" + <*> v .:? "insert_one" + <*> v .:? "select" + <*> v .:? "select_aggregate" + <*> v .:? "select_by_pk" + <*> v .:? "update" + <*> v .:? "update_by_pk" + +instance ToJSON DeletePermissionEntry where + toJSON (DeletePermissionEntry commentDeletePermissionEntry permissionDeletePermissionEntry roleDeletePermissionEntry) = + object + [ "comment" .= commentDeletePermissionEntry + , "permission" .= permissionDeletePermissionEntry + , "role" .= roleDeletePermissionEntry + ] + +instance FromJSON DeletePermissionEntry where + parseJSON (Object v) = DeletePermissionEntry + <$> v .:? "comment" + <*> v .: "permission" + <*> v .: "role" + +instance ToJSON DeletePermission where + toJSON (DeletePermission filterDeletePermission) = + object + [ "filter" .= filterDeletePermission + ] + +instance FromJSON DeletePermission where + parseJSON (Object v) = DeletePermission + <$> v .:? "filter" + +instance ToJSON Filter where + toJSON (AnythingMapInFilter x) = toJSON x + toJSON (DoubleInFilter x) = toJSON x + toJSON (StringInFilter x) = toJSON x + +instance FromJSON Filter where + parseJSON xs@(Object _) = (fmap AnythingMapInFilter . parseJSON) xs + parseJSON xs@(Number _) = (fmap DoubleInFilter . parseJSON) xs + parseJSON xs@(String _) = (fmap StringInFilter . parseJSON) xs + +instance ToJSON EventTrigger where + toJSON (EventTrigger definitionEventTrigger headersEventTrigger nameEventTrigger retryConfEventTrigger webhookEventTrigger webhookFromEnvEventTrigger) = + object + [ "definition" .= definitionEventTrigger + , "headers" .= headersEventTrigger + , "name" .= nameEventTrigger + , "retry_conf" .= retryConfEventTrigger + , "webhook" .= webhookEventTrigger + , "webhook_from_env" .= webhookFromEnvEventTrigger + ] + +instance FromJSON EventTrigger where + parseJSON (Object v) = EventTrigger + <$> v .: "definition" + <*> v .:? "headers" + <*> v .: "name" + <*> v .: "retry_conf" + <*> v .:? "webhook" + <*> v .:? "webhook_from_env" + +instance ToJSON EventTriggerDefinition where + toJSON (EventTriggerDefinition deleteEventTriggerDefinition enableManualEventTriggerDefinition insertEventTriggerDefinition updateEventTriggerDefinition) = + object + [ "delete" .= deleteEventTriggerDefinition + , "enable_manual" .= enableManualEventTriggerDefinition + , "insert" .= insertEventTriggerDefinition + , "update" .= updateEventTriggerDefinition + ] + +instance FromJSON EventTriggerDefinition where + parseJSON (Object v) = EventTriggerDefinition + <$> v .:? "delete" + <*> v .: "enable_manual" + <*> v .:? "insert" + <*> v .:? "update" + +instance ToJSON OperationSpec where + toJSON (OperationSpec columnsOperationSpec payloadOperationSpec) = + object + [ "columns" .= columnsOperationSpec + , "payload" .= payloadOperationSpec + ] + +instance FromJSON OperationSpec where + parseJSON (Object v) = OperationSpec + <$> v .: "columns" + <*> v .:? "payload" + +instance ToJSON EventTriggerColumns where + toJSON (EnumInEventTriggerColumns x) = toJSON x + toJSON (StringArrayInEventTriggerColumns x) = toJSON x + +instance FromJSON EventTriggerColumns where + parseJSON xs@(Object _) = (fmap EnumInEventTriggerColumns . parseJSON) xs + parseJSON xs@(Array _) = (fmap StringArrayInEventTriggerColumns . parseJSON) xs + +instance ToJSON Columns where + toJSON EmptyColumns = "*" + +instance FromJSON Columns where + parseJSON = withText "Columns" parseText + where + parseText "*" = return EmptyColumns + +instance ToJSON RetryConf where + toJSON (RetryConf intervalSECRetryConf numRetriesRetryConf timeoutSECRetryConf) = + object + [ "interval_sec" .= intervalSECRetryConf + , "num_retries" .= numRetriesRetryConf + , "timeout_sec" .= timeoutSECRetryConf + ] + +instance FromJSON RetryConf where + parseJSON (Object v) = RetryConf + <$> v .:? "interval_sec" + <*> v .:? "num_retries" + <*> v .:? "timeout_sec" + +instance ToJSON InsertPermissionEntry where + toJSON (InsertPermissionEntry commentInsertPermissionEntry permissionInsertPermissionEntry roleInsertPermissionEntry) = + object + [ "comment" .= commentInsertPermissionEntry + , "permission" .= permissionInsertPermissionEntry + , "role" .= roleInsertPermissionEntry + ] + +instance FromJSON InsertPermissionEntry where + parseJSON (Object v) = InsertPermissionEntry + <$> v .:? "comment" + <*> v .: "permission" + <*> v .: "role" + +instance ToJSON InsertPermission where + toJSON (InsertPermission backendOnlyInsertPermission checkInsertPermission columnsInsertPermission setInsertPermission) = + object + [ "backend_only" .= backendOnlyInsertPermission + , "check" .= checkInsertPermission + , "columns" .= columnsInsertPermission + , "set" .= setInsertPermission + ] + +instance FromJSON InsertPermission where + parseJSON (Object v) = InsertPermission + <$> v .:? "backend_only" + <*> v .:? "check" + <*> v .: "columns" + <*> v .:? "set" + +instance ToJSON ObjectRelationship where + toJSON (ObjectRelationship commentObjectRelationship nameObjectRelationship usingObjectRelationship) = + object + [ "comment" .= commentObjectRelationship + , "name" .= nameObjectRelationship + , "using" .= usingObjectRelationship + ] + +instance FromJSON ObjectRelationship where + parseJSON (Object v) = ObjectRelationship + <$> v .:? "comment" + <*> v .: "name" + <*> v .: "using" + +instance ToJSON ObjRelUsing where + toJSON (ObjRelUsing foreignKeyConstraintOnObjRelUsing manualConfigurationObjRelUsing) = + object + [ "foreign_key_constraint_on" .= foreignKeyConstraintOnObjRelUsing + , "manual_configuration" .= manualConfigurationObjRelUsing + ] + +instance FromJSON ObjRelUsing where + parseJSON (Object v) = ObjRelUsing + <$> v .:? "foreign_key_constraint_on" + <*> v .:? "manual_configuration" + +instance ToJSON ObjRelUsingManualMapping where + toJSON (ObjRelUsingManualMapping columnMappingObjRelUsingManualMapping remoteTableObjRelUsingManualMapping) = + object + [ "column_mapping" .= columnMappingObjRelUsingManualMapping + , "remote_table" .= remoteTableObjRelUsingManualMapping + ] + +instance FromJSON ObjRelUsingManualMapping where + parseJSON (Object v) = ObjRelUsingManualMapping + <$> v .: "column_mapping" + <*> v .: "remote_table" + +instance ToJSON RemoteRelationship where + toJSON (RemoteRelationship definitionRemoteRelationship nameRemoteRelationship) = + object + [ "definition" .= definitionRemoteRelationship + , "name" .= nameRemoteRelationship + ] + +instance FromJSON RemoteRelationship where + parseJSON (Object v) = RemoteRelationship + <$> v .: "definition" + <*> v .: "name" + +instance ToJSON RemoteRelationshipDef where + toJSON (RemoteRelationshipDef hasuraFieldsRemoteRelationshipDef remoteFieldRemoteRelationshipDef remoteSchemaRemoteRelationshipDef) = + object + [ "hasura_fields" .= hasuraFieldsRemoteRelationshipDef + , "remote_field" .= remoteFieldRemoteRelationshipDef + , "remote_schema" .= remoteSchemaRemoteRelationshipDef + ] + +instance FromJSON RemoteRelationshipDef where + parseJSON (Object v) = RemoteRelationshipDef + <$> v .: "hasura_fields" + <*> v .: "remote_field" + <*> v .: "remote_schema" + +instance ToJSON RemoteFieldValue where + toJSON (RemoteFieldValue argumentsRemoteFieldValue fieldRemoteFieldValue) = + object + [ "arguments" .= argumentsRemoteFieldValue + , "field" .= fieldRemoteFieldValue + ] + +instance FromJSON RemoteFieldValue where + parseJSON (Object v) = RemoteFieldValue + <$> v .: "arguments" + <*> v .:? "field" + +instance ToJSON SelectPermissionEntry where + toJSON (SelectPermissionEntry commentSelectPermissionEntry permissionSelectPermissionEntry roleSelectPermissionEntry) = + object + [ "comment" .= commentSelectPermissionEntry + , "permission" .= permissionSelectPermissionEntry + , "role" .= roleSelectPermissionEntry + ] + +instance FromJSON SelectPermissionEntry where + parseJSON (Object v) = SelectPermissionEntry + <$> v .:? "comment" + <*> v .: "permission" + <*> v .: "role" + +instance ToJSON SelectPermission where + toJSON (SelectPermission allowAggregationsSelectPermission columnsSelectPermission computedFieldsSelectPermission filterSelectPermission limitSelectPermission) = + object + [ "allow_aggregations" .= allowAggregationsSelectPermission + , "columns" .= columnsSelectPermission + , "computed_fields" .= computedFieldsSelectPermission + , "filter" .= filterSelectPermission + , "limit" .= limitSelectPermission + ] + +instance FromJSON SelectPermission where + parseJSON (Object v) = SelectPermission + <$> v .:? "allow_aggregations" + <*> v .: "columns" + <*> v .:? "computed_fields" + <*> v .:? "filter" + <*> v .:? "limit" + +instance ToJSON UpdatePermissionEntry where + toJSON (UpdatePermissionEntry commentUpdatePermissionEntry permissionUpdatePermissionEntry roleUpdatePermissionEntry) = + object + [ "comment" .= commentUpdatePermissionEntry + , "permission" .= permissionUpdatePermissionEntry + , "role" .= roleUpdatePermissionEntry + ] + +instance FromJSON UpdatePermissionEntry where + parseJSON (Object v) = UpdatePermissionEntry + <$> v .:? "comment" + <*> v .: "permission" + <*> v .: "role" + +instance ToJSON UpdatePermission where + toJSON (UpdatePermission checkUpdatePermission columnsUpdatePermission filterUpdatePermission setUpdatePermission) = + object + [ "check" .= checkUpdatePermission + , "columns" .= columnsUpdatePermission + , "filter" .= filterUpdatePermission + , "set" .= setUpdatePermission + ] + +instance FromJSON UpdatePermission where + parseJSON (Object v) = UpdatePermission + <$> v .:? "check" + <*> v .: "columns" + <*> v .:? "filter" + <*> v .:? "set" + +instance ToJSON PGConnectionParameters where + toJSON (PGConnectionParameters databasePGConnectionParameters hostPGConnectionParameters passwordPGConnectionParameters portPGConnectionParameters usernamePGConnectionParameters) = + object + [ "database" .= databasePGConnectionParameters + , "host" .= hostPGConnectionParameters + , "password" .= passwordPGConnectionParameters + , "port" .= portPGConnectionParameters + , "username" .= usernamePGConnectionParameters + ] + +instance FromJSON PGConnectionParameters where + parseJSON (Object v) = PGConnectionParameters + <$> v .: "database" + <*> v .: "host" + <*> v .:? "password" + <*> v .: "port" + <*> v .: "username" + +instance ToJSON BaseSource where + toJSON (BaseSource functionsBaseSource nameBaseSource tablesBaseSource) = + object + [ "functions" .= functionsBaseSource + , "name" .= nameBaseSource + , "tables" .= tablesBaseSource + ] + +instance FromJSON BaseSource where + parseJSON (Object v) = BaseSource + <$> v .:? "functions" + <*> v .: "name" + <*> v .: "tables" + +instance ToJSON PGSource where + toJSON (PGSource configurationPGSource functionsPGSource kindPGSource namePGSource tablesPGSource) = + object + [ "configuration" .= configurationPGSource + , "functions" .= functionsPGSource + , "kind" .= kindPGSource + , "name" .= namePGSource + , "tables" .= tablesPGSource + ] + +instance FromJSON PGSource where + parseJSON (Object v) = PGSource + <$> v .: "configuration" + <*> v .:? "functions" + <*> v .: "kind" + <*> v .: "name" + <*> v .: "tables" + +instance ToJSON PGConfiguration where + toJSON (PGConfiguration connectionInfoPGConfiguration readReplicasPGConfiguration) = + object + [ "connection_info" .= connectionInfoPGConfiguration + , "read_replicas" .= readReplicasPGConfiguration + ] + +instance FromJSON PGConfiguration where + parseJSON (Object v) = PGConfiguration + <$> v .: "connection_info" + <*> v .:? "read_replicas" + +instance ToJSON PGSourceConnectionInfo where + toJSON (PGSourceConnectionInfo databaseURLPGSourceConnectionInfo isolationLevelPGSourceConnectionInfo poolSettingsPGSourceConnectionInfo sslConfigurationPGSourceConnectionInfo usePreparedStatementsPGSourceConnectionInfo) = + object + [ "database_url" .= databaseURLPGSourceConnectionInfo + , "isolation_level" .= isolationLevelPGSourceConnectionInfo + , "pool_settings" .= poolSettingsPGSourceConnectionInfo + , "ssl_configuration" .= sslConfigurationPGSourceConnectionInfo + , "use_prepared_statements" .= usePreparedStatementsPGSourceConnectionInfo + ] + +instance FromJSON PGSourceConnectionInfo where + parseJSON (Object v) = PGSourceConnectionInfo + <$> v .: "database_url" + <*> v .:? "isolation_level" + <*> v .:? "pool_settings" + <*> v .:? "ssl_configuration" + <*> v .:? "use_prepared_statements" + +instance ToJSON DatabaseURL where + toJSON (PGConnectionParametersClassInDatabaseURL x) = toJSON x + toJSON (StringInDatabaseURL x) = toJSON x + +instance FromJSON DatabaseURL where + parseJSON xs@(Object _) = (fmap PGConnectionParametersClassInDatabaseURL . parseJSON) xs + parseJSON xs@(String _) = (fmap StringInDatabaseURL . parseJSON) xs + +instance ToJSON PGConnectionParametersClass where + toJSON (PGConnectionParametersClass fromEnvPGConnectionParametersClass databasePGConnectionParametersClass hostPGConnectionParametersClass passwordPGConnectionParametersClass portPGConnectionParametersClass usernamePGConnectionParametersClass) = + object + [ "from_env" .= fromEnvPGConnectionParametersClass + , "database" .= databasePGConnectionParametersClass + , "host" .= hostPGConnectionParametersClass + , "password" .= passwordPGConnectionParametersClass + , "port" .= portPGConnectionParametersClass + , "username" .= usernamePGConnectionParametersClass + ] + +instance FromJSON PGConnectionParametersClass where + parseJSON (Object v) = PGConnectionParametersClass + <$> v .:? "from_env" + <*> v .:? "database" + <*> v .:? "host" + <*> v .:? "password" + <*> v .:? "port" + <*> v .:? "username" + +instance ToJSON IsolationLevel where + toJSON ReadCommittedIsolationLevel = "read-committed" + toJSON RepeatableReadIsolationLevel = "repeatable-read" + toJSON SerializableIsolationLevel = "serializable" + +instance FromJSON IsolationLevel where + parseJSON = withText "IsolationLevel" parseText + where + parseText "read-committed" = return ReadCommittedIsolationLevel + parseText "repeatable-read" = return RepeatableReadIsolationLevel + parseText "serializable" = return SerializableIsolationLevel + +instance ToJSON PGPoolSettings where + toJSON (PGPoolSettings connectionLifetimePGPoolSettings idleTimeoutPGPoolSettings maxConnectionsPGPoolSettings poolTimeoutPGPoolSettings retriesPGPoolSettings) = + object + [ "connection_lifetime" .= connectionLifetimePGPoolSettings + , "idle_timeout" .= idleTimeoutPGPoolSettings + , "max_connections" .= maxConnectionsPGPoolSettings + , "pool_timeout" .= poolTimeoutPGPoolSettings + , "retries" .= retriesPGPoolSettings + ] + +instance FromJSON PGPoolSettings where + parseJSON (Object v) = PGPoolSettings + <$> v .:? "connection_lifetime" + <*> v .:? "idle_timeout" + <*> v .:? "max_connections" + <*> v .:? "pool_timeout" + <*> v .:? "retries" + +instance ToJSON PGCERTSettings where + toJSON (PGCERTSettings sslcertPGCERTSettings sslkeyPGCERTSettings sslmodePGCERTSettings sslpasswordPGCERTSettings sslrootcertPGCERTSettings) = + object + [ "sslcert" .= sslcertPGCERTSettings + , "sslkey" .= sslkeyPGCERTSettings + , "sslmode" .= sslmodePGCERTSettings + , "sslpassword" .= sslpasswordPGCERTSettings + , "sslrootcert" .= sslrootcertPGCERTSettings + ] + +instance FromJSON PGCERTSettings where + parseJSON (Object v) = PGCERTSettings + <$> v .: "sslcert" + <*> v .: "sslkey" + <*> v .: "sslmode" + <*> v .:? "sslpassword" + <*> v .: "sslrootcert" + +instance ToJSON FromEnv where + toJSON (FromEnv fromEnvFromEnv) = + object + [ "from_env" .= fromEnvFromEnv + ] + +instance FromJSON FromEnv where + parseJSON (Object v) = FromEnv + <$> v .: "from_env" + +instance ToJSON Sslpassword where + toJSON (FromEnvInSslpassword x) = toJSON x + toJSON (StringInSslpassword x) = toJSON x + +instance FromJSON Sslpassword where + parseJSON xs@(Object _) = (fmap FromEnvInSslpassword . parseJSON) xs + parseJSON xs@(String _) = (fmap StringInSslpassword . parseJSON) xs + +instance ToJSON PGSourceKind where + toJSON KindCitusPGSourceKind = "citus" + toJSON KindPostgresPGSourceKind = "postgres" + +instance FromJSON PGSourceKind where + parseJSON = withText "PGSourceKind" parseText + where + parseText "citus" = return KindCitusPGSourceKind + parseText "postgres" = return KindPostgresPGSourceKind + +instance ToJSON MSSQLSource where + toJSON (MSSQLSource configurationMSSQLSource functionsMSSQLSource kindMSSQLSource nameMSSQLSource tablesMSSQLSource) = + object + [ "configuration" .= configurationMSSQLSource + , "functions" .= functionsMSSQLSource + , "kind" .= kindMSSQLSource + , "name" .= nameMSSQLSource + , "tables" .= tablesMSSQLSource + ] + +instance FromJSON MSSQLSource where + parseJSON (Object v) = MSSQLSource + <$> v .: "configuration" + <*> v .:? "functions" + <*> v .: "kind" + <*> v .: "name" + <*> v .: "tables" + +instance ToJSON MSSQLConfiguration where + toJSON (MSSQLConfiguration connectionInfoMSSQLConfiguration) = + object + [ "connection_info" .= connectionInfoMSSQLConfiguration + ] + +instance FromJSON MSSQLConfiguration where + parseJSON (Object v) = MSSQLConfiguration + <$> v .: "connection_info" + +instance ToJSON MSSQLSourceConnectionInfo where + toJSON (MSSQLSourceConnectionInfo connectionStringMSSQLSourceConnectionInfo poolSettingsMSSQLSourceConnectionInfo) = + object + [ "connection_string" .= connectionStringMSSQLSourceConnectionInfo + , "pool_settings" .= poolSettingsMSSQLSourceConnectionInfo + ] + +instance FromJSON MSSQLSourceConnectionInfo where + parseJSON (Object v) = MSSQLSourceConnectionInfo + <$> v .: "connection_string" + <*> v .:? "pool_settings" + +instance ToJSON MSSQLPoolSettings where + toJSON (MSSQLPoolSettings idleTimeoutMSSQLPoolSettings maxConnectionsMSSQLPoolSettings) = + object + [ "idle_timeout" .= idleTimeoutMSSQLPoolSettings + , "max_connections" .= maxConnectionsMSSQLPoolSettings + ] + +instance FromJSON MSSQLPoolSettings where + parseJSON (Object v) = MSSQLPoolSettings + <$> v .:? "idle_timeout" + <*> v .:? "max_connections" + +instance ToJSON MSSQLSourceKind where + toJSON KindMssqlMSSQLSourceKind = "mssql" + +instance FromJSON MSSQLSourceKind where + parseJSON = withText "MSSQLSourceKind" parseText + where + parseText "mssql" = return KindMssqlMSSQLSourceKind + +instance ToJSON BigQuerySource where + toJSON (BigQuerySource configurationBigQuerySource functionsBigQuerySource kindBigQuerySource nameBigQuerySource tablesBigQuerySource) = + object + [ "configuration" .= configurationBigQuerySource + , "functions" .= functionsBigQuerySource + , "kind" .= kindBigQuerySource + , "name" .= nameBigQuerySource + , "tables" .= tablesBigQuerySource + ] + +instance FromJSON BigQuerySource where + parseJSON (Object v) = BigQuerySource + <$> v .: "configuration" + <*> v .:? "functions" + <*> v .: "kind" + <*> v .: "name" + <*> v .: "tables" + +instance ToJSON BigQueryConfiguration where + toJSON (BigQueryConfiguration datasetsBigQueryConfiguration projectIDBigQueryConfiguration serviceAccountBigQueryConfiguration) = + object + [ "datasets" .= datasetsBigQueryConfiguration + , "project_id" .= projectIDBigQueryConfiguration + , "service_account" .= serviceAccountBigQueryConfiguration + ] + +instance FromJSON BigQueryConfiguration where + parseJSON (Object v) = BigQueryConfiguration + <$> v .: "datasets" + <*> v .: "project_id" + <*> v .: "service_account" + +instance ToJSON Datasets where + toJSON (FromEnvInDatasets x) = toJSON x + toJSON (StringArrayInDatasets x) = toJSON x + +instance FromJSON Datasets where + parseJSON xs@(Object _) = (fmap FromEnvInDatasets . parseJSON) xs + parseJSON xs@(Array _) = (fmap StringArrayInDatasets . parseJSON) xs + +instance ToJSON ServiceAccount where + toJSON (RecordStringAnyClassInServiceAccount x) = toJSON x + toJSON (StringInServiceAccount x) = toJSON x + +instance FromJSON ServiceAccount where + parseJSON xs@(Object _) = (fmap RecordStringAnyClassInServiceAccount . parseJSON) xs + parseJSON xs@(String _) = (fmap StringInServiceAccount . parseJSON) xs + +instance ToJSON RecordStringAnyClass where + toJSON (RecordStringAnyClass fromEnvRecordStringAnyClass) = + object + [ "from_env" .= fromEnvRecordStringAnyClass + ] + +instance FromJSON RecordStringAnyClass where + parseJSON (Object v) = RecordStringAnyClass + <$> v .:? "from_env" + +instance ToJSON BigQuerySourceKind where + toJSON KindBigqueryBigQuerySourceKind = "bigquery" + +instance FromJSON BigQuerySourceKind where + parseJSON = withText "BigQuerySourceKind" parseText + where + parseText "bigquery" = return KindBigqueryBigQuerySourceKind + +instance ToJSON HasuraMetadataV3 where + toJSON (HasuraMetadataV3 actionsHasuraMetadataV3 allowlistHasuraMetadataV3 apiLimitsHasuraMetadataV3 cronTriggersHasuraMetadataV3 customTypesHasuraMetadataV3 inheritedRolesHasuraMetadataV3 queryCollectionsHasuraMetadataV3 remoteSchemasHasuraMetadataV3 restEndpointsHasuraMetadataV3 sourcesHasuraMetadataV3 versionHasuraMetadataV3) = + object + [ "actions" .= actionsHasuraMetadataV3 + , "allowlist" .= allowlistHasuraMetadataV3 + , "api_limits" .= apiLimitsHasuraMetadataV3 + , "cron_triggers" .= cronTriggersHasuraMetadataV3 + , "custom_types" .= customTypesHasuraMetadataV3 + , "inherited_roles" .= inheritedRolesHasuraMetadataV3 + , "query_collections" .= queryCollectionsHasuraMetadataV3 + , "remote_schemas" .= remoteSchemasHasuraMetadataV3 + , "rest_endpoints" .= restEndpointsHasuraMetadataV3 + , "sources" .= sourcesHasuraMetadataV3 + , "version" .= versionHasuraMetadataV3 + ] + +instance FromJSON HasuraMetadataV3 where + parseJSON (Object v) = HasuraMetadataV3 + <$> v .:? "actions" + <*> v .:? "allowlist" + <*> v .:? "api_limits" + <*> v .:? "cron_triggers" + <*> v .:? "custom_types" + <*> v .:? "inherited_roles" + <*> v .:? "query_collections" + <*> v .:? "remote_schemas" + <*> v .: "rest_endpoints" + <*> v .: "sources" + <*> v .: "version" + +instance ToJSON APILimits where + toJSON (APILimits depthLimitAPILimits disabledAPILimits nodeLimitAPILimits rateLimitAPILimits) = + object + [ "depth_limit" .= depthLimitAPILimits + , "disabled" .= disabledAPILimits + , "node_limit" .= nodeLimitAPILimits + , "rate_limit" .= rateLimitAPILimits + ] + +instance FromJSON APILimits where + parseJSON (Object v) = APILimits + <$> v .:? "depth_limit" + <*> v .: "disabled" + <*> v .:? "node_limit" + <*> v .:? "rate_limit" + +instance ToJSON DepthLimit where + toJSON (DepthLimit globalDepthLimit perRoleDepthLimit) = + object + [ "global" .= globalDepthLimit + , "per_role" .= perRoleDepthLimit + ] + +instance FromJSON DepthLimit where + parseJSON (Object v) = DepthLimit + <$> v .: "global" + <*> v .: "per_role" + +instance ToJSON NodeLimit where + toJSON (NodeLimit globalNodeLimit perRoleNodeLimit) = + object + [ "global" .= globalNodeLimit + , "per_role" .= perRoleNodeLimit + ] + +instance FromJSON NodeLimit where + parseJSON (Object v) = NodeLimit + <$> v .: "global" + <*> v .: "per_role" + +instance ToJSON RateLimit where + toJSON (RateLimit globalRateLimit perRoleRateLimit) = + object + [ "global" .= globalRateLimit + , "per_role" .= perRoleRateLimit + ] + +instance FromJSON RateLimit where + parseJSON (Object v) = RateLimit + <$> v .: "global" + <*> v .: "per_role" + +instance ToJSON RateLimitRule where + toJSON (RateLimitRule maxReqsPerMinRateLimitRule uniqueParamsRateLimitRule) = + object + [ "max_reqs_per_min" .= maxReqsPerMinRateLimitRule + , "unique_params" .= uniqueParamsRateLimitRule + ] + +instance FromJSON RateLimitRule where + parseJSON (Object v) = RateLimitRule + <$> v .: "max_reqs_per_min" + <*> v .: "unique_params" + +instance ToJSON UniqueParams where + toJSON (EnumInUniqueParams x) = toJSON x + toJSON NullInUniqueParams = Null + toJSON (StringArrayInUniqueParams x) = toJSON x + +instance FromJSON UniqueParams where + parseJSON xs@(Object _) = (fmap EnumInUniqueParams . parseJSON) xs + parseJSON Null = return NullInUniqueParams + parseJSON xs@(Array _) = (fmap StringArrayInUniqueParams . parseJSON) xs + +instance ToJSON UniqueParamsEnum where + toJSON IPUniqueParamsEnum = "IP" + +instance FromJSON UniqueParamsEnum where + parseJSON = withText "UniqueParamsEnum" parseText + where + parseText "IP" = return IPUniqueParamsEnum + +instance ToJSON InheritedRole where + toJSON (InheritedRole roleNameInheritedRole roleSetInheritedRole) = + object + [ "role_name" .= roleNameInheritedRole + , "role_set" .= roleSetInheritedRole + ] + +instance FromJSON InheritedRole where + parseJSON (Object v) = InheritedRole + <$> v .: "role_name" + <*> v .: "role_set" + +instance ToJSON RESTEndpoint where + toJSON (RESTEndpoint commentRESTEndpoint definitionRESTEndpoint methodsRESTEndpoint nameRESTEndpoint urlRESTEndpoint) = + object + [ "comment" .= commentRESTEndpoint + , "definition" .= definitionRESTEndpoint + , "methods" .= methodsRESTEndpoint + , "name" .= nameRESTEndpoint + , "url" .= urlRESTEndpoint + ] + +instance FromJSON RESTEndpoint where + parseJSON (Object v) = RESTEndpoint + <$> v .:? "comment" + <*> v .: "definition" + <*> v .: "methods" + <*> v .: "name" + <*> v .: "url" + +instance ToJSON RESTEndpointDefinition where + toJSON (RESTEndpointDefinition queryRESTEndpointDefinition) = + object + [ "query" .= queryRESTEndpointDefinition + ] + +instance FromJSON RESTEndpointDefinition where + parseJSON (Object v) = RESTEndpointDefinition + <$> v .: "query" + +instance ToJSON QueryClass where + toJSON (QueryClass collectionNameQueryClass queryNameQueryClass) = + object + [ "collection_name" .= collectionNameQueryClass + , "query_name" .= queryNameQueryClass + ] + +instance FromJSON QueryClass where + parseJSON (Object v) = QueryClass + <$> v .: "collection_name" + <*> v .: "query_name" + +instance ToJSON Method where + toJSON PatchMethod = "PATCH" + toJSON PostMethod = "POST" + toJSON PutMethod = "PUT" + +instance FromJSON Method where + parseJSON = withText "Method" parseText + where + parseText "PATCH" = return PatchMethod + parseText "POST" = return PostMethod + parseText "PUT" = return PutMethod + +instance ToJSON Source where + toJSON (Source configurationSource functionsSource kindSource nameSource tablesSource) = + object + [ "configuration" .= configurationSource + , "functions" .= functionsSource + , "kind" .= kindSource + , "name" .= nameSource + , "tables" .= tablesSource + ] + +instance FromJSON Source where + parseJSON (Object v) = Source + <$> v .: "configuration" + <*> v .:? "functions" + <*> v .: "kind" + <*> v .: "name" + <*> v .: "tables" + +instance ToJSON Configuration where + toJSON (Configuration connectionInfoConfiguration readReplicasConfiguration datasetsConfiguration projectIDConfiguration serviceAccountConfiguration) = + object + [ "connection_info" .= connectionInfoConfiguration + , "read_replicas" .= readReplicasConfiguration + , "datasets" .= datasetsConfiguration + , "project_id" .= projectIDConfiguration + , "service_account" .= serviceAccountConfiguration + ] + +instance FromJSON Configuration where + parseJSON (Object v) = Configuration + <$> v .:? "connection_info" + <*> v .:? "read_replicas" + <*> v .:? "datasets" + <*> v .:? "project_id" + <*> v .:? "service_account" + +instance ToJSON SourceConnectionInfo where + toJSON (SourceConnectionInfo databaseURLSourceConnectionInfo isolationLevelSourceConnectionInfo poolSettingsSourceConnectionInfo sslConfigurationSourceConnectionInfo usePreparedStatementsSourceConnectionInfo connectionStringSourceConnectionInfo) = + object + [ "database_url" .= databaseURLSourceConnectionInfo + , "isolation_level" .= isolationLevelSourceConnectionInfo + , "pool_settings" .= poolSettingsSourceConnectionInfo + , "ssl_configuration" .= sslConfigurationSourceConnectionInfo + , "use_prepared_statements" .= usePreparedStatementsSourceConnectionInfo + , "connection_string" .= connectionStringSourceConnectionInfo + ] + +instance FromJSON SourceConnectionInfo where + parseJSON (Object v) = SourceConnectionInfo + <$> v .:? "database_url" + <*> v .:? "isolation_level" + <*> v .:? "pool_settings" + <*> v .:? "ssl_configuration" + <*> v .:? "use_prepared_statements" + <*> v .:? "connection_string" + +instance ToJSON PoolSettings where + toJSON (PoolSettings connectionLifetimePoolSettings idleTimeoutPoolSettings maxConnectionsPoolSettings poolTimeoutPoolSettings retriesPoolSettings) = + object + [ "connection_lifetime" .= connectionLifetimePoolSettings + , "idle_timeout" .= idleTimeoutPoolSettings + , "max_connections" .= maxConnectionsPoolSettings + , "pool_timeout" .= poolTimeoutPoolSettings + , "retries" .= retriesPoolSettings + ] + +instance FromJSON PoolSettings where + parseJSON (Object v) = PoolSettings + <$> v .:? "connection_lifetime" + <*> v .:? "idle_timeout" + <*> v .:? "max_connections" + <*> v .:? "pool_timeout" + <*> v .:? "retries" + +instance ToJSON BackendKind where + toJSON BackendKindBigqueryBackendKind = "bigquery" + toJSON BackendKindCitusBackendKind = "citus" + toJSON BackendKindMssqlBackendKind = "mssql" + toJSON BackendKindPostgresBackendKind = "postgres" + +instance FromJSON BackendKind where + parseJSON = withText "BackendKind" parseText + where + parseText "bigquery" = return BackendKindBigqueryBackendKind + parseText "citus" = return BackendKindCitusBackendKind + parseText "mssql" = return BackendKindMssqlBackendKind + parseText "postgres" = return BackendKindPostgresBackendKind diff --git a/contrib/metadata-types/generated/HasuraMetadataV3.json b/contrib/metadata-types/generated/HasuraMetadataV3.json new file mode 100644 index 00000000000..1d98576ccaf --- /dev/null +++ b/contrib/metadata-types/generated/HasuraMetadataV3.json @@ -0,0 +1,2641 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "PGColumn": { + "type": "string" + }, + "ComputedFieldName": { + "type": "string" + }, + "RoleName": { + "type": "string" + }, + "TriggerName": { + "type": "string" + }, + "RemoteRelationshipName": { + "type": "string" + }, + "RemoteSchemaName": { + "type": "string" + }, + "CollectionName": { + "type": "string" + }, + "GraphQLName": { + "type": "string" + }, + "GraphQLType": { + "type": "string" + }, + "RelationshipName": { + "type": "string" + }, + "ActionName": { + "type": "string" + }, + "WebhookURL": { + "description": "A String value which supports templating environment variables enclosed in {{ and }}.\nTemplate example: https://{{ACTION_API_DOMAIN}}/create-user", + "type": "string" + }, + "TableName": { + "anyOf": [ + { + "$ref": "#/definitions/QualifiedTable" + }, + { + "type": "string" + } + ] + }, + "QualifiedTable": { + "title": "QualifiedTable", + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "name" + }, + "schema": { + "type": "string", + "title": "schema" + } + }, + "required": [ + "name", + "schema" + ] + }, + "TableConfig": { + "description": "Configuration for the table/view\nhttps://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config", + "title": "TableConfig", + "type": "object", + "properties": { + "custom_name": { + "description": "Customise the table name", + "type": "string", + "title": "custom_name" + }, + "custom_root_fields": { + "description": "Customise the root fields", + "$ref": "#/definitions/CustomRootFields", + "title": "custom_root_fields" + }, + "custom_column_names": { + "description": "Customise the column names", + "$ref": "#/definitions/CustomColumnNames", + "title": "custom_column_names" + } + } + }, + "TableEntry": { + "description": "Representation of a table in metadata, 'tables.yaml' and 'metadata.json'", + "title": "TableEntry", + "type": "object", + "properties": { + "table": { + "$ref": "#/definitions/QualifiedTable", + "title": "table" + }, + "is_enum": { + "type": "boolean", + "title": "is_enum" + }, + "configuration": { + "description": "Configuration for the table/view\nhttps://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config", + "$ref": "#/definitions/TableConfig", + "title": "configuration" + }, + "event_triggers": { + "type": "array", + "items": { + "$ref": "#/definitions/EventTrigger" + }, + "title": "event_triggers" + }, + "computed_fields": { + "type": "array", + "items": { + "$ref": "#/definitions/ComputedField" + }, + "title": "computed_fields" + }, + "object_relationships": { + "type": "array", + "items": { + "$ref": "#/definitions/ObjectRelationship" + }, + "title": "object_relationships" + }, + "array_relationships": { + "type": "array", + "items": { + "$ref": "#/definitions/ArrayRelationship" + }, + "title": "array_relationships" + }, + "remote_relationships": { + "type": "array", + "items": { + "$ref": "#/definitions/RemoteRelationship" + }, + "title": "remote_relationships" + }, + "insert_permissions": { + "type": "array", + "items": { + "$ref": "#/definitions/InsertPermissionEntry" + }, + "title": "insert_permissions" + }, + "select_permissions": { + "type": "array", + "items": { + "$ref": "#/definitions/SelectPermissionEntry" + }, + "title": "select_permissions" + }, + "update_permissions": { + "type": "array", + "items": { + "$ref": "#/definitions/UpdatePermissionEntry" + }, + "title": "update_permissions" + }, + "delete_permissions": { + "type": "array", + "items": { + "$ref": "#/definitions/DeletePermissionEntry" + }, + "title": "delete_permissions" + } + }, + "required": [ + "table" + ] + }, + "CustomRootFields": { + "description": "Customise the root fields\nhttps://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#custom-root-fields", + "title": "CustomRootFields", + "type": "object", + "properties": { + "select": { + "description": "Customise the `` root field", + "type": "string", + "title": "select" + }, + "select_by_pk": { + "description": "Customise the `_by_pk` root field", + "type": "string", + "title": "select_by_pk" + }, + "select_aggregate": { + "description": "Customise the `_aggregate` root field", + "type": "string", + "title": "select_aggregate" + }, + "insert": { + "description": "Customise the `insert_` root field", + "type": "string", + "title": "insert" + }, + "insert_one": { + "description": "Customise the `insert__one` root field", + "type": "string", + "title": "insert_one" + }, + "update": { + "description": "Customise the `update_` root field", + "type": "string", + "title": "update" + }, + "update_by_pk": { + "description": "Customise the `update__by_pk` root field", + "type": "string", + "title": "update_by_pk" + }, + "delete": { + "description": "Customise the `delete_` root field", + "type": "string", + "title": "delete" + }, + "delete_by_pk": { + "description": "Customise the `delete__by_pk` root field", + "type": "string", + "title": "delete_by_pk" + } + } + }, + "CustomColumnNames": { + "description": "A JSON Object of Postgres column name to GraphQL name mapping", + "title": "CustomColumnNames", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "FunctionName": { + "anyOf": [ + { + "$ref": "#/definitions/QualifiedFunction" + }, + { + "type": "string" + } + ] + }, + "QualifiedFunction": { + "title": "QualifiedFunction", + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "name" + }, + "schema": { + "type": "string", + "title": "schema" + } + }, + "required": [ + "name", + "schema" + ] + }, + "CustomFunction": { + "description": "A custom SQL function to add to the GraphQL schema with configuration.\nhttps://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-functions.html#args-syntax", + "title": "CustomFunction", + "type": "object", + "properties": { + "function": { + "description": "Name of the SQL function", + "anyOf": [ + { + "$ref": "#/definitions/QualifiedFunction" + }, + { + "type": "string" + } + ], + "title": "function" + }, + "configuration": { + "description": "Configuration for the SQL function", + "$ref": "#/definitions/FunctionConfiguration", + "title": "configuration" + } + }, + "required": [ + "function" + ] + }, + "FunctionConfiguration": { + "description": "Configuration for a CustomFunction\nhttps://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-functions.html#function-configuration", + "title": "FunctionConfiguration", + "type": "object", + "properties": { + "session_argument": { + "description": "Function argument which accepts session info JSON\nCurrently, only functions which satisfy the following constraints can be exposed over the GraphQL API (terminology from Postgres docs):\n- Function behaviour: ONLY `STABLE` or `IMMUTABLE`\n- Return type: MUST be `SETOF `\n- Argument modes: ONLY `IN`", + "type": "string", + "title": "session_argument" + } + } + }, + "ObjectRelationship": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#args-syntax", + "title": "ObjectRelationship", + "type": "object", + "properties": { + "name": { + "description": "Name of the new relationship", + "type": "string", + "title": "name" + }, + "using": { + "$ref": "#/definitions/ObjRelUsing", + "description": "Use one of the available ways to define an object relationship", + "title": "using" + }, + "comment": { + "description": "Comment", + "type": "string", + "title": "comment" + } + }, + "required": [ + "name", + "using" + ] + }, + "ObjRelUsing": { + "description": "Use one of the available ways to define an object relationship\nhttps://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#objrelusing", + "title": "ObjRelUsing", + "type": "object", + "properties": { + "foreign_key_constraint_on": { + "description": "The column with foreign key constraint", + "type": "string", + "title": "foreign_key_constraint_on" + }, + "manual_configuration": { + "description": "Manual mapping of table and columns", + "$ref": "#/definitions/ObjRelUsingManualMapping", + "title": "manual_configuration" + } + } + }, + "ObjRelUsingManualMapping": { + "description": "Manual mapping of table and columns\nhttps://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#objrelusingmanualmapping", + "title": "ObjRelUsingManualMapping", + "type": "object", + "properties": { + "remote_table": { + "description": "The table to which the relationship has to be established", + "anyOf": [ + { + "$ref": "#/definitions/QualifiedTable" + }, + { + "type": "string" + } + ], + "title": "remote_table" + }, + "column_mapping": { + "description": "Mapping of columns from current table to remote table", + "type": "object", + "additionalProperties": { + "type": "string" + }, + "title": "column_mapping" + } + }, + "required": [ + "column_mapping", + "remote_table" + ] + }, + "ArrayRelationship": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#create-array-relationship-syntax", + "title": "ArrayRelationship", + "type": "object", + "properties": { + "name": { + "description": "Name of the new relationship", + "type": "string", + "title": "name" + }, + "using": { + "$ref": "#/definitions/ArrRelUsing", + "description": "Use one of the available ways to define an array relationship", + "title": "using" + }, + "comment": { + "description": "Comment", + "type": "string", + "title": "comment" + } + }, + "required": [ + "name", + "using" + ] + }, + "ArrRelUsing": { + "description": "Use one of the available ways to define an object relationship\nhttps://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusing", + "title": "ArrRelUsing", + "type": "object", + "properties": { + "foreign_key_constraint_on": { + "description": "The column with foreign key constraint", + "$ref": "#/definitions/ArrRelUsingFKeyOn", + "title": "foreign_key_constraint_on" + }, + "manual_configuration": { + "description": "Manual mapping of table and columns", + "$ref": "#/definitions/ArrRelUsingManualMapping", + "title": "manual_configuration" + } + } + }, + "ArrRelUsingFKeyOn": { + "description": "The column with foreign key constraint\nhttps://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusingfkeyon", + "title": "ArrRelUsingFKeyOn", + "type": "object", + "properties": { + "column": { + "type": "string", + "title": "column" + }, + "table": { + "anyOf": [ + { + "$ref": "#/definitions/QualifiedTable" + }, + { + "type": "string" + } + ], + "title": "table" + } + }, + "required": [ + "column", + "table" + ] + }, + "ArrRelUsingManualMapping": { + "description": "Manual mapping of table and columns\nhttps://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusingmanualmapping", + "title": "ArrRelUsingManualMapping", + "type": "object", + "properties": { + "remote_table": { + "description": "The table to which the relationship has to be established", + "anyOf": [ + { + "$ref": "#/definitions/QualifiedTable" + }, + { + "type": "string" + } + ], + "title": "remote_table" + }, + "column_mapping": { + "description": "Mapping of columns from current table to remote table", + "type": "object", + "additionalProperties": { + "type": "string" + }, + "title": "column_mapping" + } + }, + "required": [ + "column_mapping", + "remote_table" + ] + }, + "ColumnPresetsExpression": { + "description": "Preset values for columns that can be sourced from session variables or static values.\nhttps://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#columnpresetexp", + "title": "ColumnPresetsExpression", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "InsertPermissionEntry": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#args-syntax", + "title": "InsertPermissionEntry", + "type": "object", + "properties": { + "role": { + "description": "Role", + "type": "string", + "title": "role" + }, + "permission": { + "$ref": "#/definitions/InsertPermission", + "description": "The permission definition", + "title": "permission" + }, + "comment": { + "description": "Comment", + "type": "string", + "title": "comment" + } + }, + "required": [ + "permission", + "role" + ] + }, + "InsertPermission": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#insertpermission", + "title": "InsertPermission", + "type": "object", + "properties": { + "check": { + "description": "This expression has to hold true for every new row that is inserted", + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "object", + "properties": {}, + "additionalProperties": true + }, + { + "type": [ + "string", + "number" + ] + } + ] + }, + "title": "check" + }, + "set": { + "description": "Preset values for columns that can be sourced from session variables or static values", + "$ref": "#/definitions/ColumnPresetsExpression", + "title": "set" + }, + "columns": { + "description": "Can insert into only these columns (or all when '*' is specified)", + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "enum": [ + "*" + ], + "type": "string" + } + ], + "title": "columns" + }, + "backend_only": { + "description": "When set to true the mutation is accessible only if x-hasura-use-backend-only-permissions session variable exists\nand is set to true and request is made with x-hasura-admin-secret set if any auth is configured", + "type": "boolean", + "title": "backend_only" + } + }, + "required": [ + "columns" + ] + }, + "SelectPermissionEntry": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-select-permission-syntax", + "title": "SelectPermissionEntry", + "type": "object", + "properties": { + "role": { + "description": "Role", + "type": "string", + "title": "role" + }, + "permission": { + "$ref": "#/definitions/SelectPermission", + "description": "The permission definition", + "title": "permission" + }, + "comment": { + "description": "Comment", + "type": "string", + "title": "comment" + } + }, + "required": [ + "permission", + "role" + ] + }, + "SelectPermission": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#selectpermission", + "title": "SelectPermission", + "type": "object", + "properties": { + "columns": { + "description": "Only these columns are selectable (or all when '*' is specified)", + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "enum": [ + "*" + ], + "type": "string" + } + ], + "title": "columns" + }, + "computed_fields": { + "description": "Only these computed fields are selectable", + "type": "array", + "items": { + "type": "string" + }, + "title": "computed_fields" + }, + "limit": { + "description": "The maximum number of rows that can be returned", + "type": "integer", + "title": "limit" + }, + "allow_aggregations": { + "description": "Toggle allowing aggregate queries", + "type": "boolean", + "title": "allow_aggregations" + }, + "filter": { + "description": "Only the rows where this precondition holds true are selectable", + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "object", + "properties": {}, + "additionalProperties": true + }, + { + "type": [ + "string", + "number" + ] + } + ] + }, + "title": "filter" + } + }, + "required": [ + "columns" + ] + }, + "UpdatePermissionEntry": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-update-permission-syntax", + "title": "UpdatePermissionEntry", + "type": "object", + "properties": { + "role": { + "description": "Role", + "type": "string", + "title": "role" + }, + "permission": { + "$ref": "#/definitions/UpdatePermission", + "description": "The permission definition", + "title": "permission" + }, + "comment": { + "description": "Comment", + "type": "string", + "title": "comment" + } + }, + "required": [ + "permission", + "role" + ] + }, + "UpdatePermission": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#updatepermission", + "title": "UpdatePermission", + "type": "object", + "properties": { + "check": { + "description": "Postcondition which must be satisfied by rows which have been updated", + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "object", + "properties": {}, + "additionalProperties": true + }, + { + "type": [ + "string", + "number" + ] + } + ] + }, + "title": "check" + }, + "set": { + "description": "Preset values for columns that can be sourced from session variables or static values", + "$ref": "#/definitions/ColumnPresetsExpression", + "title": "set" + }, + "columns": { + "description": "Only these columns are selectable (or all when '*' is specified)", + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "enum": [ + "*" + ], + "type": "string" + } + ], + "title": "columns" + }, + "filter": { + "description": "Only the rows where this precondition holds true are updatable", + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "object", + "properties": {}, + "additionalProperties": true + }, + { + "type": [ + "string", + "number" + ] + } + ] + }, + "title": "filter" + } + }, + "required": [ + "columns" + ] + }, + "DeletePermissionEntry": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-delete-permission-syntax", + "title": "DeletePermissionEntry", + "type": "object", + "properties": { + "role": { + "description": "Role", + "type": "string", + "title": "role" + }, + "permission": { + "$ref": "#/definitions/DeletePermission", + "description": "The permission definition", + "title": "permission" + }, + "comment": { + "description": "Comment", + "type": "string", + "title": "comment" + } + }, + "required": [ + "permission", + "role" + ] + }, + "DeletePermission": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#deletepermission", + "title": "DeletePermission", + "type": "object", + "properties": { + "filter": { + "description": "Only the rows where this precondition holds true are updatable", + "type": "object", + "additionalProperties": { + "anyOf": [ + { + "type": "object", + "properties": {}, + "additionalProperties": true + }, + { + "type": [ + "string", + "number" + ] + } + ] + }, + "title": "filter" + } + } + }, + "ComputedField": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/computed-field.html#args-syntax", + "title": "ComputedField", + "type": "object", + "properties": { + "name": { + "description": "Name of the new computed field", + "type": "string", + "title": "name" + }, + "definition": { + "$ref": "#/definitions/ComputedFieldDefinition", + "description": "The computed field definition", + "title": "definition" + }, + "comment": { + "description": "Comment", + "type": "string", + "title": "comment" + } + }, + "required": [ + "definition", + "name" + ] + }, + "ComputedFieldDefinition": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/computed-field.html#computedfielddefinition", + "title": "ComputedFieldDefinition", + "type": "object", + "properties": { + "function": { + "description": "The SQL function", + "anyOf": [ + { + "$ref": "#/definitions/QualifiedFunction" + }, + { + "type": "string" + } + ], + "title": "function" + }, + "table_argument": { + "description": "Name of the argument which accepts a table row type. If omitted, the first argument is considered a table argument", + "type": "string", + "title": "table_argument" + }, + "session_argument": { + "description": "Name of the argument which accepts the Hasura session object as a JSON/JSONB value. If omitted, the Hasura session object is not passed to the function", + "type": "string", + "title": "session_argument" + } + }, + "required": [ + "function" + ] + }, + "EventTrigger": { + "description": "NOTE: The metadata type doesn't QUITE match the 'create' arguments here\nhttps://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#create-event-trigger", + "title": "EventTrigger", + "type": "object", + "properties": { + "name": { + "description": "Name of the event trigger", + "type": "string", + "title": "name" + }, + "definition": { + "$ref": "#/definitions/EventTriggerDefinition", + "description": "The SQL function", + "title": "definition" + }, + "retry_conf": { + "$ref": "#/definitions/RetryConf", + "description": "The SQL function", + "title": "retry_conf" + }, + "webhook": { + "description": "The SQL function", + "type": "string", + "title": "webhook" + }, + "webhook_from_env": { + "type": "string", + "title": "webhook_from_env" + }, + "headers": { + "description": "The SQL function", + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/HeaderFromValue" + }, + { + "$ref": "#/definitions/HeaderFromEnv" + } + ] + }, + "title": "headers" + } + }, + "required": [ + "definition", + "name", + "retry_conf" + ] + }, + "EventTriggerDefinition": { + "title": "EventTriggerDefinition", + "type": "object", + "properties": { + "enable_manual": { + "type": "boolean", + "title": "enable_manual" + }, + "insert": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec", + "$ref": "#/definitions/OperationSpec", + "title": "insert" + }, + "delete": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec", + "$ref": "#/definitions/OperationSpec", + "title": "delete" + }, + "update": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec", + "$ref": "#/definitions/OperationSpec", + "title": "update" + } + }, + "required": [ + "enable_manual" + ] + }, + "EventTriggerColumns": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "enum": [ + "*" + ], + "type": "string" + } + ] + }, + "OperationSpec": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec", + "title": "OperationSpec", + "type": "object", + "properties": { + "columns": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#eventtriggercolumns", + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "enum": [ + "*" + ], + "type": "string" + } + ], + "title": "columns" + }, + "payload": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#eventtriggercolumns", + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "enum": [ + "*" + ], + "type": "string" + } + ], + "title": "payload" + } + }, + "required": [ + "columns" + ] + }, + "HeaderFromValue": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromvalue", + "title": "HeaderFromValue", + "type": "object", + "properties": { + "name": { + "description": "Name of the header", + "type": "string", + "title": "name" + }, + "value": { + "description": "Value of the header", + "type": "string", + "title": "value" + } + }, + "required": [ + "name", + "value" + ] + }, + "HeaderFromEnv": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromenv", + "title": "HeaderFromEnv", + "type": "object", + "properties": { + "name": { + "description": "Name of the header", + "type": "string", + "title": "name" + }, + "value_from_env": { + "description": "Name of the environment variable which holds the value of the header", + "type": "string", + "title": "value_from_env" + } + }, + "required": [ + "name", + "value_from_env" + ] + }, + "RetryConf": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#retryconf", + "title": "RetryConf", + "type": "object", + "properties": { + "num_retries": { + "description": "Number of times to retry delivery.\nDefault: 0", + "type": "integer", + "title": "num_retries" + }, + "interval_sec": { + "description": "Number of seconds to wait between each retry.\nDefault: 10", + "type": "integer", + "title": "interval_sec" + }, + "timeout_sec": { + "description": "Number of seconds to wait for response before timing out.\nDefault: 60", + "type": "integer", + "title": "timeout_sec" + } + } + }, + "CronTrigger": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/scheduled-triggers.html#create-cron-trigger", + "title": "CronTrigger", + "type": "object", + "properties": { + "name": { + "description": "Name of the cron trigger", + "type": "string", + "title": "name" + }, + "webhook": { + "description": "URL of the webhook", + "type": "string", + "title": "webhook" + }, + "schedule": { + "description": "Cron expression at which the trigger should be invoked.", + "type": "string", + "title": "schedule" + }, + "payload": { + "description": "Any JSON payload which will be sent when the webhook is invoked.", + "type": "object", + "properties": {}, + "additionalProperties": true, + "title": "payload" + }, + "headers": { + "description": "List of headers to be sent with the webhook", + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/HeaderFromValue" + }, + { + "$ref": "#/definitions/HeaderFromEnv" + } + ] + }, + "title": "headers" + }, + "retry_conf": { + "description": "Retry configuration if scheduled invocation delivery fails", + "$ref": "#/definitions/RetryConfST", + "title": "retry_conf" + }, + "include_in_metadata": { + "description": "Flag to indicate whether a trigger should be included in the metadata. When a cron trigger is included in the metadata, the user will be able to export it when the metadata of the graphql-engine is exported.", + "type": "boolean", + "title": "include_in_metadata" + }, + "comment": { + "description": "Custom comment.", + "type": "string", + "title": "comment" + } + }, + "required": [ + "headers", + "include_in_metadata", + "name", + "schedule", + "webhook" + ] + }, + "RetryConfST": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/scheduled-triggers.html#retryconfst", + "title": "RetryConfST", + "type": "object", + "properties": { + "num_retries": { + "description": "Number of times to retry delivery.\nDefault: 0", + "type": "integer", + "title": "num_retries" + }, + "retry_interval_seconds": { + "description": "Number of seconds to wait between each retry.\nDefault: 10", + "type": "integer", + "title": "retry_interval_seconds" + }, + "timeout_seconds": { + "description": "Number of seconds to wait for response before timing out.\nDefault: 60", + "type": "integer", + "title": "timeout_seconds" + }, + "tolerance_seconds": { + "description": "Number of seconds between scheduled time and actual delivery time that is acceptable. If the time difference is more than this, then the event is dropped.\nDefault: 21600 (6 hours)", + "type": "integer", + "title": "tolerance_seconds" + } + } + }, + "RemoteSchema": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-schemas.html#add-remote-schema", + "title": "RemoteSchema", + "type": "object", + "properties": { + "name": { + "description": "Name of the remote schema", + "type": "string", + "title": "name" + }, + "definition": { + "$ref": "#/definitions/RemoteSchemaDef", + "description": "Name of the remote schema", + "title": "definition" + }, + "comment": { + "description": "Comment", + "type": "string", + "title": "comment" + } + }, + "required": [ + "definition", + "name" + ] + }, + "RemoteSchemaDef": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#remoteschemadef", + "title": "RemoteSchemaDef", + "type": "object", + "properties": { + "url": { + "type": "string", + "title": "url" + }, + "url_from_env": { + "type": "string", + "title": "url_from_env" + }, + "headers": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/HeaderFromValue" + }, + { + "$ref": "#/definitions/HeaderFromEnv" + } + ] + }, + "title": "headers" + }, + "forward_client_headers": { + "type": "boolean", + "title": "forward_client_headers" + }, + "timeout_seconds": { + "type": "number", + "title": "timeout_seconds" + } + } + }, + "RemoteRelationship": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-relationships.html#args-syntax", + "title": "RemoteRelationship", + "type": "object", + "properties": { + "name": { + "description": "Name of the remote relationship", + "type": "string", + "title": "name" + }, + "definition": { + "$ref": "#/definitions/RemoteRelationshipDef", + "description": "Definition object", + "title": "definition" + } + }, + "required": [ + "definition", + "name" + ] + }, + "RemoteRelationshipDef": { + "title": "RemoteRelationshipDef", + "type": "object", + "properties": { + "hasura_fields": { + "description": "Column(s) in the table that is used for joining with remote schema field.\nAll join keys in remote_field must appear here.", + "type": "array", + "items": { + "type": "string" + }, + "title": "hasura_fields" + }, + "remote_schema": { + "description": "Name of the remote schema to join with", + "type": "string", + "title": "remote_schema" + }, + "remote_field": { + "$ref": "#/definitions/RemoteField", + "description": "The schema tree ending at the field in remote schema which needs to be joined with.", + "title": "remote_field" + } + }, + "required": [ + "hasura_fields", + "remote_field", + "remote_schema" + ] + }, + "RemoteField": { + "description": "A recursive tree structure that points to the field in the remote schema that needs to be joined with.\nIt is recursive because the remote field maybe nested deeply in the remote schema.\nhttps://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-relationships.html#remotefield", + "title": "RemoteField", + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "arguments": { + "$ref": "#/definitions/InputArguments", + "title": "arguments" + }, + "field": { + "description": "A recursive tree structure that points to the field in the remote schema that needs to be joined with.\nIt is recursive because the remote field maybe nested deeply in the remote schema.\nhttps://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-relationships.html#remotefield", + "$ref": "#/definitions/RemoteField", + "title": "field" + } + }, + "required": [ + "arguments" + ] + } + }, + "InputArguments": { + "description": "Note: Table columns can be referred by prefixing $ e.g $id.\nhttps://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-relationships.html#inputarguments", + "title": "InputArguments", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "QueryCollectionEntry": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/query-collections.html#args-syntax", + "title": "QueryCollectionEntry", + "type": "object", + "properties": { + "name": { + "description": "Name of the query collection", + "type": "string", + "title": "name" + }, + "definition": { + "description": "List of queries", + "type": "object", + "properties": { + "queries": { + "type": "array", + "items": { + "$ref": "#/definitions/QueryCollection" + }, + "title": "queries" + } + }, + "required": [ + "queries" + ], + "title": "definition" + }, + "comment": { + "description": "Comment", + "type": "string", + "title": "comment" + } + }, + "required": [ + "definition", + "name" + ] + }, + "QueryCollection": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#collectionquery", + "title": "QueryCollection", + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "name" + }, + "query": { + "type": "string", + "title": "query" + } + }, + "required": [ + "name", + "query" + ] + }, + "AllowList": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/query-collections.html#add-collection-to-allowlist-syntax", + "title": "AllowList", + "type": "object", + "properties": { + "collection": { + "description": "Name of a query collection to be added to the allow-list", + "type": "string", + "title": "collection" + } + }, + "required": [ + "collection" + ] + }, + "CustomTypes": { + "title": "CustomTypes", + "type": "object", + "properties": { + "input_objects": { + "type": "array", + "items": { + "$ref": "#/definitions/InputObjectType" + }, + "title": "input_objects" + }, + "objects": { + "type": "array", + "items": { + "$ref": "#/definitions/ObjectType" + }, + "title": "objects" + }, + "scalars": { + "type": "array", + "items": { + "$ref": "#/definitions/ScalarType" + }, + "title": "scalars" + }, + "enums": { + "type": "array", + "items": { + "$ref": "#/definitions/EnumType" + }, + "title": "enums" + } + } + }, + "InputObjectType": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#inputobjecttype", + "title": "InputObjectType", + "type": "object", + "properties": { + "name": { + "description": "Name of the Input object type", + "type": "string", + "title": "name" + }, + "description": { + "description": "Description of the Input object type", + "type": "string", + "title": "description" + }, + "fields": { + "description": "Fields of the Input object type", + "type": "array", + "items": { + "$ref": "#/definitions/InputObjectField" + }, + "title": "fields" + } + }, + "required": [ + "fields", + "name" + ] + }, + "InputObjectField": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#inputobjectfield", + "title": "InputObjectField", + "type": "object", + "properties": { + "name": { + "description": "Name of the Input object type", + "type": "string", + "title": "name" + }, + "description": { + "description": "Description of the Input object type", + "type": "string", + "title": "description" + }, + "type": { + "description": "GraphQL type of the Input object type", + "type": "string", + "title": "type" + } + }, + "required": [ + "name", + "type" + ] + }, + "ObjectType": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objecttype", + "title": "ObjectType", + "type": "object", + "properties": { + "name": { + "description": "Name of the Input object type", + "type": "string", + "title": "name" + }, + "description": { + "description": "Description of the Input object type", + "type": "string", + "title": "description" + }, + "fields": { + "description": "Fields of the Input object type", + "type": "array", + "items": { + "$ref": "#/definitions/InputObjectField" + }, + "title": "fields" + }, + "relationships": { + "description": "Relationships of the Object type to tables", + "type": "array", + "items": { + "$ref": "#/definitions/CustomTypeObjectRelationship" + }, + "title": "relationships" + } + }, + "required": [ + "fields", + "name" + ] + }, + "ObjectField": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objectfield", + "title": "ObjectField", + "type": "object", + "properties": { + "name": { + "description": "Name of the Input object type", + "type": "string", + "title": "name" + }, + "description": { + "description": "Description of the Input object type", + "type": "string", + "title": "description" + }, + "type": { + "description": "GraphQL type of the Input object type", + "type": "string", + "title": "type" + } + }, + "required": [ + "name", + "type" + ] + }, + "CustomTypeObjectRelationship": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objectrelationship", + "title": "CustomTypeObjectRelationship", + "type": "object", + "properties": { + "name": { + "description": "Name of the relationship, shouldn’t conflict with existing field names", + "type": "string", + "title": "name" + }, + "type": { + "description": "Type of the relationship", + "enum": [ + "array", + "object" + ], + "type": "string", + "title": "type" + }, + "remote_table": { + "description": "The table to which relationship is defined", + "anyOf": [ + { + "$ref": "#/definitions/QualifiedTable" + }, + { + "type": "string" + } + ], + "title": "remote_table" + }, + "field_mapping": { + "description": "Mapping of fields of object type to columns of remote table", + "type": "object", + "additionalProperties": { + "type": "string" + }, + "title": "field_mapping" + } + }, + "required": [ + "field_mapping", + "name", + "remote_table", + "type" + ] + }, + "ScalarType": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#scalartype", + "title": "ScalarType", + "type": "object", + "properties": { + "name": { + "description": "Name of the Scalar type", + "type": "string", + "title": "name" + }, + "description": { + "description": "Description of the Scalar type", + "type": "string", + "title": "description" + } + }, + "required": [ + "name" + ] + }, + "EnumType": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#enumtype", + "title": "EnumType", + "type": "object", + "properties": { + "name": { + "description": "Name of the Enum type", + "type": "string", + "title": "name" + }, + "description": { + "description": "Description of the Enum type", + "type": "string", + "title": "description" + }, + "values": { + "description": "Values of the Enum type", + "type": "array", + "items": { + "$ref": "#/definitions/EnumValue" + }, + "title": "values" + } + }, + "required": [ + "name", + "values" + ] + }, + "EnumValue": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#enumvalue", + "title": "EnumValue", + "type": "object", + "properties": { + "value": { + "description": "Value of the Enum type", + "type": "string", + "title": "value" + }, + "description": { + "description": "Description of the Enum value", + "type": "string", + "title": "description" + }, + "is_deprecated": { + "description": "If set to true, the enum value is marked as deprecated", + "type": "boolean", + "title": "is_deprecated" + } + }, + "required": [ + "value" + ] + }, + "Action": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#args-syntax", + "title": "Action", + "type": "object", + "properties": { + "name": { + "description": "Name of the action", + "type": "string", + "title": "name" + }, + "definition": { + "$ref": "#/definitions/ActionDefinition", + "description": "Definition of the action", + "title": "definition" + }, + "comment": { + "description": "Comment", + "type": "string", + "title": "comment" + }, + "permissions": { + "description": "Permissions of the action", + "type": "array", + "items": { + "type": "object", + "properties": { + "role": { + "type": "string", + "title": "role" + } + }, + "required": [ + "role" + ] + }, + "title": "permissions" + } + }, + "required": [ + "definition", + "name" + ] + }, + "ActionDefinition": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#actiondefinition", + "title": "ActionDefinition", + "type": "object", + "properties": { + "arguments": { + "type": "array", + "items": { + "$ref": "#/definitions/InputArgument" + }, + "title": "arguments" + }, + "output_type": { + "type": "string", + "title": "output_type" + }, + "kind": { + "type": "string", + "title": "kind" + }, + "headers": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/HeaderFromValue" + }, + { + "$ref": "#/definitions/HeaderFromEnv" + } + ] + }, + "title": "headers" + }, + "forward_client_headers": { + "type": "boolean", + "title": "forward_client_headers" + }, + "handler": { + "description": "A String value which supports templating environment variables enclosed in {{ and }}.\nTemplate example: https://{{ACTION_API_DOMAIN}}/create-user", + "type": "string", + "title": "handler" + }, + "type": { + "enum": [ + "mutation", + "query" + ], + "type": "string", + "title": "type" + } + }, + "required": [ + "handler" + ] + }, + "InputArgument": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#inputargument", + "title": "InputArgument", + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "name" + }, + "type": { + "type": "string", + "title": "type" + } + }, + "required": [ + "name", + "type" + ] + }, + "HasuraMetadataV2": { + "description": "Type used in exported 'metadata.json' and replace metadata endpoint\nhttps://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/manage-metadata.html#replace-metadata", + "title": "HasuraMetadataV2", + "type": "object", + "properties": { + "version": { + "type": "number", + "title": "version" + }, + "tables": { + "type": "array", + "items": { + "$ref": "#/definitions/TableEntry" + }, + "title": "tables" + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/definitions/Action" + }, + "title": "actions" + }, + "custom_types": { + "$ref": "#/definitions/CustomTypes", + "title": "custom_types" + }, + "functions": { + "type": "array", + "items": { + "$ref": "#/definitions/CustomFunction" + }, + "title": "functions" + }, + "remote_schemas": { + "type": "array", + "items": { + "$ref": "#/definitions/RemoteSchema" + }, + "title": "remote_schemas" + }, + "query_collections": { + "type": "array", + "items": { + "$ref": "#/definitions/QueryCollectionEntry" + }, + "title": "query_collections" + }, + "allowlist": { + "type": "array", + "items": { + "$ref": "#/definitions/AllowList" + }, + "title": "allowlist" + }, + "cron_triggers": { + "type": "array", + "items": { + "$ref": "#/definitions/CronTrigger" + }, + "title": "cron_triggers" + } + }, + "required": [ + "tables", + "version" + ] + }, + "FromEnv": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#fromenv", + "title": "FromEnv", + "type": "object", + "properties": { + "from_env": { + "description": "Name of the environment variable", + "type": "string", + "title": "from_env" + } + }, + "required": [ + "from_env" + ] + }, + "PGConfiguration": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconfiguration", + "title": "PGConfiguration", + "type": "object", + "properties": { + "connection_info": { + "$ref": "#/definitions/PGSourceConnectionInfo", + "description": "Connection parameters for the source", + "title": "connection_info" + }, + "read_replicas": { + "description": "Optional list of read replica configuration (supported only in cloud/enterprise versions)", + "type": "array", + "items": { + "$ref": "#/definitions/PGSourceConnectionInfo" + }, + "title": "read_replicas" + } + }, + "required": [ + "connection_info" + ] + }, + "MsSQLConfiguration": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo", + "title": "MsSQLConfiguration", + "type": "object", + "properties": { + "connection_info": { + "$ref": "#/definitions/MsSQLSourceConnectionInfo", + "description": "Connection parameters for the source", + "title": "connection_info" + } + }, + "required": [ + "connection_info" + ] + }, + "BigQueryConfiguration": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#bigqueryconfiguration", + "title": "BigQueryConfiguration", + "type": "object", + "properties": { + "service_account": { + "description": "Service account for BigQuery database", + "anyOf": [ + { + "$ref": "#/definitions/FromEnv" + }, + { + "$ref": "#/definitions/Record" + }, + { + "type": "string" + } + ], + "title": "service_account" + }, + "project_id": { + "description": "Project Id for BigQuery database", + "anyOf": [ + { + "$ref": "#/definitions/FromEnv" + }, + { + "type": "string" + } + ], + "title": "project_id" + }, + "datasets": { + "description": "List of BigQuery datasets", + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "$ref": "#/definitions/FromEnv" + } + ], + "title": "datasets" + } + }, + "required": [ + "datasets", + "project_id", + "service_account" + ] + }, + "PGSourceConnectionInfo": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgsourceconnectioninfo", + "title": "PGSourceConnectionInfo", + "type": "object", + "properties": { + "database_url": { + "description": "The database connection URL as a string, as an environment variable, or as connection parameters.", + "anyOf": [ + { + "$ref": "#/definitions/FromEnv" + }, + { + "$ref": "#/definitions/PGConnectionParameters" + }, + { + "type": "string" + } + ], + "title": "database_url" + }, + "pool_settings": { + "description": "Connection pool settings", + "$ref": "#/definitions/PGPoolSettings", + "title": "pool_settings" + }, + "use_prepared_statements": { + "description": "If set to true the server prepares statement before executing on the source database (default: false). For more details, refer to the Postgres docs", + "type": "boolean", + "title": "use_prepared_statements" + }, + "isolation_level": { + "description": "The transaction isolation level in which the queries made to the source will be run with (default: read-committed).", + "enum": [ + "read-committed", + "repeatable-read", + "serializable" + ], + "type": "string", + "title": "isolation_level" + }, + "ssl_configuration": { + "description": "The client SSL certificate settings for the database (Only available in Cloud).", + "$ref": "#/definitions/PGCertSettings", + "title": "ssl_configuration" + } + }, + "required": [ + "database_url" + ] + }, + "MsSQLSourceConnectionInfo": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo", + "title": "MsSQLSourceConnectionInfo", + "type": "object", + "properties": { + "connection_string": { + "description": "The database connection string, or as an environment variable", + "anyOf": [ + { + "$ref": "#/definitions/FromEnv" + }, + { + "type": "string" + } + ], + "title": "connection_string" + }, + "pool_settings": { + "description": "Connection pool settings", + "$ref": "#/definitions/MsSQLPoolSettings", + "title": "pool_settings" + } + }, + "required": [ + "connection_string" + ] + }, + "PGConnectionParameters": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconnectionparameters", + "title": "PGConnectionParameters", + "type": "object", + "properties": { + "username": { + "description": "The Postgres user to be connected", + "type": "string", + "title": "username" + }, + "password": { + "description": "The Postgres user’s password", + "type": "string", + "title": "password" + }, + "database": { + "description": "The database name", + "type": "string", + "title": "database" + }, + "host": { + "description": "The name of the host to connect to", + "type": "string", + "title": "host" + }, + "port": { + "description": "The port number to connect with, at the server host", + "type": "number", + "title": "port" + } + }, + "required": [ + "database", + "host", + "port", + "username" + ] + }, + "PGPoolSettings": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgpoolsettings", + "title": "PGPoolSettings", + "type": "object", + "properties": { + "max_connections": { + "description": "Maximum number of connections to be kept in the pool (default: 50)", + "type": "number", + "title": "max_connections" + }, + "idle_timeout": { + "description": "The idle timeout (in seconds) per connection (default: 180)", + "type": "number", + "title": "idle_timeout" + }, + "retries": { + "description": "Number of retries to perform (default: 1)", + "type": "number", + "title": "retries" + }, + "pool_timeout": { + "description": "Maximum time to wait while acquiring a Postgres connection from the pool, in seconds (default: forever)", + "type": "number", + "title": "pool_timeout" + }, + "connection_lifetime": { + "description": "Time from connection creation after which the connection should be destroyed and a new one created. A value of 0 indicates we should never destroy an active connection. If 0 is passed, memory from large query results may not be reclaimed. (default: 600 sec)", + "type": "number", + "title": "connection_lifetime" + } + } + }, + "PGCertSettings": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgcertsettings", + "title": "PGCertSettings", + "type": "object", + "properties": { + "sslmode": { + "description": "The SSL connection mode. See the libpq ssl support docs for more details.", + "type": "string", + "title": "sslmode" + }, + "sslrootcert": { + "$ref": "#/definitions/FromEnv", + "description": "Environment variable which stores trusted certificate authorities.", + "title": "sslrootcert" + }, + "sslcert": { + "$ref": "#/definitions/FromEnv", + "description": "Environment variable which stores the client certificate.", + "title": "sslcert" + }, + "sslkey": { + "$ref": "#/definitions/FromEnv", + "description": "Environment variable which stores the client private key.", + "title": "sslkey" + }, + "sslpassword": { + "description": "Password in the case where the sslkey is encrypted.", + "anyOf": [ + { + "$ref": "#/definitions/FromEnv" + }, + { + "type": "string" + } + ], + "title": "sslpassword" + } + }, + "required": [ + "sslcert", + "sslkey", + "sslmode", + "sslrootcert" + ] + }, + "MsSQLPoolSettings": { + "description": "https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlpoolsettings", + "title": "MsSQLPoolSettings", + "type": "object", + "properties": { + "max_connections": { + "description": "Maximum number of connections to be kept in the pool (default: 50)", + "type": "number", + "title": "max_connections" + }, + "idle_timeout": { + "description": "The idle timeout (in seconds) per connection (default: 180)", + "type": "number", + "title": "idle_timeout" + } + } + }, + "BackendKind": { + "enum": [ + "bigquery", + "citus", + "mssql", + "postgres" + ], + "type": "string" + }, + "BaseSource": { + "title": "BaseSource", + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "name" + }, + "tables": { + "type": "array", + "items": { + "$ref": "#/definitions/TableEntry" + }, + "title": "tables" + }, + "functions": { + "type": "array", + "items": { + "$ref": "#/definitions/CustomFunction" + }, + "title": "functions" + } + }, + "required": [ + "name", + "tables" + ] + }, + "PGSource": { + "title": "PGSource", + "type": "object", + "properties": { + "kind": { + "enum": [ + "citus", + "postgres" + ], + "type": "string", + "title": "kind" + }, + "configuration": { + "$ref": "#/definitions/PGConfiguration", + "title": "configuration" + }, + "name": { + "type": "string", + "title": "name" + }, + "tables": { + "type": "array", + "items": { + "$ref": "#/definitions/TableEntry" + }, + "title": "tables" + }, + "functions": { + "type": "array", + "items": { + "$ref": "#/definitions/CustomFunction" + }, + "title": "functions" + } + }, + "required": [ + "configuration", + "kind", + "name", + "tables" + ] + }, + "MsSQLSource": { + "title": "MsSQLSource", + "type": "object", + "properties": { + "kind": { + "type": "string", + "enum": [ + "mssql" + ], + "title": "kind" + }, + "configuration": { + "$ref": "#/definitions/MsSQLConfiguration", + "title": "configuration" + }, + "name": { + "type": "string", + "title": "name" + }, + "tables": { + "type": "array", + "items": { + "$ref": "#/definitions/TableEntry" + }, + "title": "tables" + }, + "functions": { + "type": "array", + "items": { + "$ref": "#/definitions/CustomFunction" + }, + "title": "functions" + } + }, + "required": [ + "configuration", + "kind", + "name", + "tables" + ] + }, + "BigQuerySource": { + "title": "BigQuerySource", + "type": "object", + "properties": { + "kind": { + "type": "string", + "enum": [ + "bigquery" + ], + "title": "kind" + }, + "configuration": { + "$ref": "#/definitions/BigQueryConfiguration", + "title": "configuration" + }, + "name": { + "type": "string", + "title": "name" + }, + "tables": { + "type": "array", + "items": { + "$ref": "#/definitions/TableEntry" + }, + "title": "tables" + }, + "functions": { + "type": "array", + "items": { + "$ref": "#/definitions/CustomFunction" + }, + "title": "functions" + } + }, + "required": [ + "configuration", + "kind", + "name", + "tables" + ] + }, + "Source": { + "anyOf": [ + { + "$ref": "#/definitions/PGSource" + }, + { + "$ref": "#/definitions/MsSQLSource" + }, + { + "$ref": "#/definitions/BigQuerySource" + } + ] + }, + "APILimits": { + "title": "APILimits", + "type": "object", + "properties": { + "depth_limit": { + "$ref": "#/definitions/DepthLimit", + "title": "depth_limit" + }, + "disabled": { + "type": "boolean", + "title": "disabled" + }, + "rate_limit": { + "$ref": "#/definitions/RateLimit", + "title": "rate_limit" + }, + "node_limit": { + "$ref": "#/definitions/NodeLimit", + "title": "node_limit" + } + }, + "required": [ + "disabled" + ] + }, + "DepthLimit": { + "title": "DepthLimit", + "type": "object", + "properties": { + "global": { + "type": "number", + "title": "global" + }, + "per_role": { + "type": "object", + "additionalProperties": { + "type": "number" + }, + "title": "per_role" + } + }, + "required": [ + "global", + "per_role" + ] + }, + "RateLimit": { + "title": "RateLimit", + "type": "object", + "properties": { + "global": { + "$ref": "#/definitions/RateLimitRule", + "title": "global" + }, + "per_role": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/RateLimitRule" + }, + "title": "per_role" + } + }, + "required": [ + "global", + "per_role" + ] + }, + "RateLimitRule": { + "title": "RateLimitRule", + "type": "object", + "properties": { + "unique_params": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "enum": [ + "IP" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "title": "unique_params" + }, + "max_reqs_per_min": { + "type": "number", + "title": "max_reqs_per_min" + } + }, + "required": [ + "max_reqs_per_min", + "unique_params" + ] + }, + "NodeLimit": { + "title": "NodeLimit", + "type": "object", + "properties": { + "global": { + "type": "number", + "title": "global" + }, + "per_role": { + "type": "object", + "additionalProperties": { + "type": "number" + }, + "title": "per_role" + } + }, + "required": [ + "global", + "per_role" + ] + }, + "RestEndpoint": { + "title": "RestEndpoint", + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "name" + }, + "url": { + "type": "string", + "title": "url" + }, + "methods": { + "type": "array", + "items": { + "enum": [ + "PATCH", + "POST", + "PUT" + ], + "type": "string" + }, + "title": "methods" + }, + "definition": { + "$ref": "#/definitions/RestEndpointDefinition", + "title": "definition" + }, + "comment": { + "type": "string", + "title": "comment" + } + }, + "required": [ + "definition", + "methods", + "name", + "url" + ] + }, + "RestEndpointDefinition": { + "title": "RestEndpointDefinition", + "type": "object", + "properties": { + "query": { + "type": "object", + "properties": { + "query_name": { + "type": "string", + "title": "query_name" + }, + "collection_name": { + "type": "string", + "title": "collection_name" + } + }, + "required": [ + "collection_name", + "query_name" + ], + "title": "query" + } + }, + "required": [ + "query" + ] + }, + "InheritedRole": { + "title": "InheritedRole", + "type": "object", + "properties": { + "role_name": { + "type": "string", + "title": "role_name" + }, + "role_set": { + "type": "array", + "items": { + "type": "string" + }, + "title": "role_set" + } + }, + "required": [ + "role_name", + "role_set" + ] + }, + "HasuraMetadataV3": { + "title": "HasuraMetadataV3", + "type": "object", + "properties": { + "version": { + "type": "number", + "enum": [ + 3 + ], + "title": "version" + }, + "sources": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/definitions/PGSource" + }, + { + "$ref": "#/definitions/MsSQLSource" + }, + { + "$ref": "#/definitions/BigQuerySource" + } + ] + }, + "title": "sources" + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/definitions/Action" + }, + "title": "actions" + }, + "custom_types": { + "$ref": "#/definitions/CustomTypes", + "title": "custom_types" + }, + "remote_schemas": { + "type": "array", + "items": { + "$ref": "#/definitions/RemoteSchema" + }, + "title": "remote_schemas" + }, + "query_collections": { + "type": "array", + "items": { + "$ref": "#/definitions/QueryCollectionEntry" + }, + "title": "query_collections" + }, + "allowlist": { + "type": "array", + "items": { + "$ref": "#/definitions/AllowList" + }, + "title": "allowlist" + }, + "cron_triggers": { + "type": "array", + "items": { + "$ref": "#/definitions/CronTrigger" + }, + "title": "cron_triggers" + }, + "api_limits": { + "$ref": "#/definitions/APILimits", + "title": "api_limits" + }, + "rest_endpoints": { + "type": "array", + "items": { + "$ref": "#/definitions/RestEndpoint" + }, + "title": "rest_endpoints" + }, + "inherited_roles": { + "type": "array", + "items": { + "$ref": "#/definitions/InheritedRole" + }, + "title": "inherited_roles" + } + }, + "required": [ + "rest_endpoints", + "sources", + "version" + ] + }, + "Record": { + "title": "Record", + "type": "object" + } + } +} diff --git a/contrib/metadata-types/generated/HasuraMetadataV3.py b/contrib/metadata-types/generated/HasuraMetadataV3.py new file mode 100644 index 00000000000..92270117805 --- /dev/null +++ b/contrib/metadata-types/generated/HasuraMetadataV3.py @@ -0,0 +1,3553 @@ +# To use this code, make sure you +# +# import json +# +# and then, to convert JSON from a string, do +# +# result = pg_column_from_dict(json.loads(json_string)) +# result = computed_field_name_from_dict(json.loads(json_string)) +# result = role_name_from_dict(json.loads(json_string)) +# result = trigger_name_from_dict(json.loads(json_string)) +# result = remote_relationship_name_from_dict(json.loads(json_string)) +# result = remote_schema_name_from_dict(json.loads(json_string)) +# result = collection_name_from_dict(json.loads(json_string)) +# result = graph_ql_name_from_dict(json.loads(json_string)) +# result = graph_ql_type_from_dict(json.loads(json_string)) +# result = relationship_name_from_dict(json.loads(json_string)) +# result = action_name_from_dict(json.loads(json_string)) +# result = webhook_url_from_dict(json.loads(json_string)) +# result = table_name_from_dict(json.loads(json_string)) +# result = qualified_table_from_dict(json.loads(json_string)) +# result = table_config_from_dict(json.loads(json_string)) +# result = table_entry_from_dict(json.loads(json_string)) +# result = custom_root_fields_from_dict(json.loads(json_string)) +# result = custom_column_names_from_dict(json.loads(json_string)) +# result = function_name_from_dict(json.loads(json_string)) +# result = qualified_function_from_dict(json.loads(json_string)) +# result = custom_function_from_dict(json.loads(json_string)) +# result = function_configuration_from_dict(json.loads(json_string)) +# result = object_relationship_from_dict(json.loads(json_string)) +# result = obj_rel_using_from_dict(json.loads(json_string)) +# result = obj_rel_using_manual_mapping_from_dict(json.loads(json_string)) +# result = array_relationship_from_dict(json.loads(json_string)) +# result = arr_rel_using_from_dict(json.loads(json_string)) +# result = arr_rel_using_f_key_on_from_dict(json.loads(json_string)) +# result = arr_rel_using_manual_mapping_from_dict(json.loads(json_string)) +# result = column_presets_expression_from_dict(json.loads(json_string)) +# result = insert_permission_entry_from_dict(json.loads(json_string)) +# result = insert_permission_from_dict(json.loads(json_string)) +# result = select_permission_entry_from_dict(json.loads(json_string)) +# result = select_permission_from_dict(json.loads(json_string)) +# result = update_permission_entry_from_dict(json.loads(json_string)) +# result = update_permission_from_dict(json.loads(json_string)) +# result = delete_permission_entry_from_dict(json.loads(json_string)) +# result = delete_permission_from_dict(json.loads(json_string)) +# result = computed_field_from_dict(json.loads(json_string)) +# result = computed_field_definition_from_dict(json.loads(json_string)) +# result = event_trigger_from_dict(json.loads(json_string)) +# result = event_trigger_definition_from_dict(json.loads(json_string)) +# result = event_trigger_columns_from_dict(json.loads(json_string)) +# result = operation_spec_from_dict(json.loads(json_string)) +# result = header_from_value_from_dict(json.loads(json_string)) +# result = header_from_env_from_dict(json.loads(json_string)) +# result = retry_conf_from_dict(json.loads(json_string)) +# result = cron_trigger_from_dict(json.loads(json_string)) +# result = retry_conf_st_from_dict(json.loads(json_string)) +# result = remote_schema_from_dict(json.loads(json_string)) +# result = remote_schema_def_from_dict(json.loads(json_string)) +# result = remote_relationship_from_dict(json.loads(json_string)) +# result = remote_relationship_def_from_dict(json.loads(json_string)) +# result = remote_field_from_dict(json.loads(json_string)) +# result = input_arguments_from_dict(json.loads(json_string)) +# result = query_collection_entry_from_dict(json.loads(json_string)) +# result = query_collection_from_dict(json.loads(json_string)) +# result = allow_list_from_dict(json.loads(json_string)) +# result = custom_types_from_dict(json.loads(json_string)) +# result = input_object_type_from_dict(json.loads(json_string)) +# result = input_object_field_from_dict(json.loads(json_string)) +# result = object_type_from_dict(json.loads(json_string)) +# result = object_field_from_dict(json.loads(json_string)) +# result = custom_type_object_relationship_from_dict(json.loads(json_string)) +# result = scalar_type_from_dict(json.loads(json_string)) +# result = enum_type_from_dict(json.loads(json_string)) +# result = enum_value_from_dict(json.loads(json_string)) +# result = action_from_dict(json.loads(json_string)) +# result = action_definition_from_dict(json.loads(json_string)) +# result = input_argument_from_dict(json.loads(json_string)) +# result = hasura_metadata_v2_from_dict(json.loads(json_string)) +# result = from_env_from_dict(json.loads(json_string)) +# result = pg_configuration_from_dict(json.loads(json_string)) +# result = mssql_configuration_from_dict(json.loads(json_string)) +# result = big_query_configuration_from_dict(json.loads(json_string)) +# result = pg_source_connection_info_from_dict(json.loads(json_string)) +# result = mssql_source_connection_info_from_dict(json.loads(json_string)) +# result = pg_connection_parameters_from_dict(json.loads(json_string)) +# result = pg_pool_settings_from_dict(json.loads(json_string)) +# result = pgcert_settings_from_dict(json.loads(json_string)) +# result = mssql_pool_settings_from_dict(json.loads(json_string)) +# result = backend_kind_from_dict(json.loads(json_string)) +# result = base_source_from_dict(json.loads(json_string)) +# result = pg_source_from_dict(json.loads(json_string)) +# result = mssql_source_from_dict(json.loads(json_string)) +# result = big_query_source_from_dict(json.loads(json_string)) +# result = source_from_dict(json.loads(json_string)) +# result = api_limits_from_dict(json.loads(json_string)) +# result = depth_limit_from_dict(json.loads(json_string)) +# result = rate_limit_from_dict(json.loads(json_string)) +# result = rate_limit_rule_from_dict(json.loads(json_string)) +# result = node_limit_from_dict(json.loads(json_string)) +# result = rest_endpoint_from_dict(json.loads(json_string)) +# result = rest_endpoint_definition_from_dict(json.loads(json_string)) +# result = inherited_role_from_dict(json.loads(json_string)) +# result = hasura_metadata_v3_from_dict(json.loads(json_string)) +# result = record_string_any_from_dict(json.loads(json_string)) + +from dataclasses import dataclass +from typing import Any, Optional, List, Dict, Union, TypeVar, Callable, Type, cast +from enum import Enum + + +T = TypeVar("T") +EnumT = TypeVar("EnumT", bound=Enum) + + +def from_str(x: Any) -> str: + assert isinstance(x, str) + return x + + +def from_none(x: Any) -> Any: + assert x is None + return x + + +def from_union(fs, x): + for f in fs: + try: + return f(x) + except: + pass + assert False + + +def from_list(f: Callable[[Any], T], x: Any) -> List[T]: + assert isinstance(x, list) + return [f(y) for y in x] + + +def from_bool(x: Any) -> bool: + assert isinstance(x, bool) + return x + + +def to_class(c: Type[T], x: Any) -> dict: + assert isinstance(x, c) + return cast(Any, x).to_dict() + + +def to_enum(c: Type[EnumT], x: Any) -> EnumT: + assert isinstance(x, c) + return x.value + + +def from_int(x: Any) -> int: + assert isinstance(x, int) and not isinstance(x, bool) + return x + + +def from_dict(f: Callable[[Any], T], x: Any) -> Dict[str, T]: + assert isinstance(x, dict) + return { k: f(v) for (k, v) in x.items() } + + +def from_float(x: Any) -> float: + assert isinstance(x, (float, int)) and not isinstance(x, bool) + return float(x) + + +def to_float(x: Any) -> float: + assert isinstance(x, float) + return x + + +@dataclass +class HeaderFromValue: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromvalue + """ + """Name of the header""" + name: str + """Value of the header""" + value: str + + @staticmethod + def from_dict(obj: Any) -> 'HeaderFromValue': + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + value = from_str(obj.get("value")) + return HeaderFromValue(name, value) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + result["value"] = from_str(self.value) + return result + + +@dataclass +class HeaderFromEnv: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromenv + """ + """Name of the header""" + name: str + """Name of the environment variable which holds the value of the header""" + value_from_env: str + + @staticmethod + def from_dict(obj: Any) -> 'HeaderFromEnv': + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + value_from_env = from_str(obj.get("value_from_env")) + return HeaderFromEnv(name, value_from_env) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + result["value_from_env"] = from_str(self.value_from_env) + return result + + +@dataclass +class ObjectField: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objectfield + """ + """Name of the Input object type""" + name: str + """GraphQL type of the Input object type""" + type: str + """Description of the Input object type""" + description: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'ObjectField': + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + type = from_str(obj.get("type")) + description = from_union([from_str, from_none], obj.get("description")) + return ObjectField(name, type, description) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + result["type"] = from_str(self.type) + result["description"] = from_union([from_str, from_none], self.description) + return result + + +@dataclass +class InputArgument: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#inputargument + """ + name: str + type: str + + @staticmethod + def from_dict(obj: Any) -> 'InputArgument': + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + type = from_str(obj.get("type")) + return InputArgument(name, type) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + result["type"] = from_str(self.type) + return result + + +@dataclass +class Header: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromvalue + + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromenv + """ + """Name of the header""" + name: str + """Value of the header""" + value: Optional[str] = None + """Name of the environment variable which holds the value of the header""" + value_from_env: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'Header': + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + value = from_union([from_str, from_none], obj.get("value")) + value_from_env = from_union([from_str, from_none], obj.get("value_from_env")) + return Header(name, value, value_from_env) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + result["value"] = from_union([from_str, from_none], self.value) + result["value_from_env"] = from_union([from_str, from_none], self.value_from_env) + return result + + +class ActionDefinitionType(Enum): + MUTATION = "mutation" + QUERY = "query" + + +@dataclass +class ActionDefinition: + """Definition of the action + + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#actiondefinition + """ + """A String value which supports templating environment variables enclosed in {{ and }}. + Template example: https://{{ACTION_API_DOMAIN}}/create-user + """ + handler: str + arguments: Optional[List[InputArgument]] = None + forward_client_headers: Optional[bool] = None + headers: Optional[List[Header]] = None + kind: Optional[str] = None + output_type: Optional[str] = None + type: Optional[ActionDefinitionType] = None + + @staticmethod + def from_dict(obj: Any) -> 'ActionDefinition': + assert isinstance(obj, dict) + handler = from_str(obj.get("handler")) + arguments = from_union([lambda x: from_list(InputArgument.from_dict, x), from_none], obj.get("arguments")) + forward_client_headers = from_union([from_bool, from_none], obj.get("forward_client_headers")) + headers = from_union([lambda x: from_list(Header.from_dict, x), from_none], obj.get("headers")) + kind = from_union([from_str, from_none], obj.get("kind")) + output_type = from_union([from_str, from_none], obj.get("output_type")) + type = from_union([ActionDefinitionType, from_none], obj.get("type")) + return ActionDefinition(handler, arguments, forward_client_headers, headers, kind, output_type, type) + + def to_dict(self) -> dict: + result: dict = {} + result["handler"] = from_str(self.handler) + result["arguments"] = from_union([lambda x: from_list(lambda x: to_class(InputArgument, x), x), from_none], self.arguments) + result["forward_client_headers"] = from_union([from_bool, from_none], self.forward_client_headers) + result["headers"] = from_union([lambda x: from_list(lambda x: to_class(Header, x), x), from_none], self.headers) + result["kind"] = from_union([from_str, from_none], self.kind) + result["output_type"] = from_union([from_str, from_none], self.output_type) + result["type"] = from_union([lambda x: to_enum(ActionDefinitionType, x), from_none], self.type) + return result + + +@dataclass +class Permission: + role: str + + @staticmethod + def from_dict(obj: Any) -> 'Permission': + assert isinstance(obj, dict) + role = from_str(obj.get("role")) + return Permission(role) + + def to_dict(self) -> dict: + result: dict = {} + result["role"] = from_str(self.role) + return result + + +@dataclass +class Action: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#args-syntax + """ + """Definition of the action""" + definition: ActionDefinition + """Name of the action""" + name: str + """Comment""" + comment: Optional[str] = None + """Permissions of the action""" + permissions: Optional[List[Permission]] = None + + @staticmethod + def from_dict(obj: Any) -> 'Action': + assert isinstance(obj, dict) + definition = ActionDefinition.from_dict(obj.get("definition")) + name = from_str(obj.get("name")) + comment = from_union([from_str, from_none], obj.get("comment")) + permissions = from_union([lambda x: from_list(Permission.from_dict, x), from_none], obj.get("permissions")) + return Action(definition, name, comment, permissions) + + def to_dict(self) -> dict: + result: dict = {} + result["definition"] = to_class(ActionDefinition, self.definition) + result["name"] = from_str(self.name) + result["comment"] = from_union([from_str, from_none], self.comment) + result["permissions"] = from_union([lambda x: from_list(lambda x: to_class(Permission, x), x), from_none], self.permissions) + return result + + +@dataclass +class AllowList: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/query-collections.html#add-collection-to-allowlist-syntax + """ + """Name of a query collection to be added to the allow-list""" + collection: str + + @staticmethod + def from_dict(obj: Any) -> 'AllowList': + assert isinstance(obj, dict) + collection = from_str(obj.get("collection")) + return AllowList(collection) + + def to_dict(self) -> dict: + result: dict = {} + result["collection"] = from_str(self.collection) + return result + + +@dataclass +class RetryConfST: + """Retry configuration if scheduled invocation delivery fails + + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/scheduled-triggers.html#retryconfst + """ + """Number of times to retry delivery. + Default: 0 + """ + num_retries: Optional[int] = None + """Number of seconds to wait between each retry. + Default: 10 + """ + retry_interval_seconds: Optional[int] = None + """Number of seconds to wait for response before timing out. + Default: 60 + """ + timeout_seconds: Optional[int] = None + """Number of seconds between scheduled time and actual delivery time that is acceptable. If + the time difference is more than this, then the event is dropped. + Default: 21600 (6 hours) + """ + tolerance_seconds: Optional[int] = None + + @staticmethod + def from_dict(obj: Any) -> 'RetryConfST': + assert isinstance(obj, dict) + num_retries = from_union([from_int, from_none], obj.get("num_retries")) + retry_interval_seconds = from_union([from_int, from_none], obj.get("retry_interval_seconds")) + timeout_seconds = from_union([from_int, from_none], obj.get("timeout_seconds")) + tolerance_seconds = from_union([from_int, from_none], obj.get("tolerance_seconds")) + return RetryConfST(num_retries, retry_interval_seconds, timeout_seconds, tolerance_seconds) + + def to_dict(self) -> dict: + result: dict = {} + result["num_retries"] = from_union([from_int, from_none], self.num_retries) + result["retry_interval_seconds"] = from_union([from_int, from_none], self.retry_interval_seconds) + result["timeout_seconds"] = from_union([from_int, from_none], self.timeout_seconds) + result["tolerance_seconds"] = from_union([from_int, from_none], self.tolerance_seconds) + return result + + +@dataclass +class CronTrigger: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/scheduled-triggers.html#create-cron-trigger + """ + """List of headers to be sent with the webhook""" + headers: List[Header] + """Flag to indicate whether a trigger should be included in the metadata. When a cron + trigger is included in the metadata, the user will be able to export it when the metadata + of the graphql-engine is exported. + """ + include_in_metadata: bool + """Name of the cron trigger""" + name: str + """Cron expression at which the trigger should be invoked.""" + schedule: str + """URL of the webhook""" + webhook: str + """Custom comment.""" + comment: Optional[str] = None + """Any JSON payload which will be sent when the webhook is invoked.""" + payload: Optional[Dict[str, Any]] = None + """Retry configuration if scheduled invocation delivery fails""" + retry_conf: Optional[RetryConfST] = None + + @staticmethod + def from_dict(obj: Any) -> 'CronTrigger': + assert isinstance(obj, dict) + headers = from_list(Header.from_dict, obj.get("headers")) + include_in_metadata = from_bool(obj.get("include_in_metadata")) + name = from_str(obj.get("name")) + schedule = from_str(obj.get("schedule")) + webhook = from_str(obj.get("webhook")) + comment = from_union([from_str, from_none], obj.get("comment")) + payload = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("payload")) + retry_conf = from_union([RetryConfST.from_dict, from_none], obj.get("retry_conf")) + return CronTrigger(headers, include_in_metadata, name, schedule, webhook, comment, payload, retry_conf) + + def to_dict(self) -> dict: + result: dict = {} + result["headers"] = from_list(lambda x: to_class(Header, x), self.headers) + result["include_in_metadata"] = from_bool(self.include_in_metadata) + result["name"] = from_str(self.name) + result["schedule"] = from_str(self.schedule) + result["webhook"] = from_str(self.webhook) + result["comment"] = from_union([from_str, from_none], self.comment) + result["payload"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.payload) + result["retry_conf"] = from_union([lambda x: to_class(RetryConfST, x), from_none], self.retry_conf) + return result + + +@dataclass +class EnumValue: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#enumvalue + """ + """Value of the Enum type""" + value: str + """Description of the Enum value""" + description: Optional[str] = None + """If set to true, the enum value is marked as deprecated""" + is_deprecated: Optional[bool] = None + + @staticmethod + def from_dict(obj: Any) -> 'EnumValue': + assert isinstance(obj, dict) + value = from_str(obj.get("value")) + description = from_union([from_str, from_none], obj.get("description")) + is_deprecated = from_union([from_bool, from_none], obj.get("is_deprecated")) + return EnumValue(value, description, is_deprecated) + + def to_dict(self) -> dict: + result: dict = {} + result["value"] = from_str(self.value) + result["description"] = from_union([from_str, from_none], self.description) + result["is_deprecated"] = from_union([from_bool, from_none], self.is_deprecated) + return result + + +@dataclass +class EnumType: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#enumtype + """ + """Name of the Enum type""" + name: str + """Values of the Enum type""" + values: List[EnumValue] + """Description of the Enum type""" + description: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'EnumType': + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + values = from_list(EnumValue.from_dict, obj.get("values")) + description = from_union([from_str, from_none], obj.get("description")) + return EnumType(name, values, description) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + result["values"] = from_list(lambda x: to_class(EnumValue, x), self.values) + result["description"] = from_union([from_str, from_none], self.description) + return result + + +@dataclass +class InputObjectField: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#inputobjectfield + """ + """Name of the Input object type""" + name: str + """GraphQL type of the Input object type""" + type: str + """Description of the Input object type""" + description: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'InputObjectField': + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + type = from_str(obj.get("type")) + description = from_union([from_str, from_none], obj.get("description")) + return InputObjectField(name, type, description) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + result["type"] = from_str(self.type) + result["description"] = from_union([from_str, from_none], self.description) + return result + + +@dataclass +class InputObjectType: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#inputobjecttype + """ + """Fields of the Input object type""" + fields: List[InputObjectField] + """Name of the Input object type""" + name: str + """Description of the Input object type""" + description: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'InputObjectType': + assert isinstance(obj, dict) + fields = from_list(InputObjectField.from_dict, obj.get("fields")) + name = from_str(obj.get("name")) + description = from_union([from_str, from_none], obj.get("description")) + return InputObjectType(fields, name, description) + + def to_dict(self) -> dict: + result: dict = {} + result["fields"] = from_list(lambda x: to_class(InputObjectField, x), self.fields) + result["name"] = from_str(self.name) + result["description"] = from_union([from_str, from_none], self.description) + return result + + +@dataclass +class QualifiedTable: + name: str + schema: str + + @staticmethod + def from_dict(obj: Any) -> 'QualifiedTable': + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + schema = from_str(obj.get("schema")) + return QualifiedTable(name, schema) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + result["schema"] = from_str(self.schema) + return result + + +class CustomTypeObjectRelationshipType(Enum): + """Type of the relationship""" + ARRAY = "array" + OBJECT = "object" + + +@dataclass +class CustomTypeObjectRelationship: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objectrelationship + """ + """Mapping of fields of object type to columns of remote table""" + field_mapping: Dict[str, str] + """Name of the relationship, shouldn’t conflict with existing field names""" + name: str + """The table to which relationship is defined""" + remote_table: Union[QualifiedTable, str] + """Type of the relationship""" + type: CustomTypeObjectRelationshipType + + @staticmethod + def from_dict(obj: Any) -> 'CustomTypeObjectRelationship': + assert isinstance(obj, dict) + field_mapping = from_dict(from_str, obj.get("field_mapping")) + name = from_str(obj.get("name")) + remote_table = from_union([QualifiedTable.from_dict, from_str], obj.get("remote_table")) + type = CustomTypeObjectRelationshipType(obj.get("type")) + return CustomTypeObjectRelationship(field_mapping, name, remote_table, type) + + def to_dict(self) -> dict: + result: dict = {} + result["field_mapping"] = from_dict(from_str, self.field_mapping) + result["name"] = from_str(self.name) + result["remote_table"] = from_union([lambda x: to_class(QualifiedTable, x), from_str], self.remote_table) + result["type"] = to_enum(CustomTypeObjectRelationshipType, self.type) + return result + + +@dataclass +class ObjectType: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objecttype + """ + """Fields of the Input object type""" + fields: List[InputObjectField] + """Name of the Input object type""" + name: str + """Description of the Input object type""" + description: Optional[str] = None + """Relationships of the Object type to tables""" + relationships: Optional[List[CustomTypeObjectRelationship]] = None + + @staticmethod + def from_dict(obj: Any) -> 'ObjectType': + assert isinstance(obj, dict) + fields = from_list(InputObjectField.from_dict, obj.get("fields")) + name = from_str(obj.get("name")) + description = from_union([from_str, from_none], obj.get("description")) + relationships = from_union([lambda x: from_list(CustomTypeObjectRelationship.from_dict, x), from_none], obj.get("relationships")) + return ObjectType(fields, name, description, relationships) + + def to_dict(self) -> dict: + result: dict = {} + result["fields"] = from_list(lambda x: to_class(InputObjectField, x), self.fields) + result["name"] = from_str(self.name) + result["description"] = from_union([from_str, from_none], self.description) + result["relationships"] = from_union([lambda x: from_list(lambda x: to_class(CustomTypeObjectRelationship, x), x), from_none], self.relationships) + return result + + +@dataclass +class ScalarType: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#scalartype + """ + """Name of the Scalar type""" + name: str + """Description of the Scalar type""" + description: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'ScalarType': + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + description = from_union([from_str, from_none], obj.get("description")) + return ScalarType(name, description) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + result["description"] = from_union([from_str, from_none], self.description) + return result + + +@dataclass +class CustomTypes: + enums: Optional[List[EnumType]] = None + input_objects: Optional[List[InputObjectType]] = None + objects: Optional[List[ObjectType]] = None + scalars: Optional[List[ScalarType]] = None + + @staticmethod + def from_dict(obj: Any) -> 'CustomTypes': + assert isinstance(obj, dict) + enums = from_union([lambda x: from_list(EnumType.from_dict, x), from_none], obj.get("enums")) + input_objects = from_union([lambda x: from_list(InputObjectType.from_dict, x), from_none], obj.get("input_objects")) + objects = from_union([lambda x: from_list(ObjectType.from_dict, x), from_none], obj.get("objects")) + scalars = from_union([lambda x: from_list(ScalarType.from_dict, x), from_none], obj.get("scalars")) + return CustomTypes(enums, input_objects, objects, scalars) + + def to_dict(self) -> dict: + result: dict = {} + result["enums"] = from_union([lambda x: from_list(lambda x: to_class(EnumType, x), x), from_none], self.enums) + result["input_objects"] = from_union([lambda x: from_list(lambda x: to_class(InputObjectType, x), x), from_none], self.input_objects) + result["objects"] = from_union([lambda x: from_list(lambda x: to_class(ObjectType, x), x), from_none], self.objects) + result["scalars"] = from_union([lambda x: from_list(lambda x: to_class(ScalarType, x), x), from_none], self.scalars) + return result + + +@dataclass +class FunctionConfiguration: + """Configuration for the SQL function + + Configuration for a CustomFunction + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-functions.html#function-configuration + """ + """Function argument which accepts session info JSON + Currently, only functions which satisfy the following constraints can be exposed over the + GraphQL API (terminology from Postgres docs): + - Function behaviour: ONLY `STABLE` or `IMMUTABLE` + - Return type: MUST be `SETOF ` + - Argument modes: ONLY `IN` + """ + session_argument: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'FunctionConfiguration': + assert isinstance(obj, dict) + session_argument = from_union([from_str, from_none], obj.get("session_argument")) + return FunctionConfiguration(session_argument) + + def to_dict(self) -> dict: + result: dict = {} + result["session_argument"] = from_union([from_str, from_none], self.session_argument) + return result + + +@dataclass +class QualifiedFunction: + name: str + schema: str + + @staticmethod + def from_dict(obj: Any) -> 'QualifiedFunction': + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + schema = from_str(obj.get("schema")) + return QualifiedFunction(name, schema) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + result["schema"] = from_str(self.schema) + return result + + +@dataclass +class CustomFunction: + """A custom SQL function to add to the GraphQL schema with configuration. + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-functions.html#args-syntax + """ + """Name of the SQL function""" + function: Union[QualifiedFunction, str] + """Configuration for the SQL function""" + configuration: Optional[FunctionConfiguration] = None + + @staticmethod + def from_dict(obj: Any) -> 'CustomFunction': + assert isinstance(obj, dict) + function = from_union([QualifiedFunction.from_dict, from_str], obj.get("function")) + configuration = from_union([FunctionConfiguration.from_dict, from_none], obj.get("configuration")) + return CustomFunction(function, configuration) + + def to_dict(self) -> dict: + result: dict = {} + result["function"] = from_union([lambda x: to_class(QualifiedFunction, x), from_str], self.function) + result["configuration"] = from_union([lambda x: to_class(FunctionConfiguration, x), from_none], self.configuration) + return result + + +@dataclass +class QueryCollection: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#collectionquery + """ + name: str + query: str + + @staticmethod + def from_dict(obj: Any) -> 'QueryCollection': + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + query = from_str(obj.get("query")) + return QueryCollection(name, query) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + result["query"] = from_str(self.query) + return result + + +@dataclass +class Definition: + """List of queries""" + queries: List[QueryCollection] + + @staticmethod + def from_dict(obj: Any) -> 'Definition': + assert isinstance(obj, dict) + queries = from_list(QueryCollection.from_dict, obj.get("queries")) + return Definition(queries) + + def to_dict(self) -> dict: + result: dict = {} + result["queries"] = from_list(lambda x: to_class(QueryCollection, x), self.queries) + return result + + +@dataclass +class QueryCollectionEntry: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/query-collections.html#args-syntax + """ + """List of queries""" + definition: Definition + """Name of the query collection""" + name: str + """Comment""" + comment: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'QueryCollectionEntry': + assert isinstance(obj, dict) + definition = Definition.from_dict(obj.get("definition")) + name = from_str(obj.get("name")) + comment = from_union([from_str, from_none], obj.get("comment")) + return QueryCollectionEntry(definition, name, comment) + + def to_dict(self) -> dict: + result: dict = {} + result["definition"] = to_class(Definition, self.definition) + result["name"] = from_str(self.name) + result["comment"] = from_union([from_str, from_none], self.comment) + return result + + +@dataclass +class RemoteSchemaDef: + """Name of the remote schema + + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#remoteschemadef + """ + forward_client_headers: Optional[bool] = None + headers: Optional[List[Header]] = None + timeout_seconds: Optional[float] = None + url: Optional[str] = None + url_from_env: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'RemoteSchemaDef': + assert isinstance(obj, dict) + forward_client_headers = from_union([from_bool, from_none], obj.get("forward_client_headers")) + headers = from_union([lambda x: from_list(Header.from_dict, x), from_none], obj.get("headers")) + timeout_seconds = from_union([from_float, from_none], obj.get("timeout_seconds")) + url = from_union([from_str, from_none], obj.get("url")) + url_from_env = from_union([from_str, from_none], obj.get("url_from_env")) + return RemoteSchemaDef(forward_client_headers, headers, timeout_seconds, url, url_from_env) + + def to_dict(self) -> dict: + result: dict = {} + result["forward_client_headers"] = from_union([from_bool, from_none], self.forward_client_headers) + result["headers"] = from_union([lambda x: from_list(lambda x: to_class(Header, x), x), from_none], self.headers) + result["timeout_seconds"] = from_union([to_float, from_none], self.timeout_seconds) + result["url"] = from_union([from_str, from_none], self.url) + result["url_from_env"] = from_union([from_str, from_none], self.url_from_env) + return result + + +@dataclass +class RemoteSchema: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-schemas.html#add-remote-schema + """ + """Name of the remote schema""" + definition: RemoteSchemaDef + """Name of the remote schema""" + name: str + """Comment""" + comment: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'RemoteSchema': + assert isinstance(obj, dict) + definition = RemoteSchemaDef.from_dict(obj.get("definition")) + name = from_str(obj.get("name")) + comment = from_union([from_str, from_none], obj.get("comment")) + return RemoteSchema(definition, name, comment) + + def to_dict(self) -> dict: + result: dict = {} + result["definition"] = to_class(RemoteSchemaDef, self.definition) + result["name"] = from_str(self.name) + result["comment"] = from_union([from_str, from_none], self.comment) + return result + + +@dataclass +class ArrRelUsingFKeyOn: + """The column with foreign key constraint + + The column with foreign key constraint + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusingfkeyon + """ + column: str + table: Union[QualifiedTable, str] + + @staticmethod + def from_dict(obj: Any) -> 'ArrRelUsingFKeyOn': + assert isinstance(obj, dict) + column = from_str(obj.get("column")) + table = from_union([QualifiedTable.from_dict, from_str], obj.get("table")) + return ArrRelUsingFKeyOn(column, table) + + def to_dict(self) -> dict: + result: dict = {} + result["column"] = from_str(self.column) + result["table"] = from_union([lambda x: to_class(QualifiedTable, x), from_str], self.table) + return result + + +@dataclass +class ArrRelUsingManualMapping: + """Manual mapping of table and columns + + Manual mapping of table and columns + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusingmanualmapping + """ + """Mapping of columns from current table to remote table""" + column_mapping: Dict[str, str] + """The table to which the relationship has to be established""" + remote_table: Union[QualifiedTable, str] + + @staticmethod + def from_dict(obj: Any) -> 'ArrRelUsingManualMapping': + assert isinstance(obj, dict) + column_mapping = from_dict(from_str, obj.get("column_mapping")) + remote_table = from_union([QualifiedTable.from_dict, from_str], obj.get("remote_table")) + return ArrRelUsingManualMapping(column_mapping, remote_table) + + def to_dict(self) -> dict: + result: dict = {} + result["column_mapping"] = from_dict(from_str, self.column_mapping) + result["remote_table"] = from_union([lambda x: to_class(QualifiedTable, x), from_str], self.remote_table) + return result + + +@dataclass +class ArrRelUsing: + """Use one of the available ways to define an array relationship + + Use one of the available ways to define an object relationship + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusing + """ + """The column with foreign key constraint""" + foreign_key_constraint_on: Optional[ArrRelUsingFKeyOn] = None + """Manual mapping of table and columns""" + manual_configuration: Optional[ArrRelUsingManualMapping] = None + + @staticmethod + def from_dict(obj: Any) -> 'ArrRelUsing': + assert isinstance(obj, dict) + foreign_key_constraint_on = from_union([ArrRelUsingFKeyOn.from_dict, from_none], obj.get("foreign_key_constraint_on")) + manual_configuration = from_union([ArrRelUsingManualMapping.from_dict, from_none], obj.get("manual_configuration")) + return ArrRelUsing(foreign_key_constraint_on, manual_configuration) + + def to_dict(self) -> dict: + result: dict = {} + result["foreign_key_constraint_on"] = from_union([lambda x: to_class(ArrRelUsingFKeyOn, x), from_none], self.foreign_key_constraint_on) + result["manual_configuration"] = from_union([lambda x: to_class(ArrRelUsingManualMapping, x), from_none], self.manual_configuration) + return result + + +@dataclass +class ArrayRelationship: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#create-array-relationship-syntax + """ + """Name of the new relationship""" + name: str + """Use one of the available ways to define an array relationship""" + using: ArrRelUsing + """Comment""" + comment: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'ArrayRelationship': + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + using = ArrRelUsing.from_dict(obj.get("using")) + comment = from_union([from_str, from_none], obj.get("comment")) + return ArrayRelationship(name, using, comment) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + result["using"] = to_class(ArrRelUsing, self.using) + result["comment"] = from_union([from_str, from_none], self.comment) + return result + + +@dataclass +class ComputedFieldDefinition: + """The computed field definition + + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/computed-field.html#computedfielddefinition + """ + """The SQL function""" + function: Union[QualifiedFunction, str] + """Name of the argument which accepts the Hasura session object as a JSON/JSONB value. If + omitted, the Hasura session object is not passed to the function + """ + session_argument: Optional[str] = None + """Name of the argument which accepts a table row type. If omitted, the first argument is + considered a table argument + """ + table_argument: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'ComputedFieldDefinition': + assert isinstance(obj, dict) + function = from_union([QualifiedFunction.from_dict, from_str], obj.get("function")) + session_argument = from_union([from_str, from_none], obj.get("session_argument")) + table_argument = from_union([from_str, from_none], obj.get("table_argument")) + return ComputedFieldDefinition(function, session_argument, table_argument) + + def to_dict(self) -> dict: + result: dict = {} + result["function"] = from_union([lambda x: to_class(QualifiedFunction, x), from_str], self.function) + result["session_argument"] = from_union([from_str, from_none], self.session_argument) + result["table_argument"] = from_union([from_str, from_none], self.table_argument) + return result + + +@dataclass +class ComputedField: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/computed-field.html#args-syntax + """ + """The computed field definition""" + definition: ComputedFieldDefinition + """Name of the new computed field""" + name: str + """Comment""" + comment: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'ComputedField': + assert isinstance(obj, dict) + definition = ComputedFieldDefinition.from_dict(obj.get("definition")) + name = from_str(obj.get("name")) + comment = from_union([from_str, from_none], obj.get("comment")) + return ComputedField(definition, name, comment) + + def to_dict(self) -> dict: + result: dict = {} + result["definition"] = to_class(ComputedFieldDefinition, self.definition) + result["name"] = from_str(self.name) + result["comment"] = from_union([from_str, from_none], self.comment) + return result + + +@dataclass +class CustomRootFields: + """Customise the root fields + + Customise the root fields + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#custom-root-fields + """ + """Customise the `delete_` root field""" + delete: Optional[str] = None + """Customise the `delete__by_pk` root field""" + delete_by_pk: Optional[str] = None + """Customise the `insert_` root field""" + insert: Optional[str] = None + """Customise the `insert__one` root field""" + insert_one: Optional[str] = None + """Customise the `` root field""" + select: Optional[str] = None + """Customise the `_aggregate` root field""" + select_aggregate: Optional[str] = None + """Customise the `_by_pk` root field""" + select_by_pk: Optional[str] = None + """Customise the `update_` root field""" + update: Optional[str] = None + """Customise the `update__by_pk` root field""" + update_by_pk: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'CustomRootFields': + assert isinstance(obj, dict) + delete = from_union([from_str, from_none], obj.get("delete")) + delete_by_pk = from_union([from_str, from_none], obj.get("delete_by_pk")) + insert = from_union([from_str, from_none], obj.get("insert")) + insert_one = from_union([from_str, from_none], obj.get("insert_one")) + select = from_union([from_str, from_none], obj.get("select")) + select_aggregate = from_union([from_str, from_none], obj.get("select_aggregate")) + select_by_pk = from_union([from_str, from_none], obj.get("select_by_pk")) + update = from_union([from_str, from_none], obj.get("update")) + update_by_pk = from_union([from_str, from_none], obj.get("update_by_pk")) + return CustomRootFields(delete, delete_by_pk, insert, insert_one, select, select_aggregate, select_by_pk, update, update_by_pk) + + def to_dict(self) -> dict: + result: dict = {} + result["delete"] = from_union([from_str, from_none], self.delete) + result["delete_by_pk"] = from_union([from_str, from_none], self.delete_by_pk) + result["insert"] = from_union([from_str, from_none], self.insert) + result["insert_one"] = from_union([from_str, from_none], self.insert_one) + result["select"] = from_union([from_str, from_none], self.select) + result["select_aggregate"] = from_union([from_str, from_none], self.select_aggregate) + result["select_by_pk"] = from_union([from_str, from_none], self.select_by_pk) + result["update"] = from_union([from_str, from_none], self.update) + result["update_by_pk"] = from_union([from_str, from_none], self.update_by_pk) + return result + + +@dataclass +class TableConfig: + """Configuration for the table/view + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config + """ + """Customise the column names""" + custom_column_names: Optional[Dict[str, str]] = None + """Customise the table name""" + custom_name: Optional[str] = None + """Customise the root fields""" + custom_root_fields: Optional[CustomRootFields] = None + + @staticmethod + def from_dict(obj: Any) -> 'TableConfig': + assert isinstance(obj, dict) + custom_column_names = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("custom_column_names")) + custom_name = from_union([from_str, from_none], obj.get("custom_name")) + custom_root_fields = from_union([CustomRootFields.from_dict, from_none], obj.get("custom_root_fields")) + return TableConfig(custom_column_names, custom_name, custom_root_fields) + + def to_dict(self) -> dict: + result: dict = {} + result["custom_column_names"] = from_union([lambda x: from_dict(from_str, x), from_none], self.custom_column_names) + result["custom_name"] = from_union([from_str, from_none], self.custom_name) + result["custom_root_fields"] = from_union([lambda x: to_class(CustomRootFields, x), from_none], self.custom_root_fields) + return result + + +@dataclass +class DeletePermission: + """The permission definition + + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#deletepermission + """ + """Only the rows where this precondition holds true are updatable""" + filter: Optional[Dict[str, Union[float, Dict[str, Any], str]]] = None + + @staticmethod + def from_dict(obj: Any) -> 'DeletePermission': + assert isinstance(obj, dict) + filter = from_union([lambda x: from_dict(lambda x: from_union([lambda x: from_dict(lambda x: x, x), from_float, from_str], x), x), from_none], obj.get("filter")) + return DeletePermission(filter) + + def to_dict(self) -> dict: + result: dict = {} + result["filter"] = from_union([lambda x: from_dict(lambda x: from_union([lambda x: from_dict(lambda x: x, x), to_float, from_str], x), x), from_none], self.filter) + return result + + +@dataclass +class DeletePermissionEntry: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-delete-permission-syntax + """ + """The permission definition""" + permission: DeletePermission + """Role""" + role: str + """Comment""" + comment: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'DeletePermissionEntry': + assert isinstance(obj, dict) + permission = DeletePermission.from_dict(obj.get("permission")) + role = from_str(obj.get("role")) + comment = from_union([from_str, from_none], obj.get("comment")) + return DeletePermissionEntry(permission, role, comment) + + def to_dict(self) -> dict: + result: dict = {} + result["permission"] = to_class(DeletePermission, self.permission) + result["role"] = from_str(self.role) + result["comment"] = from_union([from_str, from_none], self.comment) + return result + + +class EventTriggerColumnsEnum(Enum): + EMPTY = "*" + + +@dataclass +class OperationSpec: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec + """ + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#eventtriggercolumns + """ + columns: Union[List[str], EventTriggerColumnsEnum] + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#eventtriggercolumns + """ + payload: Union[List[str], EventTriggerColumnsEnum, None] + + @staticmethod + def from_dict(obj: Any) -> 'OperationSpec': + assert isinstance(obj, dict) + columns = from_union([lambda x: from_list(from_str, x), EventTriggerColumnsEnum], obj.get("columns")) + payload = from_union([lambda x: from_list(from_str, x), EventTriggerColumnsEnum, from_none], obj.get("payload")) + return OperationSpec(columns, payload) + + def to_dict(self) -> dict: + result: dict = {} + result["columns"] = from_union([lambda x: from_list(from_str, x), lambda x: to_enum(EventTriggerColumnsEnum, x)], self.columns) + result["payload"] = from_union([lambda x: from_list(from_str, x), lambda x: to_enum(EventTriggerColumnsEnum, x), from_none], self.payload) + return result + + +@dataclass +class EventTriggerDefinition: + """The SQL function""" + enable_manual: bool + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec + """ + delete: Optional[OperationSpec] = None + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec + """ + insert: Optional[OperationSpec] = None + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec + """ + update: Optional[OperationSpec] = None + + @staticmethod + def from_dict(obj: Any) -> 'EventTriggerDefinition': + assert isinstance(obj, dict) + enable_manual = from_bool(obj.get("enable_manual")) + delete = from_union([OperationSpec.from_dict, from_none], obj.get("delete")) + insert = from_union([OperationSpec.from_dict, from_none], obj.get("insert")) + update = from_union([OperationSpec.from_dict, from_none], obj.get("update")) + return EventTriggerDefinition(enable_manual, delete, insert, update) + + def to_dict(self) -> dict: + result: dict = {} + result["enable_manual"] = from_bool(self.enable_manual) + result["delete"] = from_union([lambda x: to_class(OperationSpec, x), from_none], self.delete) + result["insert"] = from_union([lambda x: to_class(OperationSpec, x), from_none], self.insert) + result["update"] = from_union([lambda x: to_class(OperationSpec, x), from_none], self.update) + return result + + +@dataclass +class RetryConf: + """The SQL function + + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#retryconf + """ + """Number of seconds to wait between each retry. + Default: 10 + """ + interval_sec: Optional[int] = None + """Number of times to retry delivery. + Default: 0 + """ + num_retries: Optional[int] = None + """Number of seconds to wait for response before timing out. + Default: 60 + """ + timeout_sec: Optional[int] = None + + @staticmethod + def from_dict(obj: Any) -> 'RetryConf': + assert isinstance(obj, dict) + interval_sec = from_union([from_int, from_none], obj.get("interval_sec")) + num_retries = from_union([from_int, from_none], obj.get("num_retries")) + timeout_sec = from_union([from_int, from_none], obj.get("timeout_sec")) + return RetryConf(interval_sec, num_retries, timeout_sec) + + def to_dict(self) -> dict: + result: dict = {} + result["interval_sec"] = from_union([from_int, from_none], self.interval_sec) + result["num_retries"] = from_union([from_int, from_none], self.num_retries) + result["timeout_sec"] = from_union([from_int, from_none], self.timeout_sec) + return result + + +@dataclass +class EventTrigger: + """NOTE: The metadata type doesn't QUITE match the 'create' arguments here + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#create-event-trigger + """ + """The SQL function""" + definition: EventTriggerDefinition + """Name of the event trigger""" + name: str + """The SQL function""" + retry_conf: RetryConf + """The SQL function""" + headers: Optional[List[Header]] = None + """The SQL function""" + webhook: Optional[str] = None + webhook_from_env: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'EventTrigger': + assert isinstance(obj, dict) + definition = EventTriggerDefinition.from_dict(obj.get("definition")) + name = from_str(obj.get("name")) + retry_conf = RetryConf.from_dict(obj.get("retry_conf")) + headers = from_union([lambda x: from_list(Header.from_dict, x), from_none], obj.get("headers")) + webhook = from_union([from_str, from_none], obj.get("webhook")) + webhook_from_env = from_union([from_str, from_none], obj.get("webhook_from_env")) + return EventTrigger(definition, name, retry_conf, headers, webhook, webhook_from_env) + + def to_dict(self) -> dict: + result: dict = {} + result["definition"] = to_class(EventTriggerDefinition, self.definition) + result["name"] = from_str(self.name) + result["retry_conf"] = to_class(RetryConf, self.retry_conf) + result["headers"] = from_union([lambda x: from_list(lambda x: to_class(Header, x), x), from_none], self.headers) + result["webhook"] = from_union([from_str, from_none], self.webhook) + result["webhook_from_env"] = from_union([from_str, from_none], self.webhook_from_env) + return result + + +@dataclass +class InsertPermission: + """The permission definition + + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#insertpermission + """ + """Can insert into only these columns (or all when '*' is specified)""" + columns: Union[List[str], EventTriggerColumnsEnum] + """When set to true the mutation is accessible only if x-hasura-use-backend-only-permissions + session variable exists + and is set to true and request is made with x-hasura-admin-secret set if any auth is + configured + """ + backend_only: Optional[bool] = None + """This expression has to hold true for every new row that is inserted""" + check: Optional[Dict[str, Union[float, Dict[str, Any], str]]] = None + """Preset values for columns that can be sourced from session variables or static values""" + set: Optional[Dict[str, str]] = None + + @staticmethod + def from_dict(obj: Any) -> 'InsertPermission': + assert isinstance(obj, dict) + columns = from_union([lambda x: from_list(from_str, x), EventTriggerColumnsEnum], obj.get("columns")) + backend_only = from_union([from_bool, from_none], obj.get("backend_only")) + check = from_union([lambda x: from_dict(lambda x: from_union([lambda x: from_dict(lambda x: x, x), from_float, from_str], x), x), from_none], obj.get("check")) + set = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("set")) + return InsertPermission(columns, backend_only, check, set) + + def to_dict(self) -> dict: + result: dict = {} + result["columns"] = from_union([lambda x: from_list(from_str, x), lambda x: to_enum(EventTriggerColumnsEnum, x)], self.columns) + result["backend_only"] = from_union([from_bool, from_none], self.backend_only) + result["check"] = from_union([lambda x: from_dict(lambda x: from_union([lambda x: from_dict(lambda x: x, x), to_float, from_str], x), x), from_none], self.check) + result["set"] = from_union([lambda x: from_dict(from_str, x), from_none], self.set) + return result + + +@dataclass +class InsertPermissionEntry: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#args-syntax + """ + """The permission definition""" + permission: InsertPermission + """Role""" + role: str + """Comment""" + comment: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'InsertPermissionEntry': + assert isinstance(obj, dict) + permission = InsertPermission.from_dict(obj.get("permission")) + role = from_str(obj.get("role")) + comment = from_union([from_str, from_none], obj.get("comment")) + return InsertPermissionEntry(permission, role, comment) + + def to_dict(self) -> dict: + result: dict = {} + result["permission"] = to_class(InsertPermission, self.permission) + result["role"] = from_str(self.role) + result["comment"] = from_union([from_str, from_none], self.comment) + return result + + +@dataclass +class ObjRelUsingManualMapping: + """Manual mapping of table and columns + + Manual mapping of table and columns + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#objrelusingmanualmapping + """ + """Mapping of columns from current table to remote table""" + column_mapping: Dict[str, str] + """The table to which the relationship has to be established""" + remote_table: Union[QualifiedTable, str] + + @staticmethod + def from_dict(obj: Any) -> 'ObjRelUsingManualMapping': + assert isinstance(obj, dict) + column_mapping = from_dict(from_str, obj.get("column_mapping")) + remote_table = from_union([QualifiedTable.from_dict, from_str], obj.get("remote_table")) + return ObjRelUsingManualMapping(column_mapping, remote_table) + + def to_dict(self) -> dict: + result: dict = {} + result["column_mapping"] = from_dict(from_str, self.column_mapping) + result["remote_table"] = from_union([lambda x: to_class(QualifiedTable, x), from_str], self.remote_table) + return result + + +@dataclass +class ObjRelUsing: + """Use one of the available ways to define an object relationship + + Use one of the available ways to define an object relationship + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#objrelusing + """ + """The column with foreign key constraint""" + foreign_key_constraint_on: Optional[str] = None + """Manual mapping of table and columns""" + manual_configuration: Optional[ObjRelUsingManualMapping] = None + + @staticmethod + def from_dict(obj: Any) -> 'ObjRelUsing': + assert isinstance(obj, dict) + foreign_key_constraint_on = from_union([from_str, from_none], obj.get("foreign_key_constraint_on")) + manual_configuration = from_union([ObjRelUsingManualMapping.from_dict, from_none], obj.get("manual_configuration")) + return ObjRelUsing(foreign_key_constraint_on, manual_configuration) + + def to_dict(self) -> dict: + result: dict = {} + result["foreign_key_constraint_on"] = from_union([from_str, from_none], self.foreign_key_constraint_on) + result["manual_configuration"] = from_union([lambda x: to_class(ObjRelUsingManualMapping, x), from_none], self.manual_configuration) + return result + + +@dataclass +class ObjectRelationship: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#args-syntax + """ + """Name of the new relationship""" + name: str + """Use one of the available ways to define an object relationship""" + using: ObjRelUsing + """Comment""" + comment: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'ObjectRelationship': + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + using = ObjRelUsing.from_dict(obj.get("using")) + comment = from_union([from_str, from_none], obj.get("comment")) + return ObjectRelationship(name, using, comment) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + result["using"] = to_class(ObjRelUsing, self.using) + result["comment"] = from_union([from_str, from_none], self.comment) + return result + + +@dataclass +class RemoteFieldValue: + arguments: Dict[str, str] + """A recursive tree structure that points to the field in the remote schema that needs to be + joined with. + It is recursive because the remote field maybe nested deeply in the remote schema. + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-relationships.html#remotefield + """ + field: Optional[Dict[str, 'RemoteFieldValue']] = None + + @staticmethod + def from_dict(obj: Any) -> 'RemoteFieldValue': + assert isinstance(obj, dict) + arguments = from_dict(from_str, obj.get("arguments")) + field = from_union([lambda x: from_dict(RemoteFieldValue.from_dict, x), from_none], obj.get("field")) + return RemoteFieldValue(arguments, field) + + def to_dict(self) -> dict: + result: dict = {} + result["arguments"] = from_dict(from_str, self.arguments) + result["field"] = from_union([lambda x: from_dict(lambda x: to_class(RemoteFieldValue, x), x), from_none], self.field) + return result + + +@dataclass +class RemoteRelationshipDef: + """Definition object""" + """Column(s) in the table that is used for joining with remote schema field. + All join keys in remote_field must appear here. + """ + hasura_fields: List[str] + """The schema tree ending at the field in remote schema which needs to be joined with.""" + remote_field: Dict[str, RemoteFieldValue] + """Name of the remote schema to join with""" + remote_schema: str + + @staticmethod + def from_dict(obj: Any) -> 'RemoteRelationshipDef': + assert isinstance(obj, dict) + hasura_fields = from_list(from_str, obj.get("hasura_fields")) + remote_field = from_dict(RemoteFieldValue.from_dict, obj.get("remote_field")) + remote_schema = from_str(obj.get("remote_schema")) + return RemoteRelationshipDef(hasura_fields, remote_field, remote_schema) + + def to_dict(self) -> dict: + result: dict = {} + result["hasura_fields"] = from_list(from_str, self.hasura_fields) + result["remote_field"] = from_dict(lambda x: to_class(RemoteFieldValue, x), self.remote_field) + result["remote_schema"] = from_str(self.remote_schema) + return result + + +@dataclass +class RemoteRelationship: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-relationships.html#args-syntax + """ + """Definition object""" + definition: RemoteRelationshipDef + """Name of the remote relationship""" + name: str + + @staticmethod + def from_dict(obj: Any) -> 'RemoteRelationship': + assert isinstance(obj, dict) + definition = RemoteRelationshipDef.from_dict(obj.get("definition")) + name = from_str(obj.get("name")) + return RemoteRelationship(definition, name) + + def to_dict(self) -> dict: + result: dict = {} + result["definition"] = to_class(RemoteRelationshipDef, self.definition) + result["name"] = from_str(self.name) + return result + + +@dataclass +class SelectPermission: + """The permission definition + + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#selectpermission + """ + """Only these columns are selectable (or all when '*' is specified)""" + columns: Union[List[str], EventTriggerColumnsEnum] + """Toggle allowing aggregate queries""" + allow_aggregations: Optional[bool] = None + """Only these computed fields are selectable""" + computed_fields: Optional[List[str]] = None + """Only the rows where this precondition holds true are selectable""" + filter: Optional[Dict[str, Union[float, Dict[str, Any], str]]] = None + """The maximum number of rows that can be returned""" + limit: Optional[int] = None + + @staticmethod + def from_dict(obj: Any) -> 'SelectPermission': + assert isinstance(obj, dict) + columns = from_union([lambda x: from_list(from_str, x), EventTriggerColumnsEnum], obj.get("columns")) + allow_aggregations = from_union([from_bool, from_none], obj.get("allow_aggregations")) + computed_fields = from_union([lambda x: from_list(from_str, x), from_none], obj.get("computed_fields")) + filter = from_union([lambda x: from_dict(lambda x: from_union([lambda x: from_dict(lambda x: x, x), from_float, from_str], x), x), from_none], obj.get("filter")) + limit = from_union([from_int, from_none], obj.get("limit")) + return SelectPermission(columns, allow_aggregations, computed_fields, filter, limit) + + def to_dict(self) -> dict: + result: dict = {} + result["columns"] = from_union([lambda x: from_list(from_str, x), lambda x: to_enum(EventTriggerColumnsEnum, x)], self.columns) + result["allow_aggregations"] = from_union([from_bool, from_none], self.allow_aggregations) + result["computed_fields"] = from_union([lambda x: from_list(from_str, x), from_none], self.computed_fields) + result["filter"] = from_union([lambda x: from_dict(lambda x: from_union([lambda x: from_dict(lambda x: x, x), to_float, from_str], x), x), from_none], self.filter) + result["limit"] = from_union([from_int, from_none], self.limit) + return result + + +@dataclass +class SelectPermissionEntry: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-select-permission-syntax + """ + """The permission definition""" + permission: SelectPermission + """Role""" + role: str + """Comment""" + comment: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'SelectPermissionEntry': + assert isinstance(obj, dict) + permission = SelectPermission.from_dict(obj.get("permission")) + role = from_str(obj.get("role")) + comment = from_union([from_str, from_none], obj.get("comment")) + return SelectPermissionEntry(permission, role, comment) + + def to_dict(self) -> dict: + result: dict = {} + result["permission"] = to_class(SelectPermission, self.permission) + result["role"] = from_str(self.role) + result["comment"] = from_union([from_str, from_none], self.comment) + return result + + +@dataclass +class UpdatePermission: + """The permission definition + + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#updatepermission + """ + """Only these columns are selectable (or all when '*' is specified)""" + columns: Union[List[str], EventTriggerColumnsEnum] + """Postcondition which must be satisfied by rows which have been updated""" + check: Optional[Dict[str, Union[float, Dict[str, Any], str]]] = None + """Only the rows where this precondition holds true are updatable""" + filter: Optional[Dict[str, Union[float, Dict[str, Any], str]]] = None + """Preset values for columns that can be sourced from session variables or static values""" + set: Optional[Dict[str, str]] = None + + @staticmethod + def from_dict(obj: Any) -> 'UpdatePermission': + assert isinstance(obj, dict) + columns = from_union([lambda x: from_list(from_str, x), EventTriggerColumnsEnum], obj.get("columns")) + check = from_union([lambda x: from_dict(lambda x: from_union([lambda x: from_dict(lambda x: x, x), from_float, from_str], x), x), from_none], obj.get("check")) + filter = from_union([lambda x: from_dict(lambda x: from_union([lambda x: from_dict(lambda x: x, x), from_float, from_str], x), x), from_none], obj.get("filter")) + set = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("set")) + return UpdatePermission(columns, check, filter, set) + + def to_dict(self) -> dict: + result: dict = {} + result["columns"] = from_union([lambda x: from_list(from_str, x), lambda x: to_enum(EventTriggerColumnsEnum, x)], self.columns) + result["check"] = from_union([lambda x: from_dict(lambda x: from_union([lambda x: from_dict(lambda x: x, x), to_float, from_str], x), x), from_none], self.check) + result["filter"] = from_union([lambda x: from_dict(lambda x: from_union([lambda x: from_dict(lambda x: x, x), to_float, from_str], x), x), from_none], self.filter) + result["set"] = from_union([lambda x: from_dict(from_str, x), from_none], self.set) + return result + + +@dataclass +class UpdatePermissionEntry: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-update-permission-syntax + """ + """The permission definition""" + permission: UpdatePermission + """Role""" + role: str + """Comment""" + comment: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'UpdatePermissionEntry': + assert isinstance(obj, dict) + permission = UpdatePermission.from_dict(obj.get("permission")) + role = from_str(obj.get("role")) + comment = from_union([from_str, from_none], obj.get("comment")) + return UpdatePermissionEntry(permission, role, comment) + + def to_dict(self) -> dict: + result: dict = {} + result["permission"] = to_class(UpdatePermission, self.permission) + result["role"] = from_str(self.role) + result["comment"] = from_union([from_str, from_none], self.comment) + return result + + +@dataclass +class TableEntry: + """Representation of a table in metadata, 'tables.yaml' and 'metadata.json'""" + table: QualifiedTable + array_relationships: Optional[List[ArrayRelationship]] = None + computed_fields: Optional[List[ComputedField]] = None + """Configuration for the table/view + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config + """ + configuration: Optional[TableConfig] = None + delete_permissions: Optional[List[DeletePermissionEntry]] = None + event_triggers: Optional[List[EventTrigger]] = None + insert_permissions: Optional[List[InsertPermissionEntry]] = None + is_enum: Optional[bool] = None + object_relationships: Optional[List[ObjectRelationship]] = None + remote_relationships: Optional[List[RemoteRelationship]] = None + select_permissions: Optional[List[SelectPermissionEntry]] = None + update_permissions: Optional[List[UpdatePermissionEntry]] = None + + @staticmethod + def from_dict(obj: Any) -> 'TableEntry': + assert isinstance(obj, dict) + table = QualifiedTable.from_dict(obj.get("table")) + array_relationships = from_union([lambda x: from_list(ArrayRelationship.from_dict, x), from_none], obj.get("array_relationships")) + computed_fields = from_union([lambda x: from_list(ComputedField.from_dict, x), from_none], obj.get("computed_fields")) + configuration = from_union([TableConfig.from_dict, from_none], obj.get("configuration")) + delete_permissions = from_union([lambda x: from_list(DeletePermissionEntry.from_dict, x), from_none], obj.get("delete_permissions")) + event_triggers = from_union([lambda x: from_list(EventTrigger.from_dict, x), from_none], obj.get("event_triggers")) + insert_permissions = from_union([lambda x: from_list(InsertPermissionEntry.from_dict, x), from_none], obj.get("insert_permissions")) + is_enum = from_union([from_bool, from_none], obj.get("is_enum")) + object_relationships = from_union([lambda x: from_list(ObjectRelationship.from_dict, x), from_none], obj.get("object_relationships")) + remote_relationships = from_union([lambda x: from_list(RemoteRelationship.from_dict, x), from_none], obj.get("remote_relationships")) + select_permissions = from_union([lambda x: from_list(SelectPermissionEntry.from_dict, x), from_none], obj.get("select_permissions")) + update_permissions = from_union([lambda x: from_list(UpdatePermissionEntry.from_dict, x), from_none], obj.get("update_permissions")) + return TableEntry(table, array_relationships, computed_fields, configuration, delete_permissions, event_triggers, insert_permissions, is_enum, object_relationships, remote_relationships, select_permissions, update_permissions) + + def to_dict(self) -> dict: + result: dict = {} + result["table"] = to_class(QualifiedTable, self.table) + result["array_relationships"] = from_union([lambda x: from_list(lambda x: to_class(ArrayRelationship, x), x), from_none], self.array_relationships) + result["computed_fields"] = from_union([lambda x: from_list(lambda x: to_class(ComputedField, x), x), from_none], self.computed_fields) + result["configuration"] = from_union([lambda x: to_class(TableConfig, x), from_none], self.configuration) + result["delete_permissions"] = from_union([lambda x: from_list(lambda x: to_class(DeletePermissionEntry, x), x), from_none], self.delete_permissions) + result["event_triggers"] = from_union([lambda x: from_list(lambda x: to_class(EventTrigger, x), x), from_none], self.event_triggers) + result["insert_permissions"] = from_union([lambda x: from_list(lambda x: to_class(InsertPermissionEntry, x), x), from_none], self.insert_permissions) + result["is_enum"] = from_union([from_bool, from_none], self.is_enum) + result["object_relationships"] = from_union([lambda x: from_list(lambda x: to_class(ObjectRelationship, x), x), from_none], self.object_relationships) + result["remote_relationships"] = from_union([lambda x: from_list(lambda x: to_class(RemoteRelationship, x), x), from_none], self.remote_relationships) + result["select_permissions"] = from_union([lambda x: from_list(lambda x: to_class(SelectPermissionEntry, x), x), from_none], self.select_permissions) + result["update_permissions"] = from_union([lambda x: from_list(lambda x: to_class(UpdatePermissionEntry, x), x), from_none], self.update_permissions) + return result + + +@dataclass +class HasuraMetadataV2: + """Type used in exported 'metadata.json' and replace metadata endpoint + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/manage-metadata.html#replace-metadata + """ + tables: List[TableEntry] + version: float + actions: Optional[List[Action]] = None + allowlist: Optional[List[AllowList]] = None + cron_triggers: Optional[List[CronTrigger]] = None + custom_types: Optional[CustomTypes] = None + functions: Optional[List[CustomFunction]] = None + query_collections: Optional[List[QueryCollectionEntry]] = None + remote_schemas: Optional[List[RemoteSchema]] = None + + @staticmethod + def from_dict(obj: Any) -> 'HasuraMetadataV2': + assert isinstance(obj, dict) + tables = from_list(TableEntry.from_dict, obj.get("tables")) + version = from_float(obj.get("version")) + actions = from_union([lambda x: from_list(Action.from_dict, x), from_none], obj.get("actions")) + allowlist = from_union([lambda x: from_list(AllowList.from_dict, x), from_none], obj.get("allowlist")) + cron_triggers = from_union([lambda x: from_list(CronTrigger.from_dict, x), from_none], obj.get("cron_triggers")) + custom_types = from_union([CustomTypes.from_dict, from_none], obj.get("custom_types")) + functions = from_union([lambda x: from_list(CustomFunction.from_dict, x), from_none], obj.get("functions")) + query_collections = from_union([lambda x: from_list(QueryCollectionEntry.from_dict, x), from_none], obj.get("query_collections")) + remote_schemas = from_union([lambda x: from_list(RemoteSchema.from_dict, x), from_none], obj.get("remote_schemas")) + return HasuraMetadataV2(tables, version, actions, allowlist, cron_triggers, custom_types, functions, query_collections, remote_schemas) + + def to_dict(self) -> dict: + result: dict = {} + result["tables"] = from_list(lambda x: to_class(TableEntry, x), self.tables) + result["version"] = to_float(self.version) + result["actions"] = from_union([lambda x: from_list(lambda x: to_class(Action, x), x), from_none], self.actions) + result["allowlist"] = from_union([lambda x: from_list(lambda x: to_class(AllowList, x), x), from_none], self.allowlist) + result["cron_triggers"] = from_union([lambda x: from_list(lambda x: to_class(CronTrigger, x), x), from_none], self.cron_triggers) + result["custom_types"] = from_union([lambda x: to_class(CustomTypes, x), from_none], self.custom_types) + result["functions"] = from_union([lambda x: from_list(lambda x: to_class(CustomFunction, x), x), from_none], self.functions) + result["query_collections"] = from_union([lambda x: from_list(lambda x: to_class(QueryCollectionEntry, x), x), from_none], self.query_collections) + result["remote_schemas"] = from_union([lambda x: from_list(lambda x: to_class(RemoteSchema, x), x), from_none], self.remote_schemas) + return result + + +@dataclass +class PGConnectionParameters: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconnectionparameters + """ + """The database name""" + database: str + """The name of the host to connect to""" + host: str + """The port number to connect with, at the server host""" + port: float + """The Postgres user to be connected""" + username: str + """The Postgres user’s password""" + password: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'PGConnectionParameters': + assert isinstance(obj, dict) + database = from_str(obj.get("database")) + host = from_str(obj.get("host")) + port = from_float(obj.get("port")) + username = from_str(obj.get("username")) + password = from_union([from_str, from_none], obj.get("password")) + return PGConnectionParameters(database, host, port, username, password) + + def to_dict(self) -> dict: + result: dict = {} + result["database"] = from_str(self.database) + result["host"] = from_str(self.host) + result["port"] = to_float(self.port) + result["username"] = from_str(self.username) + result["password"] = from_union([from_str, from_none], self.password) + return result + + +@dataclass +class BaseSource: + name: str + tables: List[TableEntry] + functions: Optional[List[CustomFunction]] = None + + @staticmethod + def from_dict(obj: Any) -> 'BaseSource': + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + tables = from_list(TableEntry.from_dict, obj.get("tables")) + functions = from_union([lambda x: from_list(CustomFunction.from_dict, x), from_none], obj.get("functions")) + return BaseSource(name, tables, functions) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + result["tables"] = from_list(lambda x: to_class(TableEntry, x), self.tables) + result["functions"] = from_union([lambda x: from_list(lambda x: to_class(CustomFunction, x), x), from_none], self.functions) + return result + + +@dataclass +class PGConnectionParametersClass: + """https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#fromenv + + Environment variable which stores the client certificate. + + Environment variable which stores the client private key. + + Environment variable which stores trusted certificate authorities. + + + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconnectionparameters + """ + """Name of the environment variable""" + from_env: Optional[str] = None + """The database name""" + database: Optional[str] = None + """The name of the host to connect to""" + host: Optional[str] = None + """The Postgres user’s password""" + password: Optional[str] = None + """The port number to connect with, at the server host""" + port: Optional[float] = None + """The Postgres user to be connected""" + username: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'PGConnectionParametersClass': + assert isinstance(obj, dict) + from_env = from_union([from_str, from_none], obj.get("from_env")) + database = from_union([from_str, from_none], obj.get("database")) + host = from_union([from_str, from_none], obj.get("host")) + password = from_union([from_str, from_none], obj.get("password")) + port = from_union([from_float, from_none], obj.get("port")) + username = from_union([from_str, from_none], obj.get("username")) + return PGConnectionParametersClass(from_env, database, host, password, port, username) + + def to_dict(self) -> dict: + result: dict = {} + result["from_env"] = from_union([from_str, from_none], self.from_env) + result["database"] = from_union([from_str, from_none], self.database) + result["host"] = from_union([from_str, from_none], self.host) + result["password"] = from_union([from_str, from_none], self.password) + result["port"] = from_union([to_float, from_none], self.port) + result["username"] = from_union([from_str, from_none], self.username) + return result + + +class IsolationLevel(Enum): + """The transaction isolation level in which the queries made to the source will be run with + (default: read-committed). + """ + READ_COMMITTED = "read-committed" + REPEATABLE_READ = "repeatable-read" + SERIALIZABLE = "serializable" + + +@dataclass +class PGPoolSettings: + """Connection pool settings + + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgpoolsettings + """ + """Time from connection creation after which the connection should be destroyed and a new + one created. A value of 0 indicates we should never destroy an active connection. If 0 is + passed, memory from large query results may not be reclaimed. (default: 600 sec) + """ + connection_lifetime: Optional[float] = None + """The idle timeout (in seconds) per connection (default: 180)""" + idle_timeout: Optional[float] = None + """Maximum number of connections to be kept in the pool (default: 50)""" + max_connections: Optional[float] = None + """Maximum time to wait while acquiring a Postgres connection from the pool, in seconds + (default: forever) + """ + pool_timeout: Optional[float] = None + """Number of retries to perform (default: 1)""" + retries: Optional[float] = None + + @staticmethod + def from_dict(obj: Any) -> 'PGPoolSettings': + assert isinstance(obj, dict) + connection_lifetime = from_union([from_float, from_none], obj.get("connection_lifetime")) + idle_timeout = from_union([from_float, from_none], obj.get("idle_timeout")) + max_connections = from_union([from_float, from_none], obj.get("max_connections")) + pool_timeout = from_union([from_float, from_none], obj.get("pool_timeout")) + retries = from_union([from_float, from_none], obj.get("retries")) + return PGPoolSettings(connection_lifetime, idle_timeout, max_connections, pool_timeout, retries) + + def to_dict(self) -> dict: + result: dict = {} + result["connection_lifetime"] = from_union([to_float, from_none], self.connection_lifetime) + result["idle_timeout"] = from_union([to_float, from_none], self.idle_timeout) + result["max_connections"] = from_union([to_float, from_none], self.max_connections) + result["pool_timeout"] = from_union([to_float, from_none], self.pool_timeout) + result["retries"] = from_union([to_float, from_none], self.retries) + return result + + +@dataclass +class FromEnv: + """https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#fromenv + + Environment variable which stores the client certificate. + + Environment variable which stores the client private key. + + Environment variable which stores trusted certificate authorities. + """ + """Name of the environment variable""" + from_env: str + + @staticmethod + def from_dict(obj: Any) -> 'FromEnv': + assert isinstance(obj, dict) + from_env = from_str(obj.get("from_env")) + return FromEnv(from_env) + + def to_dict(self) -> dict: + result: dict = {} + result["from_env"] = from_str(self.from_env) + return result + + +@dataclass +class PGCERTSettings: + """The client SSL certificate settings for the database (Only available in Cloud). + + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgcertsettings + """ + """Environment variable which stores the client certificate.""" + sslcert: FromEnv + """Environment variable which stores the client private key.""" + sslkey: FromEnv + """The SSL connection mode. See the libpq ssl support docs + for more details. + """ + sslmode: str + """Password in the case where the sslkey is encrypted.""" + sslpassword: Union[FromEnv, None, str] + """Environment variable which stores trusted certificate authorities.""" + sslrootcert: FromEnv + + @staticmethod + def from_dict(obj: Any) -> 'PGCERTSettings': + assert isinstance(obj, dict) + sslcert = FromEnv.from_dict(obj.get("sslcert")) + sslkey = FromEnv.from_dict(obj.get("sslkey")) + sslmode = from_str(obj.get("sslmode")) + sslpassword = from_union([FromEnv.from_dict, from_str, from_none], obj.get("sslpassword")) + sslrootcert = FromEnv.from_dict(obj.get("sslrootcert")) + return PGCERTSettings(sslcert, sslkey, sslmode, sslpassword, sslrootcert) + + def to_dict(self) -> dict: + result: dict = {} + result["sslcert"] = to_class(FromEnv, self.sslcert) + result["sslkey"] = to_class(FromEnv, self.sslkey) + result["sslmode"] = from_str(self.sslmode) + result["sslpassword"] = from_union([lambda x: to_class(FromEnv, x), from_str, from_none], self.sslpassword) + result["sslrootcert"] = to_class(FromEnv, self.sslrootcert) + return result + + +@dataclass +class PGSourceConnectionInfo: + """Connection parameters for the source + + + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgsourceconnectioninfo + """ + """The database connection URL as a string, as an environment variable, or as connection + parameters. + """ + database_url: Union[PGConnectionParametersClass, str] + """The transaction isolation level in which the queries made to the source will be run with + (default: read-committed). + """ + isolation_level: Optional[IsolationLevel] = None + """Connection pool settings""" + pool_settings: Optional[PGPoolSettings] = None + """The client SSL certificate settings for the database (Only available in Cloud).""" + ssl_configuration: Optional[PGCERTSettings] = None + """If set to true the server prepares statement before executing on the source database + (default: false). For more details, refer to the Postgres docs + """ + use_prepared_statements: Optional[bool] = None + + @staticmethod + def from_dict(obj: Any) -> 'PGSourceConnectionInfo': + assert isinstance(obj, dict) + database_url = from_union([PGConnectionParametersClass.from_dict, from_str], obj.get("database_url")) + isolation_level = from_union([IsolationLevel, from_none], obj.get("isolation_level")) + pool_settings = from_union([PGPoolSettings.from_dict, from_none], obj.get("pool_settings")) + ssl_configuration = from_union([PGCERTSettings.from_dict, from_none], obj.get("ssl_configuration")) + use_prepared_statements = from_union([from_bool, from_none], obj.get("use_prepared_statements")) + return PGSourceConnectionInfo(database_url, isolation_level, pool_settings, ssl_configuration, use_prepared_statements) + + def to_dict(self) -> dict: + result: dict = {} + result["database_url"] = from_union([lambda x: to_class(PGConnectionParametersClass, x), from_str], self.database_url) + result["isolation_level"] = from_union([lambda x: to_enum(IsolationLevel, x), from_none], self.isolation_level) + result["pool_settings"] = from_union([lambda x: to_class(PGPoolSettings, x), from_none], self.pool_settings) + result["ssl_configuration"] = from_union([lambda x: to_class(PGCERTSettings, x), from_none], self.ssl_configuration) + result["use_prepared_statements"] = from_union([from_bool, from_none], self.use_prepared_statements) + return result + + +@dataclass +class PGConfiguration: + """https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconfiguration""" + """Connection parameters for the source""" + connection_info: PGSourceConnectionInfo + """Optional list of read replica configuration (supported only in cloud/enterprise versions)""" + read_replicas: Optional[List[PGSourceConnectionInfo]] = None + + @staticmethod + def from_dict(obj: Any) -> 'PGConfiguration': + assert isinstance(obj, dict) + connection_info = PGSourceConnectionInfo.from_dict(obj.get("connection_info")) + read_replicas = from_union([lambda x: from_list(PGSourceConnectionInfo.from_dict, x), from_none], obj.get("read_replicas")) + return PGConfiguration(connection_info, read_replicas) + + def to_dict(self) -> dict: + result: dict = {} + result["connection_info"] = to_class(PGSourceConnectionInfo, self.connection_info) + result["read_replicas"] = from_union([lambda x: from_list(lambda x: to_class(PGSourceConnectionInfo, x), x), from_none], self.read_replicas) + return result + + +class PGSourceKind(Enum): + CITUS = "citus" + POSTGRES = "postgres" + + +@dataclass +class PGSource: + configuration: PGConfiguration + kind: PGSourceKind + name: str + tables: List[TableEntry] + functions: Optional[List[CustomFunction]] = None + + @staticmethod + def from_dict(obj: Any) -> 'PGSource': + assert isinstance(obj, dict) + configuration = PGConfiguration.from_dict(obj.get("configuration")) + kind = PGSourceKind(obj.get("kind")) + name = from_str(obj.get("name")) + tables = from_list(TableEntry.from_dict, obj.get("tables")) + functions = from_union([lambda x: from_list(CustomFunction.from_dict, x), from_none], obj.get("functions")) + return PGSource(configuration, kind, name, tables, functions) + + def to_dict(self) -> dict: + result: dict = {} + result["configuration"] = to_class(PGConfiguration, self.configuration) + result["kind"] = to_enum(PGSourceKind, self.kind) + result["name"] = from_str(self.name) + result["tables"] = from_list(lambda x: to_class(TableEntry, x), self.tables) + result["functions"] = from_union([lambda x: from_list(lambda x: to_class(CustomFunction, x), x), from_none], self.functions) + return result + + +@dataclass +class MSSQLPoolSettings: + """Connection pool settings + + + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlpoolsettings + """ + """The idle timeout (in seconds) per connection (default: 180)""" + idle_timeout: Optional[float] = None + """Maximum number of connections to be kept in the pool (default: 50)""" + max_connections: Optional[float] = None + + @staticmethod + def from_dict(obj: Any) -> 'MSSQLPoolSettings': + assert isinstance(obj, dict) + idle_timeout = from_union([from_float, from_none], obj.get("idle_timeout")) + max_connections = from_union([from_float, from_none], obj.get("max_connections")) + return MSSQLPoolSettings(idle_timeout, max_connections) + + def to_dict(self) -> dict: + result: dict = {} + result["idle_timeout"] = from_union([to_float, from_none], self.idle_timeout) + result["max_connections"] = from_union([to_float, from_none], self.max_connections) + return result + + +@dataclass +class MSSQLSourceConnectionInfo: + """Connection parameters for the source + + + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo + """ + """The database connection string, or as an environment variable""" + connection_string: Union[FromEnv, str] + """Connection pool settings""" + pool_settings: Optional[MSSQLPoolSettings] = None + + @staticmethod + def from_dict(obj: Any) -> 'MSSQLSourceConnectionInfo': + assert isinstance(obj, dict) + connection_string = from_union([FromEnv.from_dict, from_str], obj.get("connection_string")) + pool_settings = from_union([MSSQLPoolSettings.from_dict, from_none], obj.get("pool_settings")) + return MSSQLSourceConnectionInfo(connection_string, pool_settings) + + def to_dict(self) -> dict: + result: dict = {} + result["connection_string"] = from_union([lambda x: to_class(FromEnv, x), from_str], self.connection_string) + result["pool_settings"] = from_union([lambda x: to_class(MSSQLPoolSettings, x), from_none], self.pool_settings) + return result + + +@dataclass +class MSSQLConfiguration: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo + """ + """Connection parameters for the source""" + connection_info: MSSQLSourceConnectionInfo + + @staticmethod + def from_dict(obj: Any) -> 'MSSQLConfiguration': + assert isinstance(obj, dict) + connection_info = MSSQLSourceConnectionInfo.from_dict(obj.get("connection_info")) + return MSSQLConfiguration(connection_info) + + def to_dict(self) -> dict: + result: dict = {} + result["connection_info"] = to_class(MSSQLSourceConnectionInfo, self.connection_info) + return result + + +class MSSQLSourceKind(Enum): + MSSQL = "mssql" + + +@dataclass +class MSSQLSource: + configuration: MSSQLConfiguration + kind: MSSQLSourceKind + name: str + tables: List[TableEntry] + functions: Optional[List[CustomFunction]] = None + + @staticmethod + def from_dict(obj: Any) -> 'MSSQLSource': + assert isinstance(obj, dict) + configuration = MSSQLConfiguration.from_dict(obj.get("configuration")) + kind = MSSQLSourceKind(obj.get("kind")) + name = from_str(obj.get("name")) + tables = from_list(TableEntry.from_dict, obj.get("tables")) + functions = from_union([lambda x: from_list(CustomFunction.from_dict, x), from_none], obj.get("functions")) + return MSSQLSource(configuration, kind, name, tables, functions) + + def to_dict(self) -> dict: + result: dict = {} + result["configuration"] = to_class(MSSQLConfiguration, self.configuration) + result["kind"] = to_enum(MSSQLSourceKind, self.kind) + result["name"] = from_str(self.name) + result["tables"] = from_list(lambda x: to_class(TableEntry, x), self.tables) + result["functions"] = from_union([lambda x: from_list(lambda x: to_class(CustomFunction, x), x), from_none], self.functions) + return result + + +@dataclass +class RecordStringAnyClass: + """https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#fromenv + + Environment variable which stores the client certificate. + + Environment variable which stores the client private key. + + Environment variable which stores trusted certificate authorities. + """ + """Name of the environment variable""" + from_env: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'RecordStringAnyClass': + assert isinstance(obj, dict) + from_env = from_union([from_str, from_none], obj.get("from_env")) + return RecordStringAnyClass(from_env) + + def to_dict(self) -> dict: + result: dict = {} + result["from_env"] = from_union([from_str, from_none], self.from_env) + return result + + +@dataclass +class BigQueryConfiguration: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#bigqueryconfiguration + """ + """List of BigQuery datasets""" + datasets: Union[List[str], FromEnv] + """Project Id for BigQuery database""" + project_id: Union[FromEnv, str] + """Service account for BigQuery database""" + service_account: Union[RecordStringAnyClass, str] + + @staticmethod + def from_dict(obj: Any) -> 'BigQueryConfiguration': + assert isinstance(obj, dict) + datasets = from_union([lambda x: from_list(from_str, x), FromEnv.from_dict], obj.get("datasets")) + project_id = from_union([FromEnv.from_dict, from_str], obj.get("project_id")) + service_account = from_union([RecordStringAnyClass.from_dict, from_str], obj.get("service_account")) + return BigQueryConfiguration(datasets, project_id, service_account) + + def to_dict(self) -> dict: + result: dict = {} + result["datasets"] = from_union([lambda x: from_list(from_str, x), lambda x: to_class(FromEnv, x)], self.datasets) + result["project_id"] = from_union([lambda x: to_class(FromEnv, x), from_str], self.project_id) + result["service_account"] = from_union([lambda x: to_class(RecordStringAnyClass, x), from_str], self.service_account) + return result + + +class BigQuerySourceKind(Enum): + BIGQUERY = "bigquery" + + +@dataclass +class BigQuerySource: + configuration: BigQueryConfiguration + kind: BigQuerySourceKind + name: str + tables: List[TableEntry] + functions: Optional[List[CustomFunction]] = None + + @staticmethod + def from_dict(obj: Any) -> 'BigQuerySource': + assert isinstance(obj, dict) + configuration = BigQueryConfiguration.from_dict(obj.get("configuration")) + kind = BigQuerySourceKind(obj.get("kind")) + name = from_str(obj.get("name")) + tables = from_list(TableEntry.from_dict, obj.get("tables")) + functions = from_union([lambda x: from_list(CustomFunction.from_dict, x), from_none], obj.get("functions")) + return BigQuerySource(configuration, kind, name, tables, functions) + + def to_dict(self) -> dict: + result: dict = {} + result["configuration"] = to_class(BigQueryConfiguration, self.configuration) + result["kind"] = to_enum(BigQuerySourceKind, self.kind) + result["name"] = from_str(self.name) + result["tables"] = from_list(lambda x: to_class(TableEntry, x), self.tables) + result["functions"] = from_union([lambda x: from_list(lambda x: to_class(CustomFunction, x), x), from_none], self.functions) + return result + + +@dataclass +class DepthLimit: + depth_limit_global: float + per_role: Dict[str, float] + + @staticmethod + def from_dict(obj: Any) -> 'DepthLimit': + assert isinstance(obj, dict) + depth_limit_global = from_float(obj.get("global")) + per_role = from_dict(from_float, obj.get("per_role")) + return DepthLimit(depth_limit_global, per_role) + + def to_dict(self) -> dict: + result: dict = {} + result["global"] = to_float(self.depth_limit_global) + result["per_role"] = from_dict(to_float, self.per_role) + return result + + +@dataclass +class NodeLimit: + node_limit_global: float + per_role: Dict[str, float] + + @staticmethod + def from_dict(obj: Any) -> 'NodeLimit': + assert isinstance(obj, dict) + node_limit_global = from_float(obj.get("global")) + per_role = from_dict(from_float, obj.get("per_role")) + return NodeLimit(node_limit_global, per_role) + + def to_dict(self) -> dict: + result: dict = {} + result["global"] = to_float(self.node_limit_global) + result["per_role"] = from_dict(to_float, self.per_role) + return result + + +class UniqueParamsEnum(Enum): + IP = "IP" + + +@dataclass +class RateLimitRule: + max_reqs_per_min: float + unique_params: Union[List[str], UniqueParamsEnum, None] + + @staticmethod + def from_dict(obj: Any) -> 'RateLimitRule': + assert isinstance(obj, dict) + max_reqs_per_min = from_float(obj.get("max_reqs_per_min")) + unique_params = from_union([lambda x: from_list(from_str, x), from_none, UniqueParamsEnum], obj.get("unique_params")) + return RateLimitRule(max_reqs_per_min, unique_params) + + def to_dict(self) -> dict: + result: dict = {} + result["max_reqs_per_min"] = to_float(self.max_reqs_per_min) + result["unique_params"] = from_union([lambda x: from_list(from_str, x), from_none, lambda x: to_enum(UniqueParamsEnum, x)], self.unique_params) + return result + + +@dataclass +class RateLimit: + rate_limit_global: RateLimitRule + per_role: Dict[str, RateLimitRule] + + @staticmethod + def from_dict(obj: Any) -> 'RateLimit': + assert isinstance(obj, dict) + rate_limit_global = RateLimitRule.from_dict(obj.get("global")) + per_role = from_dict(RateLimitRule.from_dict, obj.get("per_role")) + return RateLimit(rate_limit_global, per_role) + + def to_dict(self) -> dict: + result: dict = {} + result["global"] = to_class(RateLimitRule, self.rate_limit_global) + result["per_role"] = from_dict(lambda x: to_class(RateLimitRule, x), self.per_role) + return result + + +@dataclass +class APILimits: + disabled: bool + depth_limit: Optional[DepthLimit] = None + node_limit: Optional[NodeLimit] = None + rate_limit: Optional[RateLimit] = None + + @staticmethod + def from_dict(obj: Any) -> 'APILimits': + assert isinstance(obj, dict) + disabled = from_bool(obj.get("disabled")) + depth_limit = from_union([DepthLimit.from_dict, from_none], obj.get("depth_limit")) + node_limit = from_union([NodeLimit.from_dict, from_none], obj.get("node_limit")) + rate_limit = from_union([RateLimit.from_dict, from_none], obj.get("rate_limit")) + return APILimits(disabled, depth_limit, node_limit, rate_limit) + + def to_dict(self) -> dict: + result: dict = {} + result["disabled"] = from_bool(self.disabled) + result["depth_limit"] = from_union([lambda x: to_class(DepthLimit, x), from_none], self.depth_limit) + result["node_limit"] = from_union([lambda x: to_class(NodeLimit, x), from_none], self.node_limit) + result["rate_limit"] = from_union([lambda x: to_class(RateLimit, x), from_none], self.rate_limit) + return result + + +@dataclass +class InheritedRole: + role_name: str + role_set: List[str] + + @staticmethod + def from_dict(obj: Any) -> 'InheritedRole': + assert isinstance(obj, dict) + role_name = from_str(obj.get("role_name")) + role_set = from_list(from_str, obj.get("role_set")) + return InheritedRole(role_name, role_set) + + def to_dict(self) -> dict: + result: dict = {} + result["role_name"] = from_str(self.role_name) + result["role_set"] = from_list(from_str, self.role_set) + return result + + +@dataclass +class Query: + collection_name: str + query_name: str + + @staticmethod + def from_dict(obj: Any) -> 'Query': + assert isinstance(obj, dict) + collection_name = from_str(obj.get("collection_name")) + query_name = from_str(obj.get("query_name")) + return Query(collection_name, query_name) + + def to_dict(self) -> dict: + result: dict = {} + result["collection_name"] = from_str(self.collection_name) + result["query_name"] = from_str(self.query_name) + return result + + +@dataclass +class RESTEndpointDefinition: + query: Query + + @staticmethod + def from_dict(obj: Any) -> 'RESTEndpointDefinition': + assert isinstance(obj, dict) + query = Query.from_dict(obj.get("query")) + return RESTEndpointDefinition(query) + + def to_dict(self) -> dict: + result: dict = {} + result["query"] = to_class(Query, self.query) + return result + + +class Method(Enum): + PATCH = "PATCH" + POST = "POST" + PUT = "PUT" + + +@dataclass +class RESTEndpoint: + definition: RESTEndpointDefinition + methods: List[Method] + name: str + url: str + comment: Optional[str] = None + + @staticmethod + def from_dict(obj: Any) -> 'RESTEndpoint': + assert isinstance(obj, dict) + definition = RESTEndpointDefinition.from_dict(obj.get("definition")) + methods = from_list(Method, obj.get("methods")) + name = from_str(obj.get("name")) + url = from_str(obj.get("url")) + comment = from_union([from_str, from_none], obj.get("comment")) + return RESTEndpoint(definition, methods, name, url, comment) + + def to_dict(self) -> dict: + result: dict = {} + result["definition"] = to_class(RESTEndpointDefinition, self.definition) + result["methods"] = from_list(lambda x: to_enum(Method, x), self.methods) + result["name"] = from_str(self.name) + result["url"] = from_str(self.url) + result["comment"] = from_union([from_str, from_none], self.comment) + return result + + +@dataclass +class PoolSettings: + """Connection pool settings + + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgpoolsettings + + + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlpoolsettings + """ + """Time from connection creation after which the connection should be destroyed and a new + one created. A value of 0 indicates we should never destroy an active connection. If 0 is + passed, memory from large query results may not be reclaimed. (default: 600 sec) + """ + connection_lifetime: Optional[float] = None + """The idle timeout (in seconds) per connection (default: 180)""" + idle_timeout: Optional[float] = None + """Maximum number of connections to be kept in the pool (default: 50)""" + max_connections: Optional[float] = None + """Maximum time to wait while acquiring a Postgres connection from the pool, in seconds + (default: forever) + """ + pool_timeout: Optional[float] = None + """Number of retries to perform (default: 1)""" + retries: Optional[float] = None + + @staticmethod + def from_dict(obj: Any) -> 'PoolSettings': + assert isinstance(obj, dict) + connection_lifetime = from_union([from_float, from_none], obj.get("connection_lifetime")) + idle_timeout = from_union([from_float, from_none], obj.get("idle_timeout")) + max_connections = from_union([from_float, from_none], obj.get("max_connections")) + pool_timeout = from_union([from_float, from_none], obj.get("pool_timeout")) + retries = from_union([from_float, from_none], obj.get("retries")) + return PoolSettings(connection_lifetime, idle_timeout, max_connections, pool_timeout, retries) + + def to_dict(self) -> dict: + result: dict = {} + result["connection_lifetime"] = from_union([to_float, from_none], self.connection_lifetime) + result["idle_timeout"] = from_union([to_float, from_none], self.idle_timeout) + result["max_connections"] = from_union([to_float, from_none], self.max_connections) + result["pool_timeout"] = from_union([to_float, from_none], self.pool_timeout) + result["retries"] = from_union([to_float, from_none], self.retries) + return result + + +@dataclass +class SourceConnectionInfo: + """Connection parameters for the source + + + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgsourceconnectioninfo + + + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo + """ + """The database connection URL as a string, as an environment variable, or as connection + parameters. + """ + database_url: Union[PGConnectionParametersClass, None, str] + """The database connection string, or as an environment variable""" + connection_string: Union[FromEnv, None, str] + """The transaction isolation level in which the queries made to the source will be run with + (default: read-committed). + """ + isolation_level: Optional[IsolationLevel] = None + """Connection pool settings""" + pool_settings: Optional[PoolSettings] = None + """The client SSL certificate settings for the database (Only available in Cloud).""" + ssl_configuration: Optional[PGCERTSettings] = None + """If set to true the server prepares statement before executing on the source database + (default: false). For more details, refer to the Postgres docs + """ + use_prepared_statements: Optional[bool] = None + + @staticmethod + def from_dict(obj: Any) -> 'SourceConnectionInfo': + assert isinstance(obj, dict) + database_url = from_union([PGConnectionParametersClass.from_dict, from_str, from_none], obj.get("database_url")) + connection_string = from_union([FromEnv.from_dict, from_str, from_none], obj.get("connection_string")) + isolation_level = from_union([IsolationLevel, from_none], obj.get("isolation_level")) + pool_settings = from_union([PoolSettings.from_dict, from_none], obj.get("pool_settings")) + ssl_configuration = from_union([PGCERTSettings.from_dict, from_none], obj.get("ssl_configuration")) + use_prepared_statements = from_union([from_bool, from_none], obj.get("use_prepared_statements")) + return SourceConnectionInfo(database_url, connection_string, isolation_level, pool_settings, ssl_configuration, use_prepared_statements) + + def to_dict(self) -> dict: + result: dict = {} + result["database_url"] = from_union([lambda x: to_class(PGConnectionParametersClass, x), from_str, from_none], self.database_url) + result["connection_string"] = from_union([lambda x: to_class(FromEnv, x), from_str, from_none], self.connection_string) + result["isolation_level"] = from_union([lambda x: to_enum(IsolationLevel, x), from_none], self.isolation_level) + result["pool_settings"] = from_union([lambda x: to_class(PoolSettings, x), from_none], self.pool_settings) + result["ssl_configuration"] = from_union([lambda x: to_class(PGCERTSettings, x), from_none], self.ssl_configuration) + result["use_prepared_statements"] = from_union([from_bool, from_none], self.use_prepared_statements) + return result + + +@dataclass +class Configuration: + """ + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconfiguration + + + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo + + + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#bigqueryconfiguration + """ + """List of BigQuery datasets""" + datasets: Union[List[str], FromEnv, None] + """Project Id for BigQuery database""" + project_id: Union[FromEnv, None, str] + """Service account for BigQuery database""" + service_account: Union[RecordStringAnyClass, None, str] + """Connection parameters for the source""" + connection_info: Optional[SourceConnectionInfo] = None + """Optional list of read replica configuration (supported only in cloud/enterprise versions)""" + read_replicas: Optional[List[PGSourceConnectionInfo]] = None + + @staticmethod + def from_dict(obj: Any) -> 'Configuration': + assert isinstance(obj, dict) + datasets = from_union([lambda x: from_list(from_str, x), FromEnv.from_dict, from_none], obj.get("datasets")) + project_id = from_union([FromEnv.from_dict, from_str, from_none], obj.get("project_id")) + service_account = from_union([RecordStringAnyClass.from_dict, from_str, from_none], obj.get("service_account")) + connection_info = from_union([SourceConnectionInfo.from_dict, from_none], obj.get("connection_info")) + read_replicas = from_union([lambda x: from_list(PGSourceConnectionInfo.from_dict, x), from_none], obj.get("read_replicas")) + return Configuration(datasets, project_id, service_account, connection_info, read_replicas) + + def to_dict(self) -> dict: + result: dict = {} + result["datasets"] = from_union([lambda x: from_list(from_str, x), lambda x: to_class(FromEnv, x), from_none], self.datasets) + result["project_id"] = from_union([lambda x: to_class(FromEnv, x), from_str, from_none], self.project_id) + result["service_account"] = from_union([lambda x: to_class(RecordStringAnyClass, x), from_str, from_none], self.service_account) + result["connection_info"] = from_union([lambda x: to_class(SourceConnectionInfo, x), from_none], self.connection_info) + result["read_replicas"] = from_union([lambda x: from_list(lambda x: to_class(PGSourceConnectionInfo, x), x), from_none], self.read_replicas) + return result + + +class BackendKind(Enum): + BIGQUERY = "bigquery" + CITUS = "citus" + MSSQL = "mssql" + POSTGRES = "postgres" + + +@dataclass +class Source: + configuration: Configuration + kind: BackendKind + name: str + tables: List[TableEntry] + functions: Optional[List[CustomFunction]] = None + + @staticmethod + def from_dict(obj: Any) -> 'Source': + assert isinstance(obj, dict) + configuration = Configuration.from_dict(obj.get("configuration")) + kind = BackendKind(obj.get("kind")) + name = from_str(obj.get("name")) + tables = from_list(TableEntry.from_dict, obj.get("tables")) + functions = from_union([lambda x: from_list(CustomFunction.from_dict, x), from_none], obj.get("functions")) + return Source(configuration, kind, name, tables, functions) + + def to_dict(self) -> dict: + result: dict = {} + result["configuration"] = to_class(Configuration, self.configuration) + result["kind"] = to_enum(BackendKind, self.kind) + result["name"] = from_str(self.name) + result["tables"] = from_list(lambda x: to_class(TableEntry, x), self.tables) + result["functions"] = from_union([lambda x: from_list(lambda x: to_class(CustomFunction, x), x), from_none], self.functions) + return result + + +@dataclass +class HasuraMetadataV3: + rest_endpoints: List[RESTEndpoint] + sources: List[Source] + version: float + actions: Optional[List[Action]] = None + allowlist: Optional[List[AllowList]] = None + api_limits: Optional[APILimits] = None + cron_triggers: Optional[List[CronTrigger]] = None + custom_types: Optional[CustomTypes] = None + inherited_roles: Optional[List[InheritedRole]] = None + query_collections: Optional[List[QueryCollectionEntry]] = None + remote_schemas: Optional[List[RemoteSchema]] = None + + @staticmethod + def from_dict(obj: Any) -> 'HasuraMetadataV3': + assert isinstance(obj, dict) + rest_endpoints = from_list(RESTEndpoint.from_dict, obj.get("rest_endpoints")) + sources = from_list(Source.from_dict, obj.get("sources")) + version = from_float(obj.get("version")) + actions = from_union([lambda x: from_list(Action.from_dict, x), from_none], obj.get("actions")) + allowlist = from_union([lambda x: from_list(AllowList.from_dict, x), from_none], obj.get("allowlist")) + api_limits = from_union([APILimits.from_dict, from_none], obj.get("api_limits")) + cron_triggers = from_union([lambda x: from_list(CronTrigger.from_dict, x), from_none], obj.get("cron_triggers")) + custom_types = from_union([CustomTypes.from_dict, from_none], obj.get("custom_types")) + inherited_roles = from_union([lambda x: from_list(InheritedRole.from_dict, x), from_none], obj.get("inherited_roles")) + query_collections = from_union([lambda x: from_list(QueryCollectionEntry.from_dict, x), from_none], obj.get("query_collections")) + remote_schemas = from_union([lambda x: from_list(RemoteSchema.from_dict, x), from_none], obj.get("remote_schemas")) + return HasuraMetadataV3(rest_endpoints, sources, version, actions, allowlist, api_limits, cron_triggers, custom_types, inherited_roles, query_collections, remote_schemas) + + def to_dict(self) -> dict: + result: dict = {} + result["rest_endpoints"] = from_list(lambda x: to_class(RESTEndpoint, x), self.rest_endpoints) + result["sources"] = from_list(lambda x: to_class(Source, x), self.sources) + result["version"] = to_float(self.version) + result["actions"] = from_union([lambda x: from_list(lambda x: to_class(Action, x), x), from_none], self.actions) + result["allowlist"] = from_union([lambda x: from_list(lambda x: to_class(AllowList, x), x), from_none], self.allowlist) + result["api_limits"] = from_union([lambda x: to_class(APILimits, x), from_none], self.api_limits) + result["cron_triggers"] = from_union([lambda x: from_list(lambda x: to_class(CronTrigger, x), x), from_none], self.cron_triggers) + result["custom_types"] = from_union([lambda x: to_class(CustomTypes, x), from_none], self.custom_types) + result["inherited_roles"] = from_union([lambda x: from_list(lambda x: to_class(InheritedRole, x), x), from_none], self.inherited_roles) + result["query_collections"] = from_union([lambda x: from_list(lambda x: to_class(QueryCollectionEntry, x), x), from_none], self.query_collections) + result["remote_schemas"] = from_union([lambda x: from_list(lambda x: to_class(RemoteSchema, x), x), from_none], self.remote_schemas) + return result + + +def pg_column_from_dict(s: Any) -> str: + return from_str(s) + + +def pg_column_to_dict(x: str) -> Any: + return from_str(x) + + +def computed_field_name_from_dict(s: Any) -> str: + return from_str(s) + + +def computed_field_name_to_dict(x: str) -> Any: + return from_str(x) + + +def role_name_from_dict(s: Any) -> str: + return from_str(s) + + +def role_name_to_dict(x: str) -> Any: + return from_str(x) + + +def trigger_name_from_dict(s: Any) -> str: + return from_str(s) + + +def trigger_name_to_dict(x: str) -> Any: + return from_str(x) + + +def remote_relationship_name_from_dict(s: Any) -> str: + return from_str(s) + + +def remote_relationship_name_to_dict(x: str) -> Any: + return from_str(x) + + +def remote_schema_name_from_dict(s: Any) -> str: + return from_str(s) + + +def remote_schema_name_to_dict(x: str) -> Any: + return from_str(x) + + +def collection_name_from_dict(s: Any) -> str: + return from_str(s) + + +def collection_name_to_dict(x: str) -> Any: + return from_str(x) + + +def graph_ql_name_from_dict(s: Any) -> str: + return from_str(s) + + +def graph_ql_name_to_dict(x: str) -> Any: + return from_str(x) + + +def graph_ql_type_from_dict(s: Any) -> str: + return from_str(s) + + +def graph_ql_type_to_dict(x: str) -> Any: + return from_str(x) + + +def relationship_name_from_dict(s: Any) -> str: + return from_str(s) + + +def relationship_name_to_dict(x: str) -> Any: + return from_str(x) + + +def action_name_from_dict(s: Any) -> str: + return from_str(s) + + +def action_name_to_dict(x: str) -> Any: + return from_str(x) + + +def webhook_url_from_dict(s: Any) -> str: + return from_str(s) + + +def webhook_url_to_dict(x: str) -> Any: + return from_str(x) + + +def table_name_from_dict(s: Any) -> Union[QualifiedTable, str]: + return from_union([QualifiedTable.from_dict, from_str], s) + + +def table_name_to_dict(x: Union[QualifiedTable, str]) -> Any: + return from_union([lambda x: to_class(QualifiedTable, x), from_str], x) + + +def qualified_table_from_dict(s: Any) -> QualifiedTable: + return QualifiedTable.from_dict(s) + + +def qualified_table_to_dict(x: QualifiedTable) -> Any: + return to_class(QualifiedTable, x) + + +def table_config_from_dict(s: Any) -> TableConfig: + return TableConfig.from_dict(s) + + +def table_config_to_dict(x: TableConfig) -> Any: + return to_class(TableConfig, x) + + +def table_entry_from_dict(s: Any) -> TableEntry: + return TableEntry.from_dict(s) + + +def table_entry_to_dict(x: TableEntry) -> Any: + return to_class(TableEntry, x) + + +def custom_root_fields_from_dict(s: Any) -> CustomRootFields: + return CustomRootFields.from_dict(s) + + +def custom_root_fields_to_dict(x: CustomRootFields) -> Any: + return to_class(CustomRootFields, x) + + +def custom_column_names_from_dict(s: Any) -> Dict[str, str]: + return from_dict(from_str, s) + + +def custom_column_names_to_dict(x: Dict[str, str]) -> Any: + return from_dict(from_str, x) + + +def function_name_from_dict(s: Any) -> Union[QualifiedFunction, str]: + return from_union([QualifiedFunction.from_dict, from_str], s) + + +def function_name_to_dict(x: Union[QualifiedFunction, str]) -> Any: + return from_union([lambda x: to_class(QualifiedFunction, x), from_str], x) + + +def qualified_function_from_dict(s: Any) -> QualifiedFunction: + return QualifiedFunction.from_dict(s) + + +def qualified_function_to_dict(x: QualifiedFunction) -> Any: + return to_class(QualifiedFunction, x) + + +def custom_function_from_dict(s: Any) -> CustomFunction: + return CustomFunction.from_dict(s) + + +def custom_function_to_dict(x: CustomFunction) -> Any: + return to_class(CustomFunction, x) + + +def function_configuration_from_dict(s: Any) -> FunctionConfiguration: + return FunctionConfiguration.from_dict(s) + + +def function_configuration_to_dict(x: FunctionConfiguration) -> Any: + return to_class(FunctionConfiguration, x) + + +def object_relationship_from_dict(s: Any) -> ObjectRelationship: + return ObjectRelationship.from_dict(s) + + +def object_relationship_to_dict(x: ObjectRelationship) -> Any: + return to_class(ObjectRelationship, x) + + +def obj_rel_using_from_dict(s: Any) -> ObjRelUsing: + return ObjRelUsing.from_dict(s) + + +def obj_rel_using_to_dict(x: ObjRelUsing) -> Any: + return to_class(ObjRelUsing, x) + + +def obj_rel_using_manual_mapping_from_dict(s: Any) -> ObjRelUsingManualMapping: + return ObjRelUsingManualMapping.from_dict(s) + + +def obj_rel_using_manual_mapping_to_dict(x: ObjRelUsingManualMapping) -> Any: + return to_class(ObjRelUsingManualMapping, x) + + +def array_relationship_from_dict(s: Any) -> ArrayRelationship: + return ArrayRelationship.from_dict(s) + + +def array_relationship_to_dict(x: ArrayRelationship) -> Any: + return to_class(ArrayRelationship, x) + + +def arr_rel_using_from_dict(s: Any) -> ArrRelUsing: + return ArrRelUsing.from_dict(s) + + +def arr_rel_using_to_dict(x: ArrRelUsing) -> Any: + return to_class(ArrRelUsing, x) + + +def arr_rel_using_f_key_on_from_dict(s: Any) -> ArrRelUsingFKeyOn: + return ArrRelUsingFKeyOn.from_dict(s) + + +def arr_rel_using_f_key_on_to_dict(x: ArrRelUsingFKeyOn) -> Any: + return to_class(ArrRelUsingFKeyOn, x) + + +def arr_rel_using_manual_mapping_from_dict(s: Any) -> ArrRelUsingManualMapping: + return ArrRelUsingManualMapping.from_dict(s) + + +def arr_rel_using_manual_mapping_to_dict(x: ArrRelUsingManualMapping) -> Any: + return to_class(ArrRelUsingManualMapping, x) + + +def column_presets_expression_from_dict(s: Any) -> Dict[str, str]: + return from_dict(from_str, s) + + +def column_presets_expression_to_dict(x: Dict[str, str]) -> Any: + return from_dict(from_str, x) + + +def insert_permission_entry_from_dict(s: Any) -> InsertPermissionEntry: + return InsertPermissionEntry.from_dict(s) + + +def insert_permission_entry_to_dict(x: InsertPermissionEntry) -> Any: + return to_class(InsertPermissionEntry, x) + + +def insert_permission_from_dict(s: Any) -> InsertPermission: + return InsertPermission.from_dict(s) + + +def insert_permission_to_dict(x: InsertPermission) -> Any: + return to_class(InsertPermission, x) + + +def select_permission_entry_from_dict(s: Any) -> SelectPermissionEntry: + return SelectPermissionEntry.from_dict(s) + + +def select_permission_entry_to_dict(x: SelectPermissionEntry) -> Any: + return to_class(SelectPermissionEntry, x) + + +def select_permission_from_dict(s: Any) -> SelectPermission: + return SelectPermission.from_dict(s) + + +def select_permission_to_dict(x: SelectPermission) -> Any: + return to_class(SelectPermission, x) + + +def update_permission_entry_from_dict(s: Any) -> UpdatePermissionEntry: + return UpdatePermissionEntry.from_dict(s) + + +def update_permission_entry_to_dict(x: UpdatePermissionEntry) -> Any: + return to_class(UpdatePermissionEntry, x) + + +def update_permission_from_dict(s: Any) -> UpdatePermission: + return UpdatePermission.from_dict(s) + + +def update_permission_to_dict(x: UpdatePermission) -> Any: + return to_class(UpdatePermission, x) + + +def delete_permission_entry_from_dict(s: Any) -> DeletePermissionEntry: + return DeletePermissionEntry.from_dict(s) + + +def delete_permission_entry_to_dict(x: DeletePermissionEntry) -> Any: + return to_class(DeletePermissionEntry, x) + + +def delete_permission_from_dict(s: Any) -> DeletePermission: + return DeletePermission.from_dict(s) + + +def delete_permission_to_dict(x: DeletePermission) -> Any: + return to_class(DeletePermission, x) + + +def computed_field_from_dict(s: Any) -> ComputedField: + return ComputedField.from_dict(s) + + +def computed_field_to_dict(x: ComputedField) -> Any: + return to_class(ComputedField, x) + + +def computed_field_definition_from_dict(s: Any) -> ComputedFieldDefinition: + return ComputedFieldDefinition.from_dict(s) + + +def computed_field_definition_to_dict(x: ComputedFieldDefinition) -> Any: + return to_class(ComputedFieldDefinition, x) + + +def event_trigger_from_dict(s: Any) -> EventTrigger: + return EventTrigger.from_dict(s) + + +def event_trigger_to_dict(x: EventTrigger) -> Any: + return to_class(EventTrigger, x) + + +def event_trigger_definition_from_dict(s: Any) -> EventTriggerDefinition: + return EventTriggerDefinition.from_dict(s) + + +def event_trigger_definition_to_dict(x: EventTriggerDefinition) -> Any: + return to_class(EventTriggerDefinition, x) + + +def event_trigger_columns_from_dict(s: Any) -> Union[List[str], EventTriggerColumnsEnum]: + return from_union([lambda x: from_list(from_str, x), EventTriggerColumnsEnum], s) + + +def event_trigger_columns_to_dict(x: Union[List[str], EventTriggerColumnsEnum]) -> Any: + return from_union([lambda x: from_list(from_str, x), lambda x: to_enum(EventTriggerColumnsEnum, x)], x) + + +def operation_spec_from_dict(s: Any) -> OperationSpec: + return OperationSpec.from_dict(s) + + +def operation_spec_to_dict(x: OperationSpec) -> Any: + return to_class(OperationSpec, x) + + +def header_from_value_from_dict(s: Any) -> HeaderFromValue: + return HeaderFromValue.from_dict(s) + + +def header_from_value_to_dict(x: HeaderFromValue) -> Any: + return to_class(HeaderFromValue, x) + + +def header_from_env_from_dict(s: Any) -> HeaderFromEnv: + return HeaderFromEnv.from_dict(s) + + +def header_from_env_to_dict(x: HeaderFromEnv) -> Any: + return to_class(HeaderFromEnv, x) + + +def retry_conf_from_dict(s: Any) -> RetryConf: + return RetryConf.from_dict(s) + + +def retry_conf_to_dict(x: RetryConf) -> Any: + return to_class(RetryConf, x) + + +def cron_trigger_from_dict(s: Any) -> CronTrigger: + return CronTrigger.from_dict(s) + + +def cron_trigger_to_dict(x: CronTrigger) -> Any: + return to_class(CronTrigger, x) + + +def retry_conf_st_from_dict(s: Any) -> RetryConfST: + return RetryConfST.from_dict(s) + + +def retry_conf_st_to_dict(x: RetryConfST) -> Any: + return to_class(RetryConfST, x) + + +def remote_schema_from_dict(s: Any) -> RemoteSchema: + return RemoteSchema.from_dict(s) + + +def remote_schema_to_dict(x: RemoteSchema) -> Any: + return to_class(RemoteSchema, x) + + +def remote_schema_def_from_dict(s: Any) -> RemoteSchemaDef: + return RemoteSchemaDef.from_dict(s) + + +def remote_schema_def_to_dict(x: RemoteSchemaDef) -> Any: + return to_class(RemoteSchemaDef, x) + + +def remote_relationship_from_dict(s: Any) -> RemoteRelationship: + return RemoteRelationship.from_dict(s) + + +def remote_relationship_to_dict(x: RemoteRelationship) -> Any: + return to_class(RemoteRelationship, x) + + +def remote_relationship_def_from_dict(s: Any) -> RemoteRelationshipDef: + return RemoteRelationshipDef.from_dict(s) + + +def remote_relationship_def_to_dict(x: RemoteRelationshipDef) -> Any: + return to_class(RemoteRelationshipDef, x) + + +def remote_field_from_dict(s: Any) -> Dict[str, RemoteFieldValue]: + return from_dict(RemoteFieldValue.from_dict, s) + + +def remote_field_to_dict(x: Dict[str, RemoteFieldValue]) -> Any: + return from_dict(lambda x: to_class(RemoteFieldValue, x), x) + + +def input_arguments_from_dict(s: Any) -> Dict[str, str]: + return from_dict(from_str, s) + + +def input_arguments_to_dict(x: Dict[str, str]) -> Any: + return from_dict(from_str, x) + + +def query_collection_entry_from_dict(s: Any) -> QueryCollectionEntry: + return QueryCollectionEntry.from_dict(s) + + +def query_collection_entry_to_dict(x: QueryCollectionEntry) -> Any: + return to_class(QueryCollectionEntry, x) + + +def query_collection_from_dict(s: Any) -> QueryCollection: + return QueryCollection.from_dict(s) + + +def query_collection_to_dict(x: QueryCollection) -> Any: + return to_class(QueryCollection, x) + + +def allow_list_from_dict(s: Any) -> AllowList: + return AllowList.from_dict(s) + + +def allow_list_to_dict(x: AllowList) -> Any: + return to_class(AllowList, x) + + +def custom_types_from_dict(s: Any) -> CustomTypes: + return CustomTypes.from_dict(s) + + +def custom_types_to_dict(x: CustomTypes) -> Any: + return to_class(CustomTypes, x) + + +def input_object_type_from_dict(s: Any) -> InputObjectType: + return InputObjectType.from_dict(s) + + +def input_object_type_to_dict(x: InputObjectType) -> Any: + return to_class(InputObjectType, x) + + +def input_object_field_from_dict(s: Any) -> InputObjectField: + return InputObjectField.from_dict(s) + + +def input_object_field_to_dict(x: InputObjectField) -> Any: + return to_class(InputObjectField, x) + + +def object_type_from_dict(s: Any) -> ObjectType: + return ObjectType.from_dict(s) + + +def object_type_to_dict(x: ObjectType) -> Any: + return to_class(ObjectType, x) + + +def object_field_from_dict(s: Any) -> ObjectField: + return ObjectField.from_dict(s) + + +def object_field_to_dict(x: ObjectField) -> Any: + return to_class(ObjectField, x) + + +def custom_type_object_relationship_from_dict(s: Any) -> CustomTypeObjectRelationship: + return CustomTypeObjectRelationship.from_dict(s) + + +def custom_type_object_relationship_to_dict(x: CustomTypeObjectRelationship) -> Any: + return to_class(CustomTypeObjectRelationship, x) + + +def scalar_type_from_dict(s: Any) -> ScalarType: + return ScalarType.from_dict(s) + + +def scalar_type_to_dict(x: ScalarType) -> Any: + return to_class(ScalarType, x) + + +def enum_type_from_dict(s: Any) -> EnumType: + return EnumType.from_dict(s) + + +def enum_type_to_dict(x: EnumType) -> Any: + return to_class(EnumType, x) + + +def enum_value_from_dict(s: Any) -> EnumValue: + return EnumValue.from_dict(s) + + +def enum_value_to_dict(x: EnumValue) -> Any: + return to_class(EnumValue, x) + + +def action_from_dict(s: Any) -> Action: + return Action.from_dict(s) + + +def action_to_dict(x: Action) -> Any: + return to_class(Action, x) + + +def action_definition_from_dict(s: Any) -> ActionDefinition: + return ActionDefinition.from_dict(s) + + +def action_definition_to_dict(x: ActionDefinition) -> Any: + return to_class(ActionDefinition, x) + + +def input_argument_from_dict(s: Any) -> InputArgument: + return InputArgument.from_dict(s) + + +def input_argument_to_dict(x: InputArgument) -> Any: + return to_class(InputArgument, x) + + +def hasura_metadata_v2_from_dict(s: Any) -> HasuraMetadataV2: + return HasuraMetadataV2.from_dict(s) + + +def hasura_metadata_v2_to_dict(x: HasuraMetadataV2) -> Any: + return to_class(HasuraMetadataV2, x) + + +def from_env_from_dict(s: Any) -> FromEnv: + return FromEnv.from_dict(s) + + +def from_env_to_dict(x: FromEnv) -> Any: + return to_class(FromEnv, x) + + +def pg_configuration_from_dict(s: Any) -> PGConfiguration: + return PGConfiguration.from_dict(s) + + +def pg_configuration_to_dict(x: PGConfiguration) -> Any: + return to_class(PGConfiguration, x) + + +def mssql_configuration_from_dict(s: Any) -> MSSQLConfiguration: + return MSSQLConfiguration.from_dict(s) + + +def mssql_configuration_to_dict(x: MSSQLConfiguration) -> Any: + return to_class(MSSQLConfiguration, x) + + +def big_query_configuration_from_dict(s: Any) -> BigQueryConfiguration: + return BigQueryConfiguration.from_dict(s) + + +def big_query_configuration_to_dict(x: BigQueryConfiguration) -> Any: + return to_class(BigQueryConfiguration, x) + + +def pg_source_connection_info_from_dict(s: Any) -> PGSourceConnectionInfo: + return PGSourceConnectionInfo.from_dict(s) + + +def pg_source_connection_info_to_dict(x: PGSourceConnectionInfo) -> Any: + return to_class(PGSourceConnectionInfo, x) + + +def mssql_source_connection_info_from_dict(s: Any) -> MSSQLSourceConnectionInfo: + return MSSQLSourceConnectionInfo.from_dict(s) + + +def mssql_source_connection_info_to_dict(x: MSSQLSourceConnectionInfo) -> Any: + return to_class(MSSQLSourceConnectionInfo, x) + + +def pg_connection_parameters_from_dict(s: Any) -> PGConnectionParameters: + return PGConnectionParameters.from_dict(s) + + +def pg_connection_parameters_to_dict(x: PGConnectionParameters) -> Any: + return to_class(PGConnectionParameters, x) + + +def pg_pool_settings_from_dict(s: Any) -> PGPoolSettings: + return PGPoolSettings.from_dict(s) + + +def pg_pool_settings_to_dict(x: PGPoolSettings) -> Any: + return to_class(PGPoolSettings, x) + + +def pgcert_settings_from_dict(s: Any) -> PGCERTSettings: + return PGCERTSettings.from_dict(s) + + +def pgcert_settings_to_dict(x: PGCERTSettings) -> Any: + return to_class(PGCERTSettings, x) + + +def mssql_pool_settings_from_dict(s: Any) -> MSSQLPoolSettings: + return MSSQLPoolSettings.from_dict(s) + + +def mssql_pool_settings_to_dict(x: MSSQLPoolSettings) -> Any: + return to_class(MSSQLPoolSettings, x) + + +def backend_kind_from_dict(s: Any) -> BackendKind: + return BackendKind(s) + + +def backend_kind_to_dict(x: BackendKind) -> Any: + return to_enum(BackendKind, x) + + +def base_source_from_dict(s: Any) -> BaseSource: + return BaseSource.from_dict(s) + + +def base_source_to_dict(x: BaseSource) -> Any: + return to_class(BaseSource, x) + + +def pg_source_from_dict(s: Any) -> PGSource: + return PGSource.from_dict(s) + + +def pg_source_to_dict(x: PGSource) -> Any: + return to_class(PGSource, x) + + +def mssql_source_from_dict(s: Any) -> MSSQLSource: + return MSSQLSource.from_dict(s) + + +def mssql_source_to_dict(x: MSSQLSource) -> Any: + return to_class(MSSQLSource, x) + + +def big_query_source_from_dict(s: Any) -> BigQuerySource: + return BigQuerySource.from_dict(s) + + +def big_query_source_to_dict(x: BigQuerySource) -> Any: + return to_class(BigQuerySource, x) + + +def source_from_dict(s: Any) -> Source: + return Source.from_dict(s) + + +def source_to_dict(x: Source) -> Any: + return to_class(Source, x) + + +def api_limits_from_dict(s: Any) -> APILimits: + return APILimits.from_dict(s) + + +def api_limits_to_dict(x: APILimits) -> Any: + return to_class(APILimits, x) + + +def depth_limit_from_dict(s: Any) -> DepthLimit: + return DepthLimit.from_dict(s) + + +def depth_limit_to_dict(x: DepthLimit) -> Any: + return to_class(DepthLimit, x) + + +def rate_limit_from_dict(s: Any) -> RateLimit: + return RateLimit.from_dict(s) + + +def rate_limit_to_dict(x: RateLimit) -> Any: + return to_class(RateLimit, x) + + +def rate_limit_rule_from_dict(s: Any) -> RateLimitRule: + return RateLimitRule.from_dict(s) + + +def rate_limit_rule_to_dict(x: RateLimitRule) -> Any: + return to_class(RateLimitRule, x) + + +def node_limit_from_dict(s: Any) -> NodeLimit: + return NodeLimit.from_dict(s) + + +def node_limit_to_dict(x: NodeLimit) -> Any: + return to_class(NodeLimit, x) + + +def rest_endpoint_from_dict(s: Any) -> RESTEndpoint: + return RESTEndpoint.from_dict(s) + + +def rest_endpoint_to_dict(x: RESTEndpoint) -> Any: + return to_class(RESTEndpoint, x) + + +def rest_endpoint_definition_from_dict(s: Any) -> RESTEndpointDefinition: + return RESTEndpointDefinition.from_dict(s) + + +def rest_endpoint_definition_to_dict(x: RESTEndpointDefinition) -> Any: + return to_class(RESTEndpointDefinition, x) + + +def inherited_role_from_dict(s: Any) -> InheritedRole: + return InheritedRole.from_dict(s) + + +def inherited_role_to_dict(x: InheritedRole) -> Any: + return to_class(InheritedRole, x) + + +def hasura_metadata_v3_from_dict(s: Any) -> HasuraMetadataV3: + return HasuraMetadataV3.from_dict(s) + + +def hasura_metadata_v3_to_dict(x: HasuraMetadataV3) -> Any: + return to_class(HasuraMetadataV3, x) + + +def record_string_any_from_dict(s: Any) -> Dict[str, Any]: + return from_dict(lambda x: x, s) + + +def record_string_any_to_dict(x: Dict[str, Any]) -> Any: + return from_dict(lambda x: x, x) diff --git a/contrib/metadata-types/generated/HasuraMetadataV3.yaml b/contrib/metadata-types/generated/HasuraMetadataV3.yaml new file mode 100644 index 00000000000..17a24d84369 --- /dev/null +++ b/contrib/metadata-types/generated/HasuraMetadataV3.yaml @@ -0,0 +1,2047 @@ +$schema: 'http://json-schema.org/draft-07/schema#' +definitions: + PGColumn: + type: string + ComputedFieldName: + type: string + RoleName: + type: string + TriggerName: + type: string + RemoteRelationshipName: + type: string + RemoteSchemaName: + type: string + CollectionName: + type: string + GraphQLName: + type: string + GraphQLType: + type: string + RelationshipName: + type: string + ActionName: + type: string + WebhookURL: + description: >- + A String value which supports templating environment variables enclosed in + {{ and }}. + + Template example: https://{{ACTION_API_DOMAIN}}/create-user + type: string + TableName: + anyOf: + - $ref: '#/definitions/QualifiedTable' + - type: string + QualifiedTable: + title: QualifiedTable + type: object + properties: + name: + type: string + title: name + schema: + type: string + title: schema + required: + - name + - schema + TableConfig: + description: >- + Configuration for the table/view + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config + title: TableConfig + type: object + properties: + custom_name: + description: Customise the table name + type: string + title: custom_name + custom_root_fields: + description: Customise the root fields + $ref: '#/definitions/CustomRootFields' + title: custom_root_fields + custom_column_names: + description: Customise the column names + $ref: '#/definitions/CustomColumnNames' + title: custom_column_names + TableEntry: + description: 'Representation of a table in metadata, ''tables.yaml'' and ''metadata.json''' + title: TableEntry + type: object + properties: + table: + $ref: '#/definitions/QualifiedTable' + title: table + is_enum: + type: boolean + title: is_enum + configuration: + description: >- + Configuration for the table/view + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#table-config + $ref: '#/definitions/TableConfig' + title: configuration + event_triggers: + type: array + items: + $ref: '#/definitions/EventTrigger' + title: event_triggers + computed_fields: + type: array + items: + $ref: '#/definitions/ComputedField' + title: computed_fields + object_relationships: + type: array + items: + $ref: '#/definitions/ObjectRelationship' + title: object_relationships + array_relationships: + type: array + items: + $ref: '#/definitions/ArrayRelationship' + title: array_relationships + remote_relationships: + type: array + items: + $ref: '#/definitions/RemoteRelationship' + title: remote_relationships + insert_permissions: + type: array + items: + $ref: '#/definitions/InsertPermissionEntry' + title: insert_permissions + select_permissions: + type: array + items: + $ref: '#/definitions/SelectPermissionEntry' + title: select_permissions + update_permissions: + type: array + items: + $ref: '#/definitions/UpdatePermissionEntry' + title: update_permissions + delete_permissions: + type: array + items: + $ref: '#/definitions/DeletePermissionEntry' + title: delete_permissions + required: + - table + CustomRootFields: + description: >- + Customise the root fields + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/table-view.html#custom-root-fields + title: CustomRootFields + type: object + properties: + select: + description: Customise the `` root field + type: string + title: select + select_by_pk: + description: Customise the `_by_pk` root field + type: string + title: select_by_pk + select_aggregate: + description: Customise the `_aggregate` root field + type: string + title: select_aggregate + insert: + description: Customise the `insert_` root field + type: string + title: insert + insert_one: + description: Customise the `insert__one` root field + type: string + title: insert_one + update: + description: Customise the `update_` root field + type: string + title: update + update_by_pk: + description: Customise the `update__by_pk` root field + type: string + title: update_by_pk + delete: + description: Customise the `delete_` root field + type: string + title: delete + delete_by_pk: + description: Customise the `delete__by_pk` root field + type: string + title: delete_by_pk + CustomColumnNames: + description: A JSON Object of Postgres column name to GraphQL name mapping + title: CustomColumnNames + type: object + additionalProperties: + type: string + FunctionName: + anyOf: + - $ref: '#/definitions/QualifiedFunction' + - type: string + QualifiedFunction: + title: QualifiedFunction + type: object + properties: + name: + type: string + title: name + schema: + type: string + title: schema + required: + - name + - schema + CustomFunction: + description: >- + A custom SQL function to add to the GraphQL schema with configuration. + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-functions.html#args-syntax + title: CustomFunction + type: object + properties: + function: + description: Name of the SQL function + anyOf: + - $ref: '#/definitions/QualifiedFunction' + - type: string + title: function + configuration: + description: Configuration for the SQL function + $ref: '#/definitions/FunctionConfiguration' + title: configuration + required: + - function + FunctionConfiguration: + description: >- + Configuration for a CustomFunction + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-functions.html#function-configuration + title: FunctionConfiguration + type: object + properties: + session_argument: + description: >- + Function argument which accepts session info JSON + + Currently, only functions which satisfy the following constraints can + be exposed over the GraphQL API (terminology from Postgres docs): + + - Function behaviour: ONLY `STABLE` or `IMMUTABLE` + + - Return type: MUST be `SETOF ` + + - Argument modes: ONLY `IN` + type: string + title: session_argument + ObjectRelationship: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#args-syntax + title: ObjectRelationship + type: object + properties: + name: + description: Name of the new relationship + type: string + title: name + using: + $ref: '#/definitions/ObjRelUsing' + description: Use one of the available ways to define an object relationship + title: using + comment: + description: Comment + type: string + title: comment + required: + - name + - using + ObjRelUsing: + description: >- + Use one of the available ways to define an object relationship + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#objrelusing + title: ObjRelUsing + type: object + properties: + foreign_key_constraint_on: + description: The column with foreign key constraint + type: string + title: foreign_key_constraint_on + manual_configuration: + description: Manual mapping of table and columns + $ref: '#/definitions/ObjRelUsingManualMapping' + title: manual_configuration + ObjRelUsingManualMapping: + description: >- + Manual mapping of table and columns + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#objrelusingmanualmapping + title: ObjRelUsingManualMapping + type: object + properties: + remote_table: + description: The table to which the relationship has to be established + anyOf: + - $ref: '#/definitions/QualifiedTable' + - type: string + title: remote_table + column_mapping: + description: Mapping of columns from current table to remote table + type: object + additionalProperties: + type: string + title: column_mapping + required: + - column_mapping + - remote_table + ArrayRelationship: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#create-array-relationship-syntax + title: ArrayRelationship + type: object + properties: + name: + description: Name of the new relationship + type: string + title: name + using: + $ref: '#/definitions/ArrRelUsing' + description: Use one of the available ways to define an array relationship + title: using + comment: + description: Comment + type: string + title: comment + required: + - name + - using + ArrRelUsing: + description: >- + Use one of the available ways to define an object relationship + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusing + title: ArrRelUsing + type: object + properties: + foreign_key_constraint_on: + description: The column with foreign key constraint + $ref: '#/definitions/ArrRelUsingFKeyOn' + title: foreign_key_constraint_on + manual_configuration: + description: Manual mapping of table and columns + $ref: '#/definitions/ArrRelUsingManualMapping' + title: manual_configuration + ArrRelUsingFKeyOn: + description: >- + The column with foreign key constraint + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusingfkeyon + title: ArrRelUsingFKeyOn + type: object + properties: + column: + type: string + title: column + table: + anyOf: + - $ref: '#/definitions/QualifiedTable' + - type: string + title: table + required: + - column + - table + ArrRelUsingManualMapping: + description: >- + Manual mapping of table and columns + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/relationship.html#arrrelusingmanualmapping + title: ArrRelUsingManualMapping + type: object + properties: + remote_table: + description: The table to which the relationship has to be established + anyOf: + - $ref: '#/definitions/QualifiedTable' + - type: string + title: remote_table + column_mapping: + description: Mapping of columns from current table to remote table + type: object + additionalProperties: + type: string + title: column_mapping + required: + - column_mapping + - remote_table + ColumnPresetsExpression: + description: >- + Preset values for columns that can be sourced from session variables or + static values. + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#columnpresetexp + title: ColumnPresetsExpression + type: object + additionalProperties: + type: string + InsertPermissionEntry: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#args-syntax + title: InsertPermissionEntry + type: object + properties: + role: + description: Role + type: string + title: role + permission: + $ref: '#/definitions/InsertPermission' + description: The permission definition + title: permission + comment: + description: Comment + type: string + title: comment + required: + - permission + - role + InsertPermission: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#insertpermission + title: InsertPermission + type: object + properties: + check: + description: This expression has to hold true for every new row that is inserted + type: object + additionalProperties: + anyOf: + - type: object + properties: {} + additionalProperties: true + - type: + - string + - number + title: check + set: + description: >- + Preset values for columns that can be sourced from session variables + or static values + $ref: '#/definitions/ColumnPresetsExpression' + title: set + columns: + description: Can insert into only these columns (or all when '*' is specified) + anyOf: + - type: array + items: + type: string + - enum: + - '*' + type: string + title: columns + backend_only: + description: >- + When set to true the mutation is accessible only if + x-hasura-use-backend-only-permissions session variable exists + + and is set to true and request is made with x-hasura-admin-secret set + if any auth is configured + type: boolean + title: backend_only + required: + - columns + SelectPermissionEntry: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-select-permission-syntax + title: SelectPermissionEntry + type: object + properties: + role: + description: Role + type: string + title: role + permission: + $ref: '#/definitions/SelectPermission' + description: The permission definition + title: permission + comment: + description: Comment + type: string + title: comment + required: + - permission + - role + SelectPermission: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#selectpermission + title: SelectPermission + type: object + properties: + columns: + description: Only these columns are selectable (or all when '*' is specified) + anyOf: + - type: array + items: + type: string + - enum: + - '*' + type: string + title: columns + computed_fields: + description: Only these computed fields are selectable + type: array + items: + type: string + title: computed_fields + limit: + description: The maximum number of rows that can be returned + type: integer + title: limit + allow_aggregations: + description: Toggle allowing aggregate queries + type: boolean + title: allow_aggregations + filter: + description: Only the rows where this precondition holds true are selectable + type: object + additionalProperties: + anyOf: + - type: object + properties: {} + additionalProperties: true + - type: + - string + - number + title: filter + required: + - columns + UpdatePermissionEntry: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-update-permission-syntax + title: UpdatePermissionEntry + type: object + properties: + role: + description: Role + type: string + title: role + permission: + $ref: '#/definitions/UpdatePermission' + description: The permission definition + title: permission + comment: + description: Comment + type: string + title: comment + required: + - permission + - role + UpdatePermission: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#updatepermission + title: UpdatePermission + type: object + properties: + check: + description: Postcondition which must be satisfied by rows which have been updated + type: object + additionalProperties: + anyOf: + - type: object + properties: {} + additionalProperties: true + - type: + - string + - number + title: check + set: + description: >- + Preset values for columns that can be sourced from session variables + or static values + $ref: '#/definitions/ColumnPresetsExpression' + title: set + columns: + description: Only these columns are selectable (or all when '*' is specified) + anyOf: + - type: array + items: + type: string + - enum: + - '*' + type: string + title: columns + filter: + description: Only the rows where this precondition holds true are updatable + type: object + additionalProperties: + anyOf: + - type: object + properties: {} + additionalProperties: true + - type: + - string + - number + title: filter + required: + - columns + DeletePermissionEntry: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#create-delete-permission-syntax + title: DeletePermissionEntry + type: object + properties: + role: + description: Role + type: string + title: role + permission: + $ref: '#/definitions/DeletePermission' + description: The permission definition + title: permission + comment: + description: Comment + type: string + title: comment + required: + - permission + - role + DeletePermission: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/permission.html#deletepermission + title: DeletePermission + type: object + properties: + filter: + description: Only the rows where this precondition holds true are updatable + type: object + additionalProperties: + anyOf: + - type: object + properties: {} + additionalProperties: true + - type: + - string + - number + title: filter + ComputedField: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/computed-field.html#args-syntax + title: ComputedField + type: object + properties: + name: + description: Name of the new computed field + type: string + title: name + definition: + $ref: '#/definitions/ComputedFieldDefinition' + description: The computed field definition + title: definition + comment: + description: Comment + type: string + title: comment + required: + - definition + - name + ComputedFieldDefinition: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/computed-field.html#computedfielddefinition + title: ComputedFieldDefinition + type: object + properties: + function: + description: The SQL function + anyOf: + - $ref: '#/definitions/QualifiedFunction' + - type: string + title: function + table_argument: + description: >- + Name of the argument which accepts a table row type. If omitted, the + first argument is considered a table argument + type: string + title: table_argument + session_argument: + description: >- + Name of the argument which accepts the Hasura session object as a + JSON/JSONB value. If omitted, the Hasura session object is not passed + to the function + type: string + title: session_argument + required: + - function + EventTrigger: + description: >- + NOTE: The metadata type doesn't QUITE match the 'create' arguments here + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#create-event-trigger + title: EventTrigger + type: object + properties: + name: + description: Name of the event trigger + type: string + title: name + definition: + $ref: '#/definitions/EventTriggerDefinition' + description: The SQL function + title: definition + retry_conf: + $ref: '#/definitions/RetryConf' + description: The SQL function + title: retry_conf + webhook: + description: The SQL function + type: string + title: webhook + webhook_from_env: + type: string + title: webhook_from_env + headers: + description: The SQL function + type: array + items: + anyOf: + - $ref: '#/definitions/HeaderFromValue' + - $ref: '#/definitions/HeaderFromEnv' + title: headers + required: + - definition + - name + - retry_conf + EventTriggerDefinition: + title: EventTriggerDefinition + type: object + properties: + enable_manual: + type: boolean + title: enable_manual + insert: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec + $ref: '#/definitions/OperationSpec' + title: insert + delete: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec + $ref: '#/definitions/OperationSpec' + title: delete + update: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec + $ref: '#/definitions/OperationSpec' + title: update + required: + - enable_manual + EventTriggerColumns: + anyOf: + - type: array + items: + type: string + - enum: + - '*' + type: string + OperationSpec: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#operationspec + title: OperationSpec + type: object + properties: + columns: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#eventtriggercolumns + anyOf: + - type: array + items: + type: string + - enum: + - '*' + type: string + title: columns + payload: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#eventtriggercolumns + anyOf: + - type: array + items: + type: string + - enum: + - '*' + type: string + title: payload + required: + - columns + HeaderFromValue: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromvalue + title: HeaderFromValue + type: object + properties: + name: + description: Name of the header + type: string + title: name + value: + description: Value of the header + type: string + title: value + required: + - name + - value + HeaderFromEnv: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#headerfromenv + title: HeaderFromEnv + type: object + properties: + name: + description: Name of the header + type: string + title: name + value_from_env: + description: Name of the environment variable which holds the value of the header + type: string + title: value_from_env + required: + - name + - value_from_env + RetryConf: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/event-triggers.html#retryconf + title: RetryConf + type: object + properties: + num_retries: + description: |- + Number of times to retry delivery. + Default: 0 + type: integer + title: num_retries + interval_sec: + description: |- + Number of seconds to wait between each retry. + Default: 10 + type: integer + title: interval_sec + timeout_sec: + description: |- + Number of seconds to wait for response before timing out. + Default: 60 + type: integer + title: timeout_sec + CronTrigger: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/scheduled-triggers.html#create-cron-trigger + title: CronTrigger + type: object + properties: + name: + description: Name of the cron trigger + type: string + title: name + webhook: + description: URL of the webhook + type: string + title: webhook + schedule: + description: Cron expression at which the trigger should be invoked. + type: string + title: schedule + payload: + description: Any JSON payload which will be sent when the webhook is invoked. + type: object + properties: {} + additionalProperties: true + title: payload + headers: + description: List of headers to be sent with the webhook + type: array + items: + anyOf: + - $ref: '#/definitions/HeaderFromValue' + - $ref: '#/definitions/HeaderFromEnv' + title: headers + retry_conf: + description: Retry configuration if scheduled invocation delivery fails + $ref: '#/definitions/RetryConfST' + title: retry_conf + include_in_metadata: + description: >- + Flag to indicate whether a trigger should be included in the metadata. + When a cron trigger is included in the metadata, the user will be able + to export it when the metadata of the graphql-engine is exported. + type: boolean + title: include_in_metadata + comment: + description: Custom comment. + type: string + title: comment + required: + - headers + - include_in_metadata + - name + - schedule + - webhook + RetryConfST: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/scheduled-triggers.html#retryconfst + title: RetryConfST + type: object + properties: + num_retries: + description: |- + Number of times to retry delivery. + Default: 0 + type: integer + title: num_retries + retry_interval_seconds: + description: |- + Number of seconds to wait between each retry. + Default: 10 + type: integer + title: retry_interval_seconds + timeout_seconds: + description: |- + Number of seconds to wait for response before timing out. + Default: 60 + type: integer + title: timeout_seconds + tolerance_seconds: + description: >- + Number of seconds between scheduled time and actual delivery time that + is acceptable. If the time difference is more than this, then the + event is dropped. + + Default: 21600 (6 hours) + type: integer + title: tolerance_seconds + RemoteSchema: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-schemas.html#add-remote-schema + title: RemoteSchema + type: object + properties: + name: + description: Name of the remote schema + type: string + title: name + definition: + $ref: '#/definitions/RemoteSchemaDef' + description: Name of the remote schema + title: definition + comment: + description: Comment + type: string + title: comment + required: + - definition + - name + RemoteSchemaDef: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#remoteschemadef + title: RemoteSchemaDef + type: object + properties: + url: + type: string + title: url + url_from_env: + type: string + title: url_from_env + headers: + type: array + items: + anyOf: + - $ref: '#/definitions/HeaderFromValue' + - $ref: '#/definitions/HeaderFromEnv' + title: headers + forward_client_headers: + type: boolean + title: forward_client_headers + timeout_seconds: + type: number + title: timeout_seconds + RemoteRelationship: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-relationships.html#args-syntax + title: RemoteRelationship + type: object + properties: + name: + description: Name of the remote relationship + type: string + title: name + definition: + $ref: '#/definitions/RemoteRelationshipDef' + description: Definition object + title: definition + required: + - definition + - name + RemoteRelationshipDef: + title: RemoteRelationshipDef + type: object + properties: + hasura_fields: + description: >- + Column(s) in the table that is used for joining with remote schema + field. + + All join keys in remote_field must appear here. + type: array + items: + type: string + title: hasura_fields + remote_schema: + description: Name of the remote schema to join with + type: string + title: remote_schema + remote_field: + $ref: '#/definitions/RemoteField' + description: >- + The schema tree ending at the field in remote schema which needs to be + joined with. + title: remote_field + required: + - hasura_fields + - remote_field + - remote_schema + RemoteField: + description: >- + A recursive tree structure that points to the field in the remote schema + that needs to be joined with. + + It is recursive because the remote field maybe nested deeply in the remote + schema. + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-relationships.html#remotefield + title: RemoteField + type: object + additionalProperties: + type: object + properties: + arguments: + $ref: '#/definitions/InputArguments' + title: arguments + field: + description: >- + A recursive tree structure that points to the field in the remote + schema that needs to be joined with. + + It is recursive because the remote field maybe nested deeply in the + remote schema. + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-relationships.html#remotefield + $ref: '#/definitions/RemoteField' + title: field + required: + - arguments + InputArguments: + description: >- + Note: Table columns can be referred by prefixing $ e.g $id. + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/remote-relationships.html#inputarguments + title: InputArguments + type: object + additionalProperties: + type: string + QueryCollectionEntry: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/query-collections.html#args-syntax + title: QueryCollectionEntry + type: object + properties: + name: + description: Name of the query collection + type: string + title: name + definition: + description: List of queries + type: object + properties: + queries: + type: array + items: + $ref: '#/definitions/QueryCollection' + title: queries + required: + - queries + title: definition + comment: + description: Comment + type: string + title: comment + required: + - definition + - name + QueryCollection: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/syntax-defs.html#collectionquery + title: QueryCollection + type: object + properties: + name: + type: string + title: name + query: + type: string + title: query + required: + - name + - query + AllowList: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/query-collections.html#add-collection-to-allowlist-syntax + title: AllowList + type: object + properties: + collection: + description: Name of a query collection to be added to the allow-list + type: string + title: collection + required: + - collection + CustomTypes: + title: CustomTypes + type: object + properties: + input_objects: + type: array + items: + $ref: '#/definitions/InputObjectType' + title: input_objects + objects: + type: array + items: + $ref: '#/definitions/ObjectType' + title: objects + scalars: + type: array + items: + $ref: '#/definitions/ScalarType' + title: scalars + enums: + type: array + items: + $ref: '#/definitions/EnumType' + title: enums + InputObjectType: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#inputobjecttype + title: InputObjectType + type: object + properties: + name: + description: Name of the Input object type + type: string + title: name + description: + description: Description of the Input object type + type: string + title: description + fields: + description: Fields of the Input object type + type: array + items: + $ref: '#/definitions/InputObjectField' + title: fields + required: + - fields + - name + InputObjectField: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#inputobjectfield + title: InputObjectField + type: object + properties: + name: + description: Name of the Input object type + type: string + title: name + description: + description: Description of the Input object type + type: string + title: description + type: + description: GraphQL type of the Input object type + type: string + title: type + required: + - name + - type + ObjectType: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objecttype + title: ObjectType + type: object + properties: + name: + description: Name of the Input object type + type: string + title: name + description: + description: Description of the Input object type + type: string + title: description + fields: + description: Fields of the Input object type + type: array + items: + $ref: '#/definitions/InputObjectField' + title: fields + relationships: + description: Relationships of the Object type to tables + type: array + items: + $ref: '#/definitions/CustomTypeObjectRelationship' + title: relationships + required: + - fields + - name + ObjectField: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objectfield + title: ObjectField + type: object + properties: + name: + description: Name of the Input object type + type: string + title: name + description: + description: Description of the Input object type + type: string + title: description + type: + description: GraphQL type of the Input object type + type: string + title: type + required: + - name + - type + CustomTypeObjectRelationship: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#objectrelationship + title: CustomTypeObjectRelationship + type: object + properties: + name: + description: 'Name of the relationship, shouldn’t conflict with existing field names' + type: string + title: name + type: + description: Type of the relationship + enum: + - array + - object + type: string + title: type + remote_table: + description: The table to which relationship is defined + anyOf: + - $ref: '#/definitions/QualifiedTable' + - type: string + title: remote_table + field_mapping: + description: Mapping of fields of object type to columns of remote table + type: object + additionalProperties: + type: string + title: field_mapping + required: + - field_mapping + - name + - remote_table + - type + ScalarType: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#scalartype + title: ScalarType + type: object + properties: + name: + description: Name of the Scalar type + type: string + title: name + description: + description: Description of the Scalar type + type: string + title: description + required: + - name + EnumType: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#enumtype + title: EnumType + type: object + properties: + name: + description: Name of the Enum type + type: string + title: name + description: + description: Description of the Enum type + type: string + title: description + values: + description: Values of the Enum type + type: array + items: + $ref: '#/definitions/EnumValue' + title: values + required: + - name + - values + EnumValue: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/custom-types.html#enumvalue + title: EnumValue + type: object + properties: + value: + description: Value of the Enum type + type: string + title: value + description: + description: Description of the Enum value + type: string + title: description + is_deprecated: + description: 'If set to true, the enum value is marked as deprecated' + type: boolean + title: is_deprecated + required: + - value + Action: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#args-syntax + title: Action + type: object + properties: + name: + description: Name of the action + type: string + title: name + definition: + $ref: '#/definitions/ActionDefinition' + description: Definition of the action + title: definition + comment: + description: Comment + type: string + title: comment + permissions: + description: Permissions of the action + type: array + items: + type: object + properties: + role: + type: string + title: role + required: + - role + title: permissions + required: + - definition + - name + ActionDefinition: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#actiondefinition + title: ActionDefinition + type: object + properties: + arguments: + type: array + items: + $ref: '#/definitions/InputArgument' + title: arguments + output_type: + type: string + title: output_type + kind: + type: string + title: kind + headers: + type: array + items: + anyOf: + - $ref: '#/definitions/HeaderFromValue' + - $ref: '#/definitions/HeaderFromEnv' + title: headers + forward_client_headers: + type: boolean + title: forward_client_headers + handler: + description: >- + A String value which supports templating environment variables + enclosed in {{ and }}. + + Template example: https://{{ACTION_API_DOMAIN}}/create-user + type: string + title: handler + type: + enum: + - mutation + - query + type: string + title: type + required: + - handler + InputArgument: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/actions.html#inputargument + title: InputArgument + type: object + properties: + name: + type: string + title: name + type: + type: string + title: type + required: + - name + - type + HasuraMetadataV2: + description: >- + Type used in exported 'metadata.json' and replace metadata endpoint + + https://hasura.io/docs/latest/graphql/core/api-reference/schema-metadata-api/manage-metadata.html#replace-metadata + title: HasuraMetadataV2 + type: object + properties: + version: + type: number + title: version + tables: + type: array + items: + $ref: '#/definitions/TableEntry' + title: tables + actions: + type: array + items: + $ref: '#/definitions/Action' + title: actions + custom_types: + $ref: '#/definitions/CustomTypes' + title: custom_types + functions: + type: array + items: + $ref: '#/definitions/CustomFunction' + title: functions + remote_schemas: + type: array + items: + $ref: '#/definitions/RemoteSchema' + title: remote_schemas + query_collections: + type: array + items: + $ref: '#/definitions/QueryCollectionEntry' + title: query_collections + allowlist: + type: array + items: + $ref: '#/definitions/AllowList' + title: allowlist + cron_triggers: + type: array + items: + $ref: '#/definitions/CronTrigger' + title: cron_triggers + required: + - tables + - version + FromEnv: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#fromenv + title: FromEnv + type: object + properties: + from_env: + description: Name of the environment variable + type: string + title: from_env + required: + - from_env + PGConfiguration: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconfiguration + title: PGConfiguration + type: object + properties: + connection_info: + $ref: '#/definitions/PGSourceConnectionInfo' + description: Connection parameters for the source + title: connection_info + read_replicas: + description: >- + Optional list of read replica configuration (supported only in + cloud/enterprise versions) + type: array + items: + $ref: '#/definitions/PGSourceConnectionInfo' + title: read_replicas + required: + - connection_info + MsSQLConfiguration: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo + title: MsSQLConfiguration + type: object + properties: + connection_info: + $ref: '#/definitions/MsSQLSourceConnectionInfo' + description: Connection parameters for the source + title: connection_info + required: + - connection_info + BigQueryConfiguration: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#bigqueryconfiguration + title: BigQueryConfiguration + type: object + properties: + service_account: + description: Service account for BigQuery database + anyOf: + - $ref: '#/definitions/FromEnv' + - $ref: '#/definitions/Record' + - type: string + title: service_account + project_id: + description: Project Id for BigQuery database + anyOf: + - $ref: '#/definitions/FromEnv' + - type: string + title: project_id + datasets: + description: List of BigQuery datasets + anyOf: + - type: array + items: + type: string + - $ref: '#/definitions/FromEnv' + title: datasets + required: + - datasets + - project_id + - service_account + PGSourceConnectionInfo: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgsourceconnectioninfo + title: PGSourceConnectionInfo + type: object + properties: + database_url: + description: >- + The database connection URL as a string, as an environment variable, + or as connection parameters. + anyOf: + - $ref: '#/definitions/FromEnv' + - $ref: '#/definitions/PGConnectionParameters' + - type: string + title: database_url + pool_settings: + description: Connection pool settings + $ref: '#/definitions/PGPoolSettings' + title: pool_settings + use_prepared_statements: + description: >- + If set to true the server prepares statement before executing on the + source database (default: false). For more details, refer to the + Postgres docs + type: boolean + title: use_prepared_statements + isolation_level: + description: >- + The transaction isolation level in which the queries made to the + source will be run with (default: read-committed). + enum: + - read-committed + - repeatable-read + - serializable + type: string + title: isolation_level + ssl_configuration: + description: >- + The client SSL certificate settings for the database (Only available + in Cloud). + $ref: '#/definitions/PGCertSettings' + title: ssl_configuration + required: + - database_url + MsSQLSourceConnectionInfo: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo + title: MsSQLSourceConnectionInfo + type: object + properties: + connection_string: + description: 'The database connection string, or as an environment variable' + anyOf: + - $ref: '#/definitions/FromEnv' + - type: string + title: connection_string + pool_settings: + description: Connection pool settings + $ref: '#/definitions/MsSQLPoolSettings' + title: pool_settings + required: + - connection_string + PGConnectionParameters: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconnectionparameters + title: PGConnectionParameters + type: object + properties: + username: + description: The Postgres user to be connected + type: string + title: username + password: + description: The Postgres user’s password + type: string + title: password + database: + description: The database name + type: string + title: database + host: + description: The name of the host to connect to + type: string + title: host + port: + description: 'The port number to connect with, at the server host' + type: number + title: port + required: + - database + - host + - port + - username + PGPoolSettings: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgpoolsettings + title: PGPoolSettings + type: object + properties: + max_connections: + description: 'Maximum number of connections to be kept in the pool (default: 50)' + type: number + title: max_connections + idle_timeout: + description: 'The idle timeout (in seconds) per connection (default: 180)' + type: number + title: idle_timeout + retries: + description: 'Number of retries to perform (default: 1)' + type: number + title: retries + pool_timeout: + description: >- + Maximum time to wait while acquiring a Postgres connection from the + pool, in seconds (default: forever) + type: number + title: pool_timeout + connection_lifetime: + description: >- + Time from connection creation after which the connection should be + destroyed and a new one created. A value of 0 indicates we should + never destroy an active connection. If 0 is passed, memory from large + query results may not be reclaimed. (default: 600 sec) + type: number + title: connection_lifetime + PGCertSettings: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgcertsettings + title: PGCertSettings + type: object + properties: + sslmode: + description: >- + The SSL connection mode. See the libpq ssl support docs + for more details. + type: string + title: sslmode + sslrootcert: + $ref: '#/definitions/FromEnv' + description: Environment variable which stores trusted certificate authorities. + title: sslrootcert + sslcert: + $ref: '#/definitions/FromEnv' + description: Environment variable which stores the client certificate. + title: sslcert + sslkey: + $ref: '#/definitions/FromEnv' + description: Environment variable which stores the client private key. + title: sslkey + sslpassword: + description: Password in the case where the sslkey is encrypted. + anyOf: + - $ref: '#/definitions/FromEnv' + - type: string + title: sslpassword + required: + - sslcert + - sslkey + - sslmode + - sslrootcert + MsSQLPoolSettings: + description: >- + https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlpoolsettings + title: MsSQLPoolSettings + type: object + properties: + max_connections: + description: 'Maximum number of connections to be kept in the pool (default: 50)' + type: number + title: max_connections + idle_timeout: + description: 'The idle timeout (in seconds) per connection (default: 180)' + type: number + title: idle_timeout + BackendKind: + enum: + - bigquery + - citus + - mssql + - postgres + type: string + BaseSource: + title: BaseSource + type: object + properties: + name: + type: string + title: name + tables: + type: array + items: + $ref: '#/definitions/TableEntry' + title: tables + functions: + type: array + items: + $ref: '#/definitions/CustomFunction' + title: functions + required: + - name + - tables + PGSource: + title: PGSource + type: object + properties: + kind: + enum: + - citus + - postgres + type: string + title: kind + configuration: + $ref: '#/definitions/PGConfiguration' + title: configuration + name: + type: string + title: name + tables: + type: array + items: + $ref: '#/definitions/TableEntry' + title: tables + functions: + type: array + items: + $ref: '#/definitions/CustomFunction' + title: functions + required: + - configuration + - kind + - name + - tables + MsSQLSource: + title: MsSQLSource + type: object + properties: + kind: + type: string + enum: + - mssql + title: kind + configuration: + $ref: '#/definitions/MsSQLConfiguration' + title: configuration + name: + type: string + title: name + tables: + type: array + items: + $ref: '#/definitions/TableEntry' + title: tables + functions: + type: array + items: + $ref: '#/definitions/CustomFunction' + title: functions + required: + - configuration + - kind + - name + - tables + BigQuerySource: + title: BigQuerySource + type: object + properties: + kind: + type: string + enum: + - bigquery + title: kind + configuration: + $ref: '#/definitions/BigQueryConfiguration' + title: configuration + name: + type: string + title: name + tables: + type: array + items: + $ref: '#/definitions/TableEntry' + title: tables + functions: + type: array + items: + $ref: '#/definitions/CustomFunction' + title: functions + required: + - configuration + - kind + - name + - tables + Source: + anyOf: + - $ref: '#/definitions/PGSource' + - $ref: '#/definitions/MsSQLSource' + - $ref: '#/definitions/BigQuerySource' + APILimits: + title: APILimits + type: object + properties: + depth_limit: + $ref: '#/definitions/DepthLimit' + title: depth_limit + disabled: + type: boolean + title: disabled + rate_limit: + $ref: '#/definitions/RateLimit' + title: rate_limit + node_limit: + $ref: '#/definitions/NodeLimit' + title: node_limit + required: + - disabled + DepthLimit: + title: DepthLimit + type: object + properties: + global: + type: number + title: global + per_role: + type: object + additionalProperties: + type: number + title: per_role + required: + - global + - per_role + RateLimit: + title: RateLimit + type: object + properties: + global: + $ref: '#/definitions/RateLimitRule' + title: global + per_role: + type: object + additionalProperties: + $ref: '#/definitions/RateLimitRule' + title: per_role + required: + - global + - per_role + RateLimitRule: + title: RateLimitRule + type: object + properties: + unique_params: + anyOf: + - type: array + items: + type: string + - enum: + - IP + type: string + - type: 'null' + title: unique_params + max_reqs_per_min: + type: number + title: max_reqs_per_min + required: + - max_reqs_per_min + - unique_params + NodeLimit: + title: NodeLimit + type: object + properties: + global: + type: number + title: global + per_role: + type: object + additionalProperties: + type: number + title: per_role + required: + - global + - per_role + RestEndpoint: + title: RestEndpoint + type: object + properties: + name: + type: string + title: name + url: + type: string + title: url + methods: + type: array + items: + enum: + - PATCH + - POST + - PUT + type: string + title: methods + definition: + $ref: '#/definitions/RestEndpointDefinition' + title: definition + comment: + type: string + title: comment + required: + - definition + - methods + - name + - url + RestEndpointDefinition: + title: RestEndpointDefinition + type: object + properties: + query: + type: object + properties: + query_name: + type: string + title: query_name + collection_name: + type: string + title: collection_name + required: + - collection_name + - query_name + title: query + required: + - query + InheritedRole: + title: InheritedRole + type: object + properties: + role_name: + type: string + title: role_name + role_set: + type: array + items: + type: string + title: role_set + required: + - role_name + - role_set + HasuraMetadataV3: + title: HasuraMetadataV3 + type: object + properties: + version: + type: number + enum: + - 3 + title: version + sources: + type: array + items: + anyOf: + - $ref: '#/definitions/PGSource' + - $ref: '#/definitions/MsSQLSource' + - $ref: '#/definitions/BigQuerySource' + title: sources + actions: + type: array + items: + $ref: '#/definitions/Action' + title: actions + custom_types: + $ref: '#/definitions/CustomTypes' + title: custom_types + remote_schemas: + type: array + items: + $ref: '#/definitions/RemoteSchema' + title: remote_schemas + query_collections: + type: array + items: + $ref: '#/definitions/QueryCollectionEntry' + title: query_collections + allowlist: + type: array + items: + $ref: '#/definitions/AllowList' + title: allowlist + cron_triggers: + type: array + items: + $ref: '#/definitions/CronTrigger' + title: cron_triggers + api_limits: + $ref: '#/definitions/APILimits' + title: api_limits + rest_endpoints: + type: array + items: + $ref: '#/definitions/RestEndpoint' + title: rest_endpoints + inherited_roles: + type: array + items: + $ref: '#/definitions/InheritedRole' + title: inherited_roles + required: + - rest_endpoints + - sources + - version + 'Record': + title: 'Record' + type: object diff --git a/contrib/metadata-types/package.json b/contrib/metadata-types/package.json index 9012b5e0dde..f56380b34c0 100644 --- a/contrib/metadata-types/package.json +++ b/contrib/metadata-types/package.json @@ -18,17 +18,18 @@ }, "devDependencies": { "@types/js-yaml": "^3.12.5", - "@types/node": "^14.0.14", - "fast-glob": "^3.2.4", + "@types/node": "^16.10.3", "ava": "^3.9.0", - "ts-node": "^8.10.2", - "typescript": "^3.9.6", + "fast-glob": "^3.2.4", "js-yaml": "^3.14.0", "microbundle": "^0.12.3", - "quicktype": "^15.0.248", - "quicktype-core": "^6.0.66", + "prettier": "^2.4.1", + "quicktype": "^15.0.260", + "quicktype-core": "^6.0.70", "quicktype-typescript-input": "^0.0.11", - "tsd": "^0.12.1" + "ts-node": "^10.2.1", + "tsd": "^0.12.1", + "typescript": "^4.4.3" }, "ava": { "extensions": [ @@ -38,4 +39,4 @@ "ts-node/register" ] } -} \ No newline at end of file +} diff --git a/contrib/metadata-types/src/types/HasuraMetadataV2.ts b/contrib/metadata-types/src/types/HasuraMetadataV2.ts index 2f876e7f004..bc72ca6e32e 100644 --- a/contrib/metadata-types/src/types/HasuraMetadataV2.ts +++ b/contrib/metadata-types/src/types/HasuraMetadataV2.ts @@ -785,7 +785,7 @@ export interface Action { /** Comment */ comment?: string /** Permissions of the action */ - permissions?: { role: string } + permissions?: Array<{ role: string }> } /** diff --git a/contrib/metadata-types/src/types/HasuraMetadataV3.ts b/contrib/metadata-types/src/types/HasuraMetadataV3.ts new file mode 100644 index 00000000000..0927027ebf3 --- /dev/null +++ b/contrib/metadata-types/src/types/HasuraMetadataV3.ts @@ -0,0 +1,233 @@ +import { + Action, + AllowList, + CronTrigger, + CustomFunction, + CustomTypes, + QueryCollectionEntry, + RemoteSchema, + TableEntry, +} from "./HasuraMetadataV2" + +/** + * https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#fromenv + */ +export interface FromEnv { + /** Name of the environment variable */ + from_env: string +} + +/** + * https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconfiguration + */ +export interface PGConfiguration { + /** Connection parameters for the source */ + connection_info: PGSourceConnectionInfo + /** Optional list of read replica configuration (supported only in cloud/enterprise versions) */ + read_replicas?: PGSourceConnectionInfo[] +} + +/** + * https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo + */ +export interface MsSQLConfiguration { + /** Connection parameters for the source */ + connection_info: MsSQLSourceConnectionInfo +} + +/** + * https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#bigqueryconfiguration + */ +export interface BigQueryConfiguration { + /** Service account for BigQuery database */ + service_account: string | Record | FromEnv + /** Project Id for BigQuery database */ + project_id: string | FromEnv + /** List of BigQuery datasets */ + datasets: string[] | FromEnv +} + +/** + * https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgsourceconnectioninfo + */ +export interface PGSourceConnectionInfo { + /** The database connection URL as a string, as an environment variable, or as connection parameters. */ + database_url: string | FromEnv | PGConnectionParameters + /** Connection pool settings */ + pool_settings?: PGPoolSettings + + /** If set to true the server prepares statement before executing on the source database (default: false). For more details, refer to the Postgres docs */ + use_prepared_statements?: boolean + + /** The transaction isolation level in which the queries made to the source will be run with (default: read-committed). */ + isolation_level?: "read-committed" | "repeatable-read" | "serializable" + + /** The client SSL certificate settings for the database (Only available in Cloud). */ + ssl_configuration?: PGCertSettings +} + +/** + * https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlsourceconnectioninfo + */ +export interface MsSQLSourceConnectionInfo { + /** The database connection string, or as an environment variable */ + connection_string: string | FromEnv + /** Connection pool settings */ + pool_settings?: MsSQLPoolSettings +} + +/** + * https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgconnectionparameters + */ +export interface PGConnectionParameters { + /**The Postgres user to be connected */ + username: string + /** The Postgres user’s password */ + password?: string + /** The database name */ + database: string + /** The name of the host to connect to */ + host: string + /** The port number to connect with, at the server host */ + port: number +} + +/** + * https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgpoolsettings + */ +export interface PGPoolSettings { + /** Maximum number of connections to be kept in the pool (default: 50) */ + max_connections?: number + /** The idle timeout (in seconds) per connection (default: 180) */ + idle_timeout?: number + /** Number of retries to perform (default: 1) */ + retries?: number + /** Maximum time to wait while acquiring a Postgres connection from the pool, in seconds (default: forever) */ + pool_timeout?: number + /** Time from connection creation after which the connection should be destroyed and a new one created. A value of 0 indicates we should never destroy an active connection. If 0 is passed, memory from large query results may not be reclaimed. (default: 600 sec) */ + connection_lifetime?: number +} + +/** + * https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#pgcertsettings + */ +export interface PGCertSettings { + /** The SSL connection mode. See the libpq ssl support docs for more details. */ + sslmode: string + /** Environment variable which stores trusted certificate authorities. */ + sslrootcert: FromEnv + /** Environment variable which stores the client certificate. */ + sslcert: FromEnv + /** Environment variable which stores the client private key. */ + sslkey: FromEnv + /** Password in the case where the sslkey is encrypted. */ + sslpassword?: string | FromEnv +} + +/** + * https://hasura.io/docs/latest/graphql/core/api-reference/syntax-defs.html#mssqlpoolsettings + */ +export interface MsSQLPoolSettings { + /** Maximum number of connections to be kept in the pool (default: 50) */ + max_connections?: number + /** The idle timeout (in seconds) per connection (default: 180) */ + idle_timeout?: number +} + +export enum BackendKind { + POSTGRES = "postgres", + MSSQL = "mssql", + CITUS = "citus", + BIGQUERY = "bigquery", +} + +interface BaseSource { + name: string + tables: TableEntry[] + functions?: CustomFunction[] +} + +interface PGSource extends BaseSource { + kind: BackendKind.POSTGRES | BackendKind.CITUS + configuration: PGConfiguration +} + +interface MsSQLSource extends BaseSource { + kind: BackendKind.MSSQL + configuration: MsSQLConfiguration +} + +interface BigQuerySource extends BaseSource { + kind: BackendKind.BIGQUERY + configuration: BigQueryConfiguration +} + +export type Source = PGSource | MsSQLSource | BigQuerySource + +export interface APILimits { + depth_limit?: DepthLimit; + disabled: boolean; + rate_limit?: RateLimit; + node_limit?: NodeLimit; +} + +export interface DepthLimit { + global: number; + per_role: { + [role: string]: number; + }; +} + +export interface RateLimit { + global: RateLimitRule; + per_role: { + [role: string]: RateLimitRule; + }; +} + +export interface RateLimitRule { + unique_params: null | 'IP' | string[]; + max_reqs_per_min: number; +} + +export interface NodeLimit { + global: number; + per_role: { + [role: string]: number; + }; +} + +export interface RestEndpoint { + name: string; + url: string; + methods: ('POST' | 'PUT' | 'PATCH')[]; + definition: RestEndpointDefinition; + comment?: string; +} + +export interface RestEndpointDefinition { + query: { + query_name: string; + collection_name: string; + }; +} + +export interface InheritedRole { + role_name: string; + role_set: string[]; +} + +// quicktype code generator can't handle Typescript's "Omit" type +export interface HasuraMetadataV3 { + version: 3 + sources: Source[] + actions?: Action[] + custom_types?: CustomTypes + remote_schemas?: RemoteSchema[] + query_collections?: QueryCollectionEntry[] + allowlist?: AllowList[] + cron_triggers?: CronTrigger[] + api_limits?: APILimits + rest_endpoints: RestEndpoint[] + inherited_roles?: InheritedRole[] +} diff --git a/contrib/metadata-types/yarn.lock b/contrib/metadata-types/yarn.lock index 43466a3c7f2..c549635b00e 100644 --- a/contrib/metadata-types/yarn.lock +++ b/contrib/metadata-types/yarn.lock @@ -907,6 +907,18 @@ dependencies: arrify "^1.0.1" +"@cspotcode/source-map-consumer@0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b" + integrity sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg== + +"@cspotcode/source-map-support@0.6.1": + version "0.6.1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.6.1.tgz#118511f316e2e87ee4294761868e254d3da47960" + integrity sha512-DX3Z+T5dt1ockmPdobJS/FAsQPW4V4SrWEhD2iYQT2Cb2tQsiMnYxrcUH9By/Z3B+v0S5LMBkQtV/XOBbpLEOg== + dependencies: + "@cspotcode/source-map-consumer" "0.8.0" + "@mark.probst/typescript-json-schema@~0.32.0": version "0.32.0" resolved "https://registry.yarnpkg.com/@mark.probst/typescript-json-schema/-/typescript-json-schema-0.32.0.tgz#724d2de8baa2e46e5af4cfdeb9fe3758ced9b2a4" @@ -1013,6 +1025,26 @@ dependencies: defer-to-connect "^1.0.1" +"@tsconfig/node10@^1.0.7": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9" + integrity sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg== + +"@tsconfig/node12@^1.0.7": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.9.tgz#62c1f6dee2ebd9aead80dc3afa56810e58e1a04c" + integrity sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw== + +"@tsconfig/node14@^1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.1.tgz#95f2d167ffb9b8d2068b0b235302fafd4df711f2" + integrity sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg== + +"@tsconfig/node16@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e" + integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA== + "@types/color-name@^1.1.1": version "1.1.1" resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" @@ -1051,11 +1083,16 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.0.tgz#69a23a3ad29caf0097f06eda59b361ee2f0639f6" integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY= -"@types/node@*", "@types/node@^14.0.14": +"@types/node@*": version "14.6.0" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.6.0.tgz#7d4411bf5157339337d7cff864d9ff45f177b499" integrity sha512-mikldZQitV94akrc4sCcSjtJfsTKt4p+e/s0AGscVA6XArQ9kFclP+ZiYUMnq987rc6QlYxXv/EivqlfSLxpKA== +"@types/node@^16.10.3": + version "16.10.3" + resolved "https://registry.yarnpkg.com/@types/node/-/node-16.10.3.tgz#7a8f2838603ea314d1d22bb3171d899e15c57bd5" + integrity sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ== + "@types/normalize-package-data@^2.4.0": version "2.4.0" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" @@ -1083,11 +1120,21 @@ acorn-walk@^7.2.0: resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== +acorn-walk@^8.1.1: + version "8.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" + integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== + acorn@^7.1.0, acorn@^7.1.1, acorn@^7.3.1: version "7.4.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.0.tgz#e1ad486e6c54501634c6c397c5c121daa383607c" integrity sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w== +acorn@^8.4.1: + version "8.5.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.5.0.tgz#4512ccb99b3698c752591e9bb4472e38ad43cee2" + integrity sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q== + aggregate-error@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.0.1.tgz#db2fe7246e536f40d9b5442a39e117d7dd6a24e0" @@ -1823,6 +1870,11 @@ cosmiconfig@^6.0.0: path-type "^4.0.0" yaml "^1.7.2" +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + cross-spawn@^6.0.0: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -3575,7 +3627,7 @@ nice-try@^1.0.4: resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== -node-fetch@^1.0.1, node-fetch@^1.7.1: +node-fetch@^1.0.1: version "1.7.3" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ== @@ -3583,6 +3635,11 @@ node-fetch@^1.0.1, node-fetch@^1.7.1: encoding "^0.1.11" is-stream "^1.0.1" +node-fetch@^2.6.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" + integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== + node-releases@^1.1.61: version "1.1.61" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.61.tgz#707b0fca9ce4e11783612ba4a2fcba09047af16e" @@ -4305,6 +4362,11 @@ prepend-http@^2.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= +prettier@^2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c" + integrity sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA== + pretty-bytes@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-3.0.1.tgz#27d0008d778063a0b4811bb35c79f1bd5d5fbccf" @@ -4364,7 +4426,7 @@ quick-lru@^4.0.1: resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f" integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== -quicktype-core@^6.0.18, quicktype-core@^6.0.66: +quicktype-core@^6.0.18: version "6.0.68" resolved "https://registry.yarnpkg.com/quicktype-core/-/quicktype-core-6.0.68.tgz#bcb613c59eca68dac521e9b7854c073ee79a68c6" integrity sha512-9or+dslvADdgXGVYMjGr1xehVvBYr0WLRSgQ7MjaQ+NmAvqSCub9Hsq9S2Bbqj5cyDkm2faulbH4yQ7ksckffw== @@ -4382,6 +4444,24 @@ quicktype-core@^6.0.18, quicktype-core@^6.0.66: wordwrap "^1.0.0" yaml "^1.5.0" +quicktype-core@^6.0.70: + version "6.0.70" + resolved "https://registry.yarnpkg.com/quicktype-core/-/quicktype-core-6.0.70.tgz#3be15eef505d356bc16fad01d2941d726c0a5700" + integrity sha512-BMoG1omvauNhgGFzz1AkFVIC0LPXPArE6cCGI5fTeHvXKQsVUCbHt+seee2TaqUkELX9Pk6yA0s8OW8vW3kllA== + dependencies: + "@mark.probst/unicode-properties" "~1.1.0" + browser-or-node "^1.2.1" + collection-utils "^1.0.1" + is-url "^1.2.4" + isomorphic-fetch "^2.2.1" + js-base64 "^2.4.3" + pako "^1.0.6" + pluralize "^7.0.0" + readable-stream "2.3.0" + urijs "^1.19.1" + wordwrap "^1.0.0" + yaml "^1.5.0" + quicktype-typescript-input@^0.0.11: version "0.0.11" resolved "https://registry.yarnpkg.com/quicktype-typescript-input/-/quicktype-typescript-input-0.0.11.tgz#b2682b77bb3c932a46fe0ae7524964be096c55f2" @@ -4391,10 +4471,10 @@ quicktype-typescript-input@^0.0.11: quicktype-core "^6.0.18" typescript "~3.2.1" -quicktype@^15.0.248: - version "15.0.256" - resolved "https://registry.yarnpkg.com/quicktype/-/quicktype-15.0.256.tgz#4d9afa15a3dab4f9728f70e15d8210472c7b54ae" - integrity sha512-GSMi0WDy9NLviujRT4ExrY3cIfDmw4o5RIbVBF/8Bzw7K4/qh46WDZSUdZ/DLIlF93hI4R3QHV2Q4ce0uXUvgg== +quicktype@^15.0.260: + version "15.0.260" + resolved "https://registry.yarnpkg.com/quicktype/-/quicktype-15.0.260.tgz#ee3f3cf2a2d39b5e7ec38d8d91b3a88f01d0fae0" + integrity sha512-OYP77enVz2UkcdDqVFc2AcFGYjk5/ENGYZHmSEY5Oy6Y2xVatlHUnrScddEkI+xJxSfYS6UXSH8oOTW7mEOiEw== dependencies: "@mark.probst/typescript-json-schema" "~0.32.0" "@mark.probst/unicode-properties" "~1.1.0" @@ -4409,14 +4489,14 @@ quicktype@^15.0.248: js-base64 "^2.4.3" lodash "^4.17.19" moment "^2.22.1" - node-fetch "^1.7.1" + node-fetch "^2.6.1" pako "^1.0.6" pluralize "^7.0.0" readable-stream "2.3.0" stream-json "1.1.3" string-to-stream "^1.1.0" typescript "~3.2.1" - urijs "^1.19.1" + urijs "^1.19.4" uuid "^3.2.1" wordwrap "^1.0.0" yaml "^1.5.0" @@ -4866,7 +4946,7 @@ slice-ansi@^3.0.0: astral-regex "^2.0.0" is-fullwidth-code-point "^3.0.0" -source-map-support@^0.5.17, source-map-support@^0.5.19, source-map-support@~0.5.12: +source-map-support@^0.5.19, source-map-support@~0.5.12: version "0.5.19" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== @@ -5280,15 +5360,22 @@ trim-off-newlines@^1.0.1: resolved "https://registry.yarnpkg.com/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz#9f9ba9d9efa8764c387698bcbfeb2c848f11adb3" integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM= -ts-node@^8.10.2: - version "8.10.2" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.10.2.tgz#eee03764633b1234ddd37f8db9ec10b75ec7fb8d" - integrity sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA== +ts-node@^10.2.1: + version "10.2.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.2.1.tgz#4cc93bea0a7aba2179497e65bb08ddfc198b3ab5" + integrity sha512-hCnyOyuGmD5wHleOQX6NIjJtYVIO8bPP8F2acWkB4W06wdlkgyvJtubO/I9NkI88hCFECbsEgoLc0VNkYmcSfw== dependencies: + "@cspotcode/source-map-support" "0.6.1" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" arg "^4.1.0" + create-require "^1.1.0" diff "^4.0.1" make-error "^1.1.1" - source-map-support "^0.5.17" yn "3.1.1" tsd@^0.12.1: @@ -5357,11 +5444,16 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^3.9.5, typescript@^3.9.6: +typescript@^3.9.5: version "3.9.7" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa" integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw== +typescript@^4.4.3: + version "4.4.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.3.tgz#bdc5407caa2b109efd4f82fe130656f977a29324" + integrity sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA== + typescript@~3.2.1: version "3.2.4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.4.tgz#c585cb952912263d915b462726ce244ba510ef3d" @@ -5454,6 +5546,11 @@ urijs@^1.19.1: resolved "https://registry.yarnpkg.com/urijs/-/urijs-1.19.2.tgz#f9be09f00c4c5134b7cb3cf475c1dd394526265a" integrity sha512-s/UIq9ap4JPZ7H1EB5ULo/aOUbWqfDi7FKzMC2Nz+0Si8GiT1rIEaprt8hy3Vy2Ex2aJPpOQv4P4DuOZ+K1c6w== +urijs@^1.19.4: + version "1.19.7" + resolved "https://registry.yarnpkg.com/urijs/-/urijs-1.19.7.tgz#4f594e59113928fea63c00ce688fb395b1168ab9" + integrity sha512-Id+IKjdU0Hx+7Zx717jwLPsPeUqz7rAtuVBRLLs+qn+J2nf9NGITWVCxcijgYxBqe83C7sqsQPs6H1pyz3x9gA== + url-parse-lax@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-3.0.0.tgz#16b5cafc07dbe3676c1b1999177823d6503acb0c"