修复资产计费边界风险
资产生成预扣费改为 fail-closed,避免钱包异常时继续调用外部生成 新增钱包退款 outbox,退款失败时本地落盘并后台重放 拼图首图后台任务改用 SpacetimeDB claim 表实现跨实例互斥 计费 ledger id 统一绑定 request_id,并让前端重试复用 x-request-id 同步 SpacetimeDB bindings、后端架构文档和 Hermes 决策记录
This commit is contained in:
@@ -51,7 +51,8 @@ pub use mapper::{
|
||||
PublicWorkGalleryEntryRecord, PuzzleAgentMessageFinalizeRecordInput, PuzzleAgentMessageRecord,
|
||||
PuzzleAgentMessageSubmitRecordInput, PuzzleAgentSessionCreateRecordInput,
|
||||
PuzzleAgentSessionRecord, PuzzleAgentSuggestedActionRecord, PuzzleAnchorItemRecord,
|
||||
PuzzleAnchorPackRecord, PuzzleAudioAssetRecord, PuzzleBoardRecord, PuzzleCellPositionRecord,
|
||||
PuzzleAnchorPackRecord, PuzzleAudioAssetRecord, PuzzleBackgroundCompileTaskClaimRecordInput,
|
||||
PuzzleBackgroundCompileTaskReleaseRecordInput, PuzzleBoardRecord, PuzzleCellPositionRecord,
|
||||
PuzzleClearActionRequest, PuzzleClearActionResponse, PuzzleClearActionType,
|
||||
PuzzleClearBoardCell, PuzzleClearBoardSnapshot, PuzzleClearCardAsset, PuzzleClearDraftResponse,
|
||||
PuzzleClearGenerationStatus, PuzzleClearImageAsset, PuzzleClearNextLevelRequest,
|
||||
|
||||
@@ -101,7 +101,8 @@ pub use self::puzzle::{
|
||||
PuzzleAgentMessageFinalizeRecordInput, PuzzleAgentMessageRecord,
|
||||
PuzzleAgentMessageSubmitRecordInput, PuzzleAgentSessionCreateRecordInput,
|
||||
PuzzleAgentSessionRecord, PuzzleAgentSuggestedActionRecord, PuzzleAnchorItemRecord,
|
||||
PuzzleAnchorPackRecord, PuzzleAudioAssetRecord, PuzzleBoardRecord, PuzzleCellPositionRecord,
|
||||
PuzzleAnchorPackRecord, PuzzleAudioAssetRecord, PuzzleBackgroundCompileTaskClaimRecordInput,
|
||||
PuzzleBackgroundCompileTaskReleaseRecordInput, PuzzleBoardRecord, PuzzleCellPositionRecord,
|
||||
PuzzleCreatorIntentRecord, PuzzleDraftCompileFailureRecordInput, PuzzleDraftLevelRecord,
|
||||
PuzzleFormDraftRecord, PuzzleFormDraftSaveRecordInput, PuzzleGalleryCardRecord,
|
||||
PuzzleGeneratedImageCandidateRecord, PuzzleGeneratedImagesSaveRecordInput,
|
||||
@@ -199,10 +200,10 @@ pub(crate) use self::public_work::{
|
||||
map_public_work_gallery_entry, map_public_work_gallery_entry_to_detail_entry,
|
||||
};
|
||||
pub(crate) use self::puzzle::{
|
||||
map_puzzle_agent_session_procedure_result, map_puzzle_gallery_card_view_row,
|
||||
map_puzzle_run_procedure_result, map_puzzle_work_procedure_result,
|
||||
map_puzzle_works_procedure_result, map_runtime_profile_wallet_ledger_source_type_back,
|
||||
parse_puzzle_agent_stage_record,
|
||||
map_puzzle_agent_session_procedure_result, map_puzzle_background_compile_task_procedure_result,
|
||||
map_puzzle_gallery_card_view_row, map_puzzle_run_procedure_result,
|
||||
map_puzzle_work_procedure_result, map_puzzle_works_procedure_result,
|
||||
map_runtime_profile_wallet_ledger_source_type_back, parse_puzzle_agent_stage_record,
|
||||
};
|
||||
pub(crate) use self::puzzle_clear::{
|
||||
map_puzzle_clear_agent_session_procedure_result, map_puzzle_clear_gallery_card_view_row,
|
||||
|
||||
@@ -13,6 +13,16 @@ pub(crate) fn map_puzzle_agent_session_procedure_result(
|
||||
Ok(map_puzzle_agent_session_snapshot(session))
|
||||
}
|
||||
|
||||
pub(crate) fn map_puzzle_background_compile_task_procedure_result(
|
||||
result: PuzzleBackgroundCompileTaskProcedureResult,
|
||||
) -> Result<bool, SpacetimeClientError> {
|
||||
if !result.ok {
|
||||
return Err(SpacetimeClientError::procedure_failed(result.error_message));
|
||||
}
|
||||
|
||||
Ok(result.claimed)
|
||||
}
|
||||
|
||||
pub(crate) fn map_puzzle_work_procedure_result(
|
||||
result: PuzzleWorkProcedureResult,
|
||||
) -> Result<PuzzleWorkProfileRecord, SpacetimeClientError> {
|
||||
@@ -614,6 +624,23 @@ pub struct PuzzleFormDraftSaveRecordInput {
|
||||
pub saved_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct PuzzleBackgroundCompileTaskClaimRecordInput {
|
||||
pub task_id: String,
|
||||
pub claim_id: String,
|
||||
pub session_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub claimed_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct PuzzleBackgroundCompileTaskReleaseRecordInput {
|
||||
pub task_id: String,
|
||||
pub claim_id: String,
|
||||
pub session_id: String,
|
||||
pub owner_user_id: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct PuzzleAgentMessageSubmitRecordInput {
|
||||
pub session_id: String,
|
||||
|
||||
@@ -204,6 +204,7 @@ pub mod chapter_progression_table;
|
||||
pub mod chapter_progression_type;
|
||||
pub mod checkpoint_wooden_fish_run_procedure;
|
||||
pub mod claim_profile_task_reward_and_return_procedure;
|
||||
pub mod claim_puzzle_background_compile_task_procedure;
|
||||
pub mod claim_puzzle_work_point_incentive_procedure;
|
||||
pub mod clear_database_migration_import_chunks_procedure;
|
||||
pub mod clear_platform_browse_history_and_return_procedure;
|
||||
@@ -628,6 +629,11 @@ pub mod puzzle_anchor_item_type;
|
||||
pub mod puzzle_anchor_pack_type;
|
||||
pub mod puzzle_anchor_status_type;
|
||||
pub mod puzzle_audio_asset_type;
|
||||
pub mod puzzle_background_compile_task_claim_input_type;
|
||||
pub mod puzzle_background_compile_task_procedure_result_type;
|
||||
pub mod puzzle_background_compile_task_release_input_type;
|
||||
pub mod puzzle_background_compile_task_row_type;
|
||||
pub mod puzzle_background_compile_task_table;
|
||||
pub mod puzzle_board_snapshot_type;
|
||||
pub mod puzzle_cell_position_type;
|
||||
pub mod puzzle_clear_agent_session_create_input_type;
|
||||
@@ -766,6 +772,7 @@ pub mod redeem_profile_reward_code_procedure;
|
||||
pub mod refresh_session_table;
|
||||
pub mod refresh_session_type;
|
||||
pub mod refund_profile_wallet_points_and_return_procedure;
|
||||
pub mod release_puzzle_background_compile_task_procedure;
|
||||
pub mod remix_big_fish_work_procedure;
|
||||
pub mod remix_custom_world_profile_procedure;
|
||||
pub mod remix_puzzle_work_procedure;
|
||||
@@ -1312,6 +1319,7 @@ pub use chapter_progression_table::*;
|
||||
pub use chapter_progression_type::ChapterProgression;
|
||||
pub use checkpoint_wooden_fish_run_procedure::checkpoint_wooden_fish_run;
|
||||
pub use claim_profile_task_reward_and_return_procedure::claim_profile_task_reward_and_return;
|
||||
pub use claim_puzzle_background_compile_task_procedure::claim_puzzle_background_compile_task;
|
||||
pub use claim_puzzle_work_point_incentive_procedure::claim_puzzle_work_point_incentive;
|
||||
pub use clear_database_migration_import_chunks_procedure::clear_database_migration_import_chunks;
|
||||
pub use clear_platform_browse_history_and_return_procedure::clear_platform_browse_history_and_return;
|
||||
@@ -1736,6 +1744,11 @@ pub use puzzle_anchor_item_type::PuzzleAnchorItem;
|
||||
pub use puzzle_anchor_pack_type::PuzzleAnchorPack;
|
||||
pub use puzzle_anchor_status_type::PuzzleAnchorStatus;
|
||||
pub use puzzle_audio_asset_type::PuzzleAudioAsset;
|
||||
pub use puzzle_background_compile_task_claim_input_type::PuzzleBackgroundCompileTaskClaimInput;
|
||||
pub use puzzle_background_compile_task_procedure_result_type::PuzzleBackgroundCompileTaskProcedureResult;
|
||||
pub use puzzle_background_compile_task_release_input_type::PuzzleBackgroundCompileTaskReleaseInput;
|
||||
pub use puzzle_background_compile_task_row_type::PuzzleBackgroundCompileTaskRow;
|
||||
pub use puzzle_background_compile_task_table::*;
|
||||
pub use puzzle_board_snapshot_type::PuzzleBoardSnapshot;
|
||||
pub use puzzle_cell_position_type::PuzzleCellPosition;
|
||||
pub use puzzle_clear_agent_session_create_input_type::PuzzleClearAgentSessionCreateInput;
|
||||
@@ -1874,6 +1887,7 @@ pub use redeem_profile_reward_code_procedure::redeem_profile_reward_code;
|
||||
pub use refresh_session_table::*;
|
||||
pub use refresh_session_type::RefreshSession;
|
||||
pub use refund_profile_wallet_points_and_return_procedure::refund_profile_wallet_points_and_return;
|
||||
pub use release_puzzle_background_compile_task_procedure::release_puzzle_background_compile_task;
|
||||
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;
|
||||
@@ -2569,6 +2583,7 @@ pub struct DbUpdate {
|
||||
public_work_play_daily_stat: __sdk::TableUpdate<PublicWorkPlayDailyStat>,
|
||||
puzzle_agent_message: __sdk::TableUpdate<PuzzleAgentMessageRow>,
|
||||
puzzle_agent_session: __sdk::TableUpdate<PuzzleAgentSessionRow>,
|
||||
puzzle_background_compile_task: __sdk::TableUpdate<PuzzleBackgroundCompileTaskRow>,
|
||||
puzzle_clear_agent_session: __sdk::TableUpdate<PuzzleClearAgentSessionRow>,
|
||||
puzzle_clear_event: __sdk::TableUpdate<PuzzleClearEventRow>,
|
||||
puzzle_clear_gallery_card_view: __sdk::TableUpdate<PuzzleClearGalleryCardViewRow>,
|
||||
@@ -2854,6 +2869,11 @@ impl TryFrom<__ws::v2::TransactionUpdate> for DbUpdate {
|
||||
"puzzle_agent_session" => db_update.puzzle_agent_session.append(
|
||||
puzzle_agent_session_table::parse_table_update(table_update)?,
|
||||
),
|
||||
"puzzle_background_compile_task" => {
|
||||
db_update.puzzle_background_compile_task.append(
|
||||
puzzle_background_compile_task_table::parse_table_update(table_update)?,
|
||||
)
|
||||
}
|
||||
"puzzle_clear_agent_session" => db_update.puzzle_clear_agent_session.append(
|
||||
puzzle_clear_agent_session_table::parse_table_update(table_update)?,
|
||||
),
|
||||
@@ -3373,6 +3393,12 @@ impl __sdk::DbUpdate for DbUpdate {
|
||||
&self.puzzle_agent_session,
|
||||
)
|
||||
.with_updates_by_pk(|row| &row.session_id);
|
||||
diff.puzzle_background_compile_task = cache
|
||||
.apply_diff_to_table::<PuzzleBackgroundCompileTaskRow>(
|
||||
"puzzle_background_compile_task",
|
||||
&self.puzzle_background_compile_task,
|
||||
)
|
||||
.with_updates_by_pk(|row| &row.task_id);
|
||||
diff.puzzle_clear_agent_session = cache
|
||||
.apply_diff_to_table::<PuzzleClearAgentSessionRow>(
|
||||
"puzzle_clear_agent_session",
|
||||
@@ -3828,6 +3854,9 @@ impl __sdk::DbUpdate for DbUpdate {
|
||||
"puzzle_agent_session" => db_update
|
||||
.puzzle_agent_session
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"puzzle_background_compile_task" => db_update
|
||||
.puzzle_background_compile_task
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
"puzzle_clear_agent_session" => db_update
|
||||
.puzzle_clear_agent_session
|
||||
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
|
||||
@@ -4192,6 +4221,9 @@ impl __sdk::DbUpdate for DbUpdate {
|
||||
"puzzle_agent_session" => db_update
|
||||
.puzzle_agent_session
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"puzzle_background_compile_task" => db_update
|
||||
.puzzle_background_compile_task
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
"puzzle_clear_agent_session" => db_update
|
||||
.puzzle_clear_agent_session
|
||||
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
|
||||
@@ -4410,6 +4442,7 @@ pub struct AppliedDiff<'r> {
|
||||
public_work_play_daily_stat: __sdk::TableAppliedDiff<'r, PublicWorkPlayDailyStat>,
|
||||
puzzle_agent_message: __sdk::TableAppliedDiff<'r, PuzzleAgentMessageRow>,
|
||||
puzzle_agent_session: __sdk::TableAppliedDiff<'r, PuzzleAgentSessionRow>,
|
||||
puzzle_background_compile_task: __sdk::TableAppliedDiff<'r, PuzzleBackgroundCompileTaskRow>,
|
||||
puzzle_clear_agent_session: __sdk::TableAppliedDiff<'r, PuzzleClearAgentSessionRow>,
|
||||
puzzle_clear_event: __sdk::TableAppliedDiff<'r, PuzzleClearEventRow>,
|
||||
puzzle_clear_gallery_card_view: __sdk::TableAppliedDiff<'r, PuzzleClearGalleryCardViewRow>,
|
||||
@@ -4829,6 +4862,11 @@ impl<'r> __sdk::AppliedDiff<'r> for AppliedDiff<'r> {
|
||||
&self.puzzle_agent_session,
|
||||
event,
|
||||
);
|
||||
callbacks.invoke_table_row_callbacks::<PuzzleBackgroundCompileTaskRow>(
|
||||
"puzzle_background_compile_task",
|
||||
&self.puzzle_background_compile_task,
|
||||
event,
|
||||
);
|
||||
callbacks.invoke_table_row_callbacks::<PuzzleClearAgentSessionRow>(
|
||||
"puzzle_clear_agent_session",
|
||||
&self.puzzle_clear_agent_session,
|
||||
@@ -5766,6 +5804,7 @@ impl __sdk::SpacetimeModule for RemoteModule {
|
||||
public_work_play_daily_stat_table::register_table(client_cache);
|
||||
puzzle_agent_message_table::register_table(client_cache);
|
||||
puzzle_agent_session_table::register_table(client_cache);
|
||||
puzzle_background_compile_task_table::register_table(client_cache);
|
||||
puzzle_clear_agent_session_table::register_table(client_cache);
|
||||
puzzle_clear_event_table::register_table(client_cache);
|
||||
puzzle_clear_gallery_card_view_table::register_table(client_cache);
|
||||
@@ -5885,6 +5924,7 @@ impl __sdk::SpacetimeModule for RemoteModule {
|
||||
"public_work_play_daily_stat",
|
||||
"puzzle_agent_message",
|
||||
"puzzle_agent_session",
|
||||
"puzzle_background_compile_task",
|
||||
"puzzle_clear_agent_session",
|
||||
"puzzle_clear_event",
|
||||
"puzzle_clear_gallery_card_view",
|
||||
|
||||
@@ -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_background_compile_task_claim_input_type::PuzzleBackgroundCompileTaskClaimInput;
|
||||
use super::puzzle_background_compile_task_procedure_result_type::PuzzleBackgroundCompileTaskProcedureResult;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
struct ClaimPuzzleBackgroundCompileTaskArgs {
|
||||
pub input: PuzzleBackgroundCompileTaskClaimInput,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for ClaimPuzzleBackgroundCompileTaskArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the procedure `claim_puzzle_background_compile_task`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteProcedures`].
|
||||
pub trait claim_puzzle_background_compile_task {
|
||||
fn claim_puzzle_background_compile_task(&self, input: PuzzleBackgroundCompileTaskClaimInput) {
|
||||
self.claim_puzzle_background_compile_task_then(input, |_, _| {});
|
||||
}
|
||||
|
||||
fn claim_puzzle_background_compile_task_then(
|
||||
&self,
|
||||
input: PuzzleBackgroundCompileTaskClaimInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<PuzzleBackgroundCompileTaskProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
);
|
||||
}
|
||||
|
||||
impl claim_puzzle_background_compile_task for super::RemoteProcedures {
|
||||
fn claim_puzzle_background_compile_task_then(
|
||||
&self,
|
||||
input: PuzzleBackgroundCompileTaskClaimInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<PuzzleBackgroundCompileTaskProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
) {
|
||||
self.imp
|
||||
.invoke_procedure_with_callback::<_, PuzzleBackgroundCompileTaskProcedureResult>(
|
||||
"claim_puzzle_background_compile_task",
|
||||
ClaimPuzzleBackgroundCompileTaskArgs { input },
|
||||
__callback,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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 PuzzleBackgroundCompileTaskClaimInput {
|
||||
pub task_id: String,
|
||||
pub claim_id: String,
|
||||
pub session_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub claimed_at_micros: i64,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for PuzzleBackgroundCompileTaskClaimInput {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
@@ -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 PuzzleBackgroundCompileTaskProcedureResult {
|
||||
pub ok: bool,
|
||||
pub claimed: bool,
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for PuzzleBackgroundCompileTaskProcedureResult {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// 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 PuzzleBackgroundCompileTaskReleaseInput {
|
||||
pub task_id: String,
|
||||
pub claim_id: String,
|
||||
pub session_id: String,
|
||||
pub owner_user_id: String,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for PuzzleBackgroundCompileTaskReleaseInput {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// 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 PuzzleBackgroundCompileTaskRow {
|
||||
pub task_id: String,
|
||||
pub claim_id: String,
|
||||
pub session_id: String,
|
||||
pub owner_user_id: String,
|
||||
pub created_at: __sdk::Timestamp,
|
||||
pub updated_at: __sdk::Timestamp,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for PuzzleBackgroundCompileTaskRow {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
/// Column accessor struct for the table `PuzzleBackgroundCompileTaskRow`.
|
||||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
pub struct PuzzleBackgroundCompileTaskRowCols {
|
||||
pub task_id: __sdk::__query_builder::Col<PuzzleBackgroundCompileTaskRow, String>,
|
||||
pub claim_id: __sdk::__query_builder::Col<PuzzleBackgroundCompileTaskRow, String>,
|
||||
pub session_id: __sdk::__query_builder::Col<PuzzleBackgroundCompileTaskRow, String>,
|
||||
pub owner_user_id: __sdk::__query_builder::Col<PuzzleBackgroundCompileTaskRow, String>,
|
||||
pub created_at: __sdk::__query_builder::Col<PuzzleBackgroundCompileTaskRow, __sdk::Timestamp>,
|
||||
pub updated_at: __sdk::__query_builder::Col<PuzzleBackgroundCompileTaskRow, __sdk::Timestamp>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasCols for PuzzleBackgroundCompileTaskRow {
|
||||
type Cols = PuzzleBackgroundCompileTaskRowCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
PuzzleBackgroundCompileTaskRowCols {
|
||||
task_id: __sdk::__query_builder::Col::new(table_name, "task_id"),
|
||||
claim_id: __sdk::__query_builder::Col::new(table_name, "claim_id"),
|
||||
session_id: __sdk::__query_builder::Col::new(table_name, "session_id"),
|
||||
owner_user_id: __sdk::__query_builder::Col::new(table_name, "owner_user_id"),
|
||||
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
|
||||
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Indexed column accessor struct for the table `PuzzleBackgroundCompileTaskRow`.
|
||||
///
|
||||
/// Provides typed access to indexed columns for query building.
|
||||
pub struct PuzzleBackgroundCompileTaskRowIxCols {
|
||||
pub session_id: __sdk::__query_builder::IxCol<PuzzleBackgroundCompileTaskRow, String>,
|
||||
pub task_id: __sdk::__query_builder::IxCol<PuzzleBackgroundCompileTaskRow, String>,
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::HasIxCols for PuzzleBackgroundCompileTaskRow {
|
||||
type IxCols = PuzzleBackgroundCompileTaskRowIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
PuzzleBackgroundCompileTaskRowIxCols {
|
||||
session_id: __sdk::__query_builder::IxCol::new(table_name, "session_id"),
|
||||
task_id: __sdk::__query_builder::IxCol::new(table_name, "task_id"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for PuzzleBackgroundCompileTaskRow {}
|
||||
@@ -0,0 +1,169 @@
|
||||
// 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 super::puzzle_background_compile_task_row_type::PuzzleBackgroundCompileTaskRow;
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
/// Table handle for the table `puzzle_background_compile_task`.
|
||||
///
|
||||
/// Obtain a handle from the [`PuzzleBackgroundCompileTaskTableAccess::puzzle_background_compile_task`] method on [`super::RemoteTables`],
|
||||
/// like `ctx.db.puzzle_background_compile_task()`.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.puzzle_background_compile_task().on_insert(...)`.
|
||||
pub struct PuzzleBackgroundCompileTaskTableHandle<'ctx> {
|
||||
imp: __sdk::TableHandle<PuzzleBackgroundCompileTaskRow>,
|
||||
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the table `puzzle_background_compile_task`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteTables`].
|
||||
pub trait PuzzleBackgroundCompileTaskTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Obtain a [`PuzzleBackgroundCompileTaskTableHandle`], which mediates access to the table `puzzle_background_compile_task`.
|
||||
fn puzzle_background_compile_task(&self) -> PuzzleBackgroundCompileTaskTableHandle<'_>;
|
||||
}
|
||||
|
||||
impl PuzzleBackgroundCompileTaskTableAccess for super::RemoteTables {
|
||||
fn puzzle_background_compile_task(&self) -> PuzzleBackgroundCompileTaskTableHandle<'_> {
|
||||
PuzzleBackgroundCompileTaskTableHandle {
|
||||
imp: self
|
||||
.imp
|
||||
.get_table::<PuzzleBackgroundCompileTaskRow>("puzzle_background_compile_task"),
|
||||
ctx: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PuzzleBackgroundCompileTaskInsertCallbackId(__sdk::CallbackId);
|
||||
pub struct PuzzleBackgroundCompileTaskDeleteCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::Table for PuzzleBackgroundCompileTaskTableHandle<'ctx> {
|
||||
type Row = PuzzleBackgroundCompileTaskRow;
|
||||
type EventContext = super::EventContext;
|
||||
|
||||
fn count(&self) -> u64 {
|
||||
self.imp.count()
|
||||
}
|
||||
fn iter(&self) -> impl Iterator<Item = PuzzleBackgroundCompileTaskRow> + '_ {
|
||||
self.imp.iter()
|
||||
}
|
||||
|
||||
type InsertCallbackId = PuzzleBackgroundCompileTaskInsertCallbackId;
|
||||
|
||||
fn on_insert(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> PuzzleBackgroundCompileTaskInsertCallbackId {
|
||||
PuzzleBackgroundCompileTaskInsertCallbackId(self.imp.on_insert(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_insert(&self, callback: PuzzleBackgroundCompileTaskInsertCallbackId) {
|
||||
self.imp.remove_on_insert(callback.0)
|
||||
}
|
||||
|
||||
type DeleteCallbackId = PuzzleBackgroundCompileTaskDeleteCallbackId;
|
||||
|
||||
fn on_delete(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
|
||||
) -> PuzzleBackgroundCompileTaskDeleteCallbackId {
|
||||
PuzzleBackgroundCompileTaskDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_delete(&self, callback: PuzzleBackgroundCompileTaskDeleteCallbackId) {
|
||||
self.imp.remove_on_delete(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PuzzleBackgroundCompileTaskUpdateCallbackId(__sdk::CallbackId);
|
||||
|
||||
impl<'ctx> __sdk::TableWithPrimaryKey for PuzzleBackgroundCompileTaskTableHandle<'ctx> {
|
||||
type UpdateCallbackId = PuzzleBackgroundCompileTaskUpdateCallbackId;
|
||||
|
||||
fn on_update(
|
||||
&self,
|
||||
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
|
||||
) -> PuzzleBackgroundCompileTaskUpdateCallbackId {
|
||||
PuzzleBackgroundCompileTaskUpdateCallbackId(self.imp.on_update(Box::new(callback)))
|
||||
}
|
||||
|
||||
fn remove_on_update(&self, callback: PuzzleBackgroundCompileTaskUpdateCallbackId) {
|
||||
self.imp.remove_on_update(callback.0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Access to the `task_id` unique index on the table `puzzle_background_compile_task`,
|
||||
/// which allows point queries on the field of the same name
|
||||
/// via the [`PuzzleBackgroundCompileTaskTaskIdUnique::find`] method.
|
||||
///
|
||||
/// Users are encouraged not to explicitly reference this type,
|
||||
/// but to directly chain method calls,
|
||||
/// like `ctx.db.puzzle_background_compile_task().task_id().find(...)`.
|
||||
pub struct PuzzleBackgroundCompileTaskTaskIdUnique<'ctx> {
|
||||
imp: __sdk::UniqueConstraintHandle<PuzzleBackgroundCompileTaskRow, String>,
|
||||
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
|
||||
}
|
||||
|
||||
impl<'ctx> PuzzleBackgroundCompileTaskTableHandle<'ctx> {
|
||||
/// Get a handle on the `task_id` unique index on the table `puzzle_background_compile_task`.
|
||||
pub fn task_id(&self) -> PuzzleBackgroundCompileTaskTaskIdUnique<'ctx> {
|
||||
PuzzleBackgroundCompileTaskTaskIdUnique {
|
||||
imp: self.imp.get_unique_constraint::<String>("task_id"),
|
||||
phantom: std::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ctx> PuzzleBackgroundCompileTaskTaskIdUnique<'ctx> {
|
||||
/// Find the subscribed row whose `task_id` column value is equal to `col_val`,
|
||||
/// if such a row is present in the client cache.
|
||||
pub fn find(&self, col_val: &String) -> Option<PuzzleBackgroundCompileTaskRow> {
|
||||
self.imp.find(col_val)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
|
||||
let _table = client_cache
|
||||
.get_or_make_table::<PuzzleBackgroundCompileTaskRow>("puzzle_background_compile_task");
|
||||
_table.add_unique_constraint::<String>("task_id", |row| &row.task_id);
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub(super) fn parse_table_update(
|
||||
raw_updates: __ws::v2::TableUpdate,
|
||||
) -> __sdk::Result<__sdk::TableUpdate<PuzzleBackgroundCompileTaskRow>> {
|
||||
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
|
||||
__sdk::InternalError::failed_parse(
|
||||
"TableUpdate<PuzzleBackgroundCompileTaskRow>",
|
||||
"TableUpdate",
|
||||
)
|
||||
.with_cause(e)
|
||||
.into()
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for query builder access to the table `PuzzleBackgroundCompileTaskRow`.
|
||||
///
|
||||
/// Implemented for [`__sdk::QueryTableAccessor`].
|
||||
pub trait puzzle_background_compile_taskQueryTableAccess {
|
||||
#[allow(non_snake_case)]
|
||||
/// Get a query builder for the table `PuzzleBackgroundCompileTaskRow`.
|
||||
fn puzzle_background_compile_task(
|
||||
&self,
|
||||
) -> __sdk::__query_builder::Table<PuzzleBackgroundCompileTaskRow>;
|
||||
}
|
||||
|
||||
impl puzzle_background_compile_taskQueryTableAccess for __sdk::QueryTableAccessor {
|
||||
fn puzzle_background_compile_task(
|
||||
&self,
|
||||
) -> __sdk::__query_builder::Table<PuzzleBackgroundCompileTaskRow> {
|
||||
__sdk::__query_builder::Table::new("puzzle_background_compile_task")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
// 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_background_compile_task_procedure_result_type::PuzzleBackgroundCompileTaskProcedureResult;
|
||||
use super::puzzle_background_compile_task_release_input_type::PuzzleBackgroundCompileTaskReleaseInput;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
struct ReleasePuzzleBackgroundCompileTaskArgs {
|
||||
pub input: PuzzleBackgroundCompileTaskReleaseInput,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for ReleasePuzzleBackgroundCompileTaskArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the procedure `release_puzzle_background_compile_task`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteProcedures`].
|
||||
pub trait release_puzzle_background_compile_task {
|
||||
fn release_puzzle_background_compile_task(
|
||||
&self,
|
||||
input: PuzzleBackgroundCompileTaskReleaseInput,
|
||||
) {
|
||||
self.release_puzzle_background_compile_task_then(input, |_, _| {});
|
||||
}
|
||||
|
||||
fn release_puzzle_background_compile_task_then(
|
||||
&self,
|
||||
input: PuzzleBackgroundCompileTaskReleaseInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<PuzzleBackgroundCompileTaskProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
);
|
||||
}
|
||||
|
||||
impl release_puzzle_background_compile_task for super::RemoteProcedures {
|
||||
fn release_puzzle_background_compile_task_then(
|
||||
&self,
|
||||
input: PuzzleBackgroundCompileTaskReleaseInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<PuzzleBackgroundCompileTaskProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
) {
|
||||
self.imp
|
||||
.invoke_procedure_with_callback::<_, PuzzleBackgroundCompileTaskProcedureResult>(
|
||||
"release_puzzle_background_compile_task",
|
||||
ReleasePuzzleBackgroundCompileTaskArgs { input },
|
||||
__callback,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
use super::*;
|
||||
use crate::mapper::*;
|
||||
use crate::module_bindings::claim_puzzle_background_compile_task_procedure::claim_puzzle_background_compile_task;
|
||||
use crate::module_bindings::claim_puzzle_work_point_incentive_procedure::claim_puzzle_work_point_incentive;
|
||||
use crate::module_bindings::delete_puzzle_work_procedure::delete_puzzle_work;
|
||||
use crate::module_bindings::record_puzzle_work_like_procedure::record_puzzle_work_like;
|
||||
use crate::module_bindings::release_puzzle_background_compile_task_procedure::release_puzzle_background_compile_task;
|
||||
use crate::module_bindings::remix_puzzle_work_procedure::remix_puzzle_work;
|
||||
use crate::module_bindings::save_puzzle_ui_background_procedure::save_puzzle_ui_background;
|
||||
|
||||
@@ -194,6 +196,67 @@ impl SpacetimeClient {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn claim_puzzle_background_compile_task(
|
||||
&self,
|
||||
input: PuzzleBackgroundCompileTaskClaimRecordInput,
|
||||
) -> Result<bool, SpacetimeClientError> {
|
||||
let procedure_input = PuzzleBackgroundCompileTaskClaimInput {
|
||||
task_id: input.task_id,
|
||||
claim_id: input.claim_id,
|
||||
session_id: input.session_id,
|
||||
owner_user_id: input.owner_user_id,
|
||||
claimed_at_micros: input.claimed_at_micros,
|
||||
};
|
||||
|
||||
self.call_after_connect(
|
||||
"claim_puzzle_background_compile_task",
|
||||
move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.claim_puzzle_background_compile_task_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(SpacetimeClientError::from_sdk_error)
|
||||
.and_then(map_puzzle_background_compile_task_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn release_puzzle_background_compile_task(
|
||||
&self,
|
||||
input: PuzzleBackgroundCompileTaskReleaseRecordInput,
|
||||
) -> Result<bool, SpacetimeClientError> {
|
||||
let procedure_input = PuzzleBackgroundCompileTaskReleaseInput {
|
||||
task_id: input.task_id,
|
||||
claim_id: input.claim_id,
|
||||
session_id: input.session_id,
|
||||
owner_user_id: input.owner_user_id,
|
||||
};
|
||||
|
||||
self.call_after_connect(
|
||||
"release_puzzle_background_compile_task",
|
||||
move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.release_puzzle_background_compile_task_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(SpacetimeClientError::from_sdk_error)
|
||||
.and_then(map_puzzle_background_compile_task_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn save_puzzle_generated_images(
|
||||
&self,
|
||||
input: PuzzleGeneratedImagesSaveRecordInput,
|
||||
|
||||
Reference in New Issue
Block a user