Merge remote-tracking branch 'origin/master' into codex/editor-asset-library

# Conflicts:
#	server-rs/crates/spacetime-client/src/lib.rs
#	server-rs/crates/spacetime-client/src/mapper.rs
#	server-rs/crates/spacetime-client/src/module_bindings.rs
#	src/components/platform-entry/PlatformEntryFlowShellImpl.tsx
This commit is contained in:
2026-06-13 16:52:03 +08:00
464 changed files with 51434 additions and 13822 deletions

View File

@@ -104,9 +104,7 @@ impl SpacetimeClient {
if result.ok {
Ok(())
} else {
Err(SpacetimeClientError::procedure_failed(
result.error_message,
))
Err(SpacetimeClientError::procedure_failed(result.error_message))
}
});
send_once(&sender, mapped);

View File

@@ -0,0 +1,173 @@
use super::*;
use crate::mapper::*;
impl SpacetimeClient {
pub async fn enqueue_external_generation_job(
&self,
input: ExternalGenerationJobEnqueueRecordInput,
) -> Result<ExternalGenerationJobRecord, SpacetimeClientError> {
let procedure_input = input.into();
self.call_after_connect(
"enqueue_external_generation_job_and_return",
move |connection, sender| {
connection
.procedures()
.enqueue_external_generation_job_and_return_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_external_generation_job_procedure_result);
send_once(&sender, mapped);
},
);
},
)
.await
}
pub async fn claim_external_generation_jobs(
&self,
input: ExternalGenerationJobClaimRecordInput,
) -> Result<Vec<ExternalGenerationJobRecord>, SpacetimeClientError> {
let procedure_input = input.into();
self.call_after_connect(
"claim_external_generation_jobs_and_return",
move |connection, sender| {
connection
.procedures()
.claim_external_generation_jobs_and_return_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_external_generation_job_claim_result);
send_once(&sender, mapped);
},
);
},
)
.await
}
pub async fn complete_external_generation_job(
&self,
input: ExternalGenerationJobCompleteRecordInput,
) -> Result<ExternalGenerationJobRecord, SpacetimeClientError> {
let procedure_input = input.into();
self.call_after_connect(
"complete_external_generation_job_and_return",
move |connection, sender| {
connection
.procedures()
.complete_external_generation_job_and_return_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_external_generation_job_procedure_result);
send_once(&sender, mapped);
},
);
},
)
.await
}
pub async fn renew_external_generation_job_lease(
&self,
input: ExternalGenerationJobRenewLeaseRecordInput,
) -> Result<ExternalGenerationJobRecord, SpacetimeClientError> {
let procedure_input = input.into();
self.call_after_connect(
"renew_external_generation_job_lease_and_return",
move |connection, sender| {
connection
.procedures()
.renew_external_generation_job_lease_and_return_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_external_generation_job_procedure_result);
send_once(&sender, mapped);
},
);
},
)
.await
}
pub async fn fail_external_generation_job(
&self,
input: ExternalGenerationJobFailRecordInput,
) -> Result<ExternalGenerationJobRecord, SpacetimeClientError> {
let procedure_input = input.into();
self.call_after_connect(
"fail_external_generation_job_and_return",
move |connection, sender| {
connection
.procedures()
.fail_external_generation_job_and_return_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_external_generation_job_procedure_result);
send_once(&sender, mapped);
},
);
},
)
.await
}
pub async fn get_external_generation_job(
&self,
input: ExternalGenerationJobGetRecordInput,
) -> Result<ExternalGenerationJobRecord, SpacetimeClientError> {
let procedure_input = input.into();
self.call_after_connect(
"get_external_generation_job_and_return",
move |connection, sender| {
connection
.procedures()
.get_external_generation_job_and_return_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_external_generation_job_procedure_result);
send_once(&sender, mapped);
},
);
},
)
.await
}
pub async fn get_external_generation_queue_stats(
&self,
) -> Result<ExternalGenerationQueueStatsRecord, SpacetimeClientError> {
self.call_after_connect(
"get_external_generation_queue_stats_and_return",
move |connection, sender| {
connection
.procedures()
.get_external_generation_queue_stats_and_return_then(move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_external_generation_queue_stats_result);
send_once(&sender, mapped);
});
},
)
.await
}
}

View File

