@@ -21,10 +21,9 @@ use serde_json::{Value, json};
|
||||
use shared_contracts::{
|
||||
match3d_agent::{
|
||||
CreateMatch3DAgentSessionRequest, ExecuteMatch3DAgentActionRequest,
|
||||
Match3DAgentActionResponse, Match3DAgentMessageResponse,
|
||||
Match3DAgentSessionResponse, Match3DAgentSessionSnapshotResponse,
|
||||
Match3DAnchorItemResponse, Match3DAnchorPackResponse, Match3DCreatorConfigResponse,
|
||||
Match3DResultDraftResponse, SendMatch3DAgentMessageRequest,
|
||||
Match3DAgentActionResponse, Match3DAgentMessageResponse, Match3DAgentSessionResponse,
|
||||
Match3DAgentSessionSnapshotResponse, Match3DAnchorItemResponse, Match3DAnchorPackResponse,
|
||||
Match3DCreatorConfigResponse, Match3DResultDraftResponse, SendMatch3DAgentMessageRequest,
|
||||
},
|
||||
match3d_runtime::{
|
||||
ClickMatch3DItemRequest, Match3DClickConfirmationResponse, Match3DClickResponse,
|
||||
@@ -41,12 +40,11 @@ use spacetime_client::{
|
||||
Match3DAgentMessageFinalizeRecordInput, Match3DAgentMessageRecord,
|
||||
Match3DAgentMessageSubmitRecordInput, Match3DAgentSessionCreateRecordInput,
|
||||
Match3DAgentSessionRecord, Match3DAnchorItemRecord, Match3DAnchorPackRecord,
|
||||
Match3DClickConfirmationRecord, Match3DCompileDraftRecordInput,
|
||||
Match3DCreatorConfigRecord, Match3DItemSnapshotRecord, Match3DResultDraftRecord,
|
||||
Match3DRunClickRecordInput, Match3DRunRecord, Match3DRunRestartRecordInput,
|
||||
Match3DRunStartRecordInput, Match3DRunStopRecordInput, Match3DRunTimeUpRecordInput,
|
||||
Match3DTraySlotRecord, Match3DWorkProfileRecord, Match3DWorkUpdateRecordInput,
|
||||
SpacetimeClientError,
|
||||
Match3DClickConfirmationRecord, Match3DCompileDraftRecordInput, Match3DCreatorConfigRecord,
|
||||
Match3DItemSnapshotRecord, Match3DResultDraftRecord, Match3DRunClickRecordInput,
|
||||
Match3DRunRecord, Match3DRunRestartRecordInput, Match3DRunStartRecordInput,
|
||||
Match3DRunStopRecordInput, Match3DRunTimeUpRecordInput, Match3DTraySlotRecord,
|
||||
Match3DWorkProfileRecord, Match3DWorkUpdateRecordInput, SpacetimeClientError,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@@ -938,7 +936,11 @@ fn map_match3d_run_response(run: Match3DRunRecord) -> Match3DRunSnapshotResponse
|
||||
clear_count: run.clear_count,
|
||||
total_item_count: run.total_item_count,
|
||||
cleared_item_count: run.cleared_item_count,
|
||||
items: run.items.into_iter().map(map_match3d_item_response).collect(),
|
||||
items: run
|
||||
.items
|
||||
.into_iter()
|
||||
.map(map_match3d_item_response)
|
||||
.collect(),
|
||||
tray_slots: run
|
||||
.tray_slots
|
||||
.into_iter()
|
||||
@@ -1002,7 +1004,10 @@ fn build_config_from_create_request(
|
||||
.unwrap_or(MATCH3D_DEFAULT_THEME)
|
||||
.to_string(),
|
||||
reference_image_src: payload.reference_image_src.clone(),
|
||||
clear_count: payload.clear_count.unwrap_or(MATCH3D_DEFAULT_CLEAR_COUNT).max(1),
|
||||
clear_count: payload
|
||||
.clear_count
|
||||
.unwrap_or(MATCH3D_DEFAULT_CLEAR_COUNT)
|
||||
.max(1),
|
||||
difficulty: payload
|
||||
.difficulty
|
||||
.unwrap_or(MATCH3D_DEFAULT_DIFFICULTY)
|
||||
@@ -1251,7 +1256,11 @@ fn match3d_json<T>(
|
||||
})
|
||||
}
|
||||
|
||||
fn match3d_bad_request(request_context: &RequestContext, provider: &str, message: &str) -> Response {
|
||||
fn match3d_bad_request(
|
||||
request_context: &RequestContext,
|
||||
provider: &str,
|
||||
message: &str,
|
||||
) -> Response {
|
||||
match3d_error_response(
|
||||
request_context,
|
||||
provider,
|
||||
@@ -1317,9 +1326,7 @@ fn match3d_sse_json_event(event_name: &str, payload: Value) -> Result<Event, App
|
||||
fn match3d_sse_json_event_or_error(event_name: &str, payload: Value) -> Event {
|
||||
match match3d_sse_json_event(event_name, payload) {
|
||||
Ok(event) => event,
|
||||
Err(error) => Event::default()
|
||||
.event("error")
|
||||
.data(format!("{error:?}")),
|
||||
Err(error) => Event::default().event("error").data(format!("{error:?}")),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,11 +36,11 @@ use shared_contracts::{
|
||||
},
|
||||
puzzle_gallery::{PuzzleGalleryDetailResponse, PuzzleGalleryResponse},
|
||||
puzzle_runtime::{
|
||||
AdvanceLocalPuzzleNextLevelRequest, PuzzleBoardSnapshotResponse, PuzzleCellPositionResponse,
|
||||
PuzzleLeaderboardEntryResponse, PuzzleMergedGroupStateResponse, PuzzlePieceStateResponse,
|
||||
PuzzleRunResponse, PuzzleRunSnapshotResponse, PuzzleRuntimeLevelSnapshotResponse,
|
||||
StartPuzzleRunRequest, SubmitPuzzleLeaderboardRequest, SwapPuzzlePiecesRequest,
|
||||
UpdatePuzzleRuntimePauseRequest, UsePuzzleRuntimePropRequest,
|
||||
AdvanceLocalPuzzleNextLevelRequest, PuzzleBoardSnapshotResponse,
|
||||
PuzzleCellPositionResponse, PuzzleLeaderboardEntryResponse, PuzzleMergedGroupStateResponse,
|
||||
PuzzlePieceStateResponse, PuzzleRunResponse, PuzzleRunSnapshotResponse,
|
||||
PuzzleRuntimeLevelSnapshotResponse, StartPuzzleRunRequest, SubmitPuzzleLeaderboardRequest,
|
||||
SwapPuzzlePiecesRequest, UpdatePuzzleRuntimePauseRequest, UsePuzzleRuntimePropRequest,
|
||||
},
|
||||
puzzle_works::{
|
||||
PutPuzzleWorkRequest, PuzzleWorkDetailResponse, PuzzleWorkMutationResponse,
|
||||
@@ -57,10 +57,10 @@ use spacetime_client::{
|
||||
PuzzleLeaderboardEntryRecord, PuzzleLeaderboardSubmitRecordInput, PuzzleMergedGroupRecord,
|
||||
PuzzlePieceStateRecord, PuzzlePublishRecordInput, PuzzleResultDraftRecord,
|
||||
PuzzleResultPreviewBlockerRecord, PuzzleResultPreviewFindingRecord, PuzzleResultPreviewRecord,
|
||||
PuzzleRunPauseRecordInput, PuzzleRunPropRecordInput, PuzzleRunRecord, PuzzleRunStartRecordInput,
|
||||
PuzzleRunSwapRecordInput, PuzzleRuntimeLevelRecord, PuzzleSelectCoverImageRecordInput,
|
||||
PuzzleWorkProfileRecord, PuzzleWorkRemixRecordInput, PuzzleWorkUpsertRecordInput,
|
||||
SpacetimeClientError,
|
||||
PuzzleRunPauseRecordInput, PuzzleRunPropRecordInput, PuzzleRunRecord,
|
||||
PuzzleRunStartRecordInput, PuzzleRunSwapRecordInput, PuzzleRuntimeLevelRecord,
|
||||
PuzzleSelectCoverImageRecordInput, PuzzleWorkProfileRecord, PuzzleWorkRemixRecordInput,
|
||||
PuzzleWorkUpsertRecordInput, SpacetimeClientError,
|
||||
};
|
||||
use std::convert::Infallible;
|
||||
use tokio::time::sleep;
|
||||
|
||||
Reference in New Issue
Block a user