diff --git a/v3/Dockerfile b/v3/Dockerfile index 6bb4fd17420..96fc3dd7dd5 100644 --- a/v3/Dockerfile +++ b/v3/Dockerfile @@ -1,5 +1,5 @@ # This should match the Rust version in rust-toolchain.yaml and the other Dockerfiles. -FROM rust:1.81.0 as chef +FROM rust:1.82.0 as chef WORKDIR app diff --git a/v3/crates/auth/hasura-authn-core/src/lib.rs b/v3/crates/auth/hasura-authn-core/src/lib.rs index 9abf8d63dda..b29426f9a2f 100644 --- a/v3/crates/auth/hasura-authn-core/src/lib.rs +++ b/v3/crates/auth/hasura-authn-core/src/lib.rs @@ -240,22 +240,21 @@ pub fn authorize_identity( let mut role = None; // traverse through the headers and collect role and session variables for (header_name, header_value) in headers { - if let Ok(session_variable) = SessionVariableName::from_str(header_name.as_str()) { - let variable_value_str = match header_value.to_str() { - Err(e) => Err(SessionError::InvalidHeaderValue { - header_name: header_name.to_string(), - error: e.to_string(), - })?, - Ok(h) => h, - }; - let variable_value = SessionVariableValue::Unparsed(variable_value_str.to_string()); + let Ok(session_variable) = SessionVariableName::from_str(header_name.as_str()); + let variable_value_str = match header_value.to_str() { + Err(e) => Err(SessionError::InvalidHeaderValue { + header_name: header_name.to_string(), + error: e.to_string(), + })?, + Ok(h) => h, + }; + let variable_value = SessionVariableValue::Unparsed(variable_value_str.to_string()); - if session_variable == SESSION_VARIABLE_ROLE { - role = Some(Role::new(variable_value_str)); - } else { - // TODO: Handle the duplicate case? - session_variables.insert(session_variable, variable_value); - } + if session_variable == SESSION_VARIABLE_ROLE { + role = Some(Role::new(variable_value_str)); + } else { + // TODO: Handle the duplicate case? + session_variables.insert(session_variable, variable_value); } } let session = identity diff --git a/v3/crates/engine/tests/common.rs b/v3/crates/engine/tests/common.rs index 8ea00344219..908a0238e78 100644 --- a/v3/crates/engine/tests/common.rs +++ b/v3/crates/engine/tests/common.rs @@ -769,30 +769,38 @@ async fn run_query_graphql_ws( // Assert response let message = channel_receiver.recv().await.expect("Expected a message"); let response = match message { - graphql_ws::Message::Protocol(graphql_ws::ServerMessage::Next { id, payload }) => { - assert_eq!(operation_id, id); - payload - } - graphql_ws::Message::Protocol(graphql_ws::ServerMessage::Error { - id, - payload: errors, - }) => { - assert_eq!(operation_id, id); - lang_graphql::http::Response::errors(errors) - } - _ => { - panic!("Expected a Next or Error message") - } + graphql_ws::Message::Protocol(message) => match *message { + graphql_ws::ServerMessage::Next { id, payload } => { + assert_eq!(operation_id, id); + payload + } + graphql_ws::ServerMessage::Error { + id, + payload: errors, + } => { + assert_eq!(operation_id, id); + lang_graphql::http::Response::errors(errors) + } + _ => { + panic!("Expected a Next or Error message") + } + }, + graphql_ws::Message::Raw(_) => panic!("Expected a Next or Error message"), }; // Assert completion when no errors if response.errors.is_none() { let message = channel_receiver.recv().await.expect("Expected a message"); match message { - graphql_ws::Message::Protocol(graphql_ws::ServerMessage::Complete { id }) => { - assert_eq!(operation_id, id); - } - _ => { + graphql_ws::Message::Protocol(message) => match *message { + graphql_ws::ServerMessage::Complete { id } => { + assert_eq!(operation_id, id); + } + _ => { + panic!("Expected a Complete message") + } + }, + graphql_ws::Message::Raw(_) => { panic!("Expected a Complete message") } }; diff --git a/v3/crates/graphql-ws/src/protocol/init.rs b/v3/crates/graphql-ws/src/protocol/init.rs index 2455ea3ba27..4fbfaedb2fc 100644 --- a/v3/crates/graphql-ws/src/protocol/init.rs +++ b/v3/crates/graphql-ws/src/protocol/init.rs @@ -28,7 +28,9 @@ pub async fn handle_connection_init(connection: ws::Connection, payload: Option< // Update state to Initialized and send a connection acknowledgment *state = ConnectionInitState::Initialized { session, headers }; connection - .send(ws::Message::Protocol(ServerMessage::ConnectionAck)) + .send(ws::Message::Protocol(Box::new( + ServerMessage::ConnectionAck, + ))) .await; } Err(ConnectionInitError::AlreadyInitialized) => { diff --git a/v3/crates/graphql-ws/src/protocol/mod.rs b/v3/crates/graphql-ws/src/protocol/mod.rs index fc722cd3ebb..eadb60ee79b 100644 --- a/v3/crates/graphql-ws/src/protocol/mod.rs +++ b/v3/crates/graphql-ws/src/protocol/mod.rs @@ -43,7 +43,7 @@ pub async fn handle_graphql_ws_message(connection: ws::Connection, message: Clie // Respond to a Ping message by sending a Pong ClientMessage::Ping => { connection - .send(ws::Message::Protocol(ServerMessage::Pong)) + .send(ws::Message::Protocol(Box::new(ServerMessage::Pong))) .await; } // Ignore the Pong message as no action is needed diff --git a/v3/crates/graphql-ws/src/protocol/subscribe.rs b/v3/crates/graphql-ws/src/protocol/subscribe.rs index 25faafff5cb..789874a44c5 100644 --- a/v3/crates/graphql-ws/src/protocol/subscribe.rs +++ b/v3/crates/graphql-ws/src/protocol/subscribe.rs @@ -109,10 +109,12 @@ pub async fn handle_subscribe( // Send the plugin error response to the client let graphql_error = error.into_graphql_error(&plugin_name); connection - .send(ws::Message::Protocol(ServerMessage::Error { - id: operation_id.clone(), - payload: NonEmpty::new(graphql_error), - })) + .send(ws::Message::Protocol(Box::new( + ServerMessage::Error { + id: operation_id.clone(), + payload: NonEmpty::new(graphql_error), + }, + ))) .await; } } @@ -139,10 +141,10 @@ pub async fn handle_subscribe( Error::PreParsePlugin(e) => { // If the pre-parse plugin fails, send an error message. connection - .send(ws::Message::Protocol(ServerMessage::Error { + .send(ws::Message::Protocol(Box::new(ServerMessage::Error { id: operation_id, payload: NonEmpty::new(e.into_graphql_error()), - })) + }))) .await; } } @@ -239,7 +241,9 @@ pub async fn send_request_error( id: operation_id, payload: NonEmpty::new(gql_error), }; - connection.send(ws::Message::Protocol(message)).await; + connection + .send(ws::Message::Protocol(Box::new(message))) + .await; } // Exported for testing purpose @@ -482,10 +486,10 @@ async fn send_graphql_ok( connection: &ws::Connection, ) { connection - .send(ws::Message::Protocol(ServerMessage::Next { + .send(ws::Message::Protocol(Box::new(ServerMessage::Next { id: operation_id, payload: response, - })) + }))) .await; } @@ -496,19 +500,19 @@ async fn send_graphql_errors( connection: &ws::Connection, ) { connection - .send(ws::Message::Protocol(ServerMessage::Error { + .send(ws::Message::Protocol(Box::new(ServerMessage::Error { id: operation_id, payload: errors, - })) + }))) .await; } /// Sends a complete message after the query/mutation execution finishes. async fn send_complete(operation_id: OperationId, connection: &ws::Connection) { connection - .send(ws::Message::Protocol(ServerMessage::Complete { + .send(ws::Message::Protocol(Box::new(ServerMessage::Complete { id: operation_id, - })) + }))) .await; } diff --git a/v3/crates/graphql-ws/src/websocket/types.rs b/v3/crates/graphql-ws/src/websocket/types.rs index 6513ca3565a..b814cdc5cb1 100644 --- a/v3/crates/graphql-ws/src/websocket/types.rs +++ b/v3/crates/graphql-ws/src/websocket/types.rs @@ -164,7 +164,7 @@ pub enum Message { /// Represents a raw WebSocket message. Raw(ws::Message), /// Represents a message using the protocol server format. - Protocol(protocol::ServerMessage), + Protocol(Box), } impl Message { diff --git a/v3/crates/metadata-resolve/src/stages/object_types/mod.rs b/v3/crates/metadata-resolve/src/stages/object_types/mod.rs index 9fadbf689b7..08fba30cc04 100644 --- a/v3/crates/metadata-resolve/src/stages/object_types/mod.rs +++ b/v3/crates/metadata-resolve/src/stages/object_types/mod.rs @@ -170,34 +170,31 @@ pub fn resolve_object_type( }); } } - match &object_type_definition.global_id_fields { - Some(global_id_fields) => { - if !global_id_fields.is_empty() { - // Throw error if the object type has a field called id" and has global fields configured. - // Because, when the global id fields are configured, the `id` field will be auto-generated. - if resolved_fields.contains_key("id") { - return Err(ObjectTypesError::IdFieldConflictingGlobalId { - type_name: qualified_type_name.clone(), - }); - } - // To check if global_id_fields are defined in object type but no model has global_id_source set to - // true: - // - If the object type has globalIdFields configured, add the object type to the - // global_id_enabled_types map. - global_id_enabled_types.insert(qualified_type_name.clone(), Vec::new()); - }; - for global_id_field in global_id_fields { - if resolved_fields.contains_key(global_id_field) { - resolved_global_id_fields.push(global_id_field.clone()); - } else { - return Err(ObjectTypesError::UnknownFieldInGlobalId { - field_name: global_id_field.clone(), - type_name: qualified_type_name.clone(), - }); - } + if let Some(global_id_fields) = &object_type_definition.global_id_fields { + if !global_id_fields.is_empty() { + // Throw error if the object type has a field called id" and has global fields configured. + // Because, when the global id fields are configured, the `id` field will be auto-generated. + if resolved_fields.contains_key("id") { + return Err(ObjectTypesError::IdFieldConflictingGlobalId { + type_name: qualified_type_name.clone(), + }); + } + // To check if global_id_fields are defined in object type but no model has global_id_source set to + // true: + // - If the object type has globalIdFields configured, add the object type to the + // global_id_enabled_types map. + global_id_enabled_types.insert(qualified_type_name.clone(), Vec::new()); + }; + for global_id_field in global_id_fields { + if resolved_fields.contains_key(global_id_field) { + resolved_global_id_fields.push(global_id_field.clone()); + } else { + return Err(ObjectTypesError::UnknownFieldInGlobalId { + field_name: global_id_field.clone(), + type_name: qualified_type_name.clone(), + }); } } - None => {} } let (graphql_type_name, graphql_input_type_name, apollo_federation_config) = match object_type_definition.graphql.as_ref() { diff --git a/v3/custom-connector.Dockerfile b/v3/custom-connector.Dockerfile index 09d04ccc07f..b653b54d17e 100644 --- a/v3/custom-connector.Dockerfile +++ b/v3/custom-connector.Dockerfile @@ -1,5 +1,5 @@ # This should match the Rust version in rust-toolchain.yaml and the other Dockerfiles. -FROM rust:1.81.0 +FROM rust:1.82.0 WORKDIR app diff --git a/v3/dev-auth-webhook.Dockerfile b/v3/dev-auth-webhook.Dockerfile index ada1882ee54..d2b727ce4ef 100644 --- a/v3/dev-auth-webhook.Dockerfile +++ b/v3/dev-auth-webhook.Dockerfile @@ -1,5 +1,5 @@ # This should match the Rust version in rust-toolchain.yaml and the other Dockerfiles. -FROM rust:1.81.0 AS builder +FROM rust:1.82.0 AS builder WORKDIR /app COPY ./Cargo.toml ./Cargo.toml diff --git a/v3/flake.lock b/v3/flake.lock index 5c941ce6918..1f13f3ce970 100644 --- a/v3/flake.lock +++ b/v3/flake.lock @@ -2,11 +2,11 @@ "nodes": { "crane": { "locked": { - "lastModified": 1725409566, - "narHash": "sha256-PrtLmqhM6UtJP7v7IGyzjBFhbG4eOAHT6LPYOFmYfbk=", + "lastModified": 1729741221, + "narHash": "sha256-8AHZZXs1lFkERfBY0C8cZGElSo33D/et7NKEpLRmvzo=", "owner": "ipetkov", "repo": "crane", - "rev": "7e4586bad4e3f8f97a9271def747cf58c4b68f3c", + "rev": "f235b656ee5b2bfd6d94c3bfd67896a575d4a6ed", "type": "github" }, "original": { @@ -35,11 +35,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1726585183, - "narHash": "sha256-bZZIY8qD5y+jEE8XeNzflvPlUpkOUlJ6RA4+wN7Xwfg=", + "lastModified": 1729776892, + "narHash": "sha256-NGTJbX/zKE1GfUlcqc/lgvvZxiUvWk9s9A1rFeZJyPE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "45b95421fdaf52d38ad3c04ae29ad1de260bbcaf", + "rev": "2aa5b5d837e7cabe4c6632c27f8b005465539f08", "type": "github" }, "original": { @@ -63,11 +63,11 @@ ] }, "locked": { - "lastModified": 1726539203, - "narHash": "sha256-u1tAteb4qkH2gGjDY3mN/4Qxa6y798t4G0jNKDyTwv8=", + "lastModified": 1729736953, + "narHash": "sha256-Rb6JUop7NRklg0uzcre+A+Ebrn/ZiQPkm4QdKg6/3pw=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "20c8461785d8f5af32d8d4d5c128589e23d7f033", + "rev": "29b1275740d9283467b8117499ec8cbb35250584", "type": "github" }, "original": { diff --git a/v3/rust-toolchain.toml b/v3/rust-toolchain.toml index d1c22818a6f..3da27692dd6 100644 --- a/v3/rust-toolchain.toml +++ b/v3/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.81.0" +channel = "1.82.0" profile = "default" # see https://rust-lang.github.io/rustup/concepts/profiles.html components = ["llvm-tools-preview", "rust-analyzer", "rust-src"] # see https://rust-lang.github.io/rustup/concepts/components.html