Files
Genarrative/server-rs/crates/spacetime-client/src/auth.rs
T
kdletters 458371a73d
Project CI / Repository checks (push) Successful in 4m11s
Project CI / Frontend tests (push) Successful in 8m38s
Project CI / Backend tests (push) Successful in 10m42s
Project CI / Native shell tests (push) Successful in 32m11s
将退款 outbox 主路径迁入 SpacetimeDB (#204)
## 变更内容

- 新增 `profile_wallet_refund_outbox` 表与 enqueue/process procedure,退款主路径进入 SpacetimeDB。
- 外部生成失败事务、inline 资产失败和跨节点 worker 统一使用库内 outbox,按 ledger 幂等并在事务内完成退款与删除。
- SpacetimeDB 完全不可达时才写本机 emergency spool,恢复时重新入库;兼容旧 spool 文件并保留 attempt 追踪。
- 更新 SpacetimeDB migration、生成 bindings、架构文档、运维恢复说明和项目决策记录。

## 验证

- `cargo check -p spacetime-module -p spacetime-client -p api-server --manifest-path server-rs/Cargo.toml`
- api-server / spacetime-client / spacetime-module / module-runtime 定向测试
- `npm run check:spacetime-schema`
- `npm run check:spacetime-runtime-access`
- `npm run check:server-rs-ddd`
- `npm run check:encoding`
- `git diff --check`

Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/204
Co-authored-by: kdletters <kdletters@qq.com>
Co-committed-by: kdletters <kdletters@qq.com>
2026-08-27 22:04:50 +08:00

67 lines
2.4 KiB
Rust

use super::*;
impl SpacetimeClient {
pub async fn validate_auth_session(
&self,
input: AuthSessionValidationRecordInput,
) -> Result<bool, SpacetimeClientError> {
let procedure_input = crate::module_bindings::AuthSessionValidationInput {
user_id: input.user_id,
session_id: input.session_id,
token_version: input.token_version,
};
self.call_after_connect("validate_auth_session", move |connection, sender| {
connection.procedures().validate_auth_session_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_auth_session_validation_result);
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn export_auth_store_projection_from_tables(
&self,
) -> Result<module_auth::AuthStoreProjectionView, SpacetimeClientError> {
self.call_after_connect(
"export_auth_store_projection_from_tables",
move |connection, sender| {
connection
.procedures()
.export_auth_store_projection_from_tables_then(move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_auth_store_projection_procedure_result);
send_once(&sender, mapped);
});
},
)
.await
}
pub async fn sync_auth_store_projection(
&self,
view: module_auth::AuthStoreProjectionView,
) -> Result<AuthStoreProjectionSyncRecord, SpacetimeClientError> {
let procedure_input = map_auth_store_projection_view_input(view);
self.call_after_connect("sync_auth_store_projection", move |connection, sender| {
connection.procedures().sync_auth_store_projection_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_auth_store_projection_sync_procedure_result);
send_once(&sender, mapped);
},
);
})
.await
}
}