Add skill for gameplay entry type workflows

This commit is contained in:
2026-05-04 02:32:38 +08:00
parent 49aad7311c
commit 34aecdddf1
77 changed files with 5997 additions and 110 deletions

View File

@@ -173,6 +173,66 @@ impl From<module_runtime::RuntimeProfileRewardCodeRedeemInput>
}
}
impl From<module_runtime::RuntimeProfileTaskCenterGetInput> for RuntimeProfileTaskCenterGetInput {
fn from(input: module_runtime::RuntimeProfileTaskCenterGetInput) -> Self {
Self {
user_id: input.user_id,
}
}
}
impl From<module_runtime::RuntimeProfileTaskClaimInput> for RuntimeProfileTaskClaimInput {
fn from(input: module_runtime::RuntimeProfileTaskClaimInput) -> Self {
Self {
user_id: input.user_id,
task_id: input.task_id,
}
}
}
impl From<module_runtime::RuntimeProfileTaskConfigAdminListInput>
for RuntimeProfileTaskConfigAdminListInput
{
fn from(input: module_runtime::RuntimeProfileTaskConfigAdminListInput) -> Self {
Self {
admin_user_id: input.admin_user_id,
}
}
}
impl From<module_runtime::RuntimeProfileTaskConfigAdminUpsertInput>
for RuntimeProfileTaskConfigAdminUpsertInput
{
fn from(input: module_runtime::RuntimeProfileTaskConfigAdminUpsertInput) -> Self {
Self {
admin_user_id: input.admin_user_id,
task_id: input.task_id,
title: input.title,
description: input.description,
event_key: input.event_key,
cycle: map_runtime_profile_task_cycle(input.cycle),
scope_kind: map_runtime_tracking_scope_kind(input.scope_kind),
threshold: input.threshold,
reward_points: input.reward_points,
enabled: input.enabled,
sort_order: input.sort_order,
updated_at_micros: input.updated_at_micros,
}
}
}
impl From<module_runtime::RuntimeProfileTaskConfigAdminDisableInput>
for RuntimeProfileTaskConfigAdminDisableInput
{
fn from(input: module_runtime::RuntimeProfileTaskConfigAdminDisableInput) -> Self {
Self {
admin_user_id: input.admin_user_id,
task_id: input.task_id,
updated_at_micros: input.updated_at_micros,
}
}
}
impl From<module_runtime::RuntimeProfileRedeemCodeAdminUpsertInput>
for RuntimeProfileRedeemCodeAdminUpsertInput
{
@@ -203,6 +263,16 @@ impl From<module_runtime::RuntimeProfileRedeemCodeAdminDisableInput>
}
}
impl From<module_runtime::RuntimeProfileRedeemCodeAdminListInput>
for RuntimeProfileRedeemCodeAdminListInput
{
fn from(input: module_runtime::RuntimeProfileRedeemCodeAdminListInput) -> Self {
Self {
admin_user_id: input.admin_user_id,
}
}
}
impl From<module_runtime::RuntimeProfileInviteCodeAdminUpsertInput>
for RuntimeProfileInviteCodeAdminUpsertInput
{
@@ -216,6 +286,16 @@ impl From<module_runtime::RuntimeProfileInviteCodeAdminUpsertInput>
}
}
impl From<module_runtime::RuntimeProfileInviteCodeAdminListInput>
for RuntimeProfileInviteCodeAdminListInput
{
fn from(input: module_runtime::RuntimeProfileInviteCodeAdminListInput) -> Self {
Self {
admin_user_id: input.admin_user_id,
}
}
}
impl From<module_runtime::RuntimeReferralInviteCenterGetInput>
for RuntimeReferralInviteCenterGetInput
{
@@ -801,6 +881,72 @@ pub(crate) fn map_runtime_profile_reward_code_redeem_procedure_result(
))
}
pub(crate) fn map_runtime_profile_task_center_procedure_result(
result: RuntimeProfileTaskCenterProcedureResult,
) -> Result<RuntimeProfileTaskCenterRecord, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
let snapshot = result
.record
.ok_or_else(|| SpacetimeClientError::missing_snapshot("profile task center 快照"))?;
Ok(build_runtime_profile_task_center_record(
map_runtime_profile_task_center_snapshot(snapshot),
))
}
pub(crate) fn map_runtime_profile_task_claim_procedure_result(
result: RuntimeProfileTaskClaimProcedureResult,
) -> Result<RuntimeProfileTaskClaimRecord, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
let snapshot = result
.record
.ok_or_else(|| SpacetimeClientError::missing_snapshot("profile task claim 快照"))?;
Ok(build_runtime_profile_task_claim_record(
map_runtime_profile_task_claim_snapshot(snapshot),
))
}
pub(crate) fn map_runtime_profile_task_config_admin_list_procedure_result(
result: RuntimeProfileTaskConfigAdminListProcedureResult,
) -> Result<Vec<RuntimeProfileTaskConfigRecord>, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
Ok(result
.entries
.into_iter()
.map(|snapshot| {
build_runtime_profile_task_config_record(map_runtime_profile_task_config_snapshot(
snapshot,
))
})
.collect())
}
pub(crate) fn map_runtime_profile_task_config_admin_procedure_result(
result: RuntimeProfileTaskConfigAdminProcedureResult,
) -> Result<RuntimeProfileTaskConfigRecord, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
let snapshot = result
.record
.ok_or_else(|| SpacetimeClientError::missing_snapshot("profile task config 快照"))?;
Ok(build_runtime_profile_task_config_record(
map_runtime_profile_task_config_snapshot(snapshot),
))
}
pub(crate) fn map_runtime_profile_redeem_code_admin_procedure_result(
result: RuntimeProfileRedeemCodeAdminProcedureResult,
) -> Result<RuntimeProfileRedeemCodeRecord, SpacetimeClientError> {
@@ -817,6 +963,24 @@ pub(crate) fn map_runtime_profile_redeem_code_admin_procedure_result(
))
}
pub(crate) fn map_runtime_profile_redeem_code_admin_list_procedure_result(
result: RuntimeProfileRedeemCodeAdminListProcedureResult,
) -> Result<Vec<RuntimeProfileRedeemCodeRecord>, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
Ok(result
.entries
.into_iter()
.map(|snapshot| {
build_runtime_profile_redeem_code_record(map_runtime_profile_redeem_code_snapshot(
snapshot,
))
})
.collect())
}
pub(crate) fn map_runtime_profile_invite_code_admin_procedure_result(
result: RuntimeProfileInviteCodeAdminProcedureResult,
) -> Result<RuntimeProfileInviteCodeRecord, SpacetimeClientError> {
@@ -837,6 +1001,24 @@ pub(crate) fn map_runtime_profile_invite_code_admin_procedure_result(
))
}
pub(crate) fn map_runtime_profile_invite_code_admin_list_procedure_result(
result: RuntimeProfileInviteCodeAdminListProcedureResult,
) -> Result<Vec<RuntimeProfileInviteCodeRecord>, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
Ok(result
.entries
.into_iter()
.map(|snapshot| {
build_runtime_profile_invite_code_record(map_runtime_profile_invite_code_snapshot(
snapshot,
))
})
.collect())
}
pub(crate) fn map_runtime_profile_play_stats_procedure_result(
result: RuntimeProfilePlayStatsProcedureResult,
) -> Result<RuntimeProfilePlayStatsRecord, SpacetimeClientError> {
@@ -1721,6 +1903,76 @@ pub(crate) fn map_runtime_profile_reward_code_redeem_snapshot(
}
}
pub(crate) fn map_runtime_profile_task_config_snapshot(
snapshot: RuntimeProfileTaskConfigSnapshot,
) -> module_runtime::RuntimeProfileTaskConfigSnapshot {
module_runtime::RuntimeProfileTaskConfigSnapshot {
task_id: snapshot.task_id,
title: snapshot.title,
description: snapshot.description,
event_key: snapshot.event_key,
cycle: map_runtime_profile_task_cycle_back(snapshot.cycle),
scope_kind: map_runtime_tracking_scope_kind_back(snapshot.scope_kind),
threshold: snapshot.threshold,
reward_points: snapshot.reward_points,
enabled: snapshot.enabled,
sort_order: snapshot.sort_order,
created_by: snapshot.created_by,
created_at_micros: snapshot.created_at_micros,
updated_by: snapshot.updated_by,
updated_at_micros: snapshot.updated_at_micros,
}
}
pub(crate) fn map_runtime_profile_task_item_snapshot(
snapshot: RuntimeProfileTaskItemSnapshot,
) -> module_runtime::RuntimeProfileTaskItemSnapshot {
module_runtime::RuntimeProfileTaskItemSnapshot {
task_id: snapshot.task_id,
title: snapshot.title,
description: snapshot.description,
event_key: snapshot.event_key,
cycle: map_runtime_profile_task_cycle_back(snapshot.cycle),
threshold: snapshot.threshold,
progress_count: snapshot.progress_count,
reward_points: snapshot.reward_points,
status: map_runtime_profile_task_status_back(snapshot.status),
day_key: snapshot.day_key,
claimed_at_micros: snapshot.claimed_at_micros,
updated_at_micros: snapshot.updated_at_micros,
}
}
pub(crate) fn map_runtime_profile_task_center_snapshot(
snapshot: RuntimeProfileTaskCenterSnapshot,
) -> module_runtime::RuntimeProfileTaskCenterSnapshot {
module_runtime::RuntimeProfileTaskCenterSnapshot {
user_id: snapshot.user_id,
day_key: snapshot.day_key,
wallet_balance: snapshot.wallet_balance,
tasks: snapshot
.tasks
.into_iter()
.map(map_runtime_profile_task_item_snapshot)
.collect(),
updated_at_micros: snapshot.updated_at_micros,
}
}
pub(crate) fn map_runtime_profile_task_claim_snapshot(
snapshot: RuntimeProfileTaskClaimSnapshot,
) -> module_runtime::RuntimeProfileTaskClaimSnapshot {
module_runtime::RuntimeProfileTaskClaimSnapshot {
user_id: snapshot.user_id,
task_id: snapshot.task_id,
day_key: snapshot.day_key,
reward_points: snapshot.reward_points,
wallet_balance: snapshot.wallet_balance,
ledger_entry: map_runtime_profile_wallet_ledger_entry_snapshot(snapshot.ledger_entry),
center: map_runtime_profile_task_center_snapshot(snapshot.center),
}
}
pub(crate) fn map_runtime_profile_redeem_code_snapshot(
snapshot: RuntimeProfileRedeemCodeSnapshot,
) -> module_runtime::RuntimeProfileRedeemCodeSnapshot {
@@ -3750,6 +4002,86 @@ pub(crate) fn map_runtime_profile_wallet_ledger_source_type_back(
crate::module_bindings::RuntimeProfileWalletLedgerSourceType::PuzzleAuthorIncentiveClaim => {
module_runtime::RuntimeProfileWalletLedgerSourceType::PuzzleAuthorIncentiveClaim
}
crate::module_bindings::RuntimeProfileWalletLedgerSourceType::DailyTaskReward => {
module_runtime::RuntimeProfileWalletLedgerSourceType::DailyTaskReward
}
}
}
pub(crate) fn map_runtime_tracking_scope_kind(
value: DomainRuntimeTrackingScopeKind,
) -> crate::module_bindings::RuntimeTrackingScopeKind {
match value {
DomainRuntimeTrackingScopeKind::Site => {
crate::module_bindings::RuntimeTrackingScopeKind::Site
}
DomainRuntimeTrackingScopeKind::Work => {
crate::module_bindings::RuntimeTrackingScopeKind::Work
}
DomainRuntimeTrackingScopeKind::Module => {
crate::module_bindings::RuntimeTrackingScopeKind::Module
}
DomainRuntimeTrackingScopeKind::User => {
crate::module_bindings::RuntimeTrackingScopeKind::User
}
}
}
pub(crate) fn map_runtime_tracking_scope_kind_back(
value: crate::module_bindings::RuntimeTrackingScopeKind,
) -> DomainRuntimeTrackingScopeKind {
match value {
crate::module_bindings::RuntimeTrackingScopeKind::Site => {
DomainRuntimeTrackingScopeKind::Site
}
crate::module_bindings::RuntimeTrackingScopeKind::Work => {
DomainRuntimeTrackingScopeKind::Work
}
crate::module_bindings::RuntimeTrackingScopeKind::Module => {
DomainRuntimeTrackingScopeKind::Module
}
crate::module_bindings::RuntimeTrackingScopeKind::User => {
DomainRuntimeTrackingScopeKind::User
}
}
}
pub(crate) fn map_runtime_profile_task_cycle(
value: DomainRuntimeProfileTaskCycle,
) -> crate::module_bindings::RuntimeProfileTaskCycle {
match value {
DomainRuntimeProfileTaskCycle::Daily => {
crate::module_bindings::RuntimeProfileTaskCycle::Daily
}
}
}
pub(crate) fn map_runtime_profile_task_cycle_back(
value: crate::module_bindings::RuntimeProfileTaskCycle,
) -> DomainRuntimeProfileTaskCycle {
match value {
crate::module_bindings::RuntimeProfileTaskCycle::Daily => {
DomainRuntimeProfileTaskCycle::Daily
}
}
}
pub(crate) fn map_runtime_profile_task_status_back(
value: crate::module_bindings::RuntimeProfileTaskStatus,
) -> DomainRuntimeProfileTaskStatus {
match value {
crate::module_bindings::RuntimeProfileTaskStatus::Incomplete => {
DomainRuntimeProfileTaskStatus::Incomplete
}
crate::module_bindings::RuntimeProfileTaskStatus::Claimable => {
DomainRuntimeProfileTaskStatus::Claimable
}
crate::module_bindings::RuntimeProfileTaskStatus::Claimed => {
DomainRuntimeProfileTaskStatus::Claimed
}
crate::module_bindings::RuntimeProfileTaskStatus::Disabled => {
DomainRuntimeProfileTaskStatus::Disabled
}
}
}