mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
Bump Rust to 1.82.0 (#1270)
<!-- The PR description should answer 2 important questions: --> ### What As a treat. V3_GIT_ORIGIN_REV_ID: 23369acdd1da6d5df828921818e4b9676e143b92
This commit is contained in:
parent
c395c9add3
commit
35d606f276
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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")
|
||||
}
|
||||
};
|
||||
|
@ -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) => {
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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<protocol::ServerMessage>),
|
||||
}
|
||||
|
||||
impl Message {
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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": {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user