@@ -113,6 +113,55 @@ impl SpacetimeClient {
action_type: payload.action_type,
session,
work,
queue_state: None,
})
}
pub async fn mark_jump_hop_generation_queued(
&self,
session_id: String,
owner_user_id: String,
payload: JumpHopActionRequest,
) -> Result<JumpHopActionResponse, SpacetimeClientError> {
let current = self
.get_jump_hop_session(session_id.clone(), owner_user_id.clone())
.await?;
let action_type = payload.action_type.clone();
let scope = match action_type {
JumpHopActionType::CompileDraft => JumpHopDraftMergeScope::CompileDraft,
JumpHopActionType::RegenerateTiles => JumpHopDraftMergeScope::RegenerateTiles,
_ => {
return Err(SpacetimeClientError::validation_failed(
"jump-hop queued generation 只支持 compile-draft/regenerate-tiles",
));
}
};
let mut base_draft = current.draft.clone();
if matches!(action_type, JumpHopActionType::RegenerateTiles)
&& let Some(draft) = base_draft.as_mut()
{
draft.tile_atlas_asset = None;
draft.tile_assets.clear();
}
let mut draft = merge_action_into_draft(base_draft, &payload, scope)?;
let profile_id = resolve_jump_hop_profile_id(&draft, &action_type)?;
draft.profile_id = Some(profile_id.clone());
draft.generation_status = JumpHopGenerationStatus::Generating;
let session = self
.compile_jump_hop_draft(build_generating_compile_input(
&current,
&owner_user_id,
&profile_id,
&draft,
current_unix_micros(),
)?)
.await?;
Ok(JumpHopActionResponse {
action_type,
session,
work: None,
queue_state: None,
})
}
@@ -233,15 +282,14 @@ impl SpacetimeClient {
};
self.call_after_connect("delete_jump_hop_work", move |connection, sender| {
connection.procedures().delete_jump_hop_work_then(
procedure_input,
move |_, result| {
connection
.procedures()
.delete_jump_hop_work_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_jump_hop_works_procedure_result);
send_once(&sender, mapped);
},
);
});
})
.await
}
@@ -805,6 +853,50 @@ fn build_compile_input(
})
}
fn build_generating_compile_input(
current: &JumpHopSessionSnapshotResponse,
owner_user_id: &str,
profile_id: &str,
draft: &JumpHopDraftResponse,
now_micros: i64,
) -> Result<JumpHopDraftCompileInput, SpacetimeClientError> {
Ok(JumpHopDraftCompileInput {
session_id: current.session_id.clone(),
owner_user_id: owner_user_id.to_string(),
profile_id: profile_id.to_string(),
author_display_name: "跳一跳玩家".to_string(),
seed_text: draft.work_title.clone(),
work_title: draft.work_title.clone(),
work_description: draft.work_description.clone(),
theme_tags_json: Some(json_string(&draft.theme_tags)?),
theme_text: Some(draft.theme_text.clone()),
difficulty: Some(difficulty_to_str(&draft.difficulty).to_string()),
style_preset: Some(style_to_str(&draft.style_preset).to_string()),
character_prompt: Some(draft.character_prompt.clone()),
tile_prompt: Some(draft.tile_prompt.clone()),
end_mood_prompt: draft.end_mood_prompt.clone(),
character_asset_json: draft
.character_asset
.as_ref()
.map(json_string)
.transpose()?,
tile_atlas_asset_json: draft
.tile_atlas_asset
.as_ref()
.map(json_string)
.transpose()?,
tile_assets_json: Some(json_string(&draft.tile_assets)?),
cover_composite: draft.cover_composite.clone(),
back_button_asset_json: draft
.back_button_asset
.as_ref()
.map(json_string)
.transpose()?,
generation_status: Some("generating".to_string()),
compiled_at_micros: now_micros,
})
}
fn build_update_input(
owner_user_id: &str,
profile_id: &str,

View File

@@ -32,13 +32,18 @@ pub use mapper::{
CustomWorldResultPreviewBlockerRecord, CustomWorldSupportedActionRecord,
CustomWorldWorkSummaryRecord, EditorCanvasViewportRecord, EditorProjectCreateRecordInput,
EditorProjectGetRecordInput, EditorProjectLayoutSaveRecordInput, EditorProjectRecord,
EditorProjectResourceCreateRecordInput, EditorProjectResourceRecord, JumpHopActionRequest,
JumpHopActionResponse, JumpHopActionType, JumpHopCharacterAsset, JumpHopDifficulty,
JumpHopDraftResponse, JumpHopGalleryCardResponse,
JumpHopGalleryDetailResponse, JumpHopGalleryResponse, JumpHopGenerationStatus,
JumpHopJumpRequest, JumpHopJumpResponse, JumpHopJumpResult, JumpHopLastJump, JumpHopPath,
JumpHopPlatform, JumpHopRestartRunRequest, JumpHopRunResponse, JumpHopRunStatus,
JumpHopRuntimeRunSnapshotResponse, JumpHopScoring, JumpHopSessionResponse,
EditorProjectResourceCreateRecordInput, EditorProjectResourceRecord,
ExternalGenerationJobClaimRecordInput,
ExternalGenerationJobCompleteRecordInput, ExternalGenerationJobEnqueueRecordInput,
ExternalGenerationJobFailRecordInput, ExternalGenerationJobGetRecordInput,
ExternalGenerationJobRecord, ExternalGenerationJobRenewLeaseRecordInput,
ExternalGenerationQueueStatsRecord, JumpHopActionRequest, JumpHopActionResponse,
JumpHopActionType, JumpHopCharacterAsset, JumpHopDifficulty, JumpHopDraftResponse,
JumpHopGalleryCardResponse, JumpHopGalleryDetailResponse, JumpHopGalleryResponse,
JumpHopGenerationStatus, JumpHopJumpRequest, JumpHopJumpResponse, JumpHopJumpResult,
JumpHopLastJump, JumpHopPath, JumpHopPlatform, JumpHopRestartRunRequest, JumpHopRunResponse,
JumpHopRunStatus, JumpHopRuntimeRunSnapshotResponse, JumpHopScoring, JumpHopSessionResponse,
JumpHopSessionSnapshotResponse, JumpHopStartRunRequest, JumpHopStylePreset, JumpHopTileAsset,
JumpHopTileType, JumpHopWorkDetailResponse, JumpHopWorkMutationResponse,
JumpHopWorkProfileResponse, JumpHopWorkSummaryResponse, JumpHopWorksResponse,
@@ -68,12 +73,13 @@ pub use mapper::{
PuzzleDraftCompileFailureRecordInput, PuzzleDraftLevelRecord, PuzzleFormDraftRecord,
PuzzleFormDraftSaveRecordInput, PuzzleGalleryCardRecord, PuzzleGeneratedImageCandidateRecord,
PuzzleGeneratedImagesSaveRecordInput, PuzzleLeaderboardEntryRecord,
PuzzleLeaderboardSubmitRecordInput, PuzzleMergedGroupRecord, PuzzlePieceStateRecord,
PuzzlePublishRecordInput, PuzzleRecommendedNextWorkRecord, PuzzleResultDraftRecord,
PuzzleResultPreviewBlockerRecord, PuzzleResultPreviewFindingRecord, PuzzleResultPreviewRecord,
PuzzleRunDragRecordInput, PuzzleRunNextLevelRecordInput, PuzzleRunPauseRecordInput,
PuzzleRunPropRecordInput, PuzzleRunRecord, PuzzleRunStartRecordInput, PuzzleRunSwapRecordInput,
PuzzleRuntimeLevelRecord, PuzzleSelectCoverImageRecordInput, PuzzleUiBackgroundSaveRecordInput,
PuzzleLeaderboardSubmitRecordInput, PuzzleLevelGenerationFailureRecordInput,
PuzzleMergedGroupRecord, PuzzlePieceStateRecord, PuzzlePublishRecordInput,
PuzzleRecommendedNextWorkRecord, PuzzleResultDraftRecord, PuzzleResultPreviewBlockerRecord,
PuzzleResultPreviewFindingRecord, PuzzleResultPreviewRecord, PuzzleRunDragRecordInput,
PuzzleRunNextLevelRecordInput, PuzzleRunPauseRecordInput, PuzzleRunPropRecordInput,
PuzzleRunRecord, PuzzleRunStartRecordInput, PuzzleRunSwapRecordInput, PuzzleRuntimeLevelRecord,
PuzzleSelectCoverImageRecordInput, PuzzleUiBackgroundSaveRecordInput,
PuzzleWorkLikeReportRecordInput, PuzzleWorkPointIncentiveClaimRecordInput,
PuzzleWorkProfileRecord, PuzzleWorkRemixRecordInput, PuzzleWorkUpsertRecordInput,
ResolveCombatActionRecord, ResolveNpcBattleInteractionInput,
@@ -116,6 +122,8 @@ pub mod big_fish;
pub mod combat;
pub mod custom_world;
pub mod editor_project;
pub mod external_generation;
pub mod inventory;
pub mod jump_hop;
pub mod match3d;

View File

@@ -9,6 +9,8 @@ mod combat;
mod common;
mod custom_world;
mod editor_project;
mod external_generation;
mod inventory;
mod jump_hop;
mod match3d;
@@ -74,6 +76,12 @@ pub use self::common::{
VisualNovelRunSnapshotRecordInput, VisualNovelRunStartRecordInput,
VisualNovelWorkCompileRecordInput,
};
pub use self::external_generation::{
ExternalGenerationJobClaimRecordInput, ExternalGenerationJobCompleteRecordInput,
ExternalGenerationJobEnqueueRecordInput, ExternalGenerationJobFailRecordInput,
ExternalGenerationJobGetRecordInput, ExternalGenerationJobRecord,
ExternalGenerationJobRenewLeaseRecordInput, ExternalGenerationQueueStatsRecord,
};
pub use self::jump_hop::{
JumpHopActionRequest, JumpHopActionResponse, JumpHopActionType, JumpHopCharacterAsset,
JumpHopDifficulty, JumpHopDraftResponse, JumpHopGalleryCardResponse,
@@ -112,13 +120,13 @@ pub use self::puzzle::{
PuzzleCreatorIntentRecord, PuzzleDraftCompileFailureRecordInput, PuzzleDraftLevelRecord,
PuzzleFormDraftRecord, PuzzleFormDraftSaveRecordInput, PuzzleGalleryCardRecord,
PuzzleGeneratedImageCandidateRecord, PuzzleGeneratedImagesSaveRecordInput,
PuzzleLeaderboardEntryRecord, PuzzleLeaderboardSubmitRecordInput, PuzzleMergedGroupRecord,
PuzzlePieceStateRecord, PuzzlePublishRecordInput, PuzzleRecommendedNextWorkRecord,
PuzzleResultDraftRecord, PuzzleResultPreviewBlockerRecord, PuzzleResultPreviewFindingRecord,
PuzzleResultPreviewRecord, PuzzleRunDragRecordInput, PuzzleRunNextLevelRecordInput,
PuzzleRunPauseRecordInput, PuzzleRunPropRecordInput, PuzzleRunRecord,
PuzzleRunStartRecordInput, PuzzleRunSwapRecordInput, PuzzleRuntimeLevelRecord,
PuzzleSelectCoverImageRecordInput, PuzzleUiBackgroundSaveRecordInput,
PuzzleLeaderboardEntryRecord, PuzzleLeaderboardSubmitRecordInput,
PuzzleLevelGenerationFailureRecordInput, PuzzleMergedGroupRecord, PuzzlePieceStateRecord,
PuzzlePublishRecordInput, PuzzleRecommendedNextWorkRecord, PuzzleResultDraftRecord,
PuzzleResultPreviewBlockerRecord, PuzzleResultPreviewFindingRecord, PuzzleResultPreviewRecord,
PuzzleRunDragRecordInput, PuzzleRunNextLevelRecordInput, PuzzleRunPauseRecordInput,
PuzzleRunPropRecordInput, PuzzleRunRecord, PuzzleRunStartRecordInput, PuzzleRunSwapRecordInput,
PuzzleRuntimeLevelRecord, PuzzleSelectCoverImageRecordInput, PuzzleUiBackgroundSaveRecordInput,
PuzzleWorkLikeReportRecordInput, PuzzleWorkPointIncentiveClaimRecordInput,
PuzzleWorkProfileRecord, PuzzleWorkRemixRecordInput, PuzzleWorkUpsertRecordInput,
};
@@ -188,6 +196,10 @@ pub(crate) use self::editor_project::{
map_editor_project_optional_procedure_result, map_editor_project_required_procedure_result,
map_editor_project_resource_procedure_result,
};
pub(crate) use self::external_generation::{
map_external_generation_job_claim_result, map_external_generation_job_procedure_result,
map_external_generation_queue_stats_result,
};
pub(crate) use self::inventory::{
map_runtime_inventory_state_procedure_result, map_runtime_item_reward_item_snapshot,
map_runtime_item_reward_item_snapshot_back,

View File

@@ -0,0 +1,255 @@
use super::*;
impl From<ExternalGenerationJobEnqueueRecordInput> for ExternalGenerationJobEnqueueInput {
fn from(input: ExternalGenerationJobEnqueueRecordInput) -> Self {
Self {
job_id: input.job_id,
dedupe_key: input.dedupe_key,
job_kind: input.job_kind,
owner_user_id: input.owner_user_id,
source_module: input.source_module,
source_entity_id: input.source_entity_id,
request_label: input.request_label,
request_payload_json: input.request_payload_json,
max_attempts: input.max_attempts,
available_at_micros: input.available_at_micros,
created_at_micros: input.created_at_micros,
}
}
}
impl From<ExternalGenerationJobClaimRecordInput> for ExternalGenerationJobClaimInput {
fn from(input: ExternalGenerationJobClaimRecordInput) -> Self {
Self {
worker_id: input.worker_id,
limit: input.limit,
lease_expires_at_micros: input.lease_expires_at_micros,
claimed_at_micros: input.claimed_at_micros,
}
}
}
impl From<ExternalGenerationJobCompleteRecordInput> for ExternalGenerationJobCompleteInput {
fn from(input: ExternalGenerationJobCompleteRecordInput) -> Self {
Self {
job_id: input.job_id,
worker_id: input.worker_id,
lease_token: input.lease_token,
result_payload_json: input.result_payload_json,
completed_at_micros: input.completed_at_micros,
}
}
}
impl From<ExternalGenerationJobRenewLeaseRecordInput> for ExternalGenerationJobRenewLeaseInput {
fn from(input: ExternalGenerationJobRenewLeaseRecordInput) -> Self {
Self {
job_id: input.job_id,
worker_id: input.worker_id,
lease_token: input.lease_token,
lease_expires_at_micros: input.lease_expires_at_micros,
renewed_at_micros: input.renewed_at_micros,
}
}
}
impl From<ExternalGenerationJobFailRecordInput> for ExternalGenerationJobFailInput {
fn from(input: ExternalGenerationJobFailRecordInput) -> Self {
Self {
job_id: input.job_id,
worker_id: input.worker_id,
lease_token: input.lease_token,
error_message: input.error_message,
retry_after_micros: input.retry_after_micros,
failed_at_micros: input.failed_at_micros,
}
}
}
impl From<ExternalGenerationJobGetRecordInput> for ExternalGenerationJobGetInput {
fn from(input: ExternalGenerationJobGetRecordInput) -> Self {
Self {
job_id: input.job_id,
owner_user_id: input.owner_user_id,
}
}
}
pub(crate) fn map_external_generation_job_procedure_result(
result: ExternalGenerationJobProcedureResult,
) -> Result<ExternalGenerationJobRecord, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
let job = result
.job
.ok_or_else(|| SpacetimeClientError::missing_snapshot("external_generation_job 快照"))?;
Ok(map_external_generation_job_snapshot(job))
}
pub(crate) fn map_external_generation_job_claim_result(
result: ExternalGenerationJobProcedureResult,
) -> Result<Vec<ExternalGenerationJobRecord>, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
Ok(result
.jobs
.into_iter()
.map(map_external_generation_job_snapshot)
.collect())
}
pub(crate) fn map_external_generation_queue_stats_result(
result: ExternalGenerationQueueStatsProcedureResult,
) -> Result<ExternalGenerationQueueStatsRecord, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
let stats = result.stats.ok_or_else(|| {
SpacetimeClientError::missing_snapshot("external_generation queue stats 快照")
})?;
Ok(ExternalGenerationQueueStatsRecord {
pending_count: stats.pending_count,
delayed_pending_count: stats.delayed_pending_count,
claimable_pending_count: stats.claimable_pending_count,
running_active_count: stats.running_active_count,
expired_running_count: stats.expired_running_count,
terminal_count: stats.terminal_count,
claimable_count: stats.claimable_count,
oldest_claimable_age_micros: stats.oldest_claimable_age_micros,
now_micros: stats.now_micros,
})
}
fn map_external_generation_job_snapshot(
snapshot: ExternalGenerationJobSnapshot,
) -> ExternalGenerationJobRecord {
ExternalGenerationJobRecord {
job_id: snapshot.job_id,
dedupe_key: snapshot.dedupe_key,
job_kind: snapshot.job_kind,
owner_user_id: snapshot.owner_user_id,
source_module: snapshot.source_module,
source_entity_id: snapshot.source_entity_id,
request_label: snapshot.request_label,
request_payload_json: snapshot.request_payload_json,
status: snapshot.status,
attempt: snapshot.attempt,
max_attempts: snapshot.max_attempts,
last_error_message: snapshot.last_error_message,
worker_id: snapshot.worker_id,
lease_expires_at: snapshot
.lease_expires_at_micros
.map(format_timestamp_micros),
available_at: format_timestamp_micros(snapshot.available_at_micros),
result_payload_json: snapshot.result_payload_json,
created_at: format_timestamp_micros(snapshot.created_at_micros),
started_at: snapshot.started_at_micros.map(format_timestamp_micros),
completed_at: snapshot.completed_at_micros.map(format_timestamp_micros),
updated_at: format_timestamp_micros(snapshot.updated_at_micros),
updated_at_micros: snapshot.updated_at_micros,
lease_token: snapshot.lease_token,
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ExternalGenerationJobEnqueueRecordInput {
pub job_id: String,
pub dedupe_key: String,
pub job_kind: String,
pub owner_user_id: String,
pub source_module: String,
pub source_entity_id: String,
pub request_label: String,
pub request_payload_json: String,
pub max_attempts: u32,
pub available_at_micros: i64,
pub created_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ExternalGenerationJobClaimRecordInput {
pub worker_id: String,
pub limit: u32,
pub lease_expires_at_micros: i64,
pub claimed_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ExternalGenerationJobCompleteRecordInput {
pub job_id: String,
pub worker_id: String,
pub lease_token: String,
pub result_payload_json: Option<String>,
pub completed_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ExternalGenerationJobRenewLeaseRecordInput {
pub job_id: String,
pub worker_id: String,
pub lease_token: String,
pub lease_expires_at_micros: i64,
pub renewed_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ExternalGenerationJobFailRecordInput {
pub job_id: String,
pub worker_id: String,
pub lease_token: String,
pub error_message: String,
pub retry_after_micros: i64,
pub failed_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ExternalGenerationJobGetRecordInput {
pub job_id: String,
pub owner_user_id: String,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ExternalGenerationJobRecord {
pub job_id: String,
pub dedupe_key: String,
pub job_kind: String,
pub owner_user_id: String,
pub source_module: String,
pub source_entity_id: String,
pub request_label: String,
pub request_payload_json: String,
pub status: String,
pub attempt: u32,
pub max_attempts: u32,
pub last_error_message: Option<String>,
pub worker_id: Option<String>,
pub lease_expires_at: Option<String>,
pub available_at: String,
pub result_payload_json: Option<String>,
pub created_at: String,
pub started_at: Option<String>,
pub completed_at: Option<String>,
pub updated_at: String,
pub updated_at_micros: i64,
pub lease_token: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ExternalGenerationQueueStatsRecord {
pub pending_count: u32,
pub delayed_pending_count: u32,
pub claimable_pending_count: u32,
pub running_active_count: u32,
pub expired_running_count: u32,
pub terminal_count: u32,
pub claimable_count: u32,
pub oldest_claimable_age_micros: Option<i64>,
pub now_micros: i64,
}

View File

@@ -669,6 +669,22 @@ pub struct PuzzleDraftCompileFailureRecordInput {
pub owner_user_id: String,
pub error_message: String,
pub failed_at_micros: i64,
pub external_generation_job_id: Option<String>,
pub external_generation_worker_id: Option<String>,
pub external_generation_lease_token: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PuzzleLevelGenerationFailureRecordInput {
pub session_id: String,
pub owner_user_id: String,
pub level_id: Option<String>,
pub levels_json: Option<String>,
pub error_message: String,
pub failed_at_micros: i64,
pub external_generation_job_id: Option<String>,
pub external_generation_worker_id: Option<String>,
pub external_generation_lease_token: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -679,6 +695,9 @@ pub struct PuzzleGeneratedImagesSaveRecordInput {
pub levels_json: Option<String>,
pub candidates_json: String,
pub saved_at_micros: i64,
pub external_generation_job_id: Option<String>,
pub external_generation_worker_id: Option<String>,
pub external_generation_lease_token: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -691,6 +710,9 @@ pub struct PuzzleUiBackgroundSaveRecordInput {
pub image_src: String,
pub image_object_key: Option<String>,
pub saved_at_micros: i64,
pub external_generation_job_id: Option<String>,
pub external_generation_worker_id: Option<String>,
pub external_generation_lease_token: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Eq)]

View File

@@ -1,7 +1,7 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
// This was generated using spacetimedb cli version 2.4.1 (commit 07b52763c9da8d7cf79780db222fec1ffcb84070).
// This was generated using spacetimedb cli version 2.5.0 (commit ca16958ef0a5f8c816700d2255a0b20ecacff901).
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
@@ -203,6 +203,7 @@ pub mod chapter_progression_snapshot_type;
pub mod chapter_progression_table;
pub mod chapter_progression_type;
pub mod checkpoint_wooden_fish_run_procedure;
pub mod claim_external_generation_jobs_and_return_procedure;
pub mod claim_profile_task_reward_and_return_procedure;
pub mod claim_puzzle_background_compile_task_procedure;
pub mod claim_puzzle_work_point_incentive_procedure;
@@ -221,6 +222,7 @@ pub mod compile_visual_novel_work_profile_procedure;
pub mod compile_wooden_fish_draft_procedure;
pub mod complete_ai_stage_and_return_procedure;
pub mod complete_ai_task_and_return_procedure;
pub mod complete_external_generation_job_and_return_procedure;
pub mod confirm_asset_object_and_return_procedure;
pub mod confirm_asset_object_reducer;
pub mod consume_inventory_item_input_type;
@@ -359,12 +361,27 @@ pub mod editor_project_snapshot_type;
pub mod editor_project_table;
pub mod editor_project_type;
pub mod editor_project_viewport_snapshot_type;
pub mod enqueue_external_generation_job_and_return_procedure;
pub mod ensure_analytics_date_dimension_for_date_reducer;
pub mod equip_inventory_item_input_type;
pub mod execute_custom_world_agent_action_procedure;
pub mod export_auth_store_snapshot_from_tables_procedure;
pub mod export_database_migration_to_file_procedure;
pub mod external_generation_job_claim_input_type;
pub mod external_generation_job_complete_input_type;
pub mod external_generation_job_enqueue_input_type;
pub mod external_generation_job_fail_input_type;
pub mod external_generation_job_get_input_type;
pub mod external_generation_job_procedure_result_type;
pub mod external_generation_job_renew_lease_input_type;
pub mod external_generation_job_snapshot_type;
pub mod external_generation_job_table;
pub mod external_generation_job_type;
pub mod external_generation_queue_stats_procedure_result_type;
pub mod external_generation_queue_stats_snapshot_type;
pub mod fail_ai_task_and_return_procedure;
pub mod fail_external_generation_job_and_return_procedure;
pub mod finalize_big_fish_agent_message_turn_procedure;
pub mod finalize_custom_world_agent_message_turn_procedure;
pub mod finalize_match_3_d_agent_message_turn_procedure;
@@ -390,6 +407,9 @@ pub mod get_custom_world_gallery_detail_by_code_procedure;
pub mod get_custom_world_gallery_detail_procedure;
pub mod get_custom_world_library_detail_procedure;
pub mod get_editor_project_and_return_procedure;
pub mod get_external_generation_job_and_return_procedure;
pub mod get_external_generation_queue_stats_and_return_procedure;
pub mod get_jump_hop_agent_session_procedure;
pub mod get_jump_hop_leaderboard_procedure;
pub mod get_jump_hop_run_procedure;
@@ -515,6 +535,7 @@ pub mod list_wooden_fish_works_procedure;
pub mod mark_profile_recharge_order_paid_and_return_procedure;
pub mod mark_puzzle_clear_level_time_up_procedure;
pub mod mark_puzzle_draft_generation_failed_procedure;
pub mod mark_puzzle_level_generation_failed_procedure;
pub mod match_3_d_agent_message_finalize_input_type;
pub mod match_3_d_agent_message_row_type;
pub mod match_3_d_agent_message_snapshot_type;
@@ -710,6 +731,7 @@ pub mod puzzle_leaderboard_entry_row_type;
pub mod puzzle_leaderboard_entry_table;
pub mod puzzle_leaderboard_entry_type;
pub mod puzzle_leaderboard_submit_input_type;
pub mod puzzle_level_generation_failure_input_type;
pub mod puzzle_merged_group_state_type;
pub mod puzzle_piece_state_type;
pub mod puzzle_publication_status_type;
@@ -794,6 +816,7 @@ pub mod release_puzzle_background_compile_task_procedure;
pub mod remix_big_fish_work_procedure;
pub mod remix_custom_world_profile_procedure;
pub mod remix_puzzle_work_procedure;
pub mod renew_external_generation_job_lease_and_return_procedure;
pub mod resolve_combat_action_and_return_procedure;
pub mod resolve_combat_action_input_type;
pub mod resolve_combat_action_procedure_result_type;
@@ -1337,6 +1360,7 @@ pub use chapter_progression_snapshot_type::ChapterProgressionSnapshot;
pub use chapter_progression_table::*;
pub use chapter_progression_type::ChapterProgression;
pub use checkpoint_wooden_fish_run_procedure::checkpoint_wooden_fish_run;
pub use claim_external_generation_jobs_and_return_procedure::claim_external_generation_jobs_and_return;
pub use claim_profile_task_reward_and_return_procedure::claim_profile_task_reward_and_return;
pub use claim_puzzle_background_compile_task_procedure::claim_puzzle_background_compile_task;
pub use claim_puzzle_work_point_incentive_procedure::claim_puzzle_work_point_incentive;
@@ -1355,6 +1379,7 @@ pub use compile_visual_novel_work_profile_procedure::compile_visual_novel_work_p
pub use compile_wooden_fish_draft_procedure::compile_wooden_fish_draft;
pub use complete_ai_stage_and_return_procedure::complete_ai_stage_and_return;
pub use complete_ai_task_and_return_procedure::complete_ai_task_and_return;
pub use complete_external_generation_job_and_return_procedure::complete_external_generation_job_and_return;
pub use confirm_asset_object_and_return_procedure::confirm_asset_object_and_return;
pub use confirm_asset_object_reducer::confirm_asset_object;
pub use consume_inventory_item_input_type::ConsumeInventoryItemInput;
@@ -1493,12 +1518,27 @@ pub use editor_project_snapshot_type::EditorProjectSnapshot;
pub use editor_project_table::*;
pub use editor_project_type::EditorProject;
pub use editor_project_viewport_snapshot_type::EditorProjectViewportSnapshot;
pub use enqueue_external_generation_job_and_return_procedure::enqueue_external_generation_job_and_return;
pub use ensure_analytics_date_dimension_for_date_reducer::ensure_analytics_date_dimension_for_date;
pub use equip_inventory_item_input_type::EquipInventoryItemInput;
pub use execute_custom_world_agent_action_procedure::execute_custom_world_agent_action;
pub use export_auth_store_snapshot_from_tables_procedure::export_auth_store_snapshot_from_tables;
pub use export_database_migration_to_file_procedure::export_database_migration_to_file;
pub use external_generation_job_claim_input_type::ExternalGenerationJobClaimInput;
pub use external_generation_job_complete_input_type::ExternalGenerationJobCompleteInput;
pub use external_generation_job_enqueue_input_type::ExternalGenerationJobEnqueueInput;
pub use external_generation_job_fail_input_type::ExternalGenerationJobFailInput;
pub use external_generation_job_get_input_type::ExternalGenerationJobGetInput;
pub use external_generation_job_procedure_result_type::ExternalGenerationJobProcedureResult;
pub use external_generation_job_renew_lease_input_type::ExternalGenerationJobRenewLeaseInput;
pub use external_generation_job_snapshot_type::ExternalGenerationJobSnapshot;
pub use external_generation_job_table::*;
pub use external_generation_job_type::ExternalGenerationJob;
pub use external_generation_queue_stats_procedure_result_type::ExternalGenerationQueueStatsProcedureResult;
pub use external_generation_queue_stats_snapshot_type::ExternalGenerationQueueStatsSnapshot;
pub use fail_ai_task_and_return_procedure::fail_ai_task_and_return;
pub use fail_external_generation_job_and_return_procedure::fail_external_generation_job_and_return;
pub use finalize_big_fish_agent_message_turn_procedure::finalize_big_fish_agent_message_turn;
pub use finalize_custom_world_agent_message_turn_procedure::finalize_custom_world_agent_message_turn;
pub use finalize_match_3_d_agent_message_turn_procedure::finalize_match_3_d_agent_message_turn;
@@ -1524,6 +1564,9 @@ pub use get_custom_world_gallery_detail_by_code_procedure::get_custom_world_gall
pub use get_custom_world_gallery_detail_procedure::get_custom_world_gallery_detail;
pub use get_custom_world_library_detail_procedure::get_custom_world_library_detail;
pub use get_editor_project_and_return_procedure::get_editor_project_and_return;
pub use get_external_generation_job_and_return_procedure::get_external_generation_job_and_return;
pub use get_external_generation_queue_stats_and_return_procedure::get_external_generation_queue_stats_and_return;
pub use get_jump_hop_agent_session_procedure::get_jump_hop_agent_session;
pub use get_jump_hop_leaderboard_procedure::get_jump_hop_leaderboard;
pub use get_jump_hop_run_procedure::get_jump_hop_run;
@@ -1649,6 +1692,7 @@ pub use list_wooden_fish_works_procedure::list_wooden_fish_works;
pub use mark_profile_recharge_order_paid_and_return_procedure::mark_profile_recharge_order_paid_and_return;
pub use mark_puzzle_clear_level_time_up_procedure::mark_puzzle_clear_level_time_up;
pub use mark_puzzle_draft_generation_failed_procedure::mark_puzzle_draft_generation_failed;
pub use mark_puzzle_level_generation_failed_procedure::mark_puzzle_level_generation_failed;
pub use match_3_d_agent_message_finalize_input_type::Match3DAgentMessageFinalizeInput;
pub use match_3_d_agent_message_row_type::Match3DAgentMessageRow;
pub use match_3_d_agent_message_snapshot_type::Match3DAgentMessageSnapshot;
@@ -1844,6 +1888,7 @@ pub use puzzle_leaderboard_entry_row_type::PuzzleLeaderboardEntryRow;
pub use puzzle_leaderboard_entry_table::*;
pub use puzzle_leaderboard_entry_type::PuzzleLeaderboardEntry;
pub use puzzle_leaderboard_submit_input_type::PuzzleLeaderboardSubmitInput;
pub use puzzle_level_generation_failure_input_type::PuzzleLevelGenerationFailureInput;
pub use puzzle_merged_group_state_type::PuzzleMergedGroupState;
pub use puzzle_piece_state_type::PuzzlePieceState;
pub use puzzle_publication_status_type::PuzzlePublicationStatus;
@@ -1928,6 +1973,7 @@ pub use release_puzzle_background_compile_task_procedure::release_puzzle_backgro
pub use remix_big_fish_work_procedure::remix_big_fish_work;
pub use remix_custom_world_profile_procedure::remix_custom_world_profile;
pub use remix_puzzle_work_procedure::remix_puzzle_work;
pub use renew_external_generation_job_lease_and_return_procedure::renew_external_generation_job_lease_and_return;
pub use resolve_combat_action_and_return_procedure::resolve_combat_action_and_return;
pub use resolve_combat_action_input_type::ResolveCombatActionInput;
pub use resolve_combat_action_procedure_result_type::ResolveCombatActionProcedureResult;
@@ -2587,6 +2633,8 @@ pub struct DbUpdate {
database_migration_operator: __sdk::TableUpdate<DatabaseMigrationOperator>,
editor_project: __sdk::TableUpdate<EditorProject>,
editor_project_resource: __sdk::TableUpdate<EditorProjectResource>,
external_generation_job: __sdk::TableUpdate<ExternalGenerationJob>,
inventory_slot: __sdk::TableUpdate<InventorySlot>,
jump_hop_agent_session: __sdk::TableUpdate<JumpHopAgentSessionRow>,
jump_hop_event: __sdk::TableUpdate<JumpHopEventRow>,
@@ -2805,6 +2853,9 @@ impl TryFrom<__ws::v2::TransactionUpdate> for DbUpdate {
"editor_project_resource" => db_update.editor_project_resource.append(
editor_project_resource_table::parse_table_update(table_update)?,
),
"external_generation_job" => db_update.external_generation_job.append(
external_generation_job_table::parse_table_update(table_update)?,
),
"inventory_slot" => db_update
.inventory_slot
.append(inventory_slot_table::parse_table_update(table_update)?),
@@ -3274,6 +3325,13 @@ impl __sdk::DbUpdate for DbUpdate {
&self.editor_project_resource,
)
.with_updates_by_pk(|row| &row.resource_id);
diff.external_generation_job = cache
.apply_diff_to_table::<ExternalGenerationJob>(
"external_generation_job",
&self.external_generation_job,
)
.with_updates_by_pk(|row| &row.job_id);
diff.inventory_slot = cache
.apply_diff_to_table::<InventorySlot>("inventory_slot", &self.inventory_slot)
.with_updates_by_pk(|row| &row.slot_id);
@@ -3807,6 +3865,9 @@ impl __sdk::DbUpdate for DbUpdate {
"editor_project_resource" => db_update
.editor_project_resource
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
"external_generation_job" => db_update
.external_generation_job
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
"inventory_slot" => db_update
.inventory_slot
.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?),
@@ -4180,6 +4241,9 @@ impl __sdk::DbUpdate for DbUpdate {
"editor_project_resource" => db_update
.editor_project_resource
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
"external_generation_job" => db_update
.external_generation_job
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
"inventory_slot" => db_update
.inventory_slot
.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?),
@@ -4475,6 +4539,8 @@ pub struct AppliedDiff<'r> {
database_migration_operator: __sdk::TableAppliedDiff<'r, DatabaseMigrationOperator>,
editor_project: __sdk::TableAppliedDiff<'r, EditorProject>,
editor_project_resource: __sdk::TableAppliedDiff<'r, EditorProjectResource>,
external_generation_job: __sdk::TableAppliedDiff<'r, ExternalGenerationJob>,
inventory_slot: __sdk::TableAppliedDiff<'r, InventorySlot>,
jump_hop_agent_session: __sdk::TableAppliedDiff<'r, JumpHopAgentSessionRow>,
jump_hop_event: __sdk::TableAppliedDiff<'r, JumpHopEventRow>,
@@ -4765,6 +4831,11 @@ impl<'r> __sdk::AppliedDiff<'r> for AppliedDiff<'r> {
&self.editor_project_resource,
event,
);
callbacks.invoke_table_row_callbacks::<ExternalGenerationJob>(
"external_generation_job",
&self.external_generation_job,
event,
);
callbacks.invoke_table_row_callbacks::<InventorySlot>(
"inventory_slot",
&self.inventory_slot,
@@ -5849,6 +5920,8 @@ impl __sdk::SpacetimeModule for RemoteModule {
database_migration_operator_table::register_table(client_cache);
editor_project_table::register_table(client_cache);
editor_project_resource_table::register_table(client_cache);
external_generation_job_table::register_table(client_cache);
inventory_slot_table::register_table(client_cache);
jump_hop_agent_session_table::register_table(client_cache);
jump_hop_event_table::register_table(client_cache);
@@ -5971,6 +6044,8 @@ impl __sdk::SpacetimeModule for RemoteModule {
"database_migration_operator",
"editor_project",
"editor_project_resource",
"external_generation_job",
"inventory_slot",
"jump_hop_agent_session",
"jump_hop_event",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,20 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::external_generation_job_snapshot_type::ExternalGenerationJobSnapshot;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct ExternalGenerationJobProcedureResult {
pub ok: bool,
pub job: Option<ExternalGenerationJobSnapshot>,
pub jobs: Vec<ExternalGenerationJobSnapshot>,
pub error_message: Option<String>,
}
impl __sdk::InModule for ExternalGenerationJobProcedureResult {
type Module = super::RemoteModule;
}

View File

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

View File

@@ -0,0 +1,35 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct ExternalGenerationJobSnapshot {
pub job_id: String,
pub dedupe_key: String,
pub job_kind: String,
pub owner_user_id: String,
pub source_module: String,
pub source_entity_id: String,
pub request_label: String,
pub request_payload_json: String,
pub status: String,
pub attempt: u32,
pub max_attempts: u32,
pub last_error_message: Option<String>,
pub worker_id: Option<String>,
pub lease_expires_at_micros: Option<i64>,
pub available_at_micros: i64,
pub result_payload_json: Option<String>,
pub created_at_micros: i64,
pub started_at_micros: Option<i64>,
pub completed_at_micros: Option<i64>,
pub updated_at_micros: i64,
pub lease_token: Option<String>,
}
impl __sdk::InModule for ExternalGenerationJobSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -0,0 +1,192 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use super::external_generation_job_type::ExternalGenerationJob;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `external_generation_job`.
///
/// Obtain a handle from the [`ExternalGenerationJobTableAccess::external_generation_job`] method on [`super::RemoteTables`],
/// like `ctx.db.external_generation_job()`.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.external_generation_job().on_insert(...)`.
pub struct ExternalGenerationJobTableHandle<'ctx> {
imp: __sdk::TableHandle<ExternalGenerationJob>,
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the table `external_generation_job`.
///
/// Implemented for [`super::RemoteTables`].
pub trait ExternalGenerationJobTableAccess {
#[allow(non_snake_case)]
/// Obtain a [`ExternalGenerationJobTableHandle`], which mediates access to the table `external_generation_job`.
fn external_generation_job(&self) -> ExternalGenerationJobTableHandle<'_>;
}
impl ExternalGenerationJobTableAccess for super::RemoteTables {
fn external_generation_job(&self) -> ExternalGenerationJobTableHandle<'_> {
ExternalGenerationJobTableHandle {
imp: self
.imp
.get_table::<ExternalGenerationJob>("external_generation_job"),
ctx: std::marker::PhantomData,
}
}
}
pub struct ExternalGenerationJobInsertCallbackId(__sdk::CallbackId);
pub struct ExternalGenerationJobDeleteCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::Table for ExternalGenerationJobTableHandle<'ctx> {
type Row = ExternalGenerationJob;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = ExternalGenerationJob> + '_ {
self.imp.iter()
}
type InsertCallbackId = ExternalGenerationJobInsertCallbackId;
fn on_insert(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> ExternalGenerationJobInsertCallbackId {
ExternalGenerationJobInsertCallbackId(self.imp.on_insert(Box::new(callback)))
}
fn remove_on_insert(&self, callback: ExternalGenerationJobInsertCallbackId) {
self.imp.remove_on_insert(callback.0)
}
type DeleteCallbackId = ExternalGenerationJobDeleteCallbackId;
fn on_delete(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> ExternalGenerationJobDeleteCallbackId {
ExternalGenerationJobDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
}
fn remove_on_delete(&self, callback: ExternalGenerationJobDeleteCallbackId) {
self.imp.remove_on_delete(callback.0)
}
}
pub struct ExternalGenerationJobUpdateCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::TableWithPrimaryKey for ExternalGenerationJobTableHandle<'ctx> {
type UpdateCallbackId = ExternalGenerationJobUpdateCallbackId;
fn on_update(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
) -> ExternalGenerationJobUpdateCallbackId {
ExternalGenerationJobUpdateCallbackId(self.imp.on_update(Box::new(callback)))
}
fn remove_on_update(&self, callback: ExternalGenerationJobUpdateCallbackId) {
self.imp.remove_on_update(callback.0)
}
}
/// Access to the `job_id` unique index on the table `external_generation_job`,
/// which allows point queries on the field of the same name
/// via the [`ExternalGenerationJobJobIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.external_generation_job().job_id().find(...)`.
pub struct ExternalGenerationJobJobIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<ExternalGenerationJob, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> ExternalGenerationJobTableHandle<'ctx> {
/// Get a handle on the `job_id` unique index on the table `external_generation_job`.
pub fn job_id(&self) -> ExternalGenerationJobJobIdUnique<'ctx> {
ExternalGenerationJobJobIdUnique {
imp: self.imp.get_unique_constraint::<String>("job_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> ExternalGenerationJobJobIdUnique<'ctx> {
/// Find the subscribed row whose `job_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<ExternalGenerationJob> {
self.imp.find(col_val)
}
}
/// Access to the `dedupe_key` unique index on the table `external_generation_job`,
/// which allows point queries on the field of the same name
/// via the [`ExternalGenerationJobDedupeKeyUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.external_generation_job().dedupe_key().find(...)`.
pub struct ExternalGenerationJobDedupeKeyUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<ExternalGenerationJob, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> ExternalGenerationJobTableHandle<'ctx> {
/// Get a handle on the `dedupe_key` unique index on the table `external_generation_job`.
pub fn dedupe_key(&self) -> ExternalGenerationJobDedupeKeyUnique<'ctx> {
ExternalGenerationJobDedupeKeyUnique {
imp: self.imp.get_unique_constraint::<String>("dedupe_key"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> ExternalGenerationJobDedupeKeyUnique<'ctx> {
/// Find the subscribed row whose `dedupe_key` 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<ExternalGenerationJob> {
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::<ExternalGenerationJob>("external_generation_job");
_table.add_unique_constraint::<String>("job_id", |row| &row.job_id);
_table.add_unique_constraint::<String>("dedupe_key", |row| &row.dedupe_key);
}
#[doc(hidden)]
pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<ExternalGenerationJob>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<ExternalGenerationJob>", "TableUpdate")
.with_cause(e)
.into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `ExternalGenerationJob`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait external_generation_jobQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `ExternalGenerationJob`.
fn external_generation_job(&self) -> __sdk::__query_builder::Table<ExternalGenerationJob>;
}
impl external_generation_jobQueryTableAccess for __sdk::QueryTableAccessor {
fn external_generation_job(&self) -> __sdk::__query_builder::Table<ExternalGenerationJob> {
__sdk::__query_builder::Table::new("external_generation_job")
}
}

View File

@@ -0,0 +1,122 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct ExternalGenerationJob {
pub job_id: String,
pub dedupe_key: String,
pub job_kind: String,
pub owner_user_id: String,
pub source_module: String,
pub source_entity_id: String,
pub request_label: String,
pub request_payload_json: String,
pub status: String,
pub attempt: u32,
pub max_attempts: u32,
pub last_error_message: Option<String>,
pub worker_id: Option<String>,
pub lease_expires_at: Option<__sdk::Timestamp>,
pub available_at: __sdk::Timestamp,
pub result_payload_json: Option<String>,
pub created_at: __sdk::Timestamp,
pub started_at: Option<__sdk::Timestamp>,
pub completed_at: Option<__sdk::Timestamp>,
pub updated_at: __sdk::Timestamp,
pub lease_token: Option<String>,
}
impl __sdk::InModule for ExternalGenerationJob {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `ExternalGenerationJob`.
///
/// Provides typed access to columns for query building.
pub struct ExternalGenerationJobCols {
pub job_id: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
pub dedupe_key: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
pub job_kind: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
pub owner_user_id: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
pub source_module: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
pub source_entity_id: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
pub request_label: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
pub request_payload_json: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
pub status: __sdk::__query_builder::Col<ExternalGenerationJob, String>,
pub attempt: __sdk::__query_builder::Col<ExternalGenerationJob, u32>,
pub max_attempts: __sdk::__query_builder::Col<ExternalGenerationJob, u32>,
pub last_error_message: __sdk::__query_builder::Col<ExternalGenerationJob, Option<String>>,
pub worker_id: __sdk::__query_builder::Col<ExternalGenerationJob, Option<String>>,
pub lease_expires_at:
__sdk::__query_builder::Col<ExternalGenerationJob, Option<__sdk::Timestamp>>,
pub available_at: __sdk::__query_builder::Col<ExternalGenerationJob, __sdk::Timestamp>,
pub result_payload_json: __sdk::__query_builder::Col<ExternalGenerationJob, Option<String>>,
pub created_at: __sdk::__query_builder::Col<ExternalGenerationJob, __sdk::Timestamp>,
pub started_at: __sdk::__query_builder::Col<ExternalGenerationJob, Option<__sdk::Timestamp>>,
pub completed_at: __sdk::__query_builder::Col<ExternalGenerationJob, Option<__sdk::Timestamp>>,
pub updated_at: __sdk::__query_builder::Col<ExternalGenerationJob, __sdk::Timestamp>,
pub lease_token: __sdk::__query_builder::Col<ExternalGenerationJob, Option<String>>,
}
impl __sdk::__query_builder::HasCols for ExternalGenerationJob {
type Cols = ExternalGenerationJobCols;
fn cols(table_name: &'static str) -> Self::Cols {
ExternalGenerationJobCols {
job_id: __sdk::__query_builder::Col::new(table_name, "job_id"),
dedupe_key: __sdk::__query_builder::Col::new(table_name, "dedupe_key"),
job_kind: __sdk::__query_builder::Col::new(table_name, "job_kind"),
owner_user_id: __sdk::__query_builder::Col::new(table_name, "owner_user_id"),
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_label: __sdk::__query_builder::Col::new(table_name, "request_label"),
request_payload_json: __sdk::__query_builder::Col::new(
table_name,
"request_payload_json",
),
status: __sdk::__query_builder::Col::new(table_name, "status"),
attempt: __sdk::__query_builder::Col::new(table_name, "attempt"),
max_attempts: __sdk::__query_builder::Col::new(table_name, "max_attempts"),
last_error_message: __sdk::__query_builder::Col::new(table_name, "last_error_message"),
worker_id: __sdk::__query_builder::Col::new(table_name, "worker_id"),
lease_expires_at: __sdk::__query_builder::Col::new(table_name, "lease_expires_at"),
available_at: __sdk::__query_builder::Col::new(table_name, "available_at"),
result_payload_json: __sdk::__query_builder::Col::new(
table_name,
"result_payload_json",
),
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"),
lease_token: __sdk::__query_builder::Col::new(table_name, "lease_token"),
}
}
}
/// Indexed column accessor struct for the table `ExternalGenerationJob`.
///
/// Provides typed access to indexed columns for query building.
pub struct ExternalGenerationJobIxCols {
pub dedupe_key: __sdk::__query_builder::IxCol<ExternalGenerationJob, String>,
pub job_id: __sdk::__query_builder::IxCol<ExternalGenerationJob, String>,
pub owner_user_id: __sdk::__query_builder::IxCol<ExternalGenerationJob, String>,
pub worker_id: __sdk::__query_builder::IxCol<ExternalGenerationJob, Option<String>>,
}
impl __sdk::__query_builder::HasIxCols for ExternalGenerationJob {
type IxCols = ExternalGenerationJobIxCols;
fn ix_cols(table_name: &'static str) -> Self::IxCols {
ExternalGenerationJobIxCols {
dedupe_key: __sdk::__query_builder::IxCol::new(table_name, "dedupe_key"),
job_id: __sdk::__query_builder::IxCol::new(table_name, "job_id"),
owner_user_id: __sdk::__query_builder::IxCol::new(table_name, "owner_user_id"),
worker_id: __sdk::__query_builder::IxCol::new(table_name, "worker_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for ExternalGenerationJob {}

View File

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

View File

@@ -0,0 +1,23 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct ExternalGenerationQueueStatsSnapshot {
pub pending_count: u32,
pub delayed_pending_count: u32,
pub claimable_pending_count: u32,
pub running_active_count: u32,
pub expired_running_count: u32,
pub terminal_count: u32,
pub claimable_count: u32,
pub oldest_claimable_age_micros: Option<i64>,
pub now_micros: i64,
}
impl __sdk::InModule for ExternalGenerationQueueStatsSnapshot {
type Module = super::RemoteModule;
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -11,6 +11,9 @@ pub struct PuzzleDraftCompileFailureInput {
pub owner_user_id: String,
pub error_message: String,
pub failed_at_micros: i64,
pub external_generation_job_id: Option<String>,
pub external_generation_worker_id: Option<String>,
pub external_generation_lease_token: Option<String>,
}
impl __sdk::InModule for PuzzleDraftCompileFailureInput {

View File

@@ -10,6 +10,9 @@ pub struct PuzzleDraftCompileInput {
pub session_id: String,
pub owner_user_id: String,
pub compiled_at_micros: i64,
pub external_generation_job_id: Option<String>,
pub external_generation_worker_id: Option<String>,
pub external_generation_lease_token: Option<String>,
}
impl __sdk::InModule for PuzzleDraftCompileInput {

View File

@@ -13,6 +13,9 @@ pub struct PuzzleGeneratedImagesSaveInput {
pub levels_json: Option<String>,
pub candidates_json: String,
pub saved_at_micros: i64,
pub external_generation_job_id: Option<String>,
pub external_generation_worker_id: Option<String>,
pub external_generation_lease_token: Option<String>,
}
impl __sdk::InModule for PuzzleGeneratedImagesSaveInput {

View File

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

View File

@@ -15,6 +15,9 @@ pub struct PuzzleUiBackgroundSaveInput {
pub image_src: String,
pub image_object_key: Option<String>,
pub saved_at_micros: i64,
pub external_generation_job_id: Option<String>,
pub external_generation_worker_id: Option<String>,
pub external_generation_lease_token: Option<String>,
}
impl __sdk::InModule for PuzzleUiBackgroundSaveInput {

View File

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

View File

@@ -149,10 +149,56 @@ impl SpacetimeClient {
owner_user_id: String,
compiled_at_micros: i64,
) -> Result<PuzzleAgentSessionRecord, SpacetimeClientError> {
self.compile_puzzle_agent_draft_inner(
session_id,
owner_user_id,
compiled_at_micros,
(None, None, None),
)
.await
}
pub async fn compile_puzzle_agent_draft_with_external_generation_guard(
&self,
session_id: String,
owner_user_id: String,
compiled_at_micros: i64,
external_generation_job_id: Option<String>,
external_generation_worker_id: Option<String>,
external_generation_lease_token: Option<String>,
) -> Result<PuzzleAgentSessionRecord, SpacetimeClientError> {
self.compile_puzzle_agent_draft_inner(
session_id,
owner_user_id,
compiled_at_micros,
(
external_generation_job_id,
external_generation_worker_id,
external_generation_lease_token,
),
)
.await
}
async fn compile_puzzle_agent_draft_inner(
&self,
session_id: String,
owner_user_id: String,
compiled_at_micros: i64,
external_generation_guard: (Option<String>, Option<String>, Option<String>),
) -> Result<PuzzleAgentSessionRecord, SpacetimeClientError> {
let (
external_generation_job_id,
external_generation_worker_id,
external_generation_lease_token,
) = external_generation_guard;
let procedure_input = PuzzleDraftCompileInput {
session_id,
owner_user_id,
compiled_at_micros,
external_generation_job_id,
external_generation_worker_id,
external_generation_lease_token,
};
self.call_after_connect("compile_puzzle_agent_draft", move |connection, sender| {
@@ -178,6 +224,9 @@ impl SpacetimeClient {
owner_user_id: input.owner_user_id,
error_message: input.error_message,
failed_at_micros: input.failed_at_micros,
external_generation_job_id: input.external_generation_job_id,
external_generation_worker_id: input.external_generation_worker_id,
external_generation_lease_token: input.external_generation_lease_token,
};
self.call_after_connect(
@@ -196,6 +245,38 @@ impl SpacetimeClient {
.await
}
pub async fn mark_puzzle_level_generation_failed(
&self,
input: PuzzleLevelGenerationFailureRecordInput,
) -> Result<PuzzleAgentSessionRecord, SpacetimeClientError> {
let procedure_input = PuzzleLevelGenerationFailureInput {
session_id: input.session_id,
owner_user_id: input.owner_user_id,
level_id: input.level_id,
levels_json: input.levels_json,
error_message: input.error_message,
failed_at_micros: input.failed_at_micros,
external_generation_job_id: input.external_generation_job_id,
external_generation_worker_id: input.external_generation_worker_id,
external_generation_lease_token: input.external_generation_lease_token,
};
self.call_after_connect(
"mark_puzzle_level_generation_failed",
move |connection, sender| {
connection
.procedures()
.mark_puzzle_level_generation_failed_then(procedure_input, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_puzzle_agent_session_procedure_result);
send_once(&sender, mapped);
});
},
)
.await
}
pub async fn claim_puzzle_background_compile_task(
&self,
input: PuzzleBackgroundCompileTaskClaimRecordInput,
@@ -268,6 +349,9 @@ impl SpacetimeClient {
levels_json: input.levels_json,
candidates_json: input.candidates_json,
saved_at_micros: input.saved_at_micros,
external_generation_job_id: input.external_generation_job_id,
external_generation_worker_id: input.external_generation_worker_id,
external_generation_lease_token: input.external_generation_lease_token,
};
self.call_after_connect("save_puzzle_generated_images", move |connection, sender| {
@@ -297,6 +381,9 @@ impl SpacetimeClient {
image_src: input.image_src,
image_object_key: input.image_object_key,
saved_at_micros: input.saved_at_micros,
external_generation_job_id: input.external_generation_job_id,
external_generation_worker_id: input.external_generation_worker_id,
external_generation_lease_token: input.external_generation_lease_token,
};
self.call_after_connect("save_puzzle_ui_background", move |connection, sender| {

View File

@@ -124,6 +124,51 @@ impl SpacetimeClient {
action_type: payload.action_type,
session,
work,
queue_state: None,
})
}
pub async fn mark_puzzle_clear_generation_queued(
&self,
session_id: String,
owner_user_id: String,
author_display_name: String,
payload: PuzzleClearActionRequest,
) -> Result<PuzzleClearActionResponse, SpacetimeClientError> {
let current = self
.get_puzzle_clear_session(session_id.clone(), owner_user_id.clone())
.await?;
let action_type = payload.action_type.clone();
let scope = match action_type {
PuzzleClearActionType::CompileDraft => PuzzleClearDraftMergeScope::CompileDraft,
PuzzleClearActionType::RegenerateAtlas => PuzzleClearDraftMergeScope::RegenerateAtlas,
_ => {
return Err(SpacetimeClientError::validation_failed(
"puzzle-clear queued generation 只支持 compile-draft/regenerate-atlas",
));
}
};
let mut draft = merge_action_into_draft(current.draft.clone(), &payload, scope)?;
let profile_id =
resolve_puzzle_clear_profile_id(&draft, &action_type, payload.profile_id.as_deref())?;
draft.profile_id = Some(profile_id.clone());
draft.generation_status = PuzzleClearGenerationStatus::Generating;
let session = self
.compile_puzzle_clear_draft(build_generating_compile_input(
&current,
&owner_user_id,
&author_display_name,
&profile_id,
&draft,
current_unix_micros(),
)?)
.await?;
Ok(PuzzleClearActionResponse {
action_type,
session,
work: None,
queue_state: None,
})
}
@@ -647,6 +692,38 @@ fn build_compile_input(
})
}
fn build_generating_compile_input(
current: &PuzzleClearSessionSnapshotResponse,
owner_user_id: &str,
author_display_name: &str,
profile_id: &str,
draft: &PuzzleClearDraftResponse,
now_micros: i64,
) -> Result<PuzzleClearDraftCompileInput, SpacetimeClientError> {
Ok(PuzzleClearDraftCompileInput {
session_id: current.session_id.clone(),
owner_user_id: owner_user_id.to_string(),
profile_id: profile_id.to_string(),
author_display_name: non_empty_str(author_display_name)
.unwrap_or_else(|| "拼消消玩家".to_string()),
work_title: draft.work_title.clone(),
work_description: draft.work_description.clone(),
theme_prompt: draft.theme_prompt.clone(),
board_background_prompt: draft.board_background_prompt.clone(),
generate_board_background: draft.generate_board_background,
board_background_asset_json: draft
.board_background_asset
.as_ref()
.map(json_string)
.transpose()?,
atlas_asset_json: draft.atlas_asset.as_ref().map(json_string).transpose()?,
pattern_groups_json: Some(json_string(&draft.pattern_groups)?),
card_assets_json: Some(json_string(&draft.card_assets)?),
generation_status: Some("generating".to_string()),
compiled_at_micros: now_micros,
})
}
fn build_failed_compile_input(
current: &PuzzleClearSessionSnapshotResponse,
owner_user_id: &str,

View File

@@ -119,6 +119,53 @@ impl SpacetimeClient {
action_type: payload.action_type,
session,
work,
queue_state: None,
})
}
pub async fn mark_wooden_fish_generation_queued(
&self,
session_id: String,
owner_user_id: String,
author_display_name: String,
payload: WoodenFishActionRequest,
) -> Result<WoodenFishActionResponse, SpacetimeClientError> {
let current = self
.get_wooden_fish_session(session_id.clone(), owner_user_id.clone())
.await?;
let action_type = payload.action_type.clone();
let scope = match action_type {
WoodenFishActionType::CompileDraft => WoodenFishDraftMergeScope::CompileDraft,
WoodenFishActionType::RegenerateHitObject => {
WoodenFishDraftMergeScope::RegenerateHitObject
}
_ => {
return Err(SpacetimeClientError::validation_failed(
"wooden-fish queued generation 只支持 compile-draft/regenerate-hit-object",
));
}
};
let mut draft = merge_action_into_draft(current.draft.clone(), &payload, scope)?;
let profile_id =
resolve_wooden_fish_profile_id(&draft, &action_type, payload.profile_id.as_deref())?;
draft.profile_id = Some(profile_id.clone());
draft.generation_status = WoodenFishGenerationStatus::Generating;
let session = self
.compile_wooden_fish_draft(build_generating_compile_input(
&current,
&owner_user_id,
&author_display_name,
&profile_id,
&draft,
current_unix_micros(),
)?)
.await?;
Ok(WoodenFishActionResponse {
action_type,
session,
work: None,
queue_state: None,
})
}
@@ -689,6 +736,52 @@ fn build_compile_input(
})
}
fn build_generating_compile_input(
current: &WoodenFishSessionSnapshotResponse,
owner_user_id: &str,
author_display_name: &str,
profile_id: &str,
draft: &WoodenFishDraftResponse,
now_micros: i64,
) -> Result<WoodenFishDraftCompileInput, SpacetimeClientError> {
Ok(WoodenFishDraftCompileInput {
session_id: current.session_id.clone(),
owner_user_id: owner_user_id.to_string(),
profile_id: profile_id.to_string(),
author_display_name: author_display_name.trim().to_string(),
work_title: draft.work_title.clone(),
work_description: draft.work_description.clone(),
theme_tags_json: Some(json_string(&draft.theme_tags)?),
hit_object_prompt: draft.hit_object_prompt.clone(),
hit_object_reference_image_src: draft.hit_object_reference_image_src.clone(),
hit_sound_prompt: draft.hit_sound_prompt.clone(),
hit_object_asset_json: draft
.hit_object_asset
.as_ref()
.map(json_string)
.transpose()?,
background_asset_json: draft
.background_asset
.as_ref()
.map(json_string)
.transpose()?,
hit_sound_asset_json: draft
.hit_sound_asset
.as_ref()
.map(json_string)
.transpose()?,
back_button_asset_json: draft
.back_button_asset
.as_ref()
.map(json_string)
.transpose()?,
floating_words_json: Some(json_string(&draft.floating_words)?),
cover_image_src: draft.cover_image_src.clone(),
generation_status: Some("generating".to_string()),
compiled_at_micros: now_micros,
})
}
fn build_failed_compile_input(
current: &WoodenFishSessionSnapshotResponse,
owner_user_id: &str,