feat: complete M3 runtime snapshot and profile save archive

This commit is contained in:
2026-04-22 13:22:23 +08:00
parent 997a8daada
commit 209e924403
340 changed files with 9878 additions and 4429 deletions

View File

@@ -49,6 +49,10 @@ use crate::{
},
runtime_inventory::get_runtime_inventory_state,
runtime_profile::{get_profile_dashboard, get_profile_play_stats, get_profile_wallet_ledger},
runtime_save::{
delete_runtime_snapshot, get_runtime_snapshot, list_profile_save_archives,
put_runtime_snapshot, resume_profile_save_archive,
},
runtime_settings::{get_runtime_settings, put_runtime_settings},
runtime_story::resolve_runtime_story_state,
state::AppState,
@@ -227,6 +231,16 @@ pub fn build_router(state: AppState) -> Router {
"/api/runtime/settings",
get(get_runtime_settings)
.put(put_runtime_settings)
.route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/runtime/save/snapshot",
get(get_runtime_snapshot)
.put(put_runtime_snapshot)
.delete(delete_runtime_snapshot)
.route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
@@ -366,6 +380,34 @@ pub fn build_router(state: AppState) -> Router {
require_bearer_auth,
)),
)
.route(
"/api/runtime/profile/save-archives",
get(list_profile_save_archives).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/profile/save-archives",
get(list_profile_save_archives).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/runtime/profile/save-archives/{world_key}",
post(resume_profile_save_archive).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/profile/save-archives/{world_key}",
post(resume_profile_save_archive).route_layer(middleware::from_fn_with_state(
state.clone(),
require_bearer_auth,
)),
)
.route(
"/api/runtime/sessions/{runtime_session_id}/inventory",
get(get_runtime_inventory_state).route_layer(middleware::from_fn_with_state(

View File

@@ -23,6 +23,7 @@ mod response_headers;
mod runtime_browse_history;
mod runtime_inventory;
mod runtime_profile;
mod runtime_save;
mod runtime_settings;
mod runtime_story;
mod session_client;

View File

@@ -0,0 +1,401 @@
use axum::{
Json,
extract::{Extension, Path, State},
http::StatusCode,
response::Response,
};
use serde::Deserialize;
use serde_json::{Value, json};
use shared_contracts::runtime::{
BasicOkResponse, ProfileSaveArchiveListResponse, ProfileSaveArchiveResumeResponse,
ProfileSaveArchiveSummaryResponse, PutSavedGameSnapshotRequest, SavedGameSnapshotResponse,
};
use shared_kernel::{offset_datetime_to_unix_micros, parse_rfc3339};
use spacetime_client::SpacetimeClientError;
use time::OffsetDateTime;
use crate::{
api_response::json_success_body, auth::AuthenticatedAccessToken, http_error::AppError,
request_context::RequestContext, state::AppState,
};
#[derive(Clone, Debug, Deserialize)]
pub struct WorldKeyPath {
#[serde(rename = "world_key")]
pub world_key: String,
}
pub async fn get_runtime_snapshot(
State(state): State<AppState>,
Extension(request_context): Extension<RequestContext>,
Extension(authenticated): Extension<AuthenticatedAccessToken>,
) -> Result<Json<Value>, Response> {
let user_id = authenticated.claims().user_id().to_string();
let record = state
.spacetime_client()
.get_runtime_snapshot(user_id)
.await
.map_err(|error| runtime_save_error_response(&request_context, map_runtime_save_client_error(error)))?;
Ok(json_success_body(
Some(&request_context),
record.as_ref().map(build_saved_game_snapshot_response),
))
}
pub async fn put_runtime_snapshot(
State(state): State<AppState>,
Extension(request_context): Extension<RequestContext>,
Extension(authenticated): Extension<AuthenticatedAccessToken>,
Json(payload): Json<PutSavedGameSnapshotRequest>,
) -> Result<Json<Value>, Response> {
let user_id = authenticated.claims().user_id().to_string();
let now = OffsetDateTime::now_utc();
let saved_at = payload
.saved_at
.as_deref()
.map(parse_rfc3339)
.transpose()
.map_err(|error| {
runtime_save_error_response(
&request_context,
AppError::from_status(StatusCode::BAD_REQUEST).with_details(json!({
"provider": "runtime-save",
"message": format!("savedAt 非法: {error}"),
})),
)
})?
.unwrap_or(now);
let updated_at_micros = offset_datetime_to_unix_micros(now);
let saved_at_micros = offset_datetime_to_unix_micros(saved_at);
let record = state
.spacetime_client()
.put_runtime_snapshot(
user_id,
saved_at_micros,
payload.bottom_tab,
payload.game_state,
payload.current_story,
updated_at_micros,
)
.await
.map_err(|error| runtime_save_error_response(&request_context, map_runtime_save_client_error(error)))?;
Ok(json_success_body(
Some(&request_context),
build_saved_game_snapshot_response(&record),
))
}
pub async fn delete_runtime_snapshot(
State(state): State<AppState>,
Extension(request_context): Extension<RequestContext>,
Extension(authenticated): Extension<AuthenticatedAccessToken>,
) -> Result<Json<Value>, Response> {
let user_id = authenticated.claims().user_id().to_string();
state
.spacetime_client()
.delete_runtime_snapshot(user_id)
.await
.map_err(|error| runtime_save_error_response(&request_context, map_runtime_save_client_error(error)))?;
Ok(json_success_body(
Some(&request_context),
BasicOkResponse { ok: true },
))
}
pub async fn list_profile_save_archives(
State(state): State<AppState>,
Extension(request_context): Extension<RequestContext>,
Extension(authenticated): Extension<AuthenticatedAccessToken>,
) -> Result<Json<Value>, Response> {
let user_id = authenticated.claims().user_id().to_string();
let entries = state
.spacetime_client()
.list_profile_save_archives(user_id)
.await
.map_err(|error| runtime_save_error_response(&request_context, map_runtime_save_client_error(error)))?;
Ok(json_success_body(
Some(&request_context),
ProfileSaveArchiveListResponse {
entries: entries
.iter()
.map(build_profile_save_archive_summary_response)
.collect(),
},
))
}
pub async fn resume_profile_save_archive(
State(state): State<AppState>,
Extension(request_context): Extension<RequestContext>,
Extension(authenticated): Extension<AuthenticatedAccessToken>,
Path(path): Path<WorldKeyPath>,
) -> Result<Json<Value>, Response> {
let world_key = path.world_key.trim().to_string();
if world_key.is_empty() {
return Err(runtime_save_error_response(
&request_context,
AppError::from_status(StatusCode::BAD_REQUEST).with_details(json!({
"provider": "runtime-save",
"message": "worldKey 不能为空",
})),
));
}
let user_id = authenticated.claims().user_id().to_string();
let (entry, snapshot) = state
.spacetime_client()
.resume_profile_save_archive(user_id, world_key)
.await
.map_err(|error| runtime_save_error_response(&request_context, map_runtime_save_resume_client_error(error)))?;
Ok(json_success_body(
Some(&request_context),
ProfileSaveArchiveResumeResponse {
entry: build_profile_save_archive_summary_response(&entry),
snapshot: build_saved_game_snapshot_response(&snapshot),
},
))
}
fn build_saved_game_snapshot_response(
record: &module_runtime::RuntimeSnapshotRecord,
) -> SavedGameSnapshotResponse {
SavedGameSnapshotResponse {
version: record.version,
saved_at: record.saved_at.clone(),
game_state: record.game_state.clone(),
bottom_tab: record.bottom_tab.clone(),
current_story: record.current_story.clone(),
}
}
fn build_profile_save_archive_summary_response(
record: &module_runtime::RuntimeProfileSaveArchiveRecord,
) -> ProfileSaveArchiveSummaryResponse {
ProfileSaveArchiveSummaryResponse {
world_key: record.world_key.clone(),
owner_user_id: record.owner_user_id.clone(),
profile_id: record.profile_id.clone(),
world_type: record.world_type.clone(),
world_name: record.world_name.clone(),
subtitle: record.subtitle.clone(),
summary_text: record.summary_text.clone(),
cover_image_src: record.cover_image_src.clone(),
last_played_at: record.saved_at.clone(),
}
}
fn map_runtime_save_client_error(error: SpacetimeClientError) -> AppError {
let (status, provider) = match error {
SpacetimeClientError::Runtime(_) => (StatusCode::BAD_REQUEST, "runtime-save"),
_ => (StatusCode::BAD_GATEWAY, "spacetimedb"),
};
AppError::from_status(status).with_details(json!({
"provider": provider,
"message": error.to_string(),
}))
}
fn map_runtime_save_resume_client_error(error: SpacetimeClientError) -> AppError {
let (status, provider) = match &error {
SpacetimeClientError::Procedure(message)
if message.contains("world_key 不存在") || message.contains("对应 world_key 不存在") =>
{
(StatusCode::NOT_FOUND, "runtime-save")
}
SpacetimeClientError::Runtime(_) => (StatusCode::BAD_REQUEST, "runtime-save"),
_ => (StatusCode::BAD_GATEWAY, "spacetimedb"),
};
AppError::from_status(status).with_details(json!({
"provider": provider,
"message": error.to_string(),
}))
}
fn runtime_save_error_response(request_context: &RequestContext, error: AppError) -> Response {
error.into_response_with_context(Some(request_context))
}
#[cfg(test)]
mod tests {
use axum::{
body::Body,
http::{Request, StatusCode},
};
use http_body_util::BodyExt;
use platform_auth::{
AccessTokenClaims, AccessTokenClaimsInput, AuthProvider, BindingStatus, sign_access_token,
};
use serde_json::Value;
use time::OffsetDateTime;
use tower::ServiceExt;
use crate::{app::build_router, config::AppConfig, state::AppState};
#[tokio::test]
async fn runtime_snapshot_requires_authentication() {
let app = build_router(AppState::new(AppConfig::default()).expect("state should build"));
let response = app
.oneshot(
Request::builder()
.method("GET")
.uri("/api/runtime/save/snapshot")
.body(Body::empty())
.expect("request should build"),
)
.await
.expect("request should succeed");
assert_eq!(response.status(), StatusCode::UNAUTHORIZED);
}
#[tokio::test]
async fn profile_save_archives_requires_authentication() {
let app = build_router(AppState::new(AppConfig::default()).expect("state should build"));
let response = app
.oneshot(
Request::builder()
.method("GET")
.uri("/api/runtime/profile/save-archives")
.body(Body::empty())
.expect("request should build"),
)
.await
.expect("request should succeed");
assert_eq!(response.status(), StatusCode::UNAUTHORIZED);
}
#[tokio::test]
async fn profile_save_archives_compat_route_matches_main_route_error_shape() {
assert_compat_route_matches_main_route_error_shape(
"/api/runtime/profile/save-archives",
"/api/profile/save-archives",
)
.await;
}
#[tokio::test]
async fn resume_profile_save_archive_rejects_blank_world_key() {
let state = seed_authenticated_state().await;
let token = issue_access_token(&state);
let app = build_router(state);
let response = app
.oneshot(
Request::builder()
.method("POST")
.uri("/api/runtime/profile/save-archives/%20%20")
.header("authorization", format!("Bearer {token}"))
.header("x-genarrative-response-envelope", "v1")
.body(Body::empty())
.expect("request should build"),
)
.await
.expect("request should succeed");
assert_eq!(response.status(), StatusCode::BAD_REQUEST);
}
async fn assert_compat_route_matches_main_route_error_shape(
main_route: &str,
compat_route: &str,
) {
let state = seed_authenticated_state().await;
let token = issue_access_token(&state);
let app = build_router(state);
let main_response = app
.clone()
.oneshot(
Request::builder()
.method("GET")
.uri(main_route)
.header("authorization", format!("Bearer {token}"))
.header("x-genarrative-response-envelope", "v1")
.body(Body::empty())
.expect("request should build"),
)
.await
.expect("request should succeed");
let compat_response = app
.oneshot(
Request::builder()
.method("GET")
.uri(compat_route)
.header("authorization", format!("Bearer {token}"))
.header("x-genarrative-response-envelope", "v1")
.body(Body::empty())
.expect("request should build"),
)
.await
.expect("request should succeed");
assert_eq!(main_response.status(), compat_response.status());
let main_payload: Value = serde_json::from_slice(
&main_response
.into_body()
.collect()
.await
.expect("body should collect")
.to_bytes(),
)
.expect("response body should be valid json");
let compat_payload: Value = serde_json::from_slice(
&compat_response
.into_body()
.collect()
.await
.expect("body should collect")
.to_bytes(),
)
.expect("response body should be valid json");
assert_eq!(
main_payload["error"]["details"]["provider"],
compat_payload["error"]["details"]["provider"]
);
}
async fn seed_authenticated_state() -> AppState {
let state = AppState::new(AppConfig::default()).expect("state should build");
state
.password_entry_service()
.execute(module_auth::PasswordEntryInput {
username: "runtime_save_user".to_string(),
password: "secret123".to_string(),
})
.await
.expect("seed login should succeed");
state
}
fn issue_access_token(state: &AppState) -> String {
let claims = AccessTokenClaims::from_input(
AccessTokenClaimsInput {
user_id: "user_00000001".to_string(),
session_id: "sess_runtime_save".to_string(),
provider: AuthProvider::Password,
roles: vec!["user".to_string()],
token_version: 1,
phone_verified: true,
binding_status: BindingStatus::Active,
display_name: Some("存档用户".to_string()),
},
state.auth_jwt_config(),
OffsetDateTime::now_utc(),
)
.expect("claims should build");
sign_access_token(&claims, state.auth_jwt_config()).expect("token should sign")
}
}

View File

@@ -10,6 +10,7 @@ spacetime-types = ["dep:spacetimedb"]
[dependencies]
serde = { version = "1", features = ["derive"] }
serde_json = "1"
shared-kernel = { path = "../shared-kernel" }
spacetimedb = { workspace = true, optional = true }
time = { version = "0.3", features = ["formatting", "parsing"] }

View File

@@ -1,6 +1,7 @@
use std::collections::HashSet;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use shared_kernel::{
format_rfc3339 as format_shared_rfc3339, normalize_optional_string, normalize_required_string,
parse_rfc3339 as parse_shared_rfc3339,
@@ -14,6 +15,8 @@ pub const DEFAULT_PLATFORM_THEME: RuntimePlatformTheme = RuntimePlatformTheme::L
pub const DEFAULT_BROWSE_HISTORY_AUTHOR_DISPLAY_NAME: &str = "玩家";
pub const MAX_BROWSE_HISTORY_BATCH_SIZE: usize = 100;
pub const PROFILE_WALLET_LEDGER_LIST_LIMIT: usize = 50;
pub const SAVE_SNAPSHOT_VERSION: u32 = 2;
pub const DEFAULT_SAVE_ARCHIVE_SUMMARY_TEXT: &str = "继续推进上一次保存的故事。";
// 运行时设置目前只冻结 light/dark 两种主题,避免各层散落字符串字面量。
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
@@ -29,6 +32,94 @@ pub struct RuntimeSettings {
pub platform_theme: RuntimePlatformTheme,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeSnapshot {
pub user_id: String,
pub version: u32,
pub saved_at_micros: i64,
pub bottom_tab: String,
pub game_state_json: String,
pub current_story_json: Option<String>,
pub created_at_micros: i64,
pub updated_at_micros: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeSnapshotProcedureResult {
pub ok: bool,
pub record: Option<RuntimeSnapshot>,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeSnapshotGetInput {
pub user_id: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeSnapshotUpsertInput {
pub user_id: String,
pub saved_at_micros: i64,
pub bottom_tab: String,
pub game_state_json: String,
pub current_story_json: Option<String>,
pub updated_at_micros: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeSnapshotDeleteInput {
pub user_id: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileSaveArchiveSnapshot {
pub archive_id: String,
pub user_id: String,
pub world_key: String,
pub owner_user_id: Option<String>,
pub profile_id: Option<String>,
pub world_type: Option<String>,
pub world_name: String,
pub subtitle: String,
pub summary_text: String,
pub cover_image_src: Option<String>,
pub saved_at_micros: i64,
pub bottom_tab: String,
pub game_state_json: String,
pub current_story_json: Option<String>,
pub created_at_micros: i64,
pub updated_at_micros: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileSaveArchiveProcedureResult {
pub ok: bool,
pub entries: Vec<RuntimeProfileSaveArchiveSnapshot>,
pub record: Option<RuntimeProfileSaveArchiveSnapshot>,
pub current_snapshot: Option<RuntimeSnapshot>,
pub error_message: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileSaveArchiveListInput {
pub user_id: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RuntimeProfileSaveArchiveResumeInput {
pub user_id: String,
pub world_key: String,
}
// 浏览历史沿用平台已有的六种世界主题,但独立冻结在 runtime 领域内,避免反向耦合创作域 crate。
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
@@ -242,6 +333,10 @@ pub enum RuntimeBrowseHistoryFieldError {
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum RuntimeProfileFieldError {
MissingUserId,
MissingWorldKey,
MissingBottomTab,
InvalidGameStateJson,
InvalidCurrentStoryJson,
}
#[derive(Clone, Debug, PartialEq)]
@@ -444,6 +539,44 @@ pub struct RuntimeProfilePlayStatsRecord {
pub updated_at_micros: Option<i64>,
}
#[derive(Clone, Debug, PartialEq)]
pub struct RuntimeSnapshotRecord {
pub user_id: String,
pub version: u32,
pub saved_at: String,
pub saved_at_micros: i64,
pub bottom_tab: String,
pub game_state: Value,
pub current_story: Option<Value>,
pub game_state_json: String,
pub current_story_json: Option<String>,
pub created_at_micros: i64,
pub updated_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq)]
pub struct RuntimeProfileSaveArchiveRecord {
pub archive_id: String,
pub user_id: String,
pub world_key: String,
pub owner_user_id: Option<String>,
pub profile_id: Option<String>,
pub world_type: Option<String>,
pub world_name: String,
pub subtitle: String,
pub summary_text: String,
pub cover_image_src: Option<String>,
pub saved_at: String,
pub saved_at_micros: i64,
pub bottom_tab: String,
pub game_state: Value,
pub current_story: Option<Value>,
pub game_state_json: String,
pub current_story_json: Option<String>,
pub created_at_micros: i64,
pub updated_at_micros: i64,
}
pub fn build_runtime_browse_history_list_input(
user_id: String,
) -> Result<RuntimeBrowseHistoryListInput, RuntimeBrowseHistoryFieldError> {
@@ -472,6 +605,37 @@ pub fn build_runtime_profile_play_stats_get_input(
Ok(RuntimeProfilePlayStatsGetInput { user_id })
}
pub fn build_runtime_snapshot_get_input(
user_id: String,
) -> Result<RuntimeSnapshotGetInput, RuntimeProfileFieldError> {
let user_id = normalize_runtime_profile_user_id(user_id)?;
Ok(RuntimeSnapshotGetInput { user_id })
}
pub fn build_runtime_snapshot_delete_input(
user_id: String,
) -> Result<RuntimeSnapshotDeleteInput, RuntimeProfileFieldError> {
let user_id = normalize_runtime_profile_user_id(user_id)?;
Ok(RuntimeSnapshotDeleteInput { user_id })
}
pub fn build_runtime_profile_save_archive_list_input(
user_id: String,
) -> Result<RuntimeProfileSaveArchiveListInput, RuntimeProfileFieldError> {
let user_id = normalize_runtime_profile_user_id(user_id)?;
Ok(RuntimeProfileSaveArchiveListInput { user_id })
}
pub fn build_runtime_profile_save_archive_resume_input(
user_id: String,
world_key: String,
) -> Result<RuntimeProfileSaveArchiveResumeInput, RuntimeProfileFieldError> {
let user_id = normalize_runtime_profile_user_id(user_id)?;
let world_key =
normalize_required_string(world_key).ok_or(RuntimeProfileFieldError::MissingWorldKey)?;
Ok(RuntimeProfileSaveArchiveResumeInput { user_id, world_key })
}
pub fn build_runtime_browse_history_clear_input(
user_id: String,
) -> Result<RuntimeBrowseHistoryClearInput, RuntimeBrowseHistoryFieldError> {
@@ -479,6 +643,31 @@ pub fn build_runtime_browse_history_clear_input(
Ok(RuntimeBrowseHistoryClearInput { user_id })
}
pub fn build_runtime_snapshot_upsert_input(
user_id: String,
saved_at_micros: i64,
bottom_tab: String,
game_state: Value,
current_story: Option<Value>,
updated_at_micros: i64,
) -> Result<RuntimeSnapshotUpsertInput, RuntimeProfileFieldError> {
let user_id = normalize_runtime_profile_user_id(user_id)?;
let bottom_tab = normalize_bottom_tab(bottom_tab)
.ok_or(RuntimeProfileFieldError::MissingBottomTab)?;
let game_state_json =
serde_json::to_string(&game_state).map_err(|_| RuntimeProfileFieldError::InvalidGameStateJson)?;
let current_story_json = normalize_current_story_json(current_story)?;
Ok(RuntimeSnapshotUpsertInput {
user_id,
saved_at_micros,
bottom_tab,
game_state_json,
current_story_json,
updated_at_micros,
})
}
pub fn build_runtime_browse_history_sync_input(
user_id: String,
entries: Vec<RuntimeBrowseHistoryWriteInput>,
@@ -669,6 +858,64 @@ pub fn build_runtime_profile_play_stats_record(
}
}
pub fn build_runtime_snapshot_record(
snapshot: RuntimeSnapshot,
) -> Result<RuntimeSnapshotRecord, RuntimeProfileFieldError> {
let game_state = serde_json::from_str::<Value>(&snapshot.game_state_json)
.map_err(|_| RuntimeProfileFieldError::InvalidGameStateJson)?;
let current_story = parse_optional_json_value(
snapshot.current_story_json.as_deref(),
RuntimeProfileFieldError::InvalidCurrentStoryJson,
)?;
Ok(RuntimeSnapshotRecord {
user_id: snapshot.user_id,
version: snapshot.version,
saved_at: format_utc_micros(snapshot.saved_at_micros),
saved_at_micros: snapshot.saved_at_micros,
bottom_tab: snapshot.bottom_tab,
game_state,
current_story,
game_state_json: snapshot.game_state_json,
current_story_json: snapshot.current_story_json,
created_at_micros: snapshot.created_at_micros,
updated_at_micros: snapshot.updated_at_micros,
})
}
pub fn build_runtime_profile_save_archive_record(
snapshot: RuntimeProfileSaveArchiveSnapshot,
) -> Result<RuntimeProfileSaveArchiveRecord, RuntimeProfileFieldError> {
let game_state = serde_json::from_str::<Value>(&snapshot.game_state_json)
.map_err(|_| RuntimeProfileFieldError::InvalidGameStateJson)?;
let current_story = parse_optional_json_value(
snapshot.current_story_json.as_deref(),
RuntimeProfileFieldError::InvalidCurrentStoryJson,
)?;
Ok(RuntimeProfileSaveArchiveRecord {
archive_id: snapshot.archive_id,
user_id: snapshot.user_id,
world_key: snapshot.world_key,
owner_user_id: snapshot.owner_user_id,
profile_id: snapshot.profile_id,
world_type: snapshot.world_type,
world_name: snapshot.world_name,
subtitle: snapshot.subtitle,
summary_text: snapshot.summary_text,
cover_image_src: snapshot.cover_image_src,
saved_at: format_utc_micros(snapshot.saved_at_micros),
saved_at_micros: snapshot.saved_at_micros,
bottom_tab: snapshot.bottom_tab,
game_state,
current_story,
game_state_json: snapshot.game_state_json,
current_story_json: snapshot.current_story_json,
created_at_micros: snapshot.created_at_micros,
updated_at_micros: snapshot.updated_at_micros,
})
}
pub fn build_runtime_browse_history_id(
user_id: &str,
owner_user_id: &str,
@@ -693,6 +940,43 @@ fn parse_utc_rfc3339_to_micros(value: &str) -> Option<i64> {
i64::try_from(nanos / 1_000).ok()
}
fn normalize_bottom_tab(value: String) -> Option<String> {
let trimmed = normalize_required_string(value)?;
let normalized = match trimmed.as_str() {
"character" | "inventory" => trimmed,
_ => "adventure".to_string(),
};
Some(normalized)
}
fn normalize_current_story_json(
current_story: Option<Value>,
) -> Result<Option<String>, RuntimeProfileFieldError> {
let Some(current_story) = current_story else {
return Ok(None);
};
if !current_story.is_object() {
return Ok(None);
}
serde_json::to_string(&current_story)
.map(Some)
.map_err(|_| RuntimeProfileFieldError::InvalidCurrentStoryJson)
}
fn parse_optional_json_value(
raw: Option<&str>,
error: RuntimeProfileFieldError,
) -> Result<Option<Value>, RuntimeProfileFieldError> {
match raw.map(str::trim).filter(|value| !value.is_empty()) {
Some(value) => serde_json::from_str::<Value>(value)
.map(Some)
.map_err(|_| error),
None => Ok(None),
}
}
impl std::fmt::Display for RuntimeSettingsFieldError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
@@ -726,6 +1010,12 @@ impl std::fmt::Display for RuntimeProfileFieldError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::MissingUserId => f.write_str("profile.user_id 不能为空"),
Self::MissingWorldKey => f.write_str("profile.world_key 不能为空"),
Self::MissingBottomTab => f.write_str("runtime_snapshot.bottom_tab 不能为空"),
Self::InvalidGameStateJson => f.write_str("runtime_snapshot.game_state 必须是合法 JSON"),
Self::InvalidCurrentStoryJson => {
f.write_str("runtime_snapshot.current_story 必须是合法 JSON object 或 null")
}
}
}
}

View File

@@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize};
pub const RUNTIME_PLATFORM_THEME_LIGHT: &str = "light";
pub const RUNTIME_PLATFORM_THEME_DARK: &str = "dark";
pub const SAVE_SNAPSHOT_VERSION: u32 = 2;
pub const PROFILE_WALLET_LEDGER_SOURCE_TYPE_SNAPSHOT_SYNC: &str = "snapshot_sync";
pub const BROWSE_HISTORY_THEME_MODE_MARTIAL: &str = "martial";
pub const BROWSE_HISTORY_THEME_MODE_ARCANE: &str = "arcane";
@@ -26,6 +27,33 @@ pub struct PutRuntimeSettingsRequest {
pub platform_theme: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SavedGameSnapshotResponse {
pub version: u32,
pub saved_at: String,
pub game_state: serde_json::Value,
pub bottom_tab: String,
pub current_story: Option<serde_json::Value>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct PutSavedGameSnapshotRequest {
pub game_state: serde_json::Value,
pub bottom_tab: String,
#[serde(default)]
pub current_story: Option<serde_json::Value>,
#[serde(default)]
pub saved_at: Option<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct BasicOkResponse {
pub ok: bool,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct PlatformBrowseHistoryEntryResponse {
@@ -135,6 +163,33 @@ pub struct ProfilePlayStatsResponse {
pub updated_at: Option<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ProfileSaveArchiveSummaryResponse {
pub world_key: String,
pub owner_user_id: Option<String>,
pub profile_id: Option<String>,
pub world_type: Option<String>,
pub world_name: String,
pub subtitle: String,
pub summary_text: String,
pub cover_image_src: Option<String>,
pub last_played_at: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ProfileSaveArchiveListResponse {
pub entries: Vec<ProfileSaveArchiveSummaryResponse>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ProfileSaveArchiveResumeResponse {
pub entry: ProfileSaveArchiveSummaryResponse,
pub snapshot: SavedGameSnapshotResponse,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct RuntimeInventorySlotResponse {
@@ -234,6 +289,43 @@ pub struct CustomWorldGalleryDetailResponse {
pub entry: CustomWorldLibraryEntryResponse,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct CustomWorldWorkSummaryResponse {
pub work_id: String,
pub source_type: String,
pub status: String,
pub title: String,
pub subtitle: String,
pub summary: String,
pub cover_image_src: Option<String>,
#[serde(default)]
pub cover_render_mode: Option<String>,
#[serde(default)]
pub cover_character_image_srcs: Vec<String>,
pub updated_at: String,
pub published_at: Option<String>,
pub stage: Option<String>,
pub stage_label: Option<String>,
pub playable_npc_count: u32,
pub landmark_count: u32,
pub role_visual_ready_count: Option<u32>,
pub role_animation_ready_count: Option<u32>,
pub role_asset_summary_label: Option<String>,
pub session_id: Option<String>,
pub profile_id: Option<String>,
pub can_resume: bool,
pub can_enter_world: bool,
pub blocker_count: u32,
pub publish_ready: bool,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct CustomWorldWorksResponse {
pub items: Vec<CustomWorldWorkSummaryResponse>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct CreateCustomWorldAgentSessionRequest {
@@ -293,6 +385,36 @@ pub struct CustomWorldDraftCardSummaryResponse {
pub asset_status_label: Option<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct CustomWorldDraftCardDetailSectionResponse {
pub id: String,
pub label: String,
pub value: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct CustomWorldDraftCardDetailResponse {
pub id: String,
pub kind: String,
pub title: String,
pub sections: Vec<CustomWorldDraftCardDetailSectionResponse>,
pub linked_ids: Vec<String>,
pub locked: bool,
pub editable: bool,
pub editable_section_ids: Vec<String>,
pub warning_messages: Vec<String>,
pub asset_status: Option<String>,
pub asset_status_label: Option<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct CustomWorldAgentCardDetailResponse {
pub card: CustomWorldDraftCardDetailResponse,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct CustomWorldAgentCheckpointResponse {
@@ -309,6 +431,24 @@ pub struct CustomWorldSupportedActionResponse {
pub reason: Option<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct CustomWorldResultPreviewBlockerResponse {
pub id: String,
pub code: String,
pub message: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct CustomWorldPublishGateResponse {
pub profile_id: String,
pub blockers: Vec<CustomWorldResultPreviewBlockerResponse>,
pub blocker_count: u32,
pub publish_ready: bool,
pub can_enter_world: bool,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct CustomWorldAgentSessionSnapshotResponse {
@@ -333,6 +473,7 @@ pub struct CustomWorldAgentSessionSnapshotResponse {
pub asset_coverage: serde_json::Value,
pub checkpoints: Vec<CustomWorldAgentCheckpointResponse>,
pub supported_actions: Vec<CustomWorldSupportedActionResponse>,
pub publish_gate: Option<CustomWorldPublishGateResponse>,
pub result_preview: Option<serde_json::Value>,
pub updated_at: String,
}
@@ -343,6 +484,67 @@ pub struct CustomWorldAgentSessionResponse {
pub session: CustomWorldAgentSessionSnapshotResponse,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ExecuteCustomWorldAgentActionRequest {
pub action: String,
#[serde(default)]
pub profile_id: Option<String>,
#[serde(default)]
pub draft_profile: Option<serde_json::Value>,
#[serde(default)]
pub legacy_result_profile: Option<serde_json::Value>,
#[serde(default)]
pub setting_text: Option<String>,
#[serde(default)]
pub card_id: Option<String>,
#[serde(default)]
pub sections: Option<Vec<ExecuteCustomWorldAgentDraftCardSectionPatch>>,
#[serde(default)]
pub profile: Option<serde_json::Value>,
#[serde(default)]
pub count: Option<u32>,
#[serde(default)]
pub prompt_text: Option<String>,
#[serde(default)]
pub anchor_card_ids: Option<Vec<String>>,
#[serde(default)]
pub role_ids: Option<Vec<String>>,
#[serde(default)]
pub role_id: Option<String>,
#[serde(default)]
pub portrait_path: Option<String>,
#[serde(default)]
pub generated_visual_asset_id: Option<String>,
#[serde(default)]
pub generated_animation_set_id: Option<String>,
#[serde(default)]
pub animation_map: Option<serde_json::Value>,
#[serde(default)]
pub scene_ids: Option<Vec<String>>,
#[serde(default)]
pub scene_id: Option<String>,
#[serde(default)]
pub scene_kind: Option<String>,
#[serde(default)]
pub image_src: Option<String>,
#[serde(default)]
pub generated_scene_asset_id: Option<String>,
#[serde(default)]
pub generated_scene_prompt: Option<String>,
#[serde(default)]
pub generated_scene_model: Option<String>,
#[serde(default)]
pub checkpoint_id: Option<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ExecuteCustomWorldAgentDraftCardSectionPatch {
pub section_id: String,
pub value: String,
}
#[cfg(test)]
mod tests {
use super::*;

View File

@@ -65,6 +65,11 @@ pub fn format_timestamp_micros(micros: i64) -> String {
format!("{seconds}.{subsec_micros:06}Z")
}
/// 统一把 `OffsetDateTime` 转成 Unix 微秒时间戳,避免各模块重复手写纳秒除法。
pub fn offset_datetime_to_unix_micros(value: OffsetDateTime) -> i64 {
(value.unix_timestamp_nanos() / 1_000) as i64
}
/// 统一格式化 RFC3339 字符串,避免每个模块自己拼格式化错误文案。
pub fn format_rfc3339(value: OffsetDateTime) -> Result<String, String> {
value
@@ -127,6 +132,15 @@ mod tests {
);
}
#[test]
fn offset_datetime_to_unix_micros_is_stable() {
let value = OffsetDateTime::UNIX_EPOCH
+ time::Duration::seconds(1_713_686_401)
+ time::Duration::microseconds(234_567);
assert_eq!(offset_datetime_to_unix_micros(value), 1_713_686_401_234_567);
}
#[test]
fn format_and_parse_rfc3339_round_trip() {
let now = OffsetDateTime::UNIX_EPOCH + time::Duration::seconds(1_713_686_400);

View File

@@ -49,14 +49,19 @@ use module_npc::{
use module_runtime::{
RuntimeBrowseHistoryRecord, RuntimeBrowseHistoryThemeMode, RuntimePlatformTheme,
RuntimeProfileDashboardRecord, RuntimeProfilePlayStatsRecord,
RuntimeProfileSaveArchiveRecord,
RuntimeProfileWalletLedgerEntryRecord, RuntimeProfileWalletLedgerSourceType,
RuntimeSettingsRecord, build_runtime_browse_history_clear_input,
RuntimeSettingsRecord, RuntimeSnapshotRecord, build_runtime_browse_history_clear_input,
build_runtime_browse_history_list_input, build_runtime_browse_history_record,
build_runtime_browse_history_sync_input, build_runtime_profile_dashboard_get_input,
build_runtime_profile_dashboard_record, build_runtime_profile_play_stats_get_input,
build_runtime_profile_play_stats_record, build_runtime_profile_wallet_ledger_entry_record,
build_runtime_profile_play_stats_record, build_runtime_profile_save_archive_list_input,
build_runtime_profile_save_archive_record, build_runtime_profile_save_archive_resume_input,
build_runtime_profile_wallet_ledger_entry_record,
build_runtime_profile_wallet_ledger_list_input, build_runtime_setting_get_input,
build_runtime_setting_record, build_runtime_setting_upsert_input,
build_runtime_snapshot_delete_input, build_runtime_snapshot_get_input,
build_runtime_snapshot_record, build_runtime_snapshot_upsert_input,
};
use module_runtime_item::{
RuntimeItemEquipmentSlot as DomainRuntimeItemEquipmentSlot,
@@ -160,6 +165,10 @@ use crate::module_bindings::{
RuntimeProfileDashboardGetInput as BindingRuntimeProfileDashboardGetInput,
RuntimeProfileDashboardProcedureResult as BindingRuntimeProfileDashboardProcedureResult,
RuntimeProfileDashboardSnapshot as BindingRuntimeProfileDashboardSnapshot,
RuntimeProfileSaveArchiveListInput as BindingRuntimeProfileSaveArchiveListInput,
RuntimeProfileSaveArchiveProcedureResult as BindingRuntimeProfileSaveArchiveProcedureResult,
RuntimeProfileSaveArchiveResumeInput as BindingRuntimeProfileSaveArchiveResumeInput,
RuntimeProfileSaveArchiveSnapshot as BindingRuntimeProfileSaveArchiveSnapshot,
RuntimeProfilePlayStatsGetInput as BindingRuntimeProfilePlayStatsGetInput,
RuntimeProfilePlayStatsProcedureResult as BindingRuntimeProfilePlayStatsProcedureResult,
RuntimeProfilePlayStatsSnapshot as BindingRuntimeProfilePlayStatsSnapshot,
@@ -172,6 +181,11 @@ use crate::module_bindings::{
RuntimeSettingProcedureResult as BindingRuntimeSettingProcedureResult,
RuntimeSettingSnapshot as BindingRuntimeSettingSnapshot,
RuntimeSettingUpsertInput as BindingRuntimeSettingUpsertInput,
RuntimeSnapshotDeleteInput as BindingRuntimeSnapshotDeleteInput,
RuntimeSnapshotGetInput as BindingRuntimeSnapshotGetInput,
RuntimeSnapshotProcedureResult as BindingRuntimeSnapshotProcedureResult,
RuntimeSnapshot as BindingRuntimeSnapshot,
RuntimeSnapshotUpsertInput as BindingRuntimeSnapshotUpsertInput,
StoryContinueInput as BindingStoryContinueInput, StoryEventKind as BindingStoryEventKind,
StoryEventSnapshot as BindingStoryEventSnapshot, StorySessionInput as BindingStorySessionInput,
StorySessionProcedureResult as BindingStorySessionProcedureResult,
@@ -192,6 +206,7 @@ use crate::module_bindings::{
create_ai_task_and_return_procedure::create_ai_task_and_return as _,
create_battle_state_and_return_procedure::create_battle_state_and_return as _,
create_custom_world_agent_session_procedure::create_custom_world_agent_session as _,
delete_runtime_snapshot_and_return_procedure::delete_runtime_snapshot_and_return as _,
fail_ai_task_and_return_procedure::fail_ai_task_and_return as _,
get_battle_state_procedure::get_battle_state as _,
get_custom_world_agent_operation_procedure::get_custom_world_agent_operation as _,
@@ -202,15 +217,18 @@ use crate::module_bindings::{
get_profile_play_stats_procedure::get_profile_play_stats as _,
get_runtime_inventory_state_procedure::get_runtime_inventory_state as _,
get_runtime_setting_or_default_procedure::get_runtime_setting_or_default as _,
get_runtime_snapshot_procedure::get_runtime_snapshot as _,
get_story_session_state_procedure::get_story_session_state as _,
list_custom_world_gallery_entries_procedure::list_custom_world_gallery_entries as _,
list_custom_world_profiles_procedure::list_custom_world_profiles as _,
list_platform_browse_history_procedure::list_platform_browse_history as _,
list_profile_save_archives_procedure::list_profile_save_archives as _,
list_profile_wallet_ledger_procedure::list_profile_wallet_ledger as _,
publish_custom_world_profile_and_return_procedure::publish_custom_world_profile_and_return as _,
publish_custom_world_world_procedure::publish_custom_world_world as _,
resolve_combat_action_and_return_procedure::resolve_combat_action_and_return as _,
resolve_npc_battle_interaction_and_return_procedure::resolve_npc_battle_interaction_and_return as _,
resume_profile_save_archive_and_return_procedure::resume_profile_save_archive_and_return as _,
start_ai_task_reducer::start_ai_task as _,
start_ai_task_stage_reducer::start_ai_task_stage as _,
submit_custom_world_agent_message_procedure::submit_custom_world_agent_message as _,
@@ -218,6 +236,7 @@ use crate::module_bindings::{
upsert_custom_world_profile_and_return_procedure::upsert_custom_world_profile_and_return as _,
upsert_platform_browse_history_and_return_procedure::upsert_platform_browse_history_and_return as _,
upsert_runtime_setting_and_return_procedure::upsert_runtime_setting_and_return as _,
upsert_runtime_snapshot_and_return_procedure::upsert_runtime_snapshot_and_return as _,
};
#[derive(Clone, Debug)]
@@ -888,6 +907,136 @@ impl SpacetimeClient {
.await
}
pub async fn get_runtime_snapshot(
&self,
user_id: String,
) -> Result<Option<RuntimeSnapshotRecord>, SpacetimeClientError> {
let procedure_input = map_runtime_snapshot_get_input(
build_runtime_snapshot_get_input(user_id)
.map_err(|error| SpacetimeClientError::Runtime(error.to_string()))?,
);
self.call_after_connect(move |connection, sender| {
connection.procedures().get_runtime_snapshot_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_runtime_snapshot_procedure_result);
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn put_runtime_snapshot(
&self,
user_id: String,
saved_at_micros: i64,
bottom_tab: String,
game_state: serde_json::Value,
current_story: Option<serde_json::Value>,
updated_at_micros: i64,
) -> Result<RuntimeSnapshotRecord, SpacetimeClientError> {
let procedure_input = map_runtime_snapshot_upsert_input(
build_runtime_snapshot_upsert_input(
user_id,
saved_at_micros,
bottom_tab,
game_state,
current_story,
updated_at_micros,
)
.map_err(|error| SpacetimeClientError::Runtime(error.to_string()))?,
);
self.call_after_connect(move |connection, sender| {
connection.procedures().upsert_runtime_snapshot_and_return_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_runtime_snapshot_required_procedure_result);
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn delete_runtime_snapshot(
&self,
user_id: String,
) -> Result<bool, SpacetimeClientError> {
let procedure_input = map_runtime_snapshot_delete_input(
build_runtime_snapshot_delete_input(user_id)
.map_err(|error| SpacetimeClientError::Runtime(error.to_string()))?,
);
self.call_after_connect(move |connection, sender| {
connection.procedures().delete_runtime_snapshot_and_return_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_runtime_snapshot_delete_procedure_result);
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn list_profile_save_archives(
&self,
user_id: String,
) -> Result<Vec<RuntimeProfileSaveArchiveRecord>, SpacetimeClientError> {
let procedure_input = map_runtime_profile_save_archive_list_input(
build_runtime_profile_save_archive_list_input(user_id)
.map_err(|error| SpacetimeClientError::Runtime(error.to_string()))?,
);
self.call_after_connect(move |connection, sender| {
connection.procedures().list_profile_save_archives_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_runtime_profile_save_archive_list_procedure_result);
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn resume_profile_save_archive(
&self,
user_id: String,
world_key: String,
) -> Result<(RuntimeProfileSaveArchiveRecord, RuntimeSnapshotRecord), SpacetimeClientError> {
let procedure_input = map_runtime_profile_save_archive_resume_input(
build_runtime_profile_save_archive_resume_input(user_id, world_key)
.map_err(|error| SpacetimeClientError::Runtime(error.to_string()))?,
);
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.resume_profile_save_archive_and_return_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_runtime_profile_save_archive_resume_procedure_result);
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn begin_story_session(
&self,
story_session_id: String,
@@ -1411,6 +1560,52 @@ fn map_runtime_profile_play_stats_get_input(
}
}
fn map_runtime_snapshot_get_input(
input: module_runtime::RuntimeSnapshotGetInput,
) -> BindingRuntimeSnapshotGetInput {
BindingRuntimeSnapshotGetInput {
user_id: input.user_id,
}
}
fn map_runtime_snapshot_upsert_input(
input: module_runtime::RuntimeSnapshotUpsertInput,
) -> BindingRuntimeSnapshotUpsertInput {
BindingRuntimeSnapshotUpsertInput {
user_id: input.user_id,
saved_at_micros: input.saved_at_micros,
bottom_tab: input.bottom_tab,
game_state_json: input.game_state_json,
current_story_json: input.current_story_json,
updated_at_micros: input.updated_at_micros,
}
}
fn map_runtime_snapshot_delete_input(
input: module_runtime::RuntimeSnapshotDeleteInput,
) -> BindingRuntimeSnapshotDeleteInput {
BindingRuntimeSnapshotDeleteInput {
user_id: input.user_id,
}
}
fn map_runtime_profile_save_archive_list_input(
input: module_runtime::RuntimeProfileSaveArchiveListInput,
) -> BindingRuntimeProfileSaveArchiveListInput {
BindingRuntimeProfileSaveArchiveListInput {
user_id: input.user_id,
}
}
fn map_runtime_profile_save_archive_resume_input(
input: module_runtime::RuntimeProfileSaveArchiveResumeInput,
) -> BindingRuntimeProfileSaveArchiveResumeInput {
BindingRuntimeProfileSaveArchiveResumeInput {
user_id: input.user_id,
world_key: input.world_key,
}
}
fn map_ai_task_create_input(input: DomainAiTaskCreateInput) -> BindingAiTaskCreateInput {
BindingAiTaskCreateInput {
task_id: input.task_id,
@@ -1786,6 +1981,89 @@ fn map_runtime_profile_play_stats_procedure_result(
))
}
fn map_runtime_snapshot_procedure_result(
result: BindingRuntimeSnapshotProcedureResult,
) -> Result<Option<RuntimeSnapshotRecord>, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::Procedure(
result
.error_message
.unwrap_or_else(|| "SpacetimeDB procedure 返回未知错误".to_string()),
));
}
result
.record
.map(|snapshot| {
build_runtime_snapshot_record(map_runtime_snapshot_snapshot(snapshot))
.map_err(|error| SpacetimeClientError::Runtime(error.to_string()))
})
.transpose()
}
fn map_runtime_snapshot_required_procedure_result(
result: BindingRuntimeSnapshotProcedureResult,
) -> Result<RuntimeSnapshotRecord, SpacetimeClientError> {
map_runtime_snapshot_procedure_result(result)?.ok_or_else(|| {
SpacetimeClientError::Procedure("SpacetimeDB procedure 未返回 runtime snapshot 快照".to_string())
})
}
fn map_runtime_snapshot_delete_procedure_result(
result: BindingRuntimeSnapshotProcedureResult,
) -> Result<bool, SpacetimeClientError> {
map_runtime_snapshot_procedure_result(result).map(|record| record.is_some())
}
fn map_runtime_profile_save_archive_list_procedure_result(
result: BindingRuntimeProfileSaveArchiveProcedureResult,
) -> Result<Vec<RuntimeProfileSaveArchiveRecord>, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::Procedure(
result
.error_message
.unwrap_or_else(|| "SpacetimeDB procedure 返回未知错误".to_string()),
));
}
result
.entries
.into_iter()
.map(|snapshot| {
build_runtime_profile_save_archive_record(
map_runtime_profile_save_archive_snapshot(snapshot),
)
.map_err(|error| SpacetimeClientError::Runtime(error.to_string()))
})
.collect()
}
fn map_runtime_profile_save_archive_resume_procedure_result(
result: BindingRuntimeProfileSaveArchiveProcedureResult,
) -> Result<(RuntimeProfileSaveArchiveRecord, RuntimeSnapshotRecord), SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::Procedure(
result
.error_message
.unwrap_or_else(|| "SpacetimeDB procedure 返回未知错误".to_string()),
));
}
let archive = result.record.ok_or_else(|| {
SpacetimeClientError::Procedure("SpacetimeDB procedure 未返回 save archive 快照".to_string())
})?;
let snapshot = result.current_snapshot.ok_or_else(|| {
SpacetimeClientError::Procedure("SpacetimeDB procedure 未返回恢复后的 runtime snapshot".to_string())
})?;
Ok((
build_runtime_profile_save_archive_record(map_runtime_profile_save_archive_snapshot(archive))
.map_err(|error| SpacetimeClientError::Runtime(error.to_string()))?,
build_runtime_snapshot_record(map_runtime_snapshot_snapshot(snapshot))
.map_err(|error| SpacetimeClientError::Runtime(error.to_string()))?,
))
}
fn map_ai_task_procedure_result(
result: BindingAiTaskProcedureResult,
) -> Result<AiTaskMutationRecord, SpacetimeClientError> {
@@ -2247,6 +2525,44 @@ fn map_runtime_profile_play_stats_snapshot(
}
}
fn map_runtime_snapshot_snapshot(
snapshot: BindingRuntimeSnapshot,
) -> module_runtime::RuntimeSnapshot {
module_runtime::RuntimeSnapshot {
user_id: snapshot.user_id,
version: snapshot.version,
saved_at_micros: snapshot.saved_at_micros,
bottom_tab: snapshot.bottom_tab,
game_state_json: snapshot.game_state_json,
current_story_json: snapshot.current_story_json,
created_at_micros: snapshot.created_at_micros,
updated_at_micros: snapshot.updated_at_micros,
}
}
fn map_runtime_profile_save_archive_snapshot(
snapshot: BindingRuntimeProfileSaveArchiveSnapshot,
) -> module_runtime::RuntimeProfileSaveArchiveSnapshot {
module_runtime::RuntimeProfileSaveArchiveSnapshot {
archive_id: snapshot.archive_id,
user_id: snapshot.user_id,
world_key: snapshot.world_key,
owner_user_id: snapshot.owner_user_id,
profile_id: snapshot.profile_id,
world_type: snapshot.world_type,
world_name: snapshot.world_name,
subtitle: snapshot.subtitle,
summary_text: snapshot.summary_text,
cover_image_src: snapshot.cover_image_src,
saved_at_micros: snapshot.saved_at_micros,
bottom_tab: snapshot.bottom_tab,
game_state_json: snapshot.game_state_json,
current_story_json: snapshot.current_story_json,
created_at_micros: snapshot.created_at_micros,
updated_at_micros: snapshot.updated_at_micros,
}
}
fn map_custom_world_library_entry_from_profile_snapshot(
snapshot: BindingCustomWorldProfileSnapshot,
) -> Result<CustomWorldLibraryEntryRecord, SpacetimeClientError> {

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::quest_record_input_type::QuestRecordInput;
@@ -14,8 +19,10 @@ pub(super) struct AcceptQuestArgs {
impl From<AcceptQuestArgs> for super::Reducer {
fn from(args: AcceptQuestArgs) -> Self {
Self::AcceptQuest { input: args.input }
}
Self::AcceptQuest {
input: args.input,
}
}
}
impl __sdk::InModule for AcceptQuestArgs {
@@ -33,8 +40,9 @@ pub trait accept_quest {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`accept_quest:accept_quest_then`] to run a callback after the reducer completes.
fn accept_quest(&self, input: QuestRecordInput) -> __sdk::Result<()> {
self.accept_quest_then(input, |_, _| {})
fn accept_quest(&self, input: QuestRecordInput,
) -> __sdk::Result<()> {
self.accept_quest_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `accept_quest` to run as soon as possible,
@@ -62,7 +70,7 @@ impl accept_quest for super::RemoteReducers {
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp
.invoke_reducer_with_callback(AcceptQuestArgs { input }, callback)
self.imp.invoke_reducer_with_callback(AcceptQuestArgs { input, }, callback)
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::quest_completion_ack_input_type::QuestCompletionAckInput;
@@ -14,8 +19,10 @@ pub(super) struct AcknowledgeQuestCompletionArgs {
impl From<AcknowledgeQuestCompletionArgs> for super::Reducer {
fn from(args: AcknowledgeQuestCompletionArgs) -> Self {
Self::AcknowledgeQuestCompletion { input: args.input }
}
Self::AcknowledgeQuestCompletion {
input: args.input,
}
}
}
impl __sdk::InModule for AcknowledgeQuestCompletionArgs {
@@ -33,8 +40,9 @@ pub trait acknowledge_quest_completion {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`acknowledge_quest_completion:acknowledge_quest_completion_then`] to run a callback after the reducer completes.
fn acknowledge_quest_completion(&self, input: QuestCompletionAckInput) -> __sdk::Result<()> {
self.acknowledge_quest_completion_then(input, |_, _| {})
fn acknowledge_quest_completion(&self, input: QuestCompletionAckInput,
) -> __sdk::Result<()> {
self.acknowledge_quest_completion_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `acknowledge_quest_completion` to run as soon as possible,
@@ -62,7 +70,7 @@ impl acknowledge_quest_completion for super::RemoteReducers {
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp
.invoke_reducer_with_callback(AcknowledgeQuestCompletionArgs { input }, callback)
self.imp.invoke_reducer_with_callback(AcknowledgeQuestCompletionArgs { input, }, callback)
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_result_reference_kind_type::AiResultReferenceKind;
@@ -12,10 +17,12 @@ pub struct AiResultReferenceInput {
pub task_id: String,
pub reference_kind: AiResultReferenceKind,
pub reference_id: String,
pub label: Option<String>,
pub label: Option::<String>,
pub created_at_micros: i64,
}
impl __sdk::InModule for AiResultReferenceInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -19,8 +24,12 @@ pub enum AiResultReferenceKind {
RuntimeItemRecord,
AssetObject,
}
impl __sdk::InModule for AiResultReferenceKind {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_result_reference_kind_type::AiResultReferenceKind;
@@ -13,10 +18,12 @@ pub struct AiResultReferenceSnapshot {
pub task_id: String,
pub reference_kind: AiResultReferenceKind,
pub reference_id: String,
pub label: Option<String>,
pub label: Option::<String>,
pub created_at_micros: i64,
}
impl __sdk::InModule for AiResultReferenceSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,9 +2,14 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use super::ai_result_reference_kind_type::AiResultReferenceKind;
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_result_reference_type::AiResultReference;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::ai_result_reference_kind_type::AiResultReferenceKind;
/// Table handle for the table `ai_result_reference`.
///
@@ -32,9 +37,7 @@ pub trait AiResultReferenceTableAccess {
impl AiResultReferenceTableAccess for super::RemoteTables {
fn ai_result_reference(&self) -> AiResultReferenceTableHandle<'_> {
AiResultReferenceTableHandle {
imp: self
.imp
.get_table::<AiResultReference>("ai_result_reference"),
imp: self.imp.get_table::<AiResultReference>("ai_result_reference"),
ctx: std::marker::PhantomData,
}
}
@@ -47,12 +50,8 @@ impl<'ctx> __sdk::Table for AiResultReferenceTableHandle<'ctx> {
type Row = AiResultReference;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = AiResultReference> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = AiResultReference> + '_ { self.imp.iter() }
type InsertCallbackId = AiResultReferenceInsertCallbackId;
@@ -98,44 +97,41 @@ impl<'ctx> __sdk::TableWithPrimaryKey for AiResultReferenceTableHandle<'ctx> {
}
}
/// Access to the `result_reference_row_id` unique index on the table `ai_result_reference`,
/// which allows point queries on the field of the same name
/// via the [`AiResultReferenceResultReferenceRowIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.ai_result_reference().result_reference_row_id().find(...)`.
pub struct AiResultReferenceResultReferenceRowIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AiResultReference, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> AiResultReferenceTableHandle<'ctx> {
/// Get a handle on the `result_reference_row_id` unique index on the table `ai_result_reference`.
pub fn result_reference_row_id(&self) -> AiResultReferenceResultReferenceRowIdUnique<'ctx> {
AiResultReferenceResultReferenceRowIdUnique {
imp: self
.imp
.get_unique_constraint::<String>("result_reference_row_id"),
phantom: std::marker::PhantomData,
/// Access to the `result_reference_row_id` unique index on the table `ai_result_reference`,
/// which allows point queries on the field of the same name
/// via the [`AiResultReferenceResultReferenceRowIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.ai_result_reference().result_reference_row_id().find(...)`.
pub struct AiResultReferenceResultReferenceRowIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AiResultReference, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> AiResultReferenceResultReferenceRowIdUnique<'ctx> {
/// Find the subscribed row whose `result_reference_row_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<AiResultReference> {
self.imp.find(col_val)
}
}
impl<'ctx> AiResultReferenceTableHandle<'ctx> {
/// Get a handle on the `result_reference_row_id` unique index on the table `ai_result_reference`.
pub fn result_reference_row_id(&self) -> AiResultReferenceResultReferenceRowIdUnique<'ctx> {
AiResultReferenceResultReferenceRowIdUnique {
imp: self.imp.get_unique_constraint::<String>("result_reference_row_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> AiResultReferenceResultReferenceRowIdUnique<'ctx> {
/// Find the subscribed row whose `result_reference_row_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<AiResultReference> {
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::<AiResultReference>("ai_result_reference");
_table.add_unique_constraint::<String>("result_reference_row_id", |row| {
&row.result_reference_row_id
});
_table.add_unique_constraint::<String>("result_reference_row_id", |row| &row.result_reference_row_id);
}
#[doc(hidden)]
@@ -143,24 +139,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<AiResultReference>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<AiResultReference>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<AiResultReference>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AiResultReference`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait ai_result_referenceQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AiResultReference`.
fn ai_result_reference(&self) -> __sdk::__query_builder::Table<AiResultReference>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AiResultReference`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait ai_result_referenceQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AiResultReference`.
fn ai_result_reference(&self) -> __sdk::__query_builder::Table<AiResultReference>;
}
impl ai_result_referenceQueryTableAccess for __sdk::QueryTableAccessor {
fn ai_result_reference(&self) -> __sdk::__query_builder::Table<AiResultReference> {
__sdk::__query_builder::Table::new("ai_result_reference")
}
}
impl ai_result_referenceQueryTableAccess for __sdk::QueryTableAccessor {
fn ai_result_reference(&self) -> __sdk::__query_builder::Table<AiResultReference> {
__sdk::__query_builder::Table::new("ai_result_reference")
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_result_reference_kind_type::AiResultReferenceKind;
@@ -14,14 +19,16 @@ pub struct AiResultReference {
pub task_id: String,
pub reference_kind: AiResultReferenceKind,
pub reference_id: String,
pub label: Option<String>,
pub label: Option::<String>,
pub created_at: __sdk::Timestamp,
}
impl __sdk::InModule for AiResultReference {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `AiResultReference`.
///
/// Provides typed access to columns for query building.
@@ -31,7 +38,7 @@ pub struct AiResultReferenceCols {
pub task_id: __sdk::__query_builder::Col<AiResultReference, String>,
pub reference_kind: __sdk::__query_builder::Col<AiResultReference, AiResultReferenceKind>,
pub reference_id: __sdk::__query_builder::Col<AiResultReference, String>,
pub label: __sdk::__query_builder::Col<AiResultReference, Option<String>>,
pub label: __sdk::__query_builder::Col<AiResultReference, Option::<String>>,
pub created_at: __sdk::__query_builder::Col<AiResultReference, __sdk::Timestamp>,
}
@@ -39,16 +46,14 @@ impl __sdk::__query_builder::HasCols for AiResultReference {
type Cols = AiResultReferenceCols;
fn cols(table_name: &'static str) -> Self::Cols {
AiResultReferenceCols {
result_reference_row_id: __sdk::__query_builder::Col::new(
table_name,
"result_reference_row_id",
),
result_reference_row_id: __sdk::__query_builder::Col::new(table_name, "result_reference_row_id"),
result_ref_id: __sdk::__query_builder::Col::new(table_name, "result_ref_id"),
task_id: __sdk::__query_builder::Col::new(table_name, "task_id"),
reference_kind: __sdk::__query_builder::Col::new(table_name, "reference_kind"),
reference_id: __sdk::__query_builder::Col::new(table_name, "reference_id"),
label: __sdk::__query_builder::Col::new(table_name, "label"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
}
}
}
@@ -65,13 +70,12 @@ impl __sdk::__query_builder::HasIxCols for AiResultReference {
type IxCols = AiResultReferenceIxCols;
fn ix_cols(table_name: &'static str) -> Self::IxCols {
AiResultReferenceIxCols {
result_reference_row_id: __sdk::__query_builder::IxCol::new(
table_name,
"result_reference_row_id",
),
result_reference_row_id: __sdk::__query_builder::IxCol::new(table_name, "result_reference_row_id"),
task_id: __sdk::__query_builder::IxCol::new(table_name, "task_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for AiResultReference {}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_kind_type::AiTaskStageKind;
@@ -11,12 +16,14 @@ use super::ai_task_stage_kind_type::AiTaskStageKind;
pub struct AiStageCompletionInput {
pub task_id: String,
pub stage_kind: AiTaskStageKind,
pub text_output: Option<String>,
pub structured_payload_json: Option<String>,
pub warning_messages: Vec<String>,
pub text_output: Option::<String>,
pub structured_payload_json: Option::<String>,
pub warning_messages: Vec::<String>,
pub completed_at_micros: i64,
}
impl __sdk::InModule for AiStageCompletionInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,13 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -11,6 +17,8 @@ pub struct AiTaskCancelInput {
pub completed_at_micros: i64,
}
impl __sdk::InModule for AiTaskCancelInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_kind_type::AiTaskKind;
use super::ai_task_stage_blueprint_type::AiTaskStageBlueprint;
@@ -15,12 +20,14 @@ pub struct AiTaskCreateInput {
pub owner_user_id: String,
pub request_label: String,
pub source_module: String,
pub source_entity_id: Option<String>,
pub request_payload_json: Option<String>,
pub stages: Vec<AiTaskStageBlueprint>,
pub source_entity_id: Option::<String>,
pub request_payload_json: Option::<String>,
pub stages: Vec::<AiTaskStageBlueprint>,
pub created_at_micros: i64,
}
impl __sdk::InModule for AiTaskCreateInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,13 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -12,6 +18,8 @@ pub struct AiTaskFailureInput {
pub completed_at_micros: i64,
}
impl __sdk::InModule for AiTaskFailureInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,13 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -11,6 +17,8 @@ pub struct AiTaskFinishInput {
pub completed_at_micros: i64,
}
impl __sdk::InModule for AiTaskFinishInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -19,8 +24,12 @@ pub enum AiTaskKind {
QuestIntent,
RuntimeItemIntent,
}
impl __sdk::InModule for AiTaskKind {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_snapshot_type::AiTaskSnapshot;
use super::ai_text_chunk_snapshot_type::AiTextChunkSnapshot;
@@ -11,11 +16,13 @@ use super::ai_text_chunk_snapshot_type::AiTextChunkSnapshot;
#[sats(crate = __lib)]
pub struct AiTaskProcedureResult {
pub ok: bool,
pub task: Option<AiTaskSnapshot>,
pub text_chunk: Option<AiTextChunkSnapshot>,
pub error_message: Option<String>,
pub task: Option::<AiTaskSnapshot>,
pub text_chunk: Option::<AiTextChunkSnapshot>,
pub error_message: Option::<String>,
}
impl __sdk::InModule for AiTaskProcedureResult {
type Module = super::RemoteModule;
}

View File

@@ -2,12 +2,17 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_result_reference_snapshot_type::AiResultReferenceSnapshot;
use super::ai_task_kind_type::AiTaskKind;
use super::ai_task_stage_snapshot_type::AiTaskStageSnapshot;
use super::ai_task_status_type::AiTaskStatus;
use super::ai_task_stage_snapshot_type::AiTaskStageSnapshot;
use super::ai_result_reference_snapshot_type::AiResultReferenceSnapshot;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -17,21 +22,23 @@ pub struct AiTaskSnapshot {
pub owner_user_id: String,
pub request_label: String,
pub source_module: String,
pub source_entity_id: Option<String>,
pub request_payload_json: Option<String>,
pub source_entity_id: Option::<String>,
pub request_payload_json: Option::<String>,
pub status: AiTaskStatus,
pub failure_message: Option<String>,
pub stages: Vec<AiTaskStageSnapshot>,
pub result_references: Vec<AiResultReferenceSnapshot>,
pub latest_text_output: Option<String>,
pub latest_structured_payload_json: Option<String>,
pub failure_message: Option::<String>,
pub stages: Vec::<AiTaskStageSnapshot>,
pub result_references: Vec::<AiResultReferenceSnapshot>,
pub latest_text_output: Option::<String>,
pub latest_structured_payload_json: Option::<String>,
pub version: u32,
pub created_at_micros: i64,
pub started_at_micros: Option<i64>,
pub completed_at_micros: Option<i64>,
pub started_at_micros: Option::<i64>,
pub completed_at_micros: Option::<i64>,
pub updated_at_micros: i64,
}
impl __sdk::InModule for AiTaskSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_kind_type::AiTaskStageKind;
@@ -15,6 +20,8 @@ pub struct AiTaskStageBlueprint {
pub order: u32,
}
impl __sdk::InModule for AiTaskStageBlueprint {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -17,8 +22,12 @@ pub enum AiTaskStageKind {
NormalizeResult,
PersistResult,
}
impl __sdk::InModule for AiTaskStageKind {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_kind_type::AiTaskStageKind;
use super::ai_task_stage_status_type::AiTaskStageStatus;
@@ -15,13 +20,15 @@ pub struct AiTaskStageSnapshot {
pub detail: String,
pub order: u32,
pub status: AiTaskStageStatus,
pub text_output: Option<String>,
pub structured_payload_json: Option<String>,
pub warning_messages: Vec<String>,
pub started_at_micros: Option<i64>,
pub completed_at_micros: Option<i64>,
pub text_output: Option::<String>,
pub structured_payload_json: Option::<String>,
pub warning_messages: Vec::<String>,
pub started_at_micros: Option::<i64>,
pub completed_at_micros: Option::<i64>,
}
impl __sdk::InModule for AiTaskStageSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_kind_type::AiTaskStageKind;
@@ -14,6 +19,8 @@ pub struct AiTaskStageStartInput {
pub started_at_micros: i64,
}
impl __sdk::InModule for AiTaskStageStartInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -15,8 +20,12 @@ pub enum AiTaskStageStatus {
Completed,
Skipped,
}
impl __sdk::InModule for AiTaskStageStatus {
type Module = super::RemoteModule;
}

View File

@@ -2,10 +2,15 @@
// 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::ai_task_stage_type::AiTaskStage;
use super::ai_task_stage_kind_type::AiTaskStageKind;
use super::ai_task_stage_status_type::AiTaskStageStatus;
use super::ai_task_stage_type::AiTaskStage;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `ai_task_stage`.
///
@@ -46,12 +51,8 @@ impl<'ctx> __sdk::Table for AiTaskStageTableHandle<'ctx> {
type Row = AiTaskStage;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = AiTaskStage> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = AiTaskStage> + '_ { self.imp.iter() }
type InsertCallbackId = AiTaskStageInsertCallbackId;
@@ -97,38 +98,39 @@ impl<'ctx> __sdk::TableWithPrimaryKey for AiTaskStageTableHandle<'ctx> {
}
}
/// Access to the `task_stage_id` unique index on the table `ai_task_stage`,
/// which allows point queries on the field of the same name
/// via the [`AiTaskStageTaskStageIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.ai_task_stage().task_stage_id().find(...)`.
pub struct AiTaskStageTaskStageIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AiTaskStage, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> AiTaskStageTableHandle<'ctx> {
/// Get a handle on the `task_stage_id` unique index on the table `ai_task_stage`.
pub fn task_stage_id(&self) -> AiTaskStageTaskStageIdUnique<'ctx> {
AiTaskStageTaskStageIdUnique {
imp: self.imp.get_unique_constraint::<String>("task_stage_id"),
phantom: std::marker::PhantomData,
/// Access to the `task_stage_id` unique index on the table `ai_task_stage`,
/// which allows point queries on the field of the same name
/// via the [`AiTaskStageTaskStageIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.ai_task_stage().task_stage_id().find(...)`.
pub struct AiTaskStageTaskStageIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AiTaskStage, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> AiTaskStageTaskStageIdUnique<'ctx> {
/// Find the subscribed row whose `task_stage_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<AiTaskStage> {
self.imp.find(col_val)
}
}
impl<'ctx> AiTaskStageTableHandle<'ctx> {
/// Get a handle on the `task_stage_id` unique index on the table `ai_task_stage`.
pub fn task_stage_id(&self) -> AiTaskStageTaskStageIdUnique<'ctx> {
AiTaskStageTaskStageIdUnique {
imp: self.imp.get_unique_constraint::<String>("task_stage_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> AiTaskStageTaskStageIdUnique<'ctx> {
/// Find the subscribed row whose `task_stage_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<AiTaskStage> {
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::<AiTaskStage>("ai_task_stage");
_table.add_unique_constraint::<String>("task_stage_id", |row| &row.task_stage_id);
}
@@ -138,24 +140,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<AiTaskStage>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<AiTaskStage>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<AiTaskStage>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AiTaskStage`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait ai_task_stageQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AiTaskStage`.
fn ai_task_stage(&self) -> __sdk::__query_builder::Table<AiTaskStage>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AiTaskStage`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait ai_task_stageQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AiTaskStage`.
fn ai_task_stage(&self) -> __sdk::__query_builder::Table<AiTaskStage>;
}
impl ai_task_stageQueryTableAccess for __sdk::QueryTableAccessor {
fn ai_task_stage(&self) -> __sdk::__query_builder::Table<AiTaskStage> {
__sdk::__query_builder::Table::new("ai_task_stage")
}
}
impl ai_task_stageQueryTableAccess for __sdk::QueryTableAccessor {
fn ai_task_stage(&self) -> __sdk::__query_builder::Table<AiTaskStage> {
__sdk::__query_builder::Table::new("ai_task_stage")
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_kind_type::AiTaskStageKind;
use super::ai_task_stage_status_type::AiTaskStageStatus;
@@ -17,17 +22,19 @@ pub struct AiTaskStage {
pub detail: String,
pub stage_order: u32,
pub status: AiTaskStageStatus,
pub text_output: Option<String>,
pub structured_payload_json: Option<String>,
pub warning_messages: Vec<String>,
pub started_at: Option<__sdk::Timestamp>,
pub completed_at: Option<__sdk::Timestamp>,
pub text_output: Option::<String>,
pub structured_payload_json: Option::<String>,
pub warning_messages: Vec::<String>,
pub started_at: Option::<__sdk::Timestamp>,
pub completed_at: Option::<__sdk::Timestamp>,
}
impl __sdk::InModule for AiTaskStage {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `AiTaskStage`.
///
/// Provides typed access to columns for query building.
@@ -39,11 +46,11 @@ pub struct AiTaskStageCols {
pub detail: __sdk::__query_builder::Col<AiTaskStage, String>,
pub stage_order: __sdk::__query_builder::Col<AiTaskStage, u32>,
pub status: __sdk::__query_builder::Col<AiTaskStage, AiTaskStageStatus>,
pub text_output: __sdk::__query_builder::Col<AiTaskStage, Option<String>>,
pub structured_payload_json: __sdk::__query_builder::Col<AiTaskStage, Option<String>>,
pub warning_messages: __sdk::__query_builder::Col<AiTaskStage, Vec<String>>,
pub started_at: __sdk::__query_builder::Col<AiTaskStage, Option<__sdk::Timestamp>>,
pub completed_at: __sdk::__query_builder::Col<AiTaskStage, Option<__sdk::Timestamp>>,
pub text_output: __sdk::__query_builder::Col<AiTaskStage, Option::<String>>,
pub structured_payload_json: __sdk::__query_builder::Col<AiTaskStage, Option::<String>>,
pub warning_messages: __sdk::__query_builder::Col<AiTaskStage, Vec::<String>>,
pub started_at: __sdk::__query_builder::Col<AiTaskStage, Option::<__sdk::Timestamp>>,
pub completed_at: __sdk::__query_builder::Col<AiTaskStage, Option::<__sdk::Timestamp>>,
}
impl __sdk::__query_builder::HasCols for AiTaskStage {
@@ -58,13 +65,11 @@ impl __sdk::__query_builder::HasCols for AiTaskStage {
stage_order: __sdk::__query_builder::Col::new(table_name, "stage_order"),
status: __sdk::__query_builder::Col::new(table_name, "status"),
text_output: __sdk::__query_builder::Col::new(table_name, "text_output"),
structured_payload_json: __sdk::__query_builder::Col::new(
table_name,
"structured_payload_json",
),
structured_payload_json: __sdk::__query_builder::Col::new(table_name, "structured_payload_json"),
warning_messages: __sdk::__query_builder::Col::new(table_name, "warning_messages"),
started_at: __sdk::__query_builder::Col::new(table_name, "started_at"),
completed_at: __sdk::__query_builder::Col::new(table_name, "completed_at"),
}
}
}
@@ -83,8 +88,10 @@ impl __sdk::__query_builder::HasIxCols for AiTaskStage {
AiTaskStageIxCols {
task_id: __sdk::__query_builder::IxCol::new(table_name, "task_id"),
task_stage_id: __sdk::__query_builder::IxCol::new(table_name, "task_stage_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for AiTaskStage {}

View File

@@ -2,7 +2,13 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -11,6 +17,8 @@ pub struct AiTaskStartInput {
pub started_at_micros: i64,
}
impl __sdk::InModule for AiTaskStartInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -17,8 +22,12 @@ pub enum AiTaskStatus {
Failed,
Cancelled,
}
impl __sdk::InModule for AiTaskStatus {
type Module = super::RemoteModule;
}

View File

@@ -2,10 +2,15 @@
// 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::ai_task_type::AiTask;
use super::ai_task_kind_type::AiTaskKind;
use super::ai_task_status_type::AiTaskStatus;
use super::ai_task_type::AiTask;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `ai_task`.
///
@@ -46,12 +51,8 @@ impl<'ctx> __sdk::Table for AiTaskTableHandle<'ctx> {
type Row = AiTask;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = AiTask> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = AiTask> + '_ { self.imp.iter() }
type InsertCallbackId = AiTaskInsertCallbackId;
@@ -97,38 +98,39 @@ impl<'ctx> __sdk::TableWithPrimaryKey for AiTaskTableHandle<'ctx> {
}
}
/// Access to the `task_id` unique index on the table `ai_task`,
/// which allows point queries on the field of the same name
/// via the [`AiTaskTaskIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.ai_task().task_id().find(...)`.
pub struct AiTaskTaskIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AiTask, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> AiTaskTableHandle<'ctx> {
/// Get a handle on the `task_id` unique index on the table `ai_task`.
pub fn task_id(&self) -> AiTaskTaskIdUnique<'ctx> {
AiTaskTaskIdUnique {
imp: self.imp.get_unique_constraint::<String>("task_id"),
phantom: std::marker::PhantomData,
/// Access to the `task_id` unique index on the table `ai_task`,
/// which allows point queries on the field of the same name
/// via the [`AiTaskTaskIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.ai_task().task_id().find(...)`.
pub struct AiTaskTaskIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AiTask, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> AiTaskTaskIdUnique<'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<AiTask> {
self.imp.find(col_val)
}
}
impl<'ctx> AiTaskTableHandle<'ctx> {
/// Get a handle on the `task_id` unique index on the table `ai_task`.
pub fn task_id(&self) -> AiTaskTaskIdUnique<'ctx> {
AiTaskTaskIdUnique {
imp: self.imp.get_unique_constraint::<String>("task_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> AiTaskTaskIdUnique<'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<AiTask> {
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::<AiTask>("ai_task");
_table.add_unique_constraint::<String>("task_id", |row| &row.task_id);
}
@@ -138,24 +140,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<AiTask>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<AiTask>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<AiTask>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AiTask`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait ai_taskQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AiTask`.
fn ai_task(&self) -> __sdk::__query_builder::Table<AiTask>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AiTask`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait ai_taskQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AiTask`.
fn ai_task(&self) -> __sdk::__query_builder::Table<AiTask>;
}
impl ai_taskQueryTableAccess for __sdk::QueryTableAccessor {
fn ai_task(&self) -> __sdk::__query_builder::Table<AiTask> {
__sdk::__query_builder::Table::new("ai_task")
}
}
impl ai_taskQueryTableAccess for __sdk::QueryTableAccessor {
fn ai_task(&self) -> __sdk::__query_builder::Table<AiTask> {
__sdk::__query_builder::Table::new("ai_task")
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_kind_type::AiTaskKind;
use super::ai_task_status_type::AiTaskStatus;
@@ -15,23 +20,25 @@ pub struct AiTask {
pub owner_user_id: String,
pub request_label: String,
pub source_module: String,
pub source_entity_id: Option<String>,
pub request_payload_json: Option<String>,
pub source_entity_id: Option::<String>,
pub request_payload_json: Option::<String>,
pub status: AiTaskStatus,
pub failure_message: Option<String>,
pub latest_text_output: Option<String>,
pub latest_structured_payload_json: Option<String>,
pub failure_message: Option::<String>,
pub latest_text_output: Option::<String>,
pub latest_structured_payload_json: Option::<String>,
pub version: u32,
pub created_at: __sdk::Timestamp,
pub started_at: Option<__sdk::Timestamp>,
pub completed_at: Option<__sdk::Timestamp>,
pub started_at: Option::<__sdk::Timestamp>,
pub completed_at: Option::<__sdk::Timestamp>,
pub updated_at: __sdk::Timestamp,
}
impl __sdk::InModule for AiTask {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `AiTask`.
///
/// Provides typed access to columns for query building.
@@ -41,16 +48,16 @@ pub struct AiTaskCols {
pub owner_user_id: __sdk::__query_builder::Col<AiTask, String>,
pub request_label: __sdk::__query_builder::Col<AiTask, String>,
pub source_module: __sdk::__query_builder::Col<AiTask, String>,
pub source_entity_id: __sdk::__query_builder::Col<AiTask, Option<String>>,
pub request_payload_json: __sdk::__query_builder::Col<AiTask, Option<String>>,
pub source_entity_id: __sdk::__query_builder::Col<AiTask, Option::<String>>,
pub request_payload_json: __sdk::__query_builder::Col<AiTask, Option::<String>>,
pub status: __sdk::__query_builder::Col<AiTask, AiTaskStatus>,
pub failure_message: __sdk::__query_builder::Col<AiTask, Option<String>>,
pub latest_text_output: __sdk::__query_builder::Col<AiTask, Option<String>>,
pub latest_structured_payload_json: __sdk::__query_builder::Col<AiTask, Option<String>>,
pub failure_message: __sdk::__query_builder::Col<AiTask, Option::<String>>,
pub latest_text_output: __sdk::__query_builder::Col<AiTask, Option::<String>>,
pub latest_structured_payload_json: __sdk::__query_builder::Col<AiTask, Option::<String>>,
pub version: __sdk::__query_builder::Col<AiTask, u32>,
pub created_at: __sdk::__query_builder::Col<AiTask, __sdk::Timestamp>,
pub started_at: __sdk::__query_builder::Col<AiTask, Option<__sdk::Timestamp>>,
pub completed_at: __sdk::__query_builder::Col<AiTask, Option<__sdk::Timestamp>>,
pub started_at: __sdk::__query_builder::Col<AiTask, Option::<__sdk::Timestamp>>,
pub completed_at: __sdk::__query_builder::Col<AiTask, Option::<__sdk::Timestamp>>,
pub updated_at: __sdk::__query_builder::Col<AiTask, __sdk::Timestamp>,
}
@@ -64,22 +71,17 @@ impl __sdk::__query_builder::HasCols for AiTask {
request_label: __sdk::__query_builder::Col::new(table_name, "request_label"),
source_module: __sdk::__query_builder::Col::new(table_name, "source_module"),
source_entity_id: __sdk::__query_builder::Col::new(table_name, "source_entity_id"),
request_payload_json: __sdk::__query_builder::Col::new(
table_name,
"request_payload_json",
),
request_payload_json: __sdk::__query_builder::Col::new(table_name, "request_payload_json"),
status: __sdk::__query_builder::Col::new(table_name, "status"),
failure_message: __sdk::__query_builder::Col::new(table_name, "failure_message"),
latest_text_output: __sdk::__query_builder::Col::new(table_name, "latest_text_output"),
latest_structured_payload_json: __sdk::__query_builder::Col::new(
table_name,
"latest_structured_payload_json",
),
latest_structured_payload_json: __sdk::__query_builder::Col::new(table_name, "latest_structured_payload_json"),
version: __sdk::__query_builder::Col::new(table_name, "version"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
started_at: __sdk::__query_builder::Col::new(table_name, "started_at"),
completed_at: __sdk::__query_builder::Col::new(table_name, "completed_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
}
}
}
@@ -102,8 +104,10 @@ impl __sdk::__query_builder::HasIxCols for AiTask {
status: __sdk::__query_builder::IxCol::new(table_name, "status"),
task_id: __sdk::__query_builder::IxCol::new(table_name, "task_id"),
task_kind: __sdk::__query_builder::IxCol::new(table_name, "task_kind"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for AiTask {}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_kind_type::AiTaskStageKind;
@@ -16,6 +21,8 @@ pub struct AiTextChunkAppendInput {
pub created_at_micros: i64,
}
impl __sdk::InModule for AiTextChunkAppendInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_kind_type::AiTaskStageKind;
@@ -17,6 +22,8 @@ pub struct AiTextChunkSnapshot {
pub created_at_micros: i64,
}
impl __sdk::InModule for AiTextChunkSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,9 +2,14 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use super::ai_task_stage_kind_type::AiTaskStageKind;
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_text_chunk_type::AiTextChunk;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::ai_task_stage_kind_type::AiTaskStageKind;
/// Table handle for the table `ai_text_chunk`.
///
@@ -45,12 +50,8 @@ impl<'ctx> __sdk::Table for AiTextChunkTableHandle<'ctx> {
type Row = AiTextChunk;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = AiTextChunk> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = AiTextChunk> + '_ { self.imp.iter() }
type InsertCallbackId = AiTextChunkInsertCallbackId;
@@ -96,40 +97,39 @@ impl<'ctx> __sdk::TableWithPrimaryKey for AiTextChunkTableHandle<'ctx> {
}
}
/// Access to the `text_chunk_row_id` unique index on the table `ai_text_chunk`,
/// which allows point queries on the field of the same name
/// via the [`AiTextChunkTextChunkRowIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.ai_text_chunk().text_chunk_row_id().find(...)`.
pub struct AiTextChunkTextChunkRowIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AiTextChunk, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> AiTextChunkTableHandle<'ctx> {
/// Get a handle on the `text_chunk_row_id` unique index on the table `ai_text_chunk`.
pub fn text_chunk_row_id(&self) -> AiTextChunkTextChunkRowIdUnique<'ctx> {
AiTextChunkTextChunkRowIdUnique {
imp: self
.imp
.get_unique_constraint::<String>("text_chunk_row_id"),
phantom: std::marker::PhantomData,
/// Access to the `text_chunk_row_id` unique index on the table `ai_text_chunk`,
/// which allows point queries on the field of the same name
/// via the [`AiTextChunkTextChunkRowIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.ai_text_chunk().text_chunk_row_id().find(...)`.
pub struct AiTextChunkTextChunkRowIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AiTextChunk, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> AiTextChunkTextChunkRowIdUnique<'ctx> {
/// Find the subscribed row whose `text_chunk_row_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<AiTextChunk> {
self.imp.find(col_val)
}
}
impl<'ctx> AiTextChunkTableHandle<'ctx> {
/// Get a handle on the `text_chunk_row_id` unique index on the table `ai_text_chunk`.
pub fn text_chunk_row_id(&self) -> AiTextChunkTextChunkRowIdUnique<'ctx> {
AiTextChunkTextChunkRowIdUnique {
imp: self.imp.get_unique_constraint::<String>("text_chunk_row_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> AiTextChunkTextChunkRowIdUnique<'ctx> {
/// Find the subscribed row whose `text_chunk_row_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<AiTextChunk> {
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::<AiTextChunk>("ai_text_chunk");
_table.add_unique_constraint::<String>("text_chunk_row_id", |row| &row.text_chunk_row_id);
}
@@ -139,24 +139,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<AiTextChunk>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<AiTextChunk>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<AiTextChunk>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AiTextChunk`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait ai_text_chunkQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AiTextChunk`.
fn ai_text_chunk(&self) -> __sdk::__query_builder::Table<AiTextChunk>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AiTextChunk`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait ai_text_chunkQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AiTextChunk`.
fn ai_text_chunk(&self) -> __sdk::__query_builder::Table<AiTextChunk>;
}
impl ai_text_chunkQueryTableAccess for __sdk::QueryTableAccessor {
fn ai_text_chunk(&self) -> __sdk::__query_builder::Table<AiTextChunk> {
__sdk::__query_builder::Table::new("ai_text_chunk")
}
}
impl ai_text_chunkQueryTableAccess for __sdk::QueryTableAccessor {
fn ai_text_chunk(&self) -> __sdk::__query_builder::Table<AiTextChunk> {
__sdk::__query_builder::Table::new("ai_text_chunk")
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_kind_type::AiTaskStageKind;
@@ -18,10 +23,12 @@ pub struct AiTextChunk {
pub created_at: __sdk::Timestamp,
}
impl __sdk::InModule for AiTextChunk {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `AiTextChunk`.
///
/// Provides typed access to columns for query building.
@@ -46,6 +53,7 @@ impl __sdk::__query_builder::HasCols for AiTextChunk {
sequence: __sdk::__query_builder::Col::new(table_name, "sequence"),
delta_text: __sdk::__query_builder::Col::new(table_name, "delta_text"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
}
}
}
@@ -64,8 +72,10 @@ impl __sdk::__query_builder::HasIxCols for AiTextChunk {
AiTextChunkIxCols {
task_id: __sdk::__query_builder::IxCol::new(table_name, "task_id"),
text_chunk_row_id: __sdk::__query_builder::IxCol::new(table_name, "text_chunk_row_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for AiTextChunk {}

View File

@@ -2,17 +2,23 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_procedure_result_type::AiTaskProcedureResult;
use super::ai_text_chunk_append_input_type::AiTextChunkAppendInput;
use super::ai_task_procedure_result_type::AiTaskProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct AppendAiTextChunkAndReturnArgs {
struct AppendAiTextChunkAndReturnArgs {
pub input: AiTextChunkAppendInput,
}
impl __sdk::InModule for AppendAiTextChunkAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for AppendAiTextChunkAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait append_ai_text_chunk_and_return {
fn append_ai_text_chunk_and_return(&self, input: AiTextChunkAppendInput) {
self.append_ai_text_chunk_and_return_then(input, |_, _| {});
fn append_ai_text_chunk_and_return(&self, input: AiTextChunkAppendInput,
) {
self.append_ai_text_chunk_and_return_then(input, |_, _| {});
}
fn append_ai_text_chunk_and_return_then(
&self,
input: AiTextChunkAppendInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AiTaskProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AiTaskProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl append_ai_text_chunk_and_return for super::RemoteProcedures {
&self,
input: AiTextChunkAppendInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AiTaskProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AiTaskProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, AiTaskProcedureResult>(
"append_ai_text_chunk_and_return",
AppendAiTextChunkAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, AiTaskProcedureResult>(
"append_ai_text_chunk_and_return",
AppendAiTextChunkAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,17 +2,23 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::chapter_progression_ledger_input_type::ChapterProgressionLedgerInput;
use super::chapter_progression_procedure_result_type::ChapterProgressionProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct ApplyChapterProgressionLedgerEntryAndReturnArgs {
struct ApplyChapterProgressionLedgerEntryAndReturnArgs {
pub input: ChapterProgressionLedgerInput,
}
impl __sdk::InModule for ApplyChapterProgressionLedgerEntryAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,22 +28,16 @@ impl __sdk::InModule for ApplyChapterProgressionLedgerEntryAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait apply_chapter_progression_ledger_entry_and_return {
fn apply_chapter_progression_ledger_entry_and_return(
&self,
input: ChapterProgressionLedgerInput,
) {
self.apply_chapter_progression_ledger_entry_and_return_then(input, |_, _| {});
fn apply_chapter_progression_ledger_entry_and_return(&self, input: ChapterProgressionLedgerInput,
) {
self.apply_chapter_progression_ledger_entry_and_return_then(input, |_, _| {});
}
fn apply_chapter_progression_ledger_entry_and_return_then(
&self,
input: ChapterProgressionLedgerInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<ChapterProgressionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<ChapterProgressionProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -46,17 +46,13 @@ impl apply_chapter_progression_ledger_entry_and_return for super::RemoteProcedur
&self,
input: ChapterProgressionLedgerInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<ChapterProgressionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<ChapterProgressionProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, ChapterProgressionProcedureResult>(
"apply_chapter_progression_ledger_entry_and_return",
ApplyChapterProgressionLedgerEntryAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, ChapterProgressionProcedureResult>(
"apply_chapter_progression_ledger_entry_and_return",
ApplyChapterProgressionLedgerEntryAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::chapter_progression_ledger_input_type::ChapterProgressionLedgerInput;
@@ -14,8 +19,10 @@ pub(super) struct ApplyChapterProgressionLedgerEntryArgs {
impl From<ApplyChapterProgressionLedgerEntryArgs> for super::Reducer {
fn from(args: ApplyChapterProgressionLedgerEntryArgs) -> Self {
Self::ApplyChapterProgressionLedgerEntry { input: args.input }
}
Self::ApplyChapterProgressionLedgerEntry {
input: args.input,
}
}
}
impl __sdk::InModule for ApplyChapterProgressionLedgerEntryArgs {
@@ -33,11 +40,9 @@ pub trait apply_chapter_progression_ledger_entry {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`apply_chapter_progression_ledger_entry:apply_chapter_progression_ledger_entry_then`] to run a callback after the reducer completes.
fn apply_chapter_progression_ledger_entry(
&self,
input: ChapterProgressionLedgerInput,
) -> __sdk::Result<()> {
self.apply_chapter_progression_ledger_entry_then(input, |_, _| {})
fn apply_chapter_progression_ledger_entry(&self, input: ChapterProgressionLedgerInput,
) -> __sdk::Result<()> {
self.apply_chapter_progression_ledger_entry_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `apply_chapter_progression_ledger_entry` to run as soon as possible,
@@ -65,9 +70,7 @@ impl apply_chapter_progression_ledger_entry for super::RemoteReducers {
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp.invoke_reducer_with_callback(
ApplyChapterProgressionLedgerEntryArgs { input },
callback,
)
self.imp.invoke_reducer_with_callback(ApplyChapterProgressionLedgerEntryArgs { input, }, callback)
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::inventory_mutation_input_type::InventoryMutationInput;
@@ -14,8 +19,10 @@ pub(super) struct ApplyInventoryMutationArgs {
impl From<ApplyInventoryMutationArgs> for super::Reducer {
fn from(args: ApplyInventoryMutationArgs) -> Self {
Self::ApplyInventoryMutation { input: args.input }
}
Self::ApplyInventoryMutation {
input: args.input,
}
}
}
impl __sdk::InModule for ApplyInventoryMutationArgs {
@@ -33,8 +40,9 @@ pub trait apply_inventory_mutation {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`apply_inventory_mutation:apply_inventory_mutation_then`] to run a callback after the reducer completes.
fn apply_inventory_mutation(&self, input: InventoryMutationInput) -> __sdk::Result<()> {
self.apply_inventory_mutation_then(input, |_, _| {})
fn apply_inventory_mutation(&self, input: InventoryMutationInput,
) -> __sdk::Result<()> {
self.apply_inventory_mutation_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `apply_inventory_mutation` to run as soon as possible,
@@ -62,7 +70,7 @@ impl apply_inventory_mutation for super::RemoteReducers {
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp
.invoke_reducer_with_callback(ApplyInventoryMutationArgs { input }, callback)
self.imp.invoke_reducer_with_callback(ApplyInventoryMutationArgs { input, }, callback)
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::quest_signal_apply_input_type::QuestSignalApplyInput;
@@ -14,8 +19,10 @@ pub(super) struct ApplyQuestSignalArgs {
impl From<ApplyQuestSignalArgs> for super::Reducer {
fn from(args: ApplyQuestSignalArgs) -> Self {
Self::ApplyQuestSignal { input: args.input }
}
Self::ApplyQuestSignal {
input: args.input,
}
}
}
impl __sdk::InModule for ApplyQuestSignalArgs {
@@ -33,8 +40,9 @@ pub trait apply_quest_signal {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`apply_quest_signal:apply_quest_signal_then`] to run a callback after the reducer completes.
fn apply_quest_signal(&self, input: QuestSignalApplyInput) -> __sdk::Result<()> {
self.apply_quest_signal_then(input, |_, _| {})
fn apply_quest_signal(&self, input: QuestSignalApplyInput,
) -> __sdk::Result<()> {
self.apply_quest_signal_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `apply_quest_signal` to run as soon as possible,
@@ -62,7 +70,7 @@ impl apply_quest_signal for super::RemoteReducers {
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp
.invoke_reducer_with_callback(ApplyQuestSignalArgs { input }, callback)
self.imp.invoke_reducer_with_callback(ApplyQuestSignalArgs { input, }, callback)
}
}

View File

@@ -2,7 +2,13 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -13,11 +19,13 @@ pub struct AssetEntityBindingInput {
pub entity_id: String,
pub slot: String,
pub asset_kind: String,
pub owner_user_id: Option<String>,
pub profile_id: Option<String>,
pub owner_user_id: Option::<String>,
pub profile_id: Option::<String>,
pub updated_at_micros: i64,
}
impl __sdk::InModule for AssetEntityBindingInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_entity_binding_snapshot_type::AssetEntityBindingSnapshot;
@@ -10,10 +15,12 @@ use super::asset_entity_binding_snapshot_type::AssetEntityBindingSnapshot;
#[sats(crate = __lib)]
pub struct AssetEntityBindingProcedureResult {
pub ok: bool,
pub record: Option<AssetEntityBindingSnapshot>,
pub error_message: Option<String>,
pub record: Option::<AssetEntityBindingSnapshot>,
pub error_message: Option::<String>,
}
impl __sdk::InModule for AssetEntityBindingProcedureResult {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,13 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -13,12 +19,14 @@ pub struct AssetEntityBindingSnapshot {
pub entity_id: String,
pub slot: String,
pub asset_kind: String,
pub owner_user_id: Option<String>,
pub profile_id: Option<String>,
pub owner_user_id: Option::<String>,
pub profile_id: Option::<String>,
pub created_at_micros: i64,
pub updated_at_micros: i64,
}
impl __sdk::InModule for AssetEntityBindingSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,8 +2,13 @@
// 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::asset_entity_binding_type::AssetEntityBinding;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `asset_entity_binding`.
///
@@ -31,9 +36,7 @@ pub trait AssetEntityBindingTableAccess {
impl AssetEntityBindingTableAccess for super::RemoteTables {
fn asset_entity_binding(&self) -> AssetEntityBindingTableHandle<'_> {
AssetEntityBindingTableHandle {
imp: self
.imp
.get_table::<AssetEntityBinding>("asset_entity_binding"),
imp: self.imp.get_table::<AssetEntityBinding>("asset_entity_binding"),
ctx: std::marker::PhantomData,
}
}
@@ -46,12 +49,8 @@ impl<'ctx> __sdk::Table for AssetEntityBindingTableHandle<'ctx> {
type Row = AssetEntityBinding;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = AssetEntityBinding> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = AssetEntityBinding> + '_ { self.imp.iter() }
type InsertCallbackId = AssetEntityBindingInsertCallbackId;
@@ -97,38 +96,39 @@ impl<'ctx> __sdk::TableWithPrimaryKey for AssetEntityBindingTableHandle<'ctx> {
}
}
/// Access to the `binding_id` unique index on the table `asset_entity_binding`,
/// which allows point queries on the field of the same name
/// via the [`AssetEntityBindingBindingIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.asset_entity_binding().binding_id().find(...)`.
pub struct AssetEntityBindingBindingIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AssetEntityBinding, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> AssetEntityBindingTableHandle<'ctx> {
/// Get a handle on the `binding_id` unique index on the table `asset_entity_binding`.
pub fn binding_id(&self) -> AssetEntityBindingBindingIdUnique<'ctx> {
AssetEntityBindingBindingIdUnique {
imp: self.imp.get_unique_constraint::<String>("binding_id"),
phantom: std::marker::PhantomData,
/// Access to the `binding_id` unique index on the table `asset_entity_binding`,
/// which allows point queries on the field of the same name
/// via the [`AssetEntityBindingBindingIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.asset_entity_binding().binding_id().find(...)`.
pub struct AssetEntityBindingBindingIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AssetEntityBinding, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> AssetEntityBindingBindingIdUnique<'ctx> {
/// Find the subscribed row whose `binding_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<AssetEntityBinding> {
self.imp.find(col_val)
}
}
impl<'ctx> AssetEntityBindingTableHandle<'ctx> {
/// Get a handle on the `binding_id` unique index on the table `asset_entity_binding`.
pub fn binding_id(&self) -> AssetEntityBindingBindingIdUnique<'ctx> {
AssetEntityBindingBindingIdUnique {
imp: self.imp.get_unique_constraint::<String>("binding_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> AssetEntityBindingBindingIdUnique<'ctx> {
/// Find the subscribed row whose `binding_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<AssetEntityBinding> {
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::<AssetEntityBinding>("asset_entity_binding");
_table.add_unique_constraint::<String>("binding_id", |row| &row.binding_id);
}
@@ -138,24 +138,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<AssetEntityBinding>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<AssetEntityBinding>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<AssetEntityBinding>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AssetEntityBinding`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait asset_entity_bindingQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AssetEntityBinding`.
fn asset_entity_binding(&self) -> __sdk::__query_builder::Table<AssetEntityBinding>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AssetEntityBinding`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait asset_entity_bindingQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AssetEntityBinding`.
fn asset_entity_binding(&self) -> __sdk::__query_builder::Table<AssetEntityBinding>;
}
impl asset_entity_bindingQueryTableAccess for __sdk::QueryTableAccessor {
fn asset_entity_binding(&self) -> __sdk::__query_builder::Table<AssetEntityBinding> {
__sdk::__query_builder::Table::new("asset_entity_binding")
}
}
impl asset_entity_bindingQueryTableAccess for __sdk::QueryTableAccessor {
fn asset_entity_binding(&self) -> __sdk::__query_builder::Table<AssetEntityBinding> {
__sdk::__query_builder::Table::new("asset_entity_binding")
}
}

View File

@@ -2,7 +2,13 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -13,16 +19,18 @@ pub struct AssetEntityBinding {
pub entity_id: String,
pub slot: String,
pub asset_kind: String,
pub owner_user_id: Option<String>,
pub profile_id: Option<String>,
pub owner_user_id: Option::<String>,
pub profile_id: Option::<String>,
pub created_at: __sdk::Timestamp,
pub updated_at: __sdk::Timestamp,
}
impl __sdk::InModule for AssetEntityBinding {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `AssetEntityBinding`.
///
/// Provides typed access to columns for query building.
@@ -33,8 +41,8 @@ pub struct AssetEntityBindingCols {
pub entity_id: __sdk::__query_builder::Col<AssetEntityBinding, String>,
pub slot: __sdk::__query_builder::Col<AssetEntityBinding, String>,
pub asset_kind: __sdk::__query_builder::Col<AssetEntityBinding, String>,
pub owner_user_id: __sdk::__query_builder::Col<AssetEntityBinding, Option<String>>,
pub profile_id: __sdk::__query_builder::Col<AssetEntityBinding, Option<String>>,
pub owner_user_id: __sdk::__query_builder::Col<AssetEntityBinding, Option::<String>>,
pub profile_id: __sdk::__query_builder::Col<AssetEntityBinding, Option::<String>>,
pub created_at: __sdk::__query_builder::Col<AssetEntityBinding, __sdk::Timestamp>,
pub updated_at: __sdk::__query_builder::Col<AssetEntityBinding, __sdk::Timestamp>,
}
@@ -53,6 +61,7 @@ impl __sdk::__query_builder::HasCols for AssetEntityBinding {
profile_id: __sdk::__query_builder::Col::new(table_name, "profile_id"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
}
}
}
@@ -71,8 +80,10 @@ impl __sdk::__query_builder::HasIxCols for AssetEntityBinding {
AssetEntityBindingIxCols {
asset_object_id: __sdk::__query_builder::IxCol::new(table_name, "asset_object_id"),
binding_id: __sdk::__query_builder::IxCol::new(table_name, "binding_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for AssetEntityBinding {}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -11,8 +16,12 @@ pub enum AssetObjectAccessPolicy {
Private,
PublicRead,
}
impl __sdk::InModule for AssetObjectAccessPolicy {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_object_upsert_snapshot_type::AssetObjectUpsertSnapshot;
@@ -10,10 +15,12 @@ use super::asset_object_upsert_snapshot_type::AssetObjectUpsertSnapshot;
#[sats(crate = __lib)]
pub struct AssetObjectProcedureResult {
pub ok: bool,
pub record: Option<AssetObjectUpsertSnapshot>,
pub error_message: Option<String>,
pub record: Option::<AssetObjectUpsertSnapshot>,
pub error_message: Option::<String>,
}
impl __sdk::InModule for AssetObjectProcedureResult {
type Module = super::RemoteModule;
}

View File

@@ -2,9 +2,14 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use super::asset_object_access_policy_type::AssetObjectAccessPolicy;
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_object_type::AssetObject;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::asset_object_access_policy_type::AssetObjectAccessPolicy;
/// Table handle for the table `asset_object`.
///
@@ -45,12 +50,8 @@ impl<'ctx> __sdk::Table for AssetObjectTableHandle<'ctx> {
type Row = AssetObject;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = AssetObject> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = AssetObject> + '_ { self.imp.iter() }
type InsertCallbackId = AssetObjectInsertCallbackId;
@@ -96,38 +97,39 @@ impl<'ctx> __sdk::TableWithPrimaryKey for AssetObjectTableHandle<'ctx> {
}
}
/// Access to the `asset_object_id` unique index on the table `asset_object`,
/// which allows point queries on the field of the same name
/// via the [`AssetObjectAssetObjectIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.asset_object().asset_object_id().find(...)`.
pub struct AssetObjectAssetObjectIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AssetObject, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> AssetObjectTableHandle<'ctx> {
/// Get a handle on the `asset_object_id` unique index on the table `asset_object`.
pub fn asset_object_id(&self) -> AssetObjectAssetObjectIdUnique<'ctx> {
AssetObjectAssetObjectIdUnique {
imp: self.imp.get_unique_constraint::<String>("asset_object_id"),
phantom: std::marker::PhantomData,
/// Access to the `asset_object_id` unique index on the table `asset_object`,
/// which allows point queries on the field of the same name
/// via the [`AssetObjectAssetObjectIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.asset_object().asset_object_id().find(...)`.
pub struct AssetObjectAssetObjectIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AssetObject, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> AssetObjectAssetObjectIdUnique<'ctx> {
/// Find the subscribed row whose `asset_object_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<AssetObject> {
self.imp.find(col_val)
}
}
impl<'ctx> AssetObjectTableHandle<'ctx> {
/// Get a handle on the `asset_object_id` unique index on the table `asset_object`.
pub fn asset_object_id(&self) -> AssetObjectAssetObjectIdUnique<'ctx> {
AssetObjectAssetObjectIdUnique {
imp: self.imp.get_unique_constraint::<String>("asset_object_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> AssetObjectAssetObjectIdUnique<'ctx> {
/// Find the subscribed row whose `asset_object_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<AssetObject> {
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::<AssetObject>("asset_object");
_table.add_unique_constraint::<String>("asset_object_id", |row| &row.asset_object_id);
}
@@ -137,24 +139,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<AssetObject>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<AssetObject>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<AssetObject>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AssetObject`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait asset_objectQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AssetObject`.
fn asset_object(&self) -> __sdk::__query_builder::Table<AssetObject>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AssetObject`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait asset_objectQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AssetObject`.
fn asset_object(&self) -> __sdk::__query_builder::Table<AssetObject>;
}
impl asset_objectQueryTableAccess for __sdk::QueryTableAccessor {
fn asset_object(&self) -> __sdk::__query_builder::Table<AssetObject> {
__sdk::__query_builder::Table::new("asset_object")
}
}
impl asset_objectQueryTableAccess for __sdk::QueryTableAccessor {
fn asset_object(&self) -> __sdk::__query_builder::Table<AssetObject> {
__sdk::__query_builder::Table::new("asset_object")
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_object_access_policy_type::AssetObjectAccessPolicy;
@@ -13,23 +18,25 @@ pub struct AssetObject {
pub bucket: String,
pub object_key: String,
pub access_policy: AssetObjectAccessPolicy,
pub content_type: Option<String>,
pub content_type: Option::<String>,
pub content_length: u64,
pub content_hash: Option<String>,
pub content_hash: Option::<String>,
pub version: u32,
pub source_job_id: Option<String>,
pub owner_user_id: Option<String>,
pub profile_id: Option<String>,
pub entity_id: Option<String>,
pub source_job_id: Option::<String>,
pub owner_user_id: Option::<String>,
pub profile_id: Option::<String>,
pub entity_id: Option::<String>,
pub asset_kind: String,
pub created_at: __sdk::Timestamp,
pub updated_at: __sdk::Timestamp,
}
impl __sdk::InModule for AssetObject {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `AssetObject`.
///
/// Provides typed access to columns for query building.
@@ -38,14 +45,14 @@ pub struct AssetObjectCols {
pub bucket: __sdk::__query_builder::Col<AssetObject, String>,
pub object_key: __sdk::__query_builder::Col<AssetObject, String>,
pub access_policy: __sdk::__query_builder::Col<AssetObject, AssetObjectAccessPolicy>,
pub content_type: __sdk::__query_builder::Col<AssetObject, Option<String>>,
pub content_type: __sdk::__query_builder::Col<AssetObject, Option::<String>>,
pub content_length: __sdk::__query_builder::Col<AssetObject, u64>,
pub content_hash: __sdk::__query_builder::Col<AssetObject, Option<String>>,
pub content_hash: __sdk::__query_builder::Col<AssetObject, Option::<String>>,
pub version: __sdk::__query_builder::Col<AssetObject, u32>,
pub source_job_id: __sdk::__query_builder::Col<AssetObject, Option<String>>,
pub owner_user_id: __sdk::__query_builder::Col<AssetObject, Option<String>>,
pub profile_id: __sdk::__query_builder::Col<AssetObject, Option<String>>,
pub entity_id: __sdk::__query_builder::Col<AssetObject, Option<String>>,
pub source_job_id: __sdk::__query_builder::Col<AssetObject, Option::<String>>,
pub owner_user_id: __sdk::__query_builder::Col<AssetObject, Option::<String>>,
pub profile_id: __sdk::__query_builder::Col<AssetObject, Option::<String>>,
pub entity_id: __sdk::__query_builder::Col<AssetObject, Option::<String>>,
pub asset_kind: __sdk::__query_builder::Col<AssetObject, String>,
pub created_at: __sdk::__query_builder::Col<AssetObject, __sdk::Timestamp>,
pub updated_at: __sdk::__query_builder::Col<AssetObject, __sdk::Timestamp>,
@@ -70,6 +77,7 @@ impl __sdk::__query_builder::HasCols for AssetObject {
asset_kind: __sdk::__query_builder::Col::new(table_name, "asset_kind"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
}
}
}
@@ -88,8 +96,10 @@ impl __sdk::__query_builder::HasIxCols for AssetObject {
AssetObjectIxCols {
asset_kind: __sdk::__query_builder::IxCol::new(table_name, "asset_kind"),
asset_object_id: __sdk::__query_builder::IxCol::new(table_name, "asset_object_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for AssetObject {}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_object_access_policy_type::AssetObjectAccessPolicy;
@@ -13,18 +18,20 @@ pub struct AssetObjectUpsertInput {
pub bucket: String,
pub object_key: String,
pub access_policy: AssetObjectAccessPolicy,
pub content_type: Option<String>,
pub content_type: Option::<String>,
pub content_length: u64,
pub content_hash: Option<String>,
pub content_hash: Option::<String>,
pub version: u32,
pub source_job_id: Option<String>,
pub owner_user_id: Option<String>,
pub profile_id: Option<String>,
pub entity_id: Option<String>,
pub source_job_id: Option::<String>,
pub owner_user_id: Option::<String>,
pub profile_id: Option::<String>,
pub entity_id: Option::<String>,
pub asset_kind: String,
pub updated_at_micros: i64,
}
impl __sdk::InModule for AssetObjectUpsertInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_object_access_policy_type::AssetObjectAccessPolicy;
@@ -13,19 +18,21 @@ pub struct AssetObjectUpsertSnapshot {
pub bucket: String,
pub object_key: String,
pub access_policy: AssetObjectAccessPolicy,
pub content_type: Option<String>,
pub content_type: Option::<String>,
pub content_length: u64,
pub content_hash: Option<String>,
pub content_hash: Option::<String>,
pub version: u32,
pub source_job_id: Option<String>,
pub owner_user_id: Option<String>,
pub profile_id: Option<String>,
pub entity_id: Option<String>,
pub source_job_id: Option::<String>,
pub owner_user_id: Option::<String>,
pub profile_id: Option::<String>,
pub entity_id: Option::<String>,
pub asset_kind: String,
pub created_at_micros: i64,
pub updated_at_micros: i64,
}
impl __sdk::InModule for AssetObjectUpsertSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,17 +2,23 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_result_reference_input_type::AiResultReferenceInput;
use super::ai_task_procedure_result_type::AiTaskProcedureResult;
use super::ai_result_reference_input_type::AiResultReferenceInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct AttachAiResultReferenceAndReturnArgs {
struct AttachAiResultReferenceAndReturnArgs {
pub input: AiResultReferenceInput,
}
impl __sdk::InModule for AttachAiResultReferenceAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for AttachAiResultReferenceAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait attach_ai_result_reference_and_return {
fn attach_ai_result_reference_and_return(&self, input: AiResultReferenceInput) {
self.attach_ai_result_reference_and_return_then(input, |_, _| {});
fn attach_ai_result_reference_and_return(&self, input: AiResultReferenceInput,
) {
self.attach_ai_result_reference_and_return_then(input, |_, _| {});
}
fn attach_ai_result_reference_and_return_then(
&self,
input: AiResultReferenceInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AiTaskProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AiTaskProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl attach_ai_result_reference_and_return for super::RemoteProcedures {
&self,
input: AiResultReferenceInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AiTaskProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AiTaskProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, AiTaskProcedureResult>(
"attach_ai_result_reference_and_return",
AttachAiResultReferenceAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, AiTaskProcedureResult>(
"attach_ai_result_reference_and_return",
AttachAiResultReferenceAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -11,8 +16,12 @@ pub enum BattleMode {
Fight,
Spar,
}
impl __sdk::InModule for BattleMode {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::battle_mode_type::BattleMode;
use super::runtime_item_reward_item_snapshot_type::RuntimeItemRewardItemSnapshot;
@@ -14,7 +19,7 @@ pub struct BattleStateInput {
pub story_session_id: String,
pub runtime_session_id: String,
pub actor_user_id: String,
pub chapter_id: Option<String>,
pub chapter_id: Option::<String>,
pub target_npc_id: String,
pub target_name: String,
pub battle_mode: BattleMode,
@@ -25,10 +30,12 @@ pub struct BattleStateInput {
pub target_hp: i32,
pub target_max_hp: i32,
pub experience_reward: u32,
pub reward_items: Vec<RuntimeItemRewardItemSnapshot>,
pub reward_items: Vec::<RuntimeItemRewardItemSnapshot>,
pub created_at_micros: i64,
}
impl __sdk::InModule for BattleStateInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::battle_state_snapshot_type::BattleStateSnapshot;
@@ -10,10 +15,12 @@ use super::battle_state_snapshot_type::BattleStateSnapshot;
#[sats(crate = __lib)]
pub struct BattleStateProcedureResult {
pub ok: bool,
pub snapshot: Option<BattleStateSnapshot>,
pub error_message: Option<String>,
pub snapshot: Option::<BattleStateSnapshot>,
pub error_message: Option::<String>,
}
impl __sdk::InModule for BattleStateProcedureResult {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,13 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -10,6 +16,8 @@ pub struct BattleStateQueryInput {
pub battle_state_id: String,
}
impl __sdk::InModule for BattleStateQueryInput {
type Module = super::RemoteModule;
}

View File

@@ -2,12 +2,17 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::battle_mode_type::BattleMode;
use super::battle_status_type::BattleStatus;
use super::combat_outcome_type::CombatOutcome;
use super::runtime_item_reward_item_snapshot_type::RuntimeItemRewardItemSnapshot;
use super::combat_outcome_type::CombatOutcome;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -16,7 +21,7 @@ pub struct BattleStateSnapshot {
pub story_session_id: String,
pub runtime_session_id: String,
pub actor_user_id: String,
pub chapter_id: Option<String>,
pub chapter_id: Option::<String>,
pub target_npc_id: String,
pub target_name: String,
pub battle_mode: BattleMode,
@@ -28,11 +33,11 @@ pub struct BattleStateSnapshot {
pub target_hp: i32,
pub target_max_hp: i32,
pub experience_reward: u32,
pub reward_items: Vec<RuntimeItemRewardItemSnapshot>,
pub reward_items: Vec::<RuntimeItemRewardItemSnapshot>,
pub turn_index: u32,
pub last_action_function_id: Option<String>,
pub last_action_text: Option<String>,
pub last_result_text: Option<String>,
pub last_action_function_id: Option::<String>,
pub last_action_text: Option::<String>,
pub last_result_text: Option::<String>,
pub last_damage_dealt: i32,
pub last_damage_taken: i32,
pub last_outcome: CombatOutcome,
@@ -41,6 +46,8 @@ pub struct BattleStateSnapshot {
pub updated_at_micros: i64,
}
impl __sdk::InModule for BattleStateSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,12 +2,17 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use super::battle_mode_type::BattleMode;
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::battle_state_type::BattleState;
use super::battle_mode_type::BattleMode;
use super::battle_status_type::BattleStatus;
use super::combat_outcome_type::CombatOutcome;
use super::runtime_item_reward_item_snapshot_type::RuntimeItemRewardItemSnapshot;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::combat_outcome_type::CombatOutcome;
/// Table handle for the table `battle_state`.
///
@@ -48,12 +53,8 @@ impl<'ctx> __sdk::Table for BattleStateTableHandle<'ctx> {
type Row = BattleState;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = BattleState> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = BattleState> + '_ { self.imp.iter() }
type InsertCallbackId = BattleStateInsertCallbackId;
@@ -99,38 +100,39 @@ impl<'ctx> __sdk::TableWithPrimaryKey for BattleStateTableHandle<'ctx> {
}
}
/// Access to the `battle_state_id` unique index on the table `battle_state`,
/// which allows point queries on the field of the same name
/// via the [`BattleStateBattleStateIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.battle_state().battle_state_id().find(...)`.
pub struct BattleStateBattleStateIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<BattleState, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> BattleStateTableHandle<'ctx> {
/// Get a handle on the `battle_state_id` unique index on the table `battle_state`.
pub fn battle_state_id(&self) -> BattleStateBattleStateIdUnique<'ctx> {
BattleStateBattleStateIdUnique {
imp: self.imp.get_unique_constraint::<String>("battle_state_id"),
phantom: std::marker::PhantomData,
/// Access to the `battle_state_id` unique index on the table `battle_state`,
/// which allows point queries on the field of the same name
/// via the [`BattleStateBattleStateIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.battle_state().battle_state_id().find(...)`.
pub struct BattleStateBattleStateIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<BattleState, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> BattleStateBattleStateIdUnique<'ctx> {
/// Find the subscribed row whose `battle_state_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<BattleState> {
self.imp.find(col_val)
}
}
impl<'ctx> BattleStateTableHandle<'ctx> {
/// Get a handle on the `battle_state_id` unique index on the table `battle_state`.
pub fn battle_state_id(&self) -> BattleStateBattleStateIdUnique<'ctx> {
BattleStateBattleStateIdUnique {
imp: self.imp.get_unique_constraint::<String>("battle_state_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> BattleStateBattleStateIdUnique<'ctx> {
/// Find the subscribed row whose `battle_state_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<BattleState> {
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::<BattleState>("battle_state");
_table.add_unique_constraint::<String>("battle_state_id", |row| &row.battle_state_id);
}
@@ -140,24 +142,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<BattleState>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<BattleState>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<BattleState>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `BattleState`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait battle_stateQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `BattleState`.
fn battle_state(&self) -> __sdk::__query_builder::Table<BattleState>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `BattleState`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait battle_stateQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `BattleState`.
fn battle_state(&self) -> __sdk::__query_builder::Table<BattleState>;
}
impl battle_stateQueryTableAccess for __sdk::QueryTableAccessor {
fn battle_state(&self) -> __sdk::__query_builder::Table<BattleState> {
__sdk::__query_builder::Table::new("battle_state")
}
}
impl battle_stateQueryTableAccess for __sdk::QueryTableAccessor {
fn battle_state(&self) -> __sdk::__query_builder::Table<BattleState> {
__sdk::__query_builder::Table::new("battle_state")
}
}

View File

@@ -2,12 +2,17 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::battle_mode_type::BattleMode;
use super::battle_status_type::BattleStatus;
use super::combat_outcome_type::CombatOutcome;
use super::runtime_item_reward_item_snapshot_type::RuntimeItemRewardItemSnapshot;
use super::combat_outcome_type::CombatOutcome;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -16,7 +21,7 @@ pub struct BattleState {
pub story_session_id: String,
pub runtime_session_id: String,
pub actor_user_id: String,
pub chapter_id: Option<String>,
pub chapter_id: Option::<String>,
pub target_npc_id: String,
pub target_name: String,
pub battle_mode: BattleMode,
@@ -28,11 +33,11 @@ pub struct BattleState {
pub target_hp: i32,
pub target_max_hp: i32,
pub experience_reward: u32,
pub reward_items: Vec<RuntimeItemRewardItemSnapshot>,
pub reward_items: Vec::<RuntimeItemRewardItemSnapshot>,
pub turn_index: u32,
pub last_action_function_id: Option<String>,
pub last_action_text: Option<String>,
pub last_result_text: Option<String>,
pub last_action_function_id: Option::<String>,
pub last_action_text: Option::<String>,
pub last_result_text: Option::<String>,
pub last_damage_dealt: i32,
pub last_damage_taken: i32,
pub last_outcome: CombatOutcome,
@@ -41,10 +46,12 @@ pub struct BattleState {
pub updated_at: __sdk::Timestamp,
}
impl __sdk::InModule for BattleState {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `BattleState`.
///
/// Provides typed access to columns for query building.
@@ -53,7 +60,7 @@ pub struct BattleStateCols {
pub story_session_id: __sdk::__query_builder::Col<BattleState, String>,
pub runtime_session_id: __sdk::__query_builder::Col<BattleState, String>,
pub actor_user_id: __sdk::__query_builder::Col<BattleState, String>,
pub chapter_id: __sdk::__query_builder::Col<BattleState, Option<String>>,
pub chapter_id: __sdk::__query_builder::Col<BattleState, Option::<String>>,
pub target_npc_id: __sdk::__query_builder::Col<BattleState, String>,
pub target_name: __sdk::__query_builder::Col<BattleState, String>,
pub battle_mode: __sdk::__query_builder::Col<BattleState, BattleMode>,
@@ -65,11 +72,11 @@ pub struct BattleStateCols {
pub target_hp: __sdk::__query_builder::Col<BattleState, i32>,
pub target_max_hp: __sdk::__query_builder::Col<BattleState, i32>,
pub experience_reward: __sdk::__query_builder::Col<BattleState, u32>,
pub reward_items: __sdk::__query_builder::Col<BattleState, Vec<RuntimeItemRewardItemSnapshot>>,
pub reward_items: __sdk::__query_builder::Col<BattleState, Vec::<RuntimeItemRewardItemSnapshot>>,
pub turn_index: __sdk::__query_builder::Col<BattleState, u32>,
pub last_action_function_id: __sdk::__query_builder::Col<BattleState, Option<String>>,
pub last_action_text: __sdk::__query_builder::Col<BattleState, Option<String>>,
pub last_result_text: __sdk::__query_builder::Col<BattleState, Option<String>>,
pub last_action_function_id: __sdk::__query_builder::Col<BattleState, Option::<String>>,
pub last_action_text: __sdk::__query_builder::Col<BattleState, Option::<String>>,
pub last_result_text: __sdk::__query_builder::Col<BattleState, Option::<String>>,
pub last_damage_dealt: __sdk::__query_builder::Col<BattleState, i32>,
pub last_damage_taken: __sdk::__query_builder::Col<BattleState, i32>,
pub last_outcome: __sdk::__query_builder::Col<BattleState, CombatOutcome>,
@@ -100,10 +107,7 @@ impl __sdk::__query_builder::HasCols for BattleState {
experience_reward: __sdk::__query_builder::Col::new(table_name, "experience_reward"),
reward_items: __sdk::__query_builder::Col::new(table_name, "reward_items"),
turn_index: __sdk::__query_builder::Col::new(table_name, "turn_index"),
last_action_function_id: __sdk::__query_builder::Col::new(
table_name,
"last_action_function_id",
),
last_action_function_id: __sdk::__query_builder::Col::new(table_name, "last_action_function_id"),
last_action_text: __sdk::__query_builder::Col::new(table_name, "last_action_text"),
last_result_text: __sdk::__query_builder::Col::new(table_name, "last_result_text"),
last_damage_dealt: __sdk::__query_builder::Col::new(table_name, "last_damage_dealt"),
@@ -112,6 +116,7 @@ impl __sdk::__query_builder::HasCols for BattleState {
version: __sdk::__query_builder::Col::new(table_name, "version"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
}
}
}
@@ -132,13 +137,12 @@ impl __sdk::__query_builder::HasIxCols for BattleState {
BattleStateIxCols {
actor_user_id: __sdk::__query_builder::IxCol::new(table_name, "actor_user_id"),
battle_state_id: __sdk::__query_builder::IxCol::new(table_name, "battle_state_id"),
runtime_session_id: __sdk::__query_builder::IxCol::new(
table_name,
"runtime_session_id",
),
runtime_session_id: __sdk::__query_builder::IxCol::new(table_name, "runtime_session_id"),
story_session_id: __sdk::__query_builder::IxCol::new(table_name, "story_session_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for BattleState {}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -13,8 +18,12 @@ pub enum BattleStatus {
Resolved,
Aborted,
}
impl __sdk::InModule for BattleStatus {
type Module = super::RemoteModule;
}

View File

@@ -2,17 +2,23 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::story_session_input_type::StorySessionInput;
use super::story_session_procedure_result_type::StorySessionProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct BeginStorySessionAndReturnArgs {
struct BeginStorySessionAndReturnArgs {
pub input: StorySessionInput,
}
impl __sdk::InModule for BeginStorySessionAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for BeginStorySessionAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait begin_story_session_and_return {
fn begin_story_session_and_return(&self, input: StorySessionInput) {
self.begin_story_session_and_return_then(input, |_, _| {});
fn begin_story_session_and_return(&self, input: StorySessionInput,
) {
self.begin_story_session_and_return_then(input, |_, _| {});
}
fn begin_story_session_and_return_then(
&self,
input: StorySessionInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<StorySessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<StorySessionProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl begin_story_session_and_return for super::RemoteProcedures {
&self,
input: StorySessionInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<StorySessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<StorySessionProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, StorySessionProcedureResult>(
"begin_story_session_and_return",
BeginStorySessionAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, StorySessionProcedureResult>(
"begin_story_session_and_return",
BeginStorySessionAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::story_session_input_type::StorySessionInput;
@@ -14,8 +19,10 @@ pub(super) struct BeginStorySessionArgs {
impl From<BeginStorySessionArgs> for super::Reducer {
fn from(args: BeginStorySessionArgs) -> Self {
Self::BeginStorySession { input: args.input }
}
Self::BeginStorySession {
input: args.input,
}
}
}
impl __sdk::InModule for BeginStorySessionArgs {
@@ -33,8 +40,9 @@ pub trait begin_story_session {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`begin_story_session:begin_story_session_then`] to run a callback after the reducer completes.
fn begin_story_session(&self, input: StorySessionInput) -> __sdk::Result<()> {
self.begin_story_session_then(input, |_, _| {})
fn begin_story_session(&self, input: StorySessionInput,
) -> __sdk::Result<()> {
self.begin_story_session_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `begin_story_session` to run as soon as possible,
@@ -62,7 +70,7 @@ impl begin_story_session for super::RemoteReducers {
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp
.invoke_reducer_with_callback(BeginStorySessionArgs { input }, callback)
self.imp.invoke_reducer_with_callback(BeginStorySessionArgs { input, }, callback)
}
}

View File

@@ -2,17 +2,23 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_entity_binding_input_type::AssetEntityBindingInput;
use super::asset_entity_binding_procedure_result_type::AssetEntityBindingProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct BindAssetObjectToEntityAndReturnArgs {
struct BindAssetObjectToEntityAndReturnArgs {
pub input: AssetEntityBindingInput,
}
impl __sdk::InModule for BindAssetObjectToEntityAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for BindAssetObjectToEntityAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait bind_asset_object_to_entity_and_return {
fn bind_asset_object_to_entity_and_return(&self, input: AssetEntityBindingInput) {
self.bind_asset_object_to_entity_and_return_then(input, |_, _| {});
fn bind_asset_object_to_entity_and_return(&self, input: AssetEntityBindingInput,
) {
self.bind_asset_object_to_entity_and_return_then(input, |_, _| {});
}
fn bind_asset_object_to_entity_and_return_then(
&self,
input: AssetEntityBindingInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AssetEntityBindingProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AssetEntityBindingProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl bind_asset_object_to_entity_and_return for super::RemoteProcedures {
&self,
input: AssetEntityBindingInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AssetEntityBindingProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AssetEntityBindingProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, AssetEntityBindingProcedureResult>(
"bind_asset_object_to_entity_and_return",
BindAssetObjectToEntityAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, AssetEntityBindingProcedureResult>(
"bind_asset_object_to_entity_and_return",
BindAssetObjectToEntityAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_entity_binding_input_type::AssetEntityBindingInput;
@@ -14,8 +19,10 @@ pub(super) struct BindAssetObjectToEntityArgs {
impl From<BindAssetObjectToEntityArgs> for super::Reducer {
fn from(args: BindAssetObjectToEntityArgs) -> Self {
Self::BindAssetObjectToEntity { input: args.input }
}
Self::BindAssetObjectToEntity {
input: args.input,
}
}
}
impl __sdk::InModule for BindAssetObjectToEntityArgs {
@@ -33,8 +40,9 @@ pub trait bind_asset_object_to_entity {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`bind_asset_object_to_entity:bind_asset_object_to_entity_then`] to run a callback after the reducer completes.
fn bind_asset_object_to_entity(&self, input: AssetEntityBindingInput) -> __sdk::Result<()> {
self.bind_asset_object_to_entity_then(input, |_, _| {})
fn bind_asset_object_to_entity(&self, input: AssetEntityBindingInput,
) -> __sdk::Result<()> {
self.bind_asset_object_to_entity_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `bind_asset_object_to_entity` to run as soon as possible,
@@ -62,7 +70,7 @@ impl bind_asset_object_to_entity for super::RemoteReducers {
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp
.invoke_reducer_with_callback(BindAssetObjectToEntityArgs { input }, callback)
self.imp.invoke_reducer_with_callback(BindAssetObjectToEntityArgs { input, }, callback)
}
}

View File

@@ -2,17 +2,23 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_cancel_input_type::AiTaskCancelInput;
use super::ai_task_procedure_result_type::AiTaskProcedureResult;
use super::ai_task_cancel_input_type::AiTaskCancelInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct CancelAiTaskAndReturnArgs {
struct CancelAiTaskAndReturnArgs {
pub input: AiTaskCancelInput,
}
impl __sdk::InModule for CancelAiTaskAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for CancelAiTaskAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait cancel_ai_task_and_return {
fn cancel_ai_task_and_return(&self, input: AiTaskCancelInput) {
self.cancel_ai_task_and_return_then(input, |_, _| {});
fn cancel_ai_task_and_return(&self, input: AiTaskCancelInput,
) {
self.cancel_ai_task_and_return_then(input, |_, _| {});
}
fn cancel_ai_task_and_return_then(
&self,
input: AiTaskCancelInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AiTaskProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AiTaskProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl cancel_ai_task_and_return for super::RemoteProcedures {
&self,
input: AiTaskCancelInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AiTaskProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AiTaskProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, AiTaskProcedureResult>(
"cancel_ai_task_and_return",
CancelAiTaskAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, AiTaskProcedureResult>(
"cancel_ai_task_and_return",
CancelAiTaskAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -15,8 +20,12 @@ pub enum ChapterPaceBand {
Pressure,
FinaleDense,
}
impl __sdk::InModule for ChapterPaceBand {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,13 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -11,6 +17,8 @@ pub struct ChapterProgressionGetInput {
pub chapter_id: String,
}
impl __sdk::InModule for ChapterProgressionGetInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::chapter_pace_band_type::ChapterPaceBand;
@@ -26,6 +31,8 @@ pub struct ChapterProgressionInput {
pub updated_at_micros: i64,
}
impl __sdk::InModule for ChapterProgressionInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,13 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -12,10 +18,12 @@ pub struct ChapterProgressionLedgerInput {
pub granted_quest_xp: u32,
pub granted_hostile_xp: u32,
pub hostile_defeat_increment: u32,
pub level_at_exit: Option<u32>,
pub level_at_exit: Option::<u32>,
pub updated_at_micros: i64,
}
impl __sdk::InModule for ChapterProgressionLedgerInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::chapter_progression_snapshot_type::ChapterProgressionSnapshot;
@@ -10,10 +15,12 @@ use super::chapter_progression_snapshot_type::ChapterProgressionSnapshot;
#[sats(crate = __lib)]
pub struct ChapterProgressionProcedureResult {
pub ok: bool,
pub record: Option<ChapterProgressionSnapshot>,
pub error_message: Option<String>,
pub record: Option::<ChapterProgressionSnapshot>,
pub error_message: Option::<String>,
}
impl __sdk::InModule for ChapterProgressionProcedureResult {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::chapter_pace_band_type::ChapterPaceBand;
@@ -25,12 +30,14 @@ pub struct ChapterProgressionSnapshot {
pub expected_hostile_defeat_count: u32,
pub actual_hostile_defeat_count: u32,
pub level_at_entry: u32,
pub level_at_exit: Option<u32>,
pub level_at_exit: Option::<u32>,
pub pace_band: ChapterPaceBand,
pub created_at_micros: i64,
pub updated_at_micros: i64,
}
impl __sdk::InModule for ChapterProgressionSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,9 +2,14 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use super::chapter_pace_band_type::ChapterPaceBand;
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::chapter_progression_type::ChapterProgression;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::chapter_pace_band_type::ChapterPaceBand;
/// Table handle for the table `chapter_progression`.
///
@@ -32,9 +37,7 @@ pub trait ChapterProgressionTableAccess {
impl ChapterProgressionTableAccess for super::RemoteTables {
fn chapter_progression(&self) -> ChapterProgressionTableHandle<'_> {
ChapterProgressionTableHandle {
imp: self
.imp
.get_table::<ChapterProgression>("chapter_progression"),
imp: self.imp.get_table::<ChapterProgression>("chapter_progression"),
ctx: std::marker::PhantomData,
}
}
@@ -47,12 +50,8 @@ impl<'ctx> __sdk::Table for ChapterProgressionTableHandle<'ctx> {
type Row = ChapterProgression;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = ChapterProgression> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = ChapterProgression> + '_ { self.imp.iter() }
type InsertCallbackId = ChapterProgressionInsertCallbackId;
@@ -98,44 +97,41 @@ impl<'ctx> __sdk::TableWithPrimaryKey for ChapterProgressionTableHandle<'ctx> {
}
}
/// Access to the `chapter_progression_id` unique index on the table `chapter_progression`,
/// which allows point queries on the field of the same name
/// via the [`ChapterProgressionChapterProgressionIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.chapter_progression().chapter_progression_id().find(...)`.
pub struct ChapterProgressionChapterProgressionIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<ChapterProgression, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> ChapterProgressionTableHandle<'ctx> {
/// Get a handle on the `chapter_progression_id` unique index on the table `chapter_progression`.
pub fn chapter_progression_id(&self) -> ChapterProgressionChapterProgressionIdUnique<'ctx> {
ChapterProgressionChapterProgressionIdUnique {
imp: self
.imp
.get_unique_constraint::<String>("chapter_progression_id"),
phantom: std::marker::PhantomData,
/// Access to the `chapter_progression_id` unique index on the table `chapter_progression`,
/// which allows point queries on the field of the same name
/// via the [`ChapterProgressionChapterProgressionIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.chapter_progression().chapter_progression_id().find(...)`.
pub struct ChapterProgressionChapterProgressionIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<ChapterProgression, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> ChapterProgressionChapterProgressionIdUnique<'ctx> {
/// Find the subscribed row whose `chapter_progression_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<ChapterProgression> {
self.imp.find(col_val)
}
}
impl<'ctx> ChapterProgressionTableHandle<'ctx> {
/// Get a handle on the `chapter_progression_id` unique index on the table `chapter_progression`.
pub fn chapter_progression_id(&self) -> ChapterProgressionChapterProgressionIdUnique<'ctx> {
ChapterProgressionChapterProgressionIdUnique {
imp: self.imp.get_unique_constraint::<String>("chapter_progression_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> ChapterProgressionChapterProgressionIdUnique<'ctx> {
/// Find the subscribed row whose `chapter_progression_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<ChapterProgression> {
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::<ChapterProgression>("chapter_progression");
_table.add_unique_constraint::<String>("chapter_progression_id", |row| {
&row.chapter_progression_id
});
_table.add_unique_constraint::<String>("chapter_progression_id", |row| &row.chapter_progression_id);
}
#[doc(hidden)]
@@ -143,24 +139,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<ChapterProgression>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<ChapterProgression>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<ChapterProgression>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `ChapterProgression`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait chapter_progressionQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `ChapterProgression`.
fn chapter_progression(&self) -> __sdk::__query_builder::Table<ChapterProgression>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `ChapterProgression`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait chapter_progressionQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `ChapterProgression`.
fn chapter_progression(&self) -> __sdk::__query_builder::Table<ChapterProgression>;
}
impl chapter_progressionQueryTableAccess for __sdk::QueryTableAccessor {
fn chapter_progression(&self) -> __sdk::__query_builder::Table<ChapterProgression> {
__sdk::__query_builder::Table::new("chapter_progression")
}
}
impl chapter_progressionQueryTableAccess for __sdk::QueryTableAccessor {
fn chapter_progression(&self) -> __sdk::__query_builder::Table<ChapterProgression> {
__sdk::__query_builder::Table::new("chapter_progression")
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::chapter_pace_band_type::ChapterPaceBand;
@@ -26,16 +31,18 @@ pub struct ChapterProgression {
pub expected_hostile_defeat_count: u32,
pub actual_hostile_defeat_count: u32,
pub level_at_entry: u32,
pub level_at_exit: Option<u32>,
pub level_at_exit: Option::<u32>,
pub pace_band: ChapterPaceBand,
pub created_at: __sdk::Timestamp,
pub updated_at: __sdk::Timestamp,
}
impl __sdk::InModule for ChapterProgression {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `ChapterProgression`.
///
/// Provides typed access to columns for query building.
@@ -57,7 +64,7 @@ pub struct ChapterProgressionCols {
pub expected_hostile_defeat_count: __sdk::__query_builder::Col<ChapterProgression, u32>,
pub actual_hostile_defeat_count: __sdk::__query_builder::Col<ChapterProgression, u32>,
pub level_at_entry: __sdk::__query_builder::Col<ChapterProgression, u32>,
pub level_at_exit: __sdk::__query_builder::Col<ChapterProgression, Option<u32>>,
pub level_at_exit: __sdk::__query_builder::Col<ChapterProgression, Option::<u32>>,
pub pace_band: __sdk::__query_builder::Col<ChapterProgression, ChapterPaceBand>,
pub created_at: __sdk::__query_builder::Col<ChapterProgression, __sdk::Timestamp>,
pub updated_at: __sdk::__query_builder::Col<ChapterProgression, __sdk::Timestamp>,
@@ -67,22 +74,13 @@ impl __sdk::__query_builder::HasCols for ChapterProgression {
type Cols = ChapterProgressionCols;
fn cols(table_name: &'static str) -> Self::Cols {
ChapterProgressionCols {
chapter_progression_id: __sdk::__query_builder::Col::new(
table_name,
"chapter_progression_id",
),
chapter_progression_id: __sdk::__query_builder::Col::new(table_name, "chapter_progression_id"),
user_id: __sdk::__query_builder::Col::new(table_name, "user_id"),
chapter_id: __sdk::__query_builder::Col::new(table_name, "chapter_id"),
chapter_index: __sdk::__query_builder::Col::new(table_name, "chapter_index"),
total_chapters: __sdk::__query_builder::Col::new(table_name, "total_chapters"),
entry_pseudo_level_millis: __sdk::__query_builder::Col::new(
table_name,
"entry_pseudo_level_millis",
),
exit_pseudo_level_millis: __sdk::__query_builder::Col::new(
table_name,
"exit_pseudo_level_millis",
),
entry_pseudo_level_millis: __sdk::__query_builder::Col::new(table_name, "entry_pseudo_level_millis"),
exit_pseudo_level_millis: __sdk::__query_builder::Col::new(table_name, "exit_pseudo_level_millis"),
entry_level: __sdk::__query_builder::Col::new(table_name, "entry_level"),
exit_level: __sdk::__query_builder::Col::new(table_name, "exit_level"),
planned_total_xp: __sdk::__query_builder::Col::new(table_name, "planned_total_xp"),
@@ -90,19 +88,14 @@ impl __sdk::__query_builder::HasCols for ChapterProgression {
planned_hostile_xp: __sdk::__query_builder::Col::new(table_name, "planned_hostile_xp"),
actual_quest_xp: __sdk::__query_builder::Col::new(table_name, "actual_quest_xp"),
actual_hostile_xp: __sdk::__query_builder::Col::new(table_name, "actual_hostile_xp"),
expected_hostile_defeat_count: __sdk::__query_builder::Col::new(
table_name,
"expected_hostile_defeat_count",
),
actual_hostile_defeat_count: __sdk::__query_builder::Col::new(
table_name,
"actual_hostile_defeat_count",
),
expected_hostile_defeat_count: __sdk::__query_builder::Col::new(table_name, "expected_hostile_defeat_count"),
actual_hostile_defeat_count: __sdk::__query_builder::Col::new(table_name, "actual_hostile_defeat_count"),
level_at_entry: __sdk::__query_builder::Col::new(table_name, "level_at_entry"),
level_at_exit: __sdk::__query_builder::Col::new(table_name, "level_at_exit"),
pace_band: __sdk::__query_builder::Col::new(table_name, "pace_band"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
}
}
}
@@ -121,13 +114,12 @@ impl __sdk::__query_builder::HasIxCols for ChapterProgression {
fn ix_cols(table_name: &'static str) -> Self::IxCols {
ChapterProgressionIxCols {
chapter_id: __sdk::__query_builder::IxCol::new(table_name, "chapter_id"),
chapter_progression_id: __sdk::__query_builder::IxCol::new(
table_name,
"chapter_progression_id",
),
chapter_progression_id: __sdk::__query_builder::IxCol::new(table_name, "chapter_progression_id"),
user_id: __sdk::__query_builder::IxCol::new(table_name, "user_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for ChapterProgression {}

View File

@@ -2,17 +2,23 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::runtime_browse_history_clear_input_type::RuntimeBrowseHistoryClearInput;
use super::runtime_browse_history_procedure_result_type::RuntimeBrowseHistoryProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct ClearPlatformBrowseHistoryAndReturnArgs {
struct ClearPlatformBrowseHistoryAndReturnArgs {
pub input: RuntimeBrowseHistoryClearInput,
}
impl __sdk::InModule for ClearPlatformBrowseHistoryAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for ClearPlatformBrowseHistoryAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait clear_platform_browse_history_and_return {
fn clear_platform_browse_history_and_return(&self, input: RuntimeBrowseHistoryClearInput) {
self.clear_platform_browse_history_and_return_then(input, |_, _| {});
fn clear_platform_browse_history_and_return(&self, input: RuntimeBrowseHistoryClearInput,
) {
self.clear_platform_browse_history_and_return_then(input, |_, _| {});
}
fn clear_platform_browse_history_and_return_then(
&self,
input: RuntimeBrowseHistoryClearInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<RuntimeBrowseHistoryProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<RuntimeBrowseHistoryProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl clear_platform_browse_history_and_return for super::RemoteProcedures {
&self,
input: RuntimeBrowseHistoryClearInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<RuntimeBrowseHistoryProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<RuntimeBrowseHistoryProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, RuntimeBrowseHistoryProcedureResult>(
"clear_platform_browse_history_and_return",
ClearPlatformBrowseHistoryAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, RuntimeBrowseHistoryProcedureResult>(
"clear_platform_browse_history_and_return",
ClearPlatformBrowseHistoryAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -15,8 +20,12 @@ pub enum CombatOutcome {
SparComplete,
Escaped,
}
impl __sdk::InModule for CombatOutcome {
type Module = super::RemoteModule;
}

View File

@@ -2,17 +2,23 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::custom_world_published_profile_compile_input_type::CustomWorldPublishedProfileCompileInput;
use super::custom_world_published_profile_compile_result_type::CustomWorldPublishedProfileCompileResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct CompileCustomWorldPublishedProfileArgs {
struct CompileCustomWorldPublishedProfileArgs {
pub input: CustomWorldPublishedProfileCompileInput,
}
impl __sdk::InModule for CompileCustomWorldPublishedProfileArgs {
type Module = super::RemoteModule;
}
@@ -22,22 +28,16 @@ impl __sdk::InModule for CompileCustomWorldPublishedProfileArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait compile_custom_world_published_profile {
fn compile_custom_world_published_profile(
&self,
input: CustomWorldPublishedProfileCompileInput,
) {
self.compile_custom_world_published_profile_then(input, |_, _| {});
fn compile_custom_world_published_profile(&self, input: CustomWorldPublishedProfileCompileInput,
) {
self.compile_custom_world_published_profile_then(input, |_, _| {});
}
fn compile_custom_world_published_profile_then(
&self,
input: CustomWorldPublishedProfileCompileInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<CustomWorldPublishedProfileCompileResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<CustomWorldPublishedProfileCompileResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -46,17 +46,13 @@ impl compile_custom_world_published_profile for super::RemoteProcedures {
&self,
input: CustomWorldPublishedProfileCompileInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<CustomWorldPublishedProfileCompileResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<CustomWorldPublishedProfileCompileResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, CustomWorldPublishedProfileCompileResult>(
"compile_custom_world_published_profile",
CompileCustomWorldPublishedProfileArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, CustomWorldPublishedProfileCompileResult>(
"compile_custom_world_published_profile",
CompileCustomWorldPublishedProfileArgs { input, },
__callback,
);
}
}

View File

@@ -2,17 +2,23 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_stage_completion_input_type::AiStageCompletionInput;
use super::ai_task_procedure_result_type::AiTaskProcedureResult;
use super::ai_stage_completion_input_type::AiStageCompletionInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct CompleteAiStageAndReturnArgs {
struct CompleteAiStageAndReturnArgs {
pub input: AiStageCompletionInput,
}
impl __sdk::InModule for CompleteAiStageAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for CompleteAiStageAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait complete_ai_stage_and_return {
fn complete_ai_stage_and_return(&self, input: AiStageCompletionInput) {
self.complete_ai_stage_and_return_then(input, |_, _| {});
fn complete_ai_stage_and_return(&self, input: AiStageCompletionInput,
) {
self.complete_ai_stage_and_return_then(input, |_, _| {});
}
fn complete_ai_stage_and_return_then(
&self,
input: AiStageCompletionInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AiTaskProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AiTaskProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl complete_ai_stage_and_return for super::RemoteProcedures {
&self,
input: AiStageCompletionInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AiTaskProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AiTaskProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, AiTaskProcedureResult>(
"complete_ai_stage_and_return",
CompleteAiStageAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, AiTaskProcedureResult>(
"complete_ai_stage_and_return",
CompleteAiStageAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,17 +2,23 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_finish_input_type::AiTaskFinishInput;
use super::ai_task_procedure_result_type::AiTaskProcedureResult;
use super::ai_task_finish_input_type::AiTaskFinishInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct CompleteAiTaskAndReturnArgs {
struct CompleteAiTaskAndReturnArgs {
pub input: AiTaskFinishInput,
}
impl __sdk::InModule for CompleteAiTaskAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for CompleteAiTaskAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait complete_ai_task_and_return {
fn complete_ai_task_and_return(&self, input: AiTaskFinishInput) {
self.complete_ai_task_and_return_then(input, |_, _| {});
fn complete_ai_task_and_return(&self, input: AiTaskFinishInput,
) {
self.complete_ai_task_and_return_then(input, |_, _| {});
}
fn complete_ai_task_and_return_then(
&self,
input: AiTaskFinishInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AiTaskProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AiTaskProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl complete_ai_task_and_return for super::RemoteProcedures {
&self,
input: AiTaskFinishInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AiTaskProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AiTaskProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, AiTaskProcedureResult>(
"complete_ai_task_and_return",
CompleteAiTaskAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, AiTaskProcedureResult>(
"complete_ai_task_and_return",
CompleteAiTaskAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,17 +2,23 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_object_procedure_result_type::AssetObjectProcedureResult;
use super::asset_object_upsert_input_type::AssetObjectUpsertInput;
use super::asset_object_procedure_result_type::AssetObjectProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct ConfirmAssetObjectAndReturnArgs {
struct ConfirmAssetObjectAndReturnArgs {
pub input: AssetObjectUpsertInput,
}
impl __sdk::InModule for ConfirmAssetObjectAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for ConfirmAssetObjectAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait confirm_asset_object_and_return {
fn confirm_asset_object_and_return(&self, input: AssetObjectUpsertInput) {
self.confirm_asset_object_and_return_then(input, |_, _| {});
fn confirm_asset_object_and_return(&self, input: AssetObjectUpsertInput,
) {
self.confirm_asset_object_and_return_then(input, |_, _| {});
}
fn confirm_asset_object_and_return_then(
&self,
input: AssetObjectUpsertInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AssetObjectProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AssetObjectProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl confirm_asset_object_and_return for super::RemoteProcedures {
&self,
input: AssetObjectUpsertInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AssetObjectProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AssetObjectProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, AssetObjectProcedureResult>(
"confirm_asset_object_and_return",
ConfirmAssetObjectAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, AssetObjectProcedureResult>(
"confirm_asset_object_and_return",
ConfirmAssetObjectAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_object_upsert_input_type::AssetObjectUpsertInput;
@@ -14,8 +19,10 @@ pub(super) struct ConfirmAssetObjectArgs {
impl From<ConfirmAssetObjectArgs> for super::Reducer {
fn from(args: ConfirmAssetObjectArgs) -> Self {
Self::ConfirmAssetObject { input: args.input }
}
Self::ConfirmAssetObject {
input: args.input,
}
}
}
impl __sdk::InModule for ConfirmAssetObjectArgs {
@@ -33,8 +40,9 @@ pub trait confirm_asset_object {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`confirm_asset_object:confirm_asset_object_then`] to run a callback after the reducer completes.
fn confirm_asset_object(&self, input: AssetObjectUpsertInput) -> __sdk::Result<()> {
self.confirm_asset_object_then(input, |_, _| {})
fn confirm_asset_object(&self, input: AssetObjectUpsertInput,
) -> __sdk::Result<()> {
self.confirm_asset_object_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `confirm_asset_object` to run as soon as possible,
@@ -62,7 +70,7 @@ impl confirm_asset_object for super::RemoteReducers {
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp
.invoke_reducer_with_callback(ConfirmAssetObjectArgs { input }, callback)
self.imp.invoke_reducer_with_callback(ConfirmAssetObjectArgs { input, }, callback)
}
}

View File

@@ -2,7 +2,13 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -11,6 +17,8 @@ pub struct ConsumeInventoryItemInput {
pub quantity: u32,
}
impl __sdk::InModule for ConsumeInventoryItemInput {
type Module = super::RemoteModule;
}

View File

@@ -2,17 +2,23 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::story_continue_input_type::StoryContinueInput;
use super::story_session_procedure_result_type::StorySessionProcedureResult;
use super::story_continue_input_type::StoryContinueInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct ContinueStoryAndReturnArgs {
struct ContinueStoryAndReturnArgs {
pub input: StoryContinueInput,
}
impl __sdk::InModule for ContinueStoryAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for ContinueStoryAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait continue_story_and_return {
fn continue_story_and_return(&self, input: StoryContinueInput) {
self.continue_story_and_return_then(input, |_, _| {});
fn continue_story_and_return(&self, input: StoryContinueInput,
) {
self.continue_story_and_return_then(input, |_, _| {});
}
fn continue_story_and_return_then(
&self,
input: StoryContinueInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<StorySessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<StorySessionProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl continue_story_and_return for super::RemoteProcedures {
&self,
input: StoryContinueInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<StorySessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<StorySessionProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, StorySessionProcedureResult>(
"continue_story_and_return",
ContinueStoryAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, StorySessionProcedureResult>(
"continue_story_and_return",
ContinueStoryAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::story_continue_input_type::StoryContinueInput;
@@ -14,8 +19,10 @@ pub(super) struct ContinueStoryArgs {
impl From<ContinueStoryArgs> for super::Reducer {
fn from(args: ContinueStoryArgs) -> Self {
Self::ContinueStory { input: args.input }
}
Self::ContinueStory {
input: args.input,
}
}
}
impl __sdk::InModule for ContinueStoryArgs {
@@ -33,8 +40,9 @@ pub trait continue_story {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`continue_story:continue_story_then`] to run a callback after the reducer completes.
fn continue_story(&self, input: StoryContinueInput) -> __sdk::Result<()> {
self.continue_story_then(input, |_, _| {})
fn continue_story(&self, input: StoryContinueInput,
) -> __sdk::Result<()> {
self.continue_story_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `continue_story` to run as soon as possible,
@@ -62,7 +70,7 @@ impl continue_story for super::RemoteReducers {
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp
.invoke_reducer_with_callback(ContinueStoryArgs { input }, callback)
self.imp.invoke_reducer_with_callback(ContinueStoryArgs { input, }, callback)
}
}

View File

@@ -2,17 +2,23 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_create_input_type::AiTaskCreateInput;
use super::ai_task_procedure_result_type::AiTaskProcedureResult;
use super::ai_task_create_input_type::AiTaskCreateInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct CreateAiTaskAndReturnArgs {
struct CreateAiTaskAndReturnArgs {
pub input: AiTaskCreateInput,
}
impl __sdk::InModule for CreateAiTaskAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for CreateAiTaskAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait create_ai_task_and_return {
fn create_ai_task_and_return(&self, input: AiTaskCreateInput) {
self.create_ai_task_and_return_then(input, |_, _| {});
fn create_ai_task_and_return(&self, input: AiTaskCreateInput,
) {
self.create_ai_task_and_return_then(input, |_, _| {});
}
fn create_ai_task_and_return_then(
&self,
input: AiTaskCreateInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AiTaskProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AiTaskProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl create_ai_task_and_return for super::RemoteProcedures {
&self,
input: AiTaskCreateInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AiTaskProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AiTaskProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, AiTaskProcedureResult>(
"create_ai_task_and_return",
CreateAiTaskAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, AiTaskProcedureResult>(
"create_ai_task_and_return",
CreateAiTaskAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_create_input_type::AiTaskCreateInput;
@@ -14,8 +19,10 @@ pub(super) struct CreateAiTaskArgs {
impl From<CreateAiTaskArgs> for super::Reducer {
fn from(args: CreateAiTaskArgs) -> Self {
Self::CreateAiTask { input: args.input }
}
Self::CreateAiTask {
input: args.input,
}
}
}
impl __sdk::InModule for CreateAiTaskArgs {
@@ -33,8 +40,9 @@ pub trait create_ai_task {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`create_ai_task:create_ai_task_then`] to run a callback after the reducer completes.
fn create_ai_task(&self, input: AiTaskCreateInput) -> __sdk::Result<()> {
self.create_ai_task_then(input, |_, _| {})
fn create_ai_task(&self, input: AiTaskCreateInput,
) -> __sdk::Result<()> {
self.create_ai_task_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `create_ai_task` to run as soon as possible,
@@ -62,7 +70,7 @@ impl create_ai_task for super::RemoteReducers {
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp
.invoke_reducer_with_callback(CreateAiTaskArgs { input }, callback)
self.imp.invoke_reducer_with_callback(CreateAiTaskArgs { input, }, callback)
}
}

View File

@@ -2,17 +2,23 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::battle_state_input_type::BattleStateInput;
use super::battle_state_procedure_result_type::BattleStateProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct CreateBattleStateAndReturnArgs {
struct CreateBattleStateAndReturnArgs {
pub input: BattleStateInput,
}
impl __sdk::InModule for CreateBattleStateAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for CreateBattleStateAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait create_battle_state_and_return {
fn create_battle_state_and_return(&self, input: BattleStateInput) {
self.create_battle_state_and_return_then(input, |_, _| {});
fn create_battle_state_and_return(&self, input: BattleStateInput,
) {
self.create_battle_state_and_return_then(input, |_, _| {});
}
fn create_battle_state_and_return_then(
&self,
input: BattleStateInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<BattleStateProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<BattleStateProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl create_battle_state_and_return for super::RemoteProcedures {
&self,
input: BattleStateInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<BattleStateProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<BattleStateProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, BattleStateProcedureResult>(
"create_battle_state_and_return",
CreateBattleStateAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, BattleStateProcedureResult>(
"create_battle_state_and_return",
CreateBattleStateAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::battle_state_input_type::BattleStateInput;
@@ -14,8 +19,10 @@ pub(super) struct CreateBattleStateArgs {
impl From<CreateBattleStateArgs> for super::Reducer {
fn from(args: CreateBattleStateArgs) -> Self {
Self::CreateBattleState { input: args.input }
}
Self::CreateBattleState {
input: args.input,
}
}
}
impl __sdk::InModule for CreateBattleStateArgs {
@@ -33,8 +40,9 @@ pub trait create_battle_state {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`create_battle_state:create_battle_state_then`] to run a callback after the reducer completes.
fn create_battle_state(&self, input: BattleStateInput) -> __sdk::Result<()> {
self.create_battle_state_then(input, |_, _| {})
fn create_battle_state(&self, input: BattleStateInput,
) -> __sdk::Result<()> {
self.create_battle_state_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `create_battle_state` to run as soon as possible,
@@ -62,7 +70,7 @@ impl create_battle_state for super::RemoteReducers {
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp
.invoke_reducer_with_callback(CreateBattleStateArgs { input }, callback)
self.imp.invoke_reducer_with_callback(CreateBattleStateArgs { input, }, callback)
}
}

View File

@@ -2,17 +2,23 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::custom_world_agent_session_create_input_type::CustomWorldAgentSessionCreateInput;
use super::custom_world_agent_session_procedure_result_type::CustomWorldAgentSessionProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct CreateCustomWorldAgentSessionArgs {
struct CreateCustomWorldAgentSessionArgs {
pub input: CustomWorldAgentSessionCreateInput,
}
impl __sdk::InModule for CreateCustomWorldAgentSessionArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for CreateCustomWorldAgentSessionArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait create_custom_world_agent_session {
fn create_custom_world_agent_session(&self, input: CustomWorldAgentSessionCreateInput) {
self.create_custom_world_agent_session_then(input, |_, _| {});
fn create_custom_world_agent_session(&self, input: CustomWorldAgentSessionCreateInput,
) {
self.create_custom_world_agent_session_then(input, |_, _| {});
}
fn create_custom_world_agent_session_then(
&self,
input: CustomWorldAgentSessionCreateInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<CustomWorldAgentSessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<CustomWorldAgentSessionProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl create_custom_world_agent_session for super::RemoteProcedures {
&self,
input: CustomWorldAgentSessionCreateInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<CustomWorldAgentSessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<CustomWorldAgentSessionProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, CustomWorldAgentSessionProcedureResult>(
"create_custom_world_agent_session",
CreateCustomWorldAgentSessionArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, CustomWorldAgentSessionProcedureResult>(
"create_custom_world_agent_session",
CreateCustomWorldAgentSessionArgs { input, },
__callback,
);
}
}

View File

@@ -2,10 +2,15 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::rpg_agent_message_kind_type::RpgAgentMessageKind;
use super::rpg_agent_message_role_type::RpgAgentMessageRole;
use super::rpg_agent_message_kind_type::RpgAgentMessageKind;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -15,10 +20,12 @@ pub struct CustomWorldAgentMessageSnapshot {
pub role: RpgAgentMessageRole,
pub kind: RpgAgentMessageKind,
pub text: String,
pub related_operation_id: Option<String>,
pub related_operation_id: Option::<String>,
pub created_at_micros: i64,
}
impl __sdk::InModule for CustomWorldAgentMessageSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,13 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -15,6 +21,8 @@ pub struct CustomWorldAgentMessageSubmitInput {
pub submitted_at_micros: i64,
}
impl __sdk::InModule for CustomWorldAgentMessageSubmitInput {
type Module = super::RemoteModule;
}

View File

@@ -2,10 +2,15 @@
// 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_agent_message_type::CustomWorldAgentMessage;
use super::rpg_agent_message_kind_type::RpgAgentMessageKind;
use super::rpg_agent_message_role_type::RpgAgentMessageRole;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::rpg_agent_message_kind_type::RpgAgentMessageKind;
/// Table handle for the table `custom_world_agent_message`.
///
@@ -33,9 +38,7 @@ pub trait CustomWorldAgentMessageTableAccess {
impl CustomWorldAgentMessageTableAccess for super::RemoteTables {
fn custom_world_agent_message(&self) -> CustomWorldAgentMessageTableHandle<'_> {
CustomWorldAgentMessageTableHandle {
imp: self
.imp
.get_table::<CustomWorldAgentMessage>("custom_world_agent_message"),
imp: self.imp.get_table::<CustomWorldAgentMessage>("custom_world_agent_message"),
ctx: std::marker::PhantomData,
}
}
@@ -48,12 +51,8 @@ impl<'ctx> __sdk::Table for CustomWorldAgentMessageTableHandle<'ctx> {
type Row = CustomWorldAgentMessage;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = CustomWorldAgentMessage> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = CustomWorldAgentMessage> + '_ { self.imp.iter() }
type InsertCallbackId = CustomWorldAgentMessageInsertCallbackId;
@@ -99,40 +98,40 @@ impl<'ctx> __sdk::TableWithPrimaryKey for CustomWorldAgentMessageTableHandle<'ct
}
}
/// Access to the `message_id` unique index on the table `custom_world_agent_message`,
/// which allows point queries on the field of the same name
/// via the [`CustomWorldAgentMessageMessageIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.custom_world_agent_message().message_id().find(...)`.
pub struct CustomWorldAgentMessageMessageIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<CustomWorldAgentMessage, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> CustomWorldAgentMessageTableHandle<'ctx> {
/// Get a handle on the `message_id` unique index on the table `custom_world_agent_message`.
pub fn message_id(&self) -> CustomWorldAgentMessageMessageIdUnique<'ctx> {
CustomWorldAgentMessageMessageIdUnique {
imp: self.imp.get_unique_constraint::<String>("message_id"),
phantom: std::marker::PhantomData,
/// Access to the `message_id` unique index on the table `custom_world_agent_message`,
/// which allows point queries on the field of the same name
/// via the [`CustomWorldAgentMessageMessageIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.custom_world_agent_message().message_id().find(...)`.
pub struct CustomWorldAgentMessageMessageIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<CustomWorldAgentMessage, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> CustomWorldAgentMessageMessageIdUnique<'ctx> {
/// Find the subscribed row whose `message_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<CustomWorldAgentMessage> {
self.imp.find(col_val)
}
}
impl<'ctx> CustomWorldAgentMessageTableHandle<'ctx> {
/// Get a handle on the `message_id` unique index on the table `custom_world_agent_message`.
pub fn message_id(&self) -> CustomWorldAgentMessageMessageIdUnique<'ctx> {
CustomWorldAgentMessageMessageIdUnique {
imp: self.imp.get_unique_constraint::<String>("message_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> CustomWorldAgentMessageMessageIdUnique<'ctx> {
/// Find the subscribed row whose `message_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<CustomWorldAgentMessage> {
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::<CustomWorldAgentMessage>("custom_world_agent_message");
let _table = client_cache.get_or_make_table::<CustomWorldAgentMessage>("custom_world_agent_message");
_table.add_unique_constraint::<String>("message_id", |row| &row.message_id);
}
@@ -141,24 +140,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<CustomWorldAgentMessage>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<CustomWorldAgentMessage>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<CustomWorldAgentMessage>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `CustomWorldAgentMessage`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait custom_world_agent_messageQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `CustomWorldAgentMessage`.
fn custom_world_agent_message(&self) -> __sdk::__query_builder::Table<CustomWorldAgentMessage>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `CustomWorldAgentMessage`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait custom_world_agent_messageQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `CustomWorldAgentMessage`.
fn custom_world_agent_message(&self) -> __sdk::__query_builder::Table<CustomWorldAgentMessage>;
}
impl custom_world_agent_messageQueryTableAccess for __sdk::QueryTableAccessor {
fn custom_world_agent_message(&self) -> __sdk::__query_builder::Table<CustomWorldAgentMessage> {
__sdk::__query_builder::Table::new("custom_world_agent_message")
}
}
impl custom_world_agent_messageQueryTableAccess for __sdk::QueryTableAccessor {
fn custom_world_agent_message(&self) -> __sdk::__query_builder::Table<CustomWorldAgentMessage> {
__sdk::__query_builder::Table::new("custom_world_agent_message")
}
}

View File

@@ -2,10 +2,15 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::rpg_agent_message_kind_type::RpgAgentMessageKind;
use super::rpg_agent_message_role_type::RpgAgentMessageRole;
use super::rpg_agent_message_kind_type::RpgAgentMessageKind;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -15,14 +20,16 @@ pub struct CustomWorldAgentMessage {
pub role: RpgAgentMessageRole,
pub kind: RpgAgentMessageKind,
pub text: String,
pub related_operation_id: Option<String>,
pub related_operation_id: Option::<String>,
pub created_at: __sdk::Timestamp,
}
impl __sdk::InModule for CustomWorldAgentMessage {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `CustomWorldAgentMessage`.
///
/// Provides typed access to columns for query building.
@@ -32,7 +39,7 @@ pub struct CustomWorldAgentMessageCols {
pub role: __sdk::__query_builder::Col<CustomWorldAgentMessage, RpgAgentMessageRole>,
pub kind: __sdk::__query_builder::Col<CustomWorldAgentMessage, RpgAgentMessageKind>,
pub text: __sdk::__query_builder::Col<CustomWorldAgentMessage, String>,
pub related_operation_id: __sdk::__query_builder::Col<CustomWorldAgentMessage, Option<String>>,
pub related_operation_id: __sdk::__query_builder::Col<CustomWorldAgentMessage, Option::<String>>,
pub created_at: __sdk::__query_builder::Col<CustomWorldAgentMessage, __sdk::Timestamp>,
}
@@ -45,11 +52,9 @@ impl __sdk::__query_builder::HasCols for CustomWorldAgentMessage {
role: __sdk::__query_builder::Col::new(table_name, "role"),
kind: __sdk::__query_builder::Col::new(table_name, "kind"),
text: __sdk::__query_builder::Col::new(table_name, "text"),
related_operation_id: __sdk::__query_builder::Col::new(
table_name,
"related_operation_id",
),
related_operation_id: __sdk::__query_builder::Col::new(table_name, "related_operation_id"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
}
}
}
@@ -68,8 +73,10 @@ impl __sdk::__query_builder::HasIxCols for CustomWorldAgentMessage {
CustomWorldAgentMessageIxCols {
message_id: __sdk::__query_builder::IxCol::new(table_name, "message_id"),
session_id: __sdk::__query_builder::IxCol::new(table_name, "session_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for CustomWorldAgentMessage {}

View File

@@ -2,7 +2,13 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -12,6 +18,8 @@ pub struct CustomWorldAgentOperationGetInput {
pub operation_id: String,
}
impl __sdk::InModule for CustomWorldAgentOperationGetInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::custom_world_agent_operation_snapshot_type::CustomWorldAgentOperationSnapshot;
@@ -10,10 +15,12 @@ use super::custom_world_agent_operation_snapshot_type::CustomWorldAgentOperation
#[sats(crate = __lib)]
pub struct CustomWorldAgentOperationProcedureResult {
pub ok: bool,
pub operation: Option<CustomWorldAgentOperationSnapshot>,
pub error_message: Option<String>,
pub operation: Option::<CustomWorldAgentOperationSnapshot>,
pub error_message: Option::<String>,
}
impl __sdk::InModule for CustomWorldAgentOperationProcedureResult {
type Module = super::RemoteModule;
}

View File

@@ -2,10 +2,15 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::rpg_agent_operation_status_type::RpgAgentOperationStatus;
use super::rpg_agent_operation_type_type::RpgAgentOperationType;
use super::rpg_agent_operation_status_type::RpgAgentOperationStatus;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -17,11 +22,13 @@ pub struct CustomWorldAgentOperationSnapshot {
pub phase_label: String,
pub phase_detail: String,
pub progress: u32,
pub error_message: Option<String>,
pub error_message: Option::<String>,
pub created_at_micros: i64,
pub updated_at_micros: i64,
}
impl __sdk::InModule for CustomWorldAgentOperationSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,10 +2,15 @@
// 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_agent_operation_type::CustomWorldAgentOperation;
use super::rpg_agent_operation_status_type::RpgAgentOperationStatus;
use super::rpg_agent_operation_type_type::RpgAgentOperationType;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::rpg_agent_operation_status_type::RpgAgentOperationStatus;
/// Table handle for the table `custom_world_agent_operation`.
///
@@ -33,9 +38,7 @@ pub trait CustomWorldAgentOperationTableAccess {
impl CustomWorldAgentOperationTableAccess for super::RemoteTables {
fn custom_world_agent_operation(&self) -> CustomWorldAgentOperationTableHandle<'_> {
CustomWorldAgentOperationTableHandle {
imp: self
.imp
.get_table::<CustomWorldAgentOperation>("custom_world_agent_operation"),
imp: self.imp.get_table::<CustomWorldAgentOperation>("custom_world_agent_operation"),
ctx: std::marker::PhantomData,
}
}
@@ -48,12 +51,8 @@ impl<'ctx> __sdk::Table for CustomWorldAgentOperationTableHandle<'ctx> {
type Row = CustomWorldAgentOperation;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = CustomWorldAgentOperation> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = CustomWorldAgentOperation> + '_ { self.imp.iter() }
type InsertCallbackId = CustomWorldAgentOperationInsertCallbackId;
@@ -99,40 +98,40 @@ impl<'ctx> __sdk::TableWithPrimaryKey for CustomWorldAgentOperationTableHandle<'
}
}
/// Access to the `operation_id` unique index on the table `custom_world_agent_operation`,
/// which allows point queries on the field of the same name
/// via the [`CustomWorldAgentOperationOperationIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.custom_world_agent_operation().operation_id().find(...)`.
pub struct CustomWorldAgentOperationOperationIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<CustomWorldAgentOperation, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> CustomWorldAgentOperationTableHandle<'ctx> {
/// Get a handle on the `operation_id` unique index on the table `custom_world_agent_operation`.
pub fn operation_id(&self) -> CustomWorldAgentOperationOperationIdUnique<'ctx> {
CustomWorldAgentOperationOperationIdUnique {
imp: self.imp.get_unique_constraint::<String>("operation_id"),
phantom: std::marker::PhantomData,
/// Access to the `operation_id` unique index on the table `custom_world_agent_operation`,
/// which allows point queries on the field of the same name
/// via the [`CustomWorldAgentOperationOperationIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.custom_world_agent_operation().operation_id().find(...)`.
pub struct CustomWorldAgentOperationOperationIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<CustomWorldAgentOperation, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> CustomWorldAgentOperationOperationIdUnique<'ctx> {
/// Find the subscribed row whose `operation_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<CustomWorldAgentOperation> {
self.imp.find(col_val)
}
}
impl<'ctx> CustomWorldAgentOperationTableHandle<'ctx> {
/// Get a handle on the `operation_id` unique index on the table `custom_world_agent_operation`.
pub fn operation_id(&self) -> CustomWorldAgentOperationOperationIdUnique<'ctx> {
CustomWorldAgentOperationOperationIdUnique {
imp: self.imp.get_unique_constraint::<String>("operation_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> CustomWorldAgentOperationOperationIdUnique<'ctx> {
/// Find the subscribed row whose `operation_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<CustomWorldAgentOperation> {
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::<CustomWorldAgentOperation>("custom_world_agent_operation");
let _table = client_cache.get_or_make_table::<CustomWorldAgentOperation>("custom_world_agent_operation");
_table.add_unique_constraint::<String>("operation_id", |row| &row.operation_id);
}
@@ -141,28 +140,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<CustomWorldAgentOperation>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<CustomWorldAgentOperation>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<CustomWorldAgentOperation>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `CustomWorldAgentOperation`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait custom_world_agent_operationQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `CustomWorldAgentOperation`.
fn custom_world_agent_operation(
&self,
) -> __sdk::__query_builder::Table<CustomWorldAgentOperation>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `CustomWorldAgentOperation`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait custom_world_agent_operationQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `CustomWorldAgentOperation`.
fn custom_world_agent_operation(&self) -> __sdk::__query_builder::Table<CustomWorldAgentOperation>;
}
impl custom_world_agent_operationQueryTableAccess for __sdk::QueryTableAccessor {
fn custom_world_agent_operation(&self) -> __sdk::__query_builder::Table<CustomWorldAgentOperation> {
__sdk::__query_builder::Table::new("custom_world_agent_operation")
}
}
impl custom_world_agent_operationQueryTableAccess for __sdk::QueryTableAccessor {
fn custom_world_agent_operation(
&self,
) -> __sdk::__query_builder::Table<CustomWorldAgentOperation> {
__sdk::__query_builder::Table::new("custom_world_agent_operation")
}
}

View File

@@ -2,10 +2,15 @@
// 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 spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::rpg_agent_operation_status_type::RpgAgentOperationStatus;
use super::rpg_agent_operation_type_type::RpgAgentOperationType;
use super::rpg_agent_operation_status_type::RpgAgentOperationStatus;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -17,28 +22,29 @@ pub struct CustomWorldAgentOperation {
pub phase_label: String,
pub phase_detail: String,
pub progress: u32,
pub error_message: Option<String>,
pub error_message: Option::<String>,
pub created_at: __sdk::Timestamp,
pub updated_at: __sdk::Timestamp,
}
impl __sdk::InModule for CustomWorldAgentOperation {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `CustomWorldAgentOperation`.
///
/// Provides typed access to columns for query building.
pub struct CustomWorldAgentOperationCols {
pub operation_id: __sdk::__query_builder::Col<CustomWorldAgentOperation, String>,
pub session_id: __sdk::__query_builder::Col<CustomWorldAgentOperation, String>,
pub operation_type:
__sdk::__query_builder::Col<CustomWorldAgentOperation, RpgAgentOperationType>,
pub operation_type: __sdk::__query_builder::Col<CustomWorldAgentOperation, RpgAgentOperationType>,
pub status: __sdk::__query_builder::Col<CustomWorldAgentOperation, RpgAgentOperationStatus>,
pub phase_label: __sdk::__query_builder::Col<CustomWorldAgentOperation, String>,
pub phase_detail: __sdk::__query_builder::Col<CustomWorldAgentOperation, String>,
pub progress: __sdk::__query_builder::Col<CustomWorldAgentOperation, u32>,
pub error_message: __sdk::__query_builder::Col<CustomWorldAgentOperation, Option<String>>,
pub error_message: __sdk::__query_builder::Col<CustomWorldAgentOperation, Option::<String>>,
pub created_at: __sdk::__query_builder::Col<CustomWorldAgentOperation, __sdk::Timestamp>,
pub updated_at: __sdk::__query_builder::Col<CustomWorldAgentOperation, __sdk::Timestamp>,
}
@@ -57,6 +63,7 @@ impl __sdk::__query_builder::HasCols for CustomWorldAgentOperation {
error_message: __sdk::__query_builder::Col::new(table_name, "error_message"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
}
}
}
@@ -75,8 +82,10 @@ impl __sdk::__query_builder::HasIxCols for CustomWorldAgentOperation {
CustomWorldAgentOperationIxCols {
operation_id: __sdk::__query_builder::IxCol::new(table_name, "operation_id"),
session_id: __sdk::__query_builder::IxCol::new(table_name, "session_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for CustomWorldAgentOperation {}

Some files were not shown because too many files have changed in this diff Show More