This commit is contained in:
2026-04-29 11:51:04 +08:00
parent e191619ab3
commit 412279ae11
89 changed files with 3966 additions and 491 deletions

View File

@@ -2,6 +2,7 @@ use super::*;
use crate::mapper::*;
use crate::module_bindings::delete_big_fish_work_procedure::delete_big_fish_work;
use crate::module_bindings::record_big_fish_play_procedure::record_big_fish_play;
use crate::module_bindings::remix_big_fish_work_procedure::remix_big_fish_work;
impl SpacetimeClient {
pub async fn create_big_fish_session(
@@ -290,4 +291,29 @@ impl SpacetimeClient {
})
.await
}
pub async fn remix_big_fish_work(
&self,
input: BigFishWorkRemixRecordInput,
) -> Result<BigFishSessionRecord, SpacetimeClientError> {
let procedure_input = BigFishWorkRemixInput {
source_session_id: input.source_session_id,
target_session_id: input.target_session_id,
target_owner_user_id: input.target_owner_user_id,
welcome_message_id: input.welcome_message_id,
remixed_at_micros: input.remixed_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.remix_big_fish_work_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_big_fish_session_procedure_result);
send_once(&sender, mapped);
});
})
.await
}
}

View File

@@ -1,6 +1,8 @@
use super::*;
use crate::mapper::*;
use crate::module_bindings::delete_custom_world_agent_session_procedure::delete_custom_world_agent_session;
use crate::module_bindings::record_custom_world_profile_play_procedure::record_custom_world_profile_play;
use crate::module_bindings::remix_custom_world_profile_procedure::remix_custom_world_profile;
impl SpacetimeClient {
pub async fn list_custom_world_profiles(
@@ -209,6 +211,55 @@ impl SpacetimeClient {
.await
}
pub async fn remix_custom_world_profile(
&self,
input: CustomWorldProfileRemixRecordInput,
) -> Result<CustomWorldLibraryMutationRecord, SpacetimeClientError> {
let procedure_input = CustomWorldProfileRemixInput {
source_owner_user_id: input.source_owner_user_id,
source_profile_id: input.source_profile_id,
target_owner_user_id: input.target_owner_user_id,
target_profile_id: input.target_profile_id,
author_display_name: input.author_display_name,
remixed_at_micros: input.remixed_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.remix_custom_world_profile_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_custom_world_library_mutation_result);
send_once(&sender, mapped);
});
})
.await
}
pub async fn record_custom_world_profile_play(
&self,
input: CustomWorldProfilePlayReportRecordInput,
) -> Result<CustomWorldLibraryMutationRecord, SpacetimeClientError> {
let procedure_input = CustomWorldProfilePlayRecordInput {
owner_user_id: input.owner_user_id,
profile_id: input.profile_id,
played_at_micros: input.played_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.record_custom_world_profile_play_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_custom_world_library_mutation_result);
send_once(&sender, mapped);
});
})
.await
}
pub async fn publish_custom_world_world(
&self,
input: CustomWorldPublishWorldRecordInput,

View File

@@ -20,8 +20,9 @@ pub use mapper::{
CustomWorldCheckpointRecord, CustomWorldDraftCardDetailRecord,
CustomWorldDraftCardDetailSectionRecord, CustomWorldDraftCardRecord,
CustomWorldGalleryEntryRecord, CustomWorldLibraryEntryRecord, CustomWorldLibraryMutationRecord,
CustomWorldProfileUpsertRecordInput, CustomWorldPublishGateRecord,
CustomWorldPublishWorldRecord, CustomWorldPublishWorldRecordInput,
CustomWorldProfilePlayReportRecordInput, CustomWorldProfileRemixRecordInput,
CustomWorldProfileUpsertRecordInput, CustomWorldPublishGateRecord, CustomWorldPublishWorldRecord,
CustomWorldPublishWorldRecordInput,
CustomWorldPublishedProfileCompileRecord, CustomWorldResultPreviewBlockerRecord,
CustomWorldSupportedActionRecord, CustomWorldWorkSummaryRecord, NpcBattleInteractionRecord,
NpcInteractionRecord, NpcStateRecord, PuzzleAgentMessageFinalizeRecordInput,
@@ -33,10 +34,10 @@ pub use mapper::{
PuzzleLeaderboardEntryRecord, PuzzleLeaderboardSubmitRecordInput, PuzzleMergedGroupRecord,
PuzzlePieceStateRecord, PuzzlePublishRecordInput, PuzzleResultDraftRecord,
PuzzleResultPreviewBlockerRecord, PuzzleResultPreviewFindingRecord, PuzzleResultPreviewRecord,
PuzzleRunDragRecordInput, PuzzleRunNextLevelRecordInput, PuzzleRunRecord,
PuzzleRunDragRecordInput, PuzzleRunNextLevelRecordInput, PuzzleRunRecord, PuzzleWorkRemixRecordInput,
PuzzleRunStartRecordInput, PuzzleRunSwapRecordInput, PuzzleRuntimeLevelRecord,
PuzzleSelectCoverImageRecordInput, PuzzleWorkProfileRecord, PuzzleWorkUpsertRecordInput,
ResolveCombatActionRecord, ResolveNpcBattleInteractionInput,
ResolveCombatActionRecord, ResolveNpcBattleInteractionInput, BigFishWorkRemixRecordInput,
};
pub mod ai;

View File

@@ -1885,6 +1885,9 @@ pub(crate) fn map_custom_world_library_entry_from_profile_snapshot(
.to_string(),
playable_npc_count: snapshot.playable_npc_count,
landmark_count: snapshot.landmark_count,
play_count: snapshot.play_count,
remix_count: snapshot.remix_count,
like_count: snapshot.like_count,
})
}
@@ -1910,6 +1913,9 @@ pub(crate) fn map_custom_world_gallery_entry_snapshot(
.to_string(),
playable_npc_count: snapshot.playable_npc_count,
landmark_count: snapshot.landmark_count,
play_count: snapshot.play_count,
remix_count: snapshot.remix_count,
like_count: snapshot.like_count,
})
}
@@ -2387,6 +2393,8 @@ pub(crate) fn map_puzzle_work_profile(
updated_at: format_timestamp_micros(snapshot.updated_at_micros),
published_at: snapshot.published_at_micros.map(format_timestamp_micros),
play_count: snapshot.play_count,
remix_count: snapshot.remix_count,
like_count: snapshot.like_count,
publish_ready: snapshot.publish_ready,
anchor_pack: map_puzzle_anchor_pack(snapshot.anchor_pack),
}
@@ -3937,6 +3945,9 @@ pub struct CustomWorldLibraryEntryRecord {
pub theme_mode: String,
pub playable_npc_count: u32,
pub landmark_count: u32,
pub play_count: u32,
pub remix_count: u32,
pub like_count: u32,
}
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -3956,6 +3967,9 @@ pub struct CustomWorldGalleryEntryRecord {
pub theme_mode: String,
pub playable_npc_count: u32,
pub landmark_count: u32,
pub play_count: u32,
pub remix_count: u32,
pub like_count: u32,
}
#[derive(Clone, Debug, PartialEq)]
@@ -4172,6 +4186,23 @@ pub struct CustomWorldProfileUpsertRecordInput {
pub updated_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CustomWorldProfileRemixRecordInput {
pub source_owner_user_id: String,
pub source_profile_id: String,
pub target_owner_user_id: String,
pub target_profile_id: String,
pub author_display_name: String,
pub remixed_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CustomWorldProfilePlayReportRecordInput {
pub owner_user_id: String,
pub profile_id: String,
pub played_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CustomWorldPublishWorldRecordInput {
pub session_id: String,
@@ -4334,6 +4365,18 @@ pub struct PuzzleWorkUpsertRecordInput {
pub updated_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PuzzleWorkRemixRecordInput {
pub source_profile_id: String,
pub target_owner_user_id: String,
pub target_session_id: String,
pub target_profile_id: String,
pub target_work_id: String,
pub author_display_name: String,
pub welcome_message_id: String,
pub remixed_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PuzzleRunStartRecordInput {
pub run_id: String,
@@ -4376,6 +4419,15 @@ pub struct BigFishPlayReportRecordInput {
pub reported_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct BigFishWorkRemixRecordInput {
pub source_session_id: String,
pub target_session_id: String,
pub target_owner_user_id: String,
pub welcome_message_id: String,
pub remixed_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PuzzleAnchorItemRecord {
pub key: String,
@@ -4502,6 +4554,8 @@ pub struct PuzzleWorkProfileRecord {
pub updated_at: String,
pub published_at: Option<String>,
pub play_count: u32,
pub remix_count: u32,
pub like_count: u32,
pub publish_ready: bool,
pub anchor_pack: PuzzleAnchorPackRecord,
}
@@ -4771,12 +4825,15 @@ pub struct BigFishWorkSummaryRecord {
pub cover_image_src: Option<String>,
pub status: String,
pub updated_at_micros: i64,
pub published_at_micros: Option<i64>,
pub publish_ready: bool,
pub level_count: u32,
pub level_main_image_ready_count: u32,
pub level_motion_ready_count: u32,
pub background_ready: bool,
pub play_count: u32,
pub remix_count: u32,
pub like_count: u32,
}
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize)]
@@ -4791,6 +4848,8 @@ struct CompatibleBigFishWorkSummaryRecord {
cover_image_src: Option<String>,
status: String,
updated_at_micros: i64,
#[serde(default)]
published_at_micros: Option<i64>,
publish_ready: bool,
level_count: u32,
level_main_image_ready_count: u32,
@@ -4798,6 +4857,10 @@ struct CompatibleBigFishWorkSummaryRecord {
background_ready: bool,
#[serde(default)]
play_count: u32,
#[serde(default)]
remix_count: u32,
#[serde(default)]
like_count: u32,
}
impl CompatibleBigFishWorkSummaryRecord {
@@ -4817,12 +4880,15 @@ impl CompatibleBigFishWorkSummaryRecord {
cover_image_src: self.cover_image_src,
status: self.status,
updated_at_micros: self.updated_at_micros,
published_at_micros: self.published_at_micros,
publish_ready: self.publish_ready,
level_count: self.level_count,
level_main_image_ready_count: self.level_main_image_ready_count,
level_motion_ready_count: self.level_motion_ready_count,
background_ready: self.background_ready,
play_count: self.play_count,
remix_count: self.remix_count,
like_count: self.like_count,
}
}
}
@@ -4831,6 +4897,73 @@ impl CompatibleBigFishWorkSummaryRecord {
mod tests {
use super::*;
#[test]
fn puzzle_works_mapper_backfills_missing_public_stat_fields() {
let result = PuzzleWorksProcedureResult {
ok: true,
items_json: Some(
r#"[{
"work_id":"puzzle-work-1",
"profile_id":"puzzle-profile-1",
"owner_user_id":"user-1",
"source_session_id":null,
"author_display_name":"测试作者",
"level_name":"雨夜拼图",
"summary":"旧公开作品摘要",
"theme_tags":["雨夜","猫咪","神庙"],
"cover_image_src":null,
"cover_asset_id":null,
"publication_status":"Published",
"updated_at_micros":123000000,
"published_at_micros":123000000,
"publish_ready":true,
"anchor_pack":{
"theme_promise":{
"key":"themePromise",
"label":"题材承诺",
"value":"雨夜冒险",
"status":"Inferred"
},
"visual_subject":{
"key":"visualSubject",
"label":"画面主体",
"value":"猫咪神庙",
"status":"Inferred"
},
"visual_mood":{
"key":"visualMood",
"label":"视觉气质",
"value":"温暖",
"status":"Inferred"
},
"composition_hooks":{
"key":"compositionHooks",
"label":"拼图记忆点",
"value":"灯光",
"status":"Inferred"
},
"tags_and_forbidden":{
"key":"tagsAndForbidden",
"label":"标签与禁忌",
"value":"雨夜, 猫咪, 神庙",
"status":"Inferred"
}
}
}]"#
.to_string(),
),
error_message: None,
};
let items = map_puzzle_works_procedure_result(result)
.expect("旧 puzzle works JSON 缺统计字段时应按 0 兼容");
assert_eq!(items.len(), 1);
assert_eq!(items[0].play_count, 0);
assert_eq!(items[0].remix_count, 0);
assert_eq!(items[0].like_count, 0);
}
#[test]
fn big_fish_works_mapper_backfills_missing_owner_user_id_for_private_lists() {
let result = BigFishWorksProcedureResult {
@@ -4861,6 +4994,10 @@ mod tests {
assert_eq!(items.len(), 1);
assert_eq!(items[0].owner_user_id, "user-1");
assert_eq!(items[0].published_at_micros, None);
assert_eq!(items[0].play_count, 0);
assert_eq!(items[0].remix_count, 0);
assert_eq!(items[0].like_count, 0);
}
#[test]
@@ -4893,6 +5030,10 @@ mod tests {
assert_eq!(items.len(), 1);
assert!(items[0].owner_user_id.is_empty());
assert_eq!(items[0].published_at_micros, None);
assert_eq!(items[0].play_count, 0);
assert_eq!(items[0].remix_count, 0);
assert_eq!(items[0].like_count, 0);
}
}

View File

@@ -21,6 +21,9 @@ pub struct BigFishCreationSession {
pub last_assistant_reply: Option<String>,
pub publish_ready: bool,
pub play_count: u32,
pub remix_count: u32,
pub like_count: u32,
pub published_at: Option<__sdk::Timestamp>,
pub created_at: __sdk::Timestamp,
pub updated_at: __sdk::Timestamp,
}
@@ -45,6 +48,9 @@ pub struct BigFishCreationSessionCols {
pub last_assistant_reply: __sdk::__query_builder::Col<BigFishCreationSession, Option<String>>,
pub publish_ready: __sdk::__query_builder::Col<BigFishCreationSession, bool>,
pub play_count: __sdk::__query_builder::Col<BigFishCreationSession, u32>,
pub remix_count: __sdk::__query_builder::Col<BigFishCreationSession, u32>,
pub like_count: __sdk::__query_builder::Col<BigFishCreationSession, u32>,
pub published_at: __sdk::__query_builder::Col<BigFishCreationSession, Option<__sdk::Timestamp>>,
pub created_at: __sdk::__query_builder::Col<BigFishCreationSession, __sdk::Timestamp>,
pub updated_at: __sdk::__query_builder::Col<BigFishCreationSession, __sdk::Timestamp>,
}
@@ -71,6 +77,9 @@ impl __sdk::__query_builder::HasCols for BigFishCreationSession {
),
publish_ready: __sdk::__query_builder::Col::new(table_name, "publish_ready"),
play_count: __sdk::__query_builder::Col::new(table_name, "play_count"),
remix_count: __sdk::__query_builder::Col::new(table_name, "remix_count"),
like_count: __sdk::__query_builder::Col::new(table_name, "like_count"),
published_at: __sdk::__query_builder::Col::new(table_name, "published_at"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
}

View File

@@ -0,0 +1,19 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct BigFishWorkRemixInput {
pub source_session_id: String,
pub target_session_id: String,
pub target_owner_user_id: String,
pub welcome_message_id: String,
pub remixed_at_micros: i64,
}
impl __sdk::InModule for BigFishWorkRemixInput {
type Module = super::RemoteModule;
}

View File

@@ -21,6 +21,9 @@ pub struct CustomWorldGalleryEntrySnapshot {
pub theme_mode: CustomWorldThemeMode,
pub playable_npc_count: u32,
pub landmark_count: u32,
pub play_count: u32,
pub remix_count: u32,
pub like_count: u32,
pub published_at_micros: i64,
pub updated_at_micros: i64,
}

View File

@@ -21,6 +21,9 @@ pub struct CustomWorldGalleryEntry {
pub theme_mode: CustomWorldThemeMode,
pub playable_npc_count: u32,
pub landmark_count: u32,
pub play_count: u32,
pub remix_count: u32,
pub like_count: u32,
pub published_at: __sdk::Timestamp,
pub updated_at: __sdk::Timestamp,
}
@@ -45,6 +48,9 @@ pub struct CustomWorldGalleryEntryCols {
pub theme_mode: __sdk::__query_builder::Col<CustomWorldGalleryEntry, CustomWorldThemeMode>,
pub playable_npc_count: __sdk::__query_builder::Col<CustomWorldGalleryEntry, u32>,
pub landmark_count: __sdk::__query_builder::Col<CustomWorldGalleryEntry, u32>,
pub play_count: __sdk::__query_builder::Col<CustomWorldGalleryEntry, u32>,
pub remix_count: __sdk::__query_builder::Col<CustomWorldGalleryEntry, u32>,
pub like_count: __sdk::__query_builder::Col<CustomWorldGalleryEntry, u32>,
pub published_at: __sdk::__query_builder::Col<CustomWorldGalleryEntry, __sdk::Timestamp>,
pub updated_at: __sdk::__query_builder::Col<CustomWorldGalleryEntry, __sdk::Timestamp>,
}
@@ -71,6 +77,9 @@ impl __sdk::__query_builder::HasCols for CustomWorldGalleryEntry {
theme_mode: __sdk::__query_builder::Col::new(table_name, "theme_mode"),
playable_npc_count: __sdk::__query_builder::Col::new(table_name, "playable_npc_count"),
landmark_count: __sdk::__query_builder::Col::new(table_name, "landmark_count"),
play_count: __sdk::__query_builder::Col::new(table_name, "play_count"),
remix_count: __sdk::__query_builder::Col::new(table_name, "remix_count"),
like_count: __sdk::__query_builder::Col::new(table_name, "like_count"),
published_at: __sdk::__query_builder::Col::new(table_name, "published_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
}

View File

@@ -0,0 +1,17 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct CustomWorldProfilePlayRecordInput {
pub owner_user_id: String,
pub profile_id: String,
pub played_at_micros: i64,
}
impl __sdk::InModule for CustomWorldProfilePlayRecordInput {
type Module = super::RemoteModule;
}

View File

@@ -0,0 +1,20 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct CustomWorldProfileRemixInput {
pub source_owner_user_id: String,
pub source_profile_id: String,
pub target_owner_user_id: String,
pub target_profile_id: String,
pub author_display_name: String,
pub remixed_at_micros: i64,
}
impl __sdk::InModule for CustomWorldProfileRemixInput {
type Module = super::RemoteModule;
}

View File

@@ -24,6 +24,9 @@ pub struct CustomWorldProfileSnapshot {
pub profile_payload_json: String,
pub playable_npc_count: u32,
pub landmark_count: u32,
pub play_count: u32,
pub remix_count: u32,
pub like_count: u32,
pub author_display_name: String,
pub published_at_micros: Option<i64>,
pub deleted_at_micros: Option<i64>,

View File

@@ -24,6 +24,9 @@ pub struct CustomWorldProfile {
pub profile_payload_json: String,
pub playable_npc_count: u32,
pub landmark_count: u32,
pub play_count: u32,
pub remix_count: u32,
pub like_count: u32,
pub author_display_name: String,
pub published_at: Option<__sdk::Timestamp>,
pub deleted_at: Option<__sdk::Timestamp>,
@@ -54,6 +57,9 @@ pub struct CustomWorldProfileCols {
pub profile_payload_json: __sdk::__query_builder::Col<CustomWorldProfile, String>,
pub playable_npc_count: __sdk::__query_builder::Col<CustomWorldProfile, u32>,
pub landmark_count: __sdk::__query_builder::Col<CustomWorldProfile, u32>,
pub play_count: __sdk::__query_builder::Col<CustomWorldProfile, u32>,
pub remix_count: __sdk::__query_builder::Col<CustomWorldProfile, u32>,
pub like_count: __sdk::__query_builder::Col<CustomWorldProfile, u32>,
pub author_display_name: __sdk::__query_builder::Col<CustomWorldProfile, String>,
pub published_at: __sdk::__query_builder::Col<CustomWorldProfile, Option<__sdk::Timestamp>>,
pub deleted_at: __sdk::__query_builder::Col<CustomWorldProfile, Option<__sdk::Timestamp>>,
@@ -88,6 +94,9 @@ impl __sdk::__query_builder::HasCols for CustomWorldProfile {
),
playable_npc_count: __sdk::__query_builder::Col::new(table_name, "playable_npc_count"),
landmark_count: __sdk::__query_builder::Col::new(table_name, "landmark_count"),
play_count: __sdk::__query_builder::Col::new(table_name, "play_count"),
remix_count: __sdk::__query_builder::Col::new(table_name, "remix_count"),
like_count: __sdk::__query_builder::Col::new(table_name, "like_count"),
author_display_name: __sdk::__query_builder::Col::new(
table_name,
"author_display_name",

View File

@@ -99,6 +99,7 @@ pub mod big_fish_session_get_input_type;
pub mod big_fish_session_procedure_result_type;
pub mod big_fish_session_snapshot_type;
pub mod big_fish_work_delete_input_type;
pub mod big_fish_work_remix_input_type;
pub mod big_fish_works_list_input_type;
pub mod big_fish_works_procedure_result_type;
pub mod bind_asset_object_to_entity_and_return_procedure;
@@ -166,7 +167,9 @@ pub mod custom_world_library_mutation_result_type;
pub mod custom_world_profile_delete_input_type;
pub mod custom_world_profile_list_input_type;
pub mod custom_world_profile_list_result_type;
pub mod custom_world_profile_play_record_input_type;
pub mod custom_world_profile_publish_input_type;
pub mod custom_world_profile_remix_input_type;
pub mod custom_world_profile_snapshot_type;
pub mod custom_world_profile_type;
pub mod custom_world_profile_unpublish_input_type;
@@ -318,6 +321,7 @@ pub mod puzzle_work_delete_input_type;
pub mod puzzle_work_get_input_type;
pub mod puzzle_work_procedure_result_type;
pub mod puzzle_work_profile_row_type;
pub mod puzzle_work_remix_input_type;
pub mod puzzle_work_upsert_input_type;
pub mod puzzle_works_list_input_type;
pub mod puzzle_works_procedure_result_type;
@@ -349,10 +353,14 @@ pub mod quest_step_snapshot_type;
pub mod quest_treasure_inspected_signal_type;
pub mod quest_turn_in_input_type;
pub mod record_big_fish_play_procedure;
pub mod record_custom_world_profile_play_procedure;
pub mod redeem_profile_referral_invite_code_procedure;
pub mod redeem_profile_reward_code_procedure;
pub mod refresh_session_type;
pub mod refund_profile_wallet_points_and_return_procedure;
pub mod remix_big_fish_work_procedure;
pub mod remix_custom_world_profile_procedure;
pub mod remix_puzzle_work_procedure;
pub mod resolve_combat_action_and_return_procedure;
pub mod resolve_combat_action_input_type;
pub mod resolve_combat_action_procedure_result_type;
@@ -583,6 +591,7 @@ pub use big_fish_session_get_input_type::BigFishSessionGetInput;
pub use big_fish_session_procedure_result_type::BigFishSessionProcedureResult;
pub use big_fish_session_snapshot_type::BigFishSessionSnapshot;
pub use big_fish_work_delete_input_type::BigFishWorkDeleteInput;
pub use big_fish_work_remix_input_type::BigFishWorkRemixInput;
pub use big_fish_works_list_input_type::BigFishWorksListInput;
pub use big_fish_works_procedure_result_type::BigFishWorksProcedureResult;
pub use bind_asset_object_to_entity_and_return_procedure::bind_asset_object_to_entity_and_return;
@@ -650,7 +659,9 @@ pub use custom_world_library_mutation_result_type::CustomWorldLibraryMutationRes
pub use custom_world_profile_delete_input_type::CustomWorldProfileDeleteInput;
pub use custom_world_profile_list_input_type::CustomWorldProfileListInput;
pub use custom_world_profile_list_result_type::CustomWorldProfileListResult;
pub use custom_world_profile_play_record_input_type::CustomWorldProfilePlayRecordInput;
pub use custom_world_profile_publish_input_type::CustomWorldProfilePublishInput;
pub use custom_world_profile_remix_input_type::CustomWorldProfileRemixInput;
pub use custom_world_profile_snapshot_type::CustomWorldProfileSnapshot;
pub use custom_world_profile_type::CustomWorldProfile;
pub use custom_world_profile_unpublish_input_type::CustomWorldProfileUnpublishInput;
@@ -802,6 +813,7 @@ pub use puzzle_work_delete_input_type::PuzzleWorkDeleteInput;
pub use puzzle_work_get_input_type::PuzzleWorkGetInput;
pub use puzzle_work_procedure_result_type::PuzzleWorkProcedureResult;
pub use puzzle_work_profile_row_type::PuzzleWorkProfileRow;
pub use puzzle_work_remix_input_type::PuzzleWorkRemixInput;
pub use puzzle_work_upsert_input_type::PuzzleWorkUpsertInput;
pub use puzzle_works_list_input_type::PuzzleWorksListInput;
pub use puzzle_works_procedure_result_type::PuzzleWorksProcedureResult;
@@ -833,10 +845,14 @@ pub use quest_step_snapshot_type::QuestStepSnapshot;
pub use quest_treasure_inspected_signal_type::QuestTreasureInspectedSignal;
pub use quest_turn_in_input_type::QuestTurnInInput;
pub use record_big_fish_play_procedure::record_big_fish_play;
pub use record_custom_world_profile_play_procedure::record_custom_world_profile_play;
pub use redeem_profile_referral_invite_code_procedure::redeem_profile_referral_invite_code;
pub use redeem_profile_reward_code_procedure::redeem_profile_reward_code;
pub use refresh_session_type::RefreshSession;
pub use refund_profile_wallet_points_and_return_procedure::refund_profile_wallet_points_and_return;
pub use remix_big_fish_work_procedure::remix_big_fish_work;
pub use remix_custom_world_profile_procedure::remix_custom_world_profile;
pub use remix_puzzle_work_procedure::remix_puzzle_work;
pub use resolve_combat_action_and_return_procedure::resolve_combat_action_and_return;
pub use resolve_combat_action_input_type::ResolveCombatActionInput;
pub use resolve_combat_action_procedure_result_type::ResolveCombatActionProcedureResult;

View File

@@ -21,6 +21,8 @@ pub struct PuzzleWorkProfileRow {
pub cover_asset_id: Option<String>,
pub publication_status: PuzzlePublicationStatus,
pub play_count: u32,
pub remix_count: u32,
pub like_count: u32,
pub anchor_pack_json: String,
pub publish_ready: bool,
pub created_at: __sdk::Timestamp,
@@ -49,6 +51,8 @@ pub struct PuzzleWorkProfileRowCols {
pub publication_status:
__sdk::__query_builder::Col<PuzzleWorkProfileRow, PuzzlePublicationStatus>,
pub play_count: __sdk::__query_builder::Col<PuzzleWorkProfileRow, u32>,
pub remix_count: __sdk::__query_builder::Col<PuzzleWorkProfileRow, u32>,
pub like_count: __sdk::__query_builder::Col<PuzzleWorkProfileRow, u32>,
pub anchor_pack_json: __sdk::__query_builder::Col<PuzzleWorkProfileRow, String>,
pub publish_ready: __sdk::__query_builder::Col<PuzzleWorkProfileRow, bool>,
pub created_at: __sdk::__query_builder::Col<PuzzleWorkProfileRow, __sdk::Timestamp>,
@@ -75,6 +79,8 @@ impl __sdk::__query_builder::HasCols for PuzzleWorkProfileRow {
cover_asset_id: __sdk::__query_builder::Col::new(table_name, "cover_asset_id"),
publication_status: __sdk::__query_builder::Col::new(table_name, "publication_status"),
play_count: __sdk::__query_builder::Col::new(table_name, "play_count"),
remix_count: __sdk::__query_builder::Col::new(table_name, "remix_count"),
like_count: __sdk::__query_builder::Col::new(table_name, "like_count"),
anchor_pack_json: __sdk::__query_builder::Col::new(table_name, "anchor_pack_json"),
publish_ready: __sdk::__query_builder::Col::new(table_name, "publish_ready"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),

View File

@@ -0,0 +1,22 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct PuzzleWorkRemixInput {
pub source_profile_id: String,
pub target_owner_user_id: String,
pub target_session_id: String,
pub target_profile_id: String,
pub target_work_id: String,
pub author_display_name: String,
pub welcome_message_id: String,
pub remixed_at_micros: i64,
}
impl __sdk::InModule for PuzzleWorkRemixInput {
type Module = super::RemoteModule;
}

View File

@@ -0,0 +1,59 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::custom_world_library_mutation_result_type::CustomWorldLibraryMutationResult;
use super::custom_world_profile_play_record_input_type::CustomWorldProfilePlayRecordInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct RecordCustomWorldProfilePlayArgs {
pub input: CustomWorldProfilePlayRecordInput,
}
impl __sdk::InModule for RecordCustomWorldProfilePlayArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `record_custom_world_profile_play`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait record_custom_world_profile_play {
fn record_custom_world_profile_play(&self, input: CustomWorldProfilePlayRecordInput) {
self.record_custom_world_profile_play_then(input, |_, _| {});
}
fn record_custom_world_profile_play_then(
&self,
input: CustomWorldProfilePlayRecordInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<CustomWorldLibraryMutationResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl record_custom_world_profile_play for super::RemoteProcedures {
fn record_custom_world_profile_play_then(
&self,
input: CustomWorldProfilePlayRecordInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<CustomWorldLibraryMutationResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, CustomWorldLibraryMutationResult>(
"record_custom_world_profile_play",
RecordCustomWorldProfilePlayArgs { input },
__callback,
);
}
}

View File

@@ -0,0 +1,59 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::big_fish_session_procedure_result_type::BigFishSessionProcedureResult;
use super::big_fish_work_remix_input_type::BigFishWorkRemixInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct RemixBigFishWorkArgs {
pub input: BigFishWorkRemixInput,
}
impl __sdk::InModule for RemixBigFishWorkArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `remix_big_fish_work`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait remix_big_fish_work {
fn remix_big_fish_work(&self, input: BigFishWorkRemixInput) {
self.remix_big_fish_work_then(input, |_, _| {});
}
fn remix_big_fish_work_then(
&self,
input: BigFishWorkRemixInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<BigFishSessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl remix_big_fish_work for super::RemoteProcedures {
fn remix_big_fish_work_then(
&self,
input: BigFishWorkRemixInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<BigFishSessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, BigFishSessionProcedureResult>(
"remix_big_fish_work",
RemixBigFishWorkArgs { input },
__callback,
);
}
}

View File

@@ -0,0 +1,59 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::custom_world_library_mutation_result_type::CustomWorldLibraryMutationResult;
use super::custom_world_profile_remix_input_type::CustomWorldProfileRemixInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct RemixCustomWorldProfileArgs {
pub input: CustomWorldProfileRemixInput,
}
impl __sdk::InModule for RemixCustomWorldProfileArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `remix_custom_world_profile`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait remix_custom_world_profile {
fn remix_custom_world_profile(&self, input: CustomWorldProfileRemixInput) {
self.remix_custom_world_profile_then(input, |_, _| {});
}
fn remix_custom_world_profile_then(
&self,
input: CustomWorldProfileRemixInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<CustomWorldLibraryMutationResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl remix_custom_world_profile for super::RemoteProcedures {
fn remix_custom_world_profile_then(
&self,
input: CustomWorldProfileRemixInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<CustomWorldLibraryMutationResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, CustomWorldLibraryMutationResult>(
"remix_custom_world_profile",
RemixCustomWorldProfileArgs { input },
__callback,
);
}
}

View File

@@ -0,0 +1,59 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::puzzle_agent_session_procedure_result_type::PuzzleAgentSessionProcedureResult;
use super::puzzle_work_remix_input_type::PuzzleWorkRemixInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct RemixPuzzleWorkArgs {
pub input: PuzzleWorkRemixInput,
}
impl __sdk::InModule for RemixPuzzleWorkArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `remix_puzzle_work`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait remix_puzzle_work {
fn remix_puzzle_work(&self, input: PuzzleWorkRemixInput) {
self.remix_puzzle_work_then(input, |_, _| {});
}
fn remix_puzzle_work_then(
&self,
input: PuzzleWorkRemixInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<PuzzleAgentSessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl remix_puzzle_work for super::RemoteProcedures {
fn remix_puzzle_work_then(
&self,
input: PuzzleWorkRemixInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<PuzzleAgentSessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, PuzzleAgentSessionProcedureResult>(
"remix_puzzle_work",
RemixPuzzleWorkArgs { input },
__callback,
);
}
}

View File

@@ -1,6 +1,7 @@
use super::*;
use crate::mapper::*;
use crate::module_bindings::delete_puzzle_work_procedure::delete_puzzle_work;
use crate::module_bindings::remix_puzzle_work_procedure::remix_puzzle_work;
impl SpacetimeClient {
pub async fn create_puzzle_agent_session(
@@ -340,6 +341,34 @@ impl SpacetimeClient {
.await
}
pub async fn remix_puzzle_work(
&self,
input: PuzzleWorkRemixRecordInput,
) -> Result<PuzzleAgentSessionRecord, SpacetimeClientError> {
let procedure_input = PuzzleWorkRemixInput {
source_profile_id: input.source_profile_id,
target_owner_user_id: input.target_owner_user_id,
target_session_id: input.target_session_id,
target_profile_id: input.target_profile_id,
target_work_id: input.target_work_id,
author_display_name: input.author_display_name,
welcome_message_id: input.welcome_message_id,
remixed_at_micros: input.remixed_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.remix_puzzle_work_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_puzzle_agent_session_procedure_result);
send_once(&sender, mapped);
});
})
.await
}
pub async fn start_puzzle_run(
&self,
input: PuzzleRunStartRecordInput,