mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +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.
|
# 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
|
WORKDIR app
|
||||||
|
|
||||||
|
@ -240,22 +240,21 @@ pub fn authorize_identity(
|
|||||||
let mut role = None;
|
let mut role = None;
|
||||||
// traverse through the headers and collect role and session variables
|
// traverse through the headers and collect role and session variables
|
||||||
for (header_name, header_value) in headers {
|
for (header_name, header_value) in headers {
|
||||||
if let Ok(session_variable) = SessionVariableName::from_str(header_name.as_str()) {
|
let Ok(session_variable) = SessionVariableName::from_str(header_name.as_str());
|
||||||
let variable_value_str = match header_value.to_str() {
|
let variable_value_str = match header_value.to_str() {
|
||||||
Err(e) => Err(SessionError::InvalidHeaderValue {
|
Err(e) => Err(SessionError::InvalidHeaderValue {
|
||||||
header_name: header_name.to_string(),
|
header_name: header_name.to_string(),
|
||||||
error: e.to_string(),
|
error: e.to_string(),
|
||||||
})?,
|
})?,
|
||||||
Ok(h) => h,
|
Ok(h) => h,
|
||||||
};
|
};
|
||||||
let variable_value = SessionVariableValue::Unparsed(variable_value_str.to_string());
|
let variable_value = SessionVariableValue::Unparsed(variable_value_str.to_string());
|
||||||
|
|
||||||
if session_variable == SESSION_VARIABLE_ROLE {
|
if session_variable == SESSION_VARIABLE_ROLE {
|
||||||
role = Some(Role::new(variable_value_str));
|
role = Some(Role::new(variable_value_str));
|
||||||
} else {
|
} else {
|
||||||
// TODO: Handle the duplicate case?
|
// TODO: Handle the duplicate case?
|
||||||
session_variables.insert(session_variable, variable_value);
|
session_variables.insert(session_variable, variable_value);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let session = identity
|
let session = identity
|
||||||
|
@ -769,30 +769,38 @@ async fn run_query_graphql_ws(
|
|||||||
// Assert response
|
// Assert response
|
||||||
let message = channel_receiver.recv().await.expect("Expected a message");
|
let message = channel_receiver.recv().await.expect("Expected a message");
|
||||||
let response = match message {
|
let response = match message {
|
||||||
graphql_ws::Message::Protocol(graphql_ws::ServerMessage::Next { id, payload }) => {
|
graphql_ws::Message::Protocol(message) => match *message {
|
||||||
assert_eq!(operation_id, id);
|
graphql_ws::ServerMessage::Next { id, payload } => {
|
||||||
payload
|
assert_eq!(operation_id, id);
|
||||||
}
|
payload
|
||||||
graphql_ws::Message::Protocol(graphql_ws::ServerMessage::Error {
|
}
|
||||||
id,
|
graphql_ws::ServerMessage::Error {
|
||||||
payload: errors,
|
id,
|
||||||
}) => {
|
payload: errors,
|
||||||
assert_eq!(operation_id, id);
|
} => {
|
||||||
lang_graphql::http::Response::errors(errors)
|
assert_eq!(operation_id, id);
|
||||||
}
|
lang_graphql::http::Response::errors(errors)
|
||||||
_ => {
|
}
|
||||||
panic!("Expected a Next or Error message")
|
_ => {
|
||||||
}
|
panic!("Expected a Next or Error message")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
graphql_ws::Message::Raw(_) => panic!("Expected a Next or Error message"),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Assert completion when no errors
|
// Assert completion when no errors
|
||||||
if response.errors.is_none() {
|
if response.errors.is_none() {
|
||||||
let message = channel_receiver.recv().await.expect("Expected a message");
|
let message = channel_receiver.recv().await.expect("Expected a message");
|
||||||
match message {
|
match message {
|
||||||
graphql_ws::Message::Protocol(graphql_ws::ServerMessage::Complete { id }) => {
|
graphql_ws::Message::Protocol(message) => match *message {
|
||||||
assert_eq!(operation_id, id);
|
graphql_ws::ServerMessage::Complete { id } => {
|
||||||
}
|
assert_eq!(operation_id, id);
|
||||||
_ => {
|
}
|
||||||
|
_ => {
|
||||||
|
panic!("Expected a Complete message")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
graphql_ws::Message::Raw(_) => {
|
||||||
panic!("Expected a Complete message")
|
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
|
// Update state to Initialized and send a connection acknowledgment
|
||||||
*state = ConnectionInitState::Initialized { session, headers };
|
*state = ConnectionInitState::Initialized { session, headers };
|
||||||
connection
|
connection
|
||||||
.send(ws::Message::Protocol(ServerMessage::ConnectionAck))
|
.send(ws::Message::Protocol(Box::new(
|
||||||
|
ServerMessage::ConnectionAck,
|
||||||
|
)))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
Err(ConnectionInitError::AlreadyInitialized) => {
|
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
|
// Respond to a Ping message by sending a Pong
|
||||||
ClientMessage::Ping => {
|
ClientMessage::Ping => {
|
||||||
connection
|
connection
|
||||||
.send(ws::Message::Protocol(ServerMessage::Pong))
|
.send(ws::Message::Protocol(Box::new(ServerMessage::Pong)))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
// Ignore the Pong message as no action is needed
|
// 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
|
// Send the plugin error response to the client
|
||||||
let graphql_error = error.into_graphql_error(&plugin_name);
|
let graphql_error = error.into_graphql_error(&plugin_name);
|
||||||
connection
|
connection
|
||||||
.send(ws::Message::Protocol(ServerMessage::Error {
|
.send(ws::Message::Protocol(Box::new(
|
||||||
id: operation_id.clone(),
|
ServerMessage::Error {
|
||||||
payload: NonEmpty::new(graphql_error),
|
id: operation_id.clone(),
|
||||||
}))
|
payload: NonEmpty::new(graphql_error),
|
||||||
|
},
|
||||||
|
)))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,10 +141,10 @@ pub async fn handle_subscribe(
|
|||||||
Error::PreParsePlugin(e) => {
|
Error::PreParsePlugin(e) => {
|
||||||
// If the pre-parse plugin fails, send an error message.
|
// If the pre-parse plugin fails, send an error message.
|
||||||
connection
|
connection
|
||||||
.send(ws::Message::Protocol(ServerMessage::Error {
|
.send(ws::Message::Protocol(Box::new(ServerMessage::Error {
|
||||||
id: operation_id,
|
id: operation_id,
|
||||||
payload: NonEmpty::new(e.into_graphql_error()),
|
payload: NonEmpty::new(e.into_graphql_error()),
|
||||||
}))
|
})))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -239,7 +241,9 @@ pub async fn send_request_error(
|
|||||||
id: operation_id,
|
id: operation_id,
|
||||||
payload: NonEmpty::new(gql_error),
|
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
|
// Exported for testing purpose
|
||||||
@ -482,10 +486,10 @@ async fn send_graphql_ok(
|
|||||||
connection: &ws::Connection,
|
connection: &ws::Connection,
|
||||||
) {
|
) {
|
||||||
connection
|
connection
|
||||||
.send(ws::Message::Protocol(ServerMessage::Next {
|
.send(ws::Message::Protocol(Box::new(ServerMessage::Next {
|
||||||
id: operation_id,
|
id: operation_id,
|
||||||
payload: response,
|
payload: response,
|
||||||
}))
|
})))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,19 +500,19 @@ async fn send_graphql_errors(
|
|||||||
connection: &ws::Connection,
|
connection: &ws::Connection,
|
||||||
) {
|
) {
|
||||||
connection
|
connection
|
||||||
.send(ws::Message::Protocol(ServerMessage::Error {
|
.send(ws::Message::Protocol(Box::new(ServerMessage::Error {
|
||||||
id: operation_id,
|
id: operation_id,
|
||||||
payload: errors,
|
payload: errors,
|
||||||
}))
|
})))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sends a complete message after the query/mutation execution finishes.
|
/// Sends a complete message after the query/mutation execution finishes.
|
||||||
async fn send_complete(operation_id: OperationId, connection: &ws::Connection) {
|
async fn send_complete(operation_id: OperationId, connection: &ws::Connection) {
|
||||||
connection
|
connection
|
||||||
.send(ws::Message::Protocol(ServerMessage::Complete {
|
.send(ws::Message::Protocol(Box::new(ServerMessage::Complete {
|
||||||
id: operation_id,
|
id: operation_id,
|
||||||
}))
|
})))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ pub enum Message {
|
|||||||
/// Represents a raw WebSocket message.
|
/// Represents a raw WebSocket message.
|
||||||
Raw(ws::Message),
|
Raw(ws::Message),
|
||||||
/// Represents a message using the protocol server format.
|
/// Represents a message using the protocol server format.
|
||||||
Protocol(protocol::ServerMessage),
|
Protocol(Box<protocol::ServerMessage>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Message {
|
impl Message {
|
||||||
|
@ -170,34 +170,31 @@ pub fn resolve_object_type(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
match &object_type_definition.global_id_fields {
|
if let Some(global_id_fields) = &object_type_definition.global_id_fields {
|
||||||
Some(global_id_fields) => {
|
if !global_id_fields.is_empty() {
|
||||||
if !global_id_fields.is_empty() {
|
// Throw error if the object type has a field called id" and has global fields configured.
|
||||||
// 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.
|
||||||
// Because, when the global id fields are configured, the `id` field will be auto-generated.
|
if resolved_fields.contains_key("id") {
|
||||||
if resolved_fields.contains_key("id") {
|
return Err(ObjectTypesError::IdFieldConflictingGlobalId {
|
||||||
return Err(ObjectTypesError::IdFieldConflictingGlobalId {
|
type_name: qualified_type_name.clone(),
|
||||||
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
|
||||||
// To check if global_id_fields are defined in object type but no model has global_id_source set to
|
// true:
|
||||||
// true:
|
// - If the object type has globalIdFields configured, add the object type to the
|
||||||
// - If the object type has globalIdFields configured, add the object type to the
|
// global_id_enabled_types map.
|
||||||
// global_id_enabled_types map.
|
global_id_enabled_types.insert(qualified_type_name.clone(), Vec::new());
|
||||||
global_id_enabled_types.insert(qualified_type_name.clone(), Vec::new());
|
};
|
||||||
};
|
for global_id_field in global_id_fields {
|
||||||
for global_id_field in global_id_fields {
|
if resolved_fields.contains_key(global_id_field) {
|
||||||
if resolved_fields.contains_key(global_id_field) {
|
resolved_global_id_fields.push(global_id_field.clone());
|
||||||
resolved_global_id_fields.push(global_id_field.clone());
|
} else {
|
||||||
} else {
|
return Err(ObjectTypesError::UnknownFieldInGlobalId {
|
||||||
return Err(ObjectTypesError::UnknownFieldInGlobalId {
|
field_name: global_id_field.clone(),
|
||||||
field_name: global_id_field.clone(),
|
type_name: qualified_type_name.clone(),
|
||||||
type_name: qualified_type_name.clone(),
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {}
|
|
||||||
}
|
}
|
||||||
let (graphql_type_name, graphql_input_type_name, apollo_federation_config) =
|
let (graphql_type_name, graphql_input_type_name, apollo_federation_config) =
|
||||||
match object_type_definition.graphql.as_ref() {
|
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.
|
# 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
|
WORKDIR app
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# This should match the Rust version in rust-toolchain.yaml and the other Dockerfiles.
|
# 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
|
WORKDIR /app
|
||||||
COPY ./Cargo.toml ./Cargo.toml
|
COPY ./Cargo.toml ./Cargo.toml
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"crane": {
|
"crane": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725409566,
|
"lastModified": 1729741221,
|
||||||
"narHash": "sha256-PrtLmqhM6UtJP7v7IGyzjBFhbG4eOAHT6LPYOFmYfbk=",
|
"narHash": "sha256-8AHZZXs1lFkERfBY0C8cZGElSo33D/et7NKEpLRmvzo=",
|
||||||
"owner": "ipetkov",
|
"owner": "ipetkov",
|
||||||
"repo": "crane",
|
"repo": "crane",
|
||||||
"rev": "7e4586bad4e3f8f97a9271def747cf58c4b68f3c",
|
"rev": "f235b656ee5b2bfd6d94c3bfd67896a575d4a6ed",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -35,11 +35,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726585183,
|
"lastModified": 1729776892,
|
||||||
"narHash": "sha256-bZZIY8qD5y+jEE8XeNzflvPlUpkOUlJ6RA4+wN7Xwfg=",
|
"narHash": "sha256-NGTJbX/zKE1GfUlcqc/lgvvZxiUvWk9s9A1rFeZJyPE=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "45b95421fdaf52d38ad3c04ae29ad1de260bbcaf",
|
"rev": "2aa5b5d837e7cabe4c6632c27f8b005465539f08",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -63,11 +63,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726539203,
|
"lastModified": 1729736953,
|
||||||
"narHash": "sha256-u1tAteb4qkH2gGjDY3mN/4Qxa6y798t4G0jNKDyTwv8=",
|
"narHash": "sha256-Rb6JUop7NRklg0uzcre+A+Ebrn/ZiQPkm4QdKg6/3pw=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "20c8461785d8f5af32d8d4d5c128589e23d7f033",
|
"rev": "29b1275740d9283467b8117499ec8cbb35250584",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.81.0"
|
channel = "1.82.0"
|
||||||
profile = "default" # see https://rust-lang.github.io/rustup/concepts/profiles.html
|
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
|
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