+1
-1
@@ -87,7 +87,7 @@
|
||||
4. 重新执行:
|
||||
|
||||
```powershell
|
||||
spacetime generate --no-config --lang rust --out-dir D:\Genarrative\server-rs\crates\spacetime-client\src\module_bindings --module-path D:\Genarrative\server-rs\crates\spacetime-module --include-private --yes
|
||||
npm run spacetime:generate
|
||||
```
|
||||
|
||||
说明:
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
```bash
|
||||
spacetime start --listen-addr 127.0.0.1:3000
|
||||
spacetime publish genarrative-dev --server local --yes --module-path server-rs/crates/spacetime-module
|
||||
spacetime generate --lang rust --out-dir server-rs/crates/spacetime-client/src/module_bindings --module-path server-rs/crates/spacetime-module --include-private --yes
|
||||
npm run spacetime:generate
|
||||
```
|
||||
|
||||
## 5. 为什么当前阶段不用 CLI 文本解析
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
1. `cargo check -p module-story --manifest-path D:\\Genarrative\\server-rs\\Cargo.toml`
|
||||
2. `cargo check -p spacetime-module --manifest-path D:\\Genarrative\\server-rs\\Cargo.toml`
|
||||
3. `cargo check -p spacetime-module --target wasm32-unknown-unknown --manifest-path D:\\Genarrative\\server-rs\\Cargo.toml`
|
||||
4. `spacetime generate --no-config --lang rust --out-dir D:\\Genarrative\\server-rs\\crates\\spacetime-client\\src\\module_bindings --module-path D:\\Genarrative\\server-rs\\crates\\spacetime-module --include-private --yes`
|
||||
4. `npm run spacetime:generate`
|
||||
5. `cargo check -p spacetime-client --manifest-path D:\\Genarrative\\server-rs\\Cargo.toml`
|
||||
6. `cargo check -p api-server --manifest-path D:\\Genarrative\\server-rs\\Cargo.toml`
|
||||
7. `npm run check:encoding`
|
||||
@@ -234,7 +234,7 @@
|
||||
|
||||
同时,本轮还完成了以下工程收口:
|
||||
|
||||
1. 已重新执行 `spacetime generate --no-config --lang rust --out-dir D:\\Genarrative\\server-rs\\crates\\spacetime-client\\src\\module_bindings --module-path D:\\Genarrative\\server-rs\\crates\\spacetime-module --include-private --yes`。
|
||||
1. 已重新执行 `npm run spacetime:generate`。
|
||||
2. 已把 `spacetime-client` 中 battle query 的占位实现替换为真实 procedure 调用。
|
||||
3. 已再次执行 `cargo check -p spacetime-client --manifest-path D:\\Genarrative\\server-rs\\Cargo.toml` 与 `cargo check -p api-server --manifest-path D:\\Genarrative\\server-rs\\Cargo.toml` 并通过。
|
||||
|
||||
|
||||
@@ -340,7 +340,7 @@ finalScore = tagSimilarityScore * 0.7 + sameAuthorScore * 0.3;
|
||||
4. `cargo check -p module-puzzle`
|
||||
5. `cargo check -p shared-contracts`
|
||||
6. `cargo check -p spacetime-module`
|
||||
7. `spacetime generate --no-config --lang rust --out-dir server-rs/crates/spacetime-client/src/module_bindings --module-path server-rs/crates/spacetime-module --include-private --yes`
|
||||
7. `npm run spacetime:generate`
|
||||
8. `cargo check -p spacetime-client`
|
||||
9. `cargo check -p api-server`
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ npm run dev:rust
|
||||
1. 检查 `cargo`、`node` 与 `spacetime` CLI。
|
||||
2. Windows Git Bash 下如 `server-rs/.spacetimedb/local/bin/current/spacetimedb-cli.exe` 不存在,先把本机 `spacetime` 所在安装目录的 `bin/` 与 `spacetime.exe` 同步到 `server-rs/.spacetimedb/local/`。
|
||||
3. 启动 `spacetime --root-dir=server-rs/.spacetimedb/local start --edition standalone --listen-addr 127.0.0.1:3101`,确保本地数据库与 SpacetimeDB 内部日志不会落到开发者全局目录。
|
||||
4. 等待 `spacetime --root-dir=server-rs/.spacetimedb/local server ping http://127.0.0.1:3101` 可用。
|
||||
4. 等待 `spacetime --root-dir=server-rs/.spacetimedb/local server ping http://127.0.0.1:3101` 可用;判定标准必须包含输出中的 `Server is online:`,不能只依赖 CLI 退出码,因为 SpacetimeDB CLI `2.1.0` 在 `502 Bad Gateway` 时也可能返回退出码 `0`。
|
||||
5. 执行 `spacetime --root-dir=server-rs/.spacetimedb/local publish <本地数据库名> --server http://127.0.0.1:3101 --module-path server-rs/crates/spacetime-module -c=on-conflict --yes`,确保 publish 的签名身份与 standalone 的本地控制库一致,并在当前开发阶段允许新版模块表结构变化且发生 schema 冲突时清除旧模块数据。
|
||||
6. 注入 `GENARRATIVE_API_*` 与 `GENARRATIVE_SPACETIME_*` 后启动 `cargo run -p api-server`;直接运行 `api-server` 时,如未显式设置 `GENARRATIVE_SPACETIME_DATABASE`,服务端也会向上查找 `spacetime.local.json` 作为本地默认库名。
|
||||
7. 等待 `http://127.0.0.1:<api-port>/healthz` 返回 HTTP 响应后再启动 Vite,避免前端初始化请求早于 Rust `api-server` 监听完成并在终端刷出 `ECONNREFUSED 127.0.0.1:<api-port>`。
|
||||
@@ -65,6 +65,23 @@ npm run dev:rust
|
||||
./scripts/dev-rust-stack.sh --preserve-database
|
||||
```
|
||||
|
||||
bindings 生成:
|
||||
|
||||
```bash
|
||||
npm run spacetime:generate
|
||||
npm run spacetime:generate -- --rust-only
|
||||
```
|
||||
|
||||
生成规则:
|
||||
|
||||
1. `npm run spacetime:generate` 是本仓库刷新 SpacetimeDB Rust client bindings 的唯一推荐入口。
|
||||
2. 前端不直连 SpacetimeDB,不生成 TypeScript bindings;前端只通过 Rust `api-server` 暴露的 HTTP / SSE contract 访问后端。
|
||||
3. Rust bindings 不生成私有表绑定,不追加 `--include-private`,生成到短临时目录后同步到 `server-rs/crates/spacetime-client/src/module_bindings`。
|
||||
4. Windows 下 SpacetimeDB CLI `2.1.0` 会在生成结束后把所有生成文件路径一次性传给 formatter;Rust bindings 文件较多,若直接输出到仓库深目录,可能触发 `Could not format generated files: 文件名或扩展名太长。`。该错误不是单个最长文件路径超过限制,而是 formatter 子进程参数总长超过 Windows `CreateProcess` 限制。
|
||||
5. CLI 在上述 formatter 失败时仍可能返回退出码 `0`;脚本会捕获输出,只要出现 `Could not format generated files` 就视为失败。
|
||||
6. 根目录 `spacetime.json` 不配置 `generate` 目标,避免裸 `spacetime generate` 在 Windows 上直接碰到 Rust formatter 路径总长限制,也避免误生成前端 bindings。
|
||||
7. 不直接手写或局部补 `server-rs/crates/spacetime-client/src/module_bindings` 下的生成文件;schema 变化后重新执行本脚本,并补跑编码检查与对应类型检查。
|
||||
|
||||
日志提取:
|
||||
|
||||
```bash
|
||||
@@ -86,6 +103,7 @@ npm run dev:rust:logs -- --follow
|
||||
2. `spacetime --root-dir=server-rs/.spacetimedb/local list --server http://127.0.0.1:3101` 应能看到 `spacetime.local.json` 中的库名;若没有,执行 `spacetime --root-dir=server-rs/.spacetimedb/local publish <本地数据库名> --server http://127.0.0.1:3101 --module-path server-rs/crates/spacetime-module -c=on-conflict --yes`。
|
||||
3. 发布库名与 `GENARRATIVE_SPACETIME_DATABASE` 不一致时,`/api/runtime/custom-world-gallery` 会从 Rust `api-server` 返回 `502`,前端首页只能展示空态或错误提示,无法自行修复。
|
||||
4. 如果 Vite 输出 `/api/auth/refresh`、`/api/auth/login-options` 或 `/api/runtime/custom-world-gallery` 的 `ECONNREFUSED`,先确认当前脚本是否已经打印 `等待 api-server 就绪` 并通过;正常情况下 Vite 只会在 `/healthz` 可访问后启动,不应再因为 Rust 监听未完成而代理失败。
|
||||
5. 如果 `spacetime server ping` 打印 `Server could not be reached (502 Bad Gateway)`,即使命令退出码为 `0` 也必须视为未就绪;脚本会继续等待新启动实例,或在 root-dir 已被其他实例占用时输出占用进程。
|
||||
|
||||
编译警告治理:
|
||||
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ spacetime publish xushi-p4wfr --server http://127.0.0.1:3101 --module-path D:\Ge
|
||||
publish 成功后,继续执行:
|
||||
|
||||
```bash
|
||||
spacetime generate --no-config --lang rust --out-dir D:\Genarrative\server-rs\crates\spacetime-client\src\module_bindings --module-path D:\Genarrative\server-rs\crates\spacetime-module --include-private --yes
|
||||
npm run spacetime:generate
|
||||
```
|
||||
|
||||
要求:
|
||||
|
||||
@@ -164,19 +164,18 @@ Stage 5 已接入 agent `publish_world` action,但调用方仍需要显式提
|
||||
本仓默认刷新命令:
|
||||
|
||||
```bash
|
||||
spacetime generate --no-config --lang rust --out-dir server-rs/crates/spacetime-client/src/module_bindings --module-path server-rs/crates/spacetime-module --include-private --yes
|
||||
npm run spacetime:generate
|
||||
```
|
||||
|
||||
如果当前工作树里存在其他并行 `cargo build/test/check` 导致 `spacetime generate` 内部构建长期卡在锁竞争,则先在独立目标目录编译 wasm,再使用 `--bin-path` 生成:
|
||||
如果当前工作树里存在其他并行 `cargo build/test/check` 导致 `spacetime generate` 内部构建长期卡在锁竞争,则先结束占锁任务后重新执行仓库脚本;脚本内部会使用短临时目录生成公开 Rust bindings,不生成私有表绑定。
|
||||
|
||||
```bash
|
||||
CARGO_TARGET_DIR=server-rs/target-spacetime-bindgen cargo build --manifest-path server-rs/crates/spacetime-module/Cargo.toml --target wasm32-unknown-unknown --release
|
||||
spacetime generate --no-config --lang rust --out-dir server-rs/crates/spacetime-client/src/module_bindings --bin-path server-rs/target-spacetime-bindgen/wasm32-unknown-unknown/release/spacetime_module.wasm --include-private --yes
|
||||
npm run spacetime:generate
|
||||
```
|
||||
|
||||
这样做的目的固定如下:
|
||||
|
||||
1. 避开根目录 `spacetime.json` 多 generate target 对单次 Rust 生成的参数冲突。
|
||||
1. 避开根目录 `spacetime.json` 误触发前端 bindings 或私有表 bindings 生成。
|
||||
2. 避开共享 `target/` 目录被其他任务占锁时的构建阻塞。
|
||||
3. 保证 `create_custom_world_agent_session` / `get_custom_world_agent_session` 这类新 procedure 与输入输出类型能同步进入 Rust bindings。
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"dev:rust:logs": "node scripts/run-bash-script.mjs scripts/spacetime-logs-local.sh",
|
||||
"dev:web": "node scripts/dev-web-rust.mjs",
|
||||
"spacetime:publish:maincloud": "node scripts/run-bash-script.mjs scripts/spacetime-publish-maincloud.sh",
|
||||
"spacetime:generate": "node scripts/generate-spacetime-bindings.mjs",
|
||||
"api-server:maincloud": "node scripts/api-server-maincloud.mjs",
|
||||
"deploy:rust:remote": "node scripts/run-bash-script.mjs scripts/deploy-rust-remote.sh",
|
||||
"build:rust:ubuntu": "node scripts/run-bash-script.mjs scripts/deploy-rust-remote.sh",
|
||||
|
||||
@@ -78,7 +78,7 @@ wait_for_spacetime() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if spacetime --root-dir="${root_dir}" server ping "${server}" >/dev/null 2>&1; then
|
||||
if is_spacetime_ready "${server}" "${root_dir}"; then
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -92,8 +92,14 @@ wait_for_spacetime() {
|
||||
is_spacetime_ready() {
|
||||
local server="$1"
|
||||
local root_dir="$2"
|
||||
local output
|
||||
|
||||
spacetime --root-dir="${root_dir}" server ping "${server}" >/dev/null 2>&1
|
||||
if ! output="$(spacetime --root-dir="${root_dir}" server ping "${server}" 2>&1)"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# SpacetimeDB CLI 2.1.0 在 502 Bad Gateway 时仍可能返回 0,不能只依赖退出码。
|
||||
[[ "${output}" == *"Server is online:"* ]]
|
||||
}
|
||||
|
||||
describe_spacetime_root_owner() {
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
import {spawn} from 'node:child_process';
|
||||
import {existsSync} from 'node:fs';
|
||||
import {cp, mkdir, readdir, rm, stat} from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import {fileURLToPath} from 'node:url';
|
||||
|
||||
const SCRIPT_DIR = path.dirname(fileURLToPath(import.meta.url));
|
||||
const REPO_ROOT = path.resolve(SCRIPT_DIR, '..');
|
||||
const MODULE_PATH = path.join(REPO_ROOT, 'server-rs', 'crates', 'spacetime-module');
|
||||
|
||||
const TARGETS = [
|
||||
{
|
||||
name: 'Rust',
|
||||
lang: 'rust',
|
||||
tempName: 'rs',
|
||||
outDir: path.join(
|
||||
REPO_ROOT,
|
||||
'server-rs',
|
||||
'crates',
|
||||
'spacetime-client',
|
||||
'src',
|
||||
'module_bindings',
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
const args = new Set(process.argv.slice(2));
|
||||
const KNOWN_ARGS = new Set(['--rust-only']);
|
||||
|
||||
for (const arg of args) {
|
||||
if (!KNOWN_ARGS.has(arg)) {
|
||||
console.error(`[spacetime:generate] 未知参数: ${arg}`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!existsSync(path.join(MODULE_PATH, 'Cargo.toml'))) {
|
||||
console.error(`[spacetime:generate] 未找到模块: ${MODULE_PATH}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const tempRoot = resolveTempRoot();
|
||||
assertSafeTempRoot(tempRoot);
|
||||
const selectedTargets = TARGETS.filter((target) => shouldRunTarget(target.lang));
|
||||
|
||||
if (selectedTargets.length === 0) {
|
||||
console.error('[spacetime:generate] 没有需要生成的目标。');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
await mkdir(tempRoot, {recursive: true});
|
||||
|
||||
for (const target of selectedTargets) {
|
||||
const tempOutDir = path.join(tempRoot, target.tempName);
|
||||
await recreateTempDir(tempOutDir);
|
||||
|
||||
console.log(`[spacetime:generate] 生成 ${target.name} bindings 到短路径: ${tempOutDir}`);
|
||||
await run('spacetime', buildGenerateArgs(target, tempOutDir));
|
||||
|
||||
const fileCount = await countFiles(tempOutDir);
|
||||
if (fileCount === 0) {
|
||||
throw new Error(`${target.name} bindings 未生成任何文件。`);
|
||||
}
|
||||
|
||||
console.log(`[spacetime:generate] 同步 ${fileCount} 个文件到 ${target.outDir}`);
|
||||
await replaceGeneratedDir(tempOutDir, target.outDir);
|
||||
}
|
||||
|
||||
await rm(tempRoot, {recursive: true, force: true});
|
||||
console.log('[spacetime:generate] bindings 生成完成。');
|
||||
|
||||
function shouldRunTarget(lang) {
|
||||
if (args.has('--rust-only')) {
|
||||
return lang === 'rust';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function resolveTempRoot() {
|
||||
if (process.env.GENARRATIVE_BINDGEN_TEMP_ROOT) {
|
||||
return path.resolve(process.env.GENARRATIVE_BINDGEN_TEMP_ROOT);
|
||||
}
|
||||
|
||||
// Windows 下 SpacetimeDB CLI 2.1.0 会把所有生成文件路径一次性传给 formatter;
|
||||
// Rust bindings 文件数较多,输出到仓库深目录时容易触发 CreateProcess 路径总长限制。
|
||||
if (process.platform === 'win32') {
|
||||
return path.join(path.parse(REPO_ROOT).root, '.genarrative-bindgen');
|
||||
}
|
||||
|
||||
return path.join(REPO_ROOT, 'tmp', 'spacetime-bindgen');
|
||||
}
|
||||
|
||||
async function recreateTempDir(dir) {
|
||||
assertInside(dir, tempRoot, '临时生成目录');
|
||||
await rm(dir, {recursive: true, force: true});
|
||||
await mkdir(dir, {recursive: true});
|
||||
}
|
||||
|
||||
async function replaceGeneratedDir(fromDir, toDir) {
|
||||
assertInside(toDir, REPO_ROOT, '仓库生成目录');
|
||||
await rm(toDir, {recursive: true, force: true});
|
||||
await mkdir(path.dirname(toDir), {recursive: true});
|
||||
await cp(fromDir, toDir, {recursive: true});
|
||||
}
|
||||
|
||||
function assertInside(candidate, parent, label) {
|
||||
const relative = path.relative(path.resolve(parent), path.resolve(candidate));
|
||||
if (relative === '' || relative.startsWith('..') || path.isAbsolute(relative)) {
|
||||
throw new Error(`${label} 不在预期目录内: ${candidate}`);
|
||||
}
|
||||
}
|
||||
|
||||
function assertSafeTempRoot(dir) {
|
||||
const resolved = path.resolve(dir);
|
||||
const parsed = path.parse(resolved);
|
||||
const basename = path.basename(resolved).toLowerCase();
|
||||
|
||||
if (resolved === path.resolve(REPO_ROOT) || resolved === parsed.root) {
|
||||
throw new Error(`临时根目录不允许指向仓库或磁盘根目录: ${resolved}`);
|
||||
}
|
||||
|
||||
if (!basename.includes('bindgen')) {
|
||||
throw new Error(`临时根目录必须是明确的 bindings 生成目录: ${resolved}`);
|
||||
}
|
||||
}
|
||||
|
||||
function buildGenerateArgs(target, outDir) {
|
||||
const generateArgs = [
|
||||
'generate',
|
||||
'--no-config',
|
||||
'--lang',
|
||||
target.lang,
|
||||
'--out-dir',
|
||||
outDir,
|
||||
'--module-path',
|
||||
MODULE_PATH,
|
||||
'--yes',
|
||||
];
|
||||
|
||||
return generateArgs;
|
||||
}
|
||||
|
||||
function run(command, commandArgs) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const child = spawn(command, commandArgs, {
|
||||
cwd: REPO_ROOT,
|
||||
env: process.env,
|
||||
shell: false,
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
});
|
||||
|
||||
let output = '';
|
||||
|
||||
child.stdout.on('data', (chunk) => {
|
||||
const text = chunk.toString();
|
||||
output += text;
|
||||
process.stdout.write(text);
|
||||
});
|
||||
|
||||
child.stderr.on('data', (chunk) => {
|
||||
const text = chunk.toString();
|
||||
output += text;
|
||||
process.stderr.write(text);
|
||||
});
|
||||
|
||||
child.on('error', reject);
|
||||
child.on('exit', (code, signal) => {
|
||||
if (signal) {
|
||||
reject(new Error(`${command} 被信号中断: ${signal}`));
|
||||
return;
|
||||
}
|
||||
|
||||
if (output.includes('Could not format generated files')) {
|
||||
reject(new Error(`${command} 生成后格式化失败。`));
|
||||
return;
|
||||
}
|
||||
|
||||
if (code === 0) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
reject(new Error(`${command} 退出码: ${code ?? 'unknown'}`));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function countFiles(dir) {
|
||||
let count = 0;
|
||||
const entries = await readdir(dir, {withFileTypes: true});
|
||||
|
||||
for (const entry of entries) {
|
||||
const entryPath = path.join(dir, entry.name);
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
count += await countFiles(entryPath);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entry.isFile() || (await stat(entryPath)).isFile()) {
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
当前目录已不再只是占位,当前阶段已经落下:
|
||||
|
||||
1. 通过 `spacetime generate --lang rust --include-private` 生成的最小 Rust bindings
|
||||
1. 通过 `npm run spacetime:generate -- --rust-only` 生成的公开 Rust bindings
|
||||
2. `DbConnection` 连接封装
|
||||
3. `confirm_asset_object_and_return` procedure 的最小调用适配
|
||||
4. `bind_asset_object_to_entity_and_return` procedure 的最小调用适配
|
||||
@@ -33,9 +33,11 @@
|
||||
|
||||
`src/module_bindings` 目录下的 Rust 文件统一视为 SpacetimeDB CLI 生成产物,后续维护必须遵守:
|
||||
|
||||
1. 只允许通过 `spacetime generate --lang rust` 刷新,不允许手工修改。
|
||||
2. 不允许对该目录执行 `rustfmt`,避免把 CLI 原始输出改写成额外格式化噪音。
|
||||
3. `src/lib.rs` 已通过 `#[rustfmt::skip] pub mod module_bindings;` 显式阻止 workspace 级 `cargo fmt` 继续递归格式化该目录。
|
||||
1. 只允许通过仓库根目录 `npm run spacetime:generate -- --rust-only` 刷新,不允许手工修改。
|
||||
2. 不生成私有表绑定,不追加 `--include-private`;如后端需要读取私有表,应先在 `api-server` 或模块层补明确 contract,而不是让客户端 crate 直接依赖私有表结构。
|
||||
3. 不允许对该目录额外执行 `rustfmt`,生成物格式只接受 SpacetimeDB CLI 生成阶段自身输出。
|
||||
4. `src/lib.rs` 已通过 `#[rustfmt::skip] pub mod module_bindings;` 显式阻止 workspace 级 `cargo fmt` 继续递归格式化该目录。
|
||||
5. Windows 下直接把 Rust bindings 输出到本目录时,SpacetimeDB CLI `2.1.0` 的生成后 formatter 可能因为路径参数总长触发 `文件名或扩展名太长`;仓库脚本会先输出到短临时目录,再同步回本目录。
|
||||
|
||||
## 3. 边界约束
|
||||
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::quest_record_input_type::QuestRecordInput;
|
||||
|
||||
@@ -19,10 +14,8 @@ pub(super) struct AcceptQuestArgs {
|
||||
|
||||
impl From<AcceptQuestArgs> for super::Reducer {
|
||||
fn from(args: AcceptQuestArgs) -> Self {
|
||||
Self::AcceptQuest {
|
||||
input: args.input,
|
||||
}
|
||||
}
|
||||
Self::AcceptQuest { input: args.input }
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for AcceptQuestArgs {
|
||||
@@ -40,9 +33,8 @@ pub trait accept_quest {
|
||||
/// The reducer will run asynchronously in the future,
|
||||
/// and this method provides no way to listen for its completion status.
|
||||
/// /// Use [`accept_quest:accept_quest_then`] to run a callback after the reducer completes.
|
||||
fn accept_quest(&self, input: QuestRecordInput,
|
||||
) -> __sdk::Result<()> {
|
||||
self.accept_quest_then(input, |_, _| {})
|
||||
fn accept_quest(&self, input: QuestRecordInput) -> __sdk::Result<()> {
|
||||
self.accept_quest_then(input, |_, _| {})
|
||||
}
|
||||
|
||||
/// Request that the remote module invoke the reducer `accept_quest` to run as soon as possible,
|
||||
@@ -70,7 +62,7 @@ impl accept_quest for super::RemoteReducers {
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()> {
|
||||
self.imp.invoke_reducer_with_callback(AcceptQuestArgs { input, }, callback)
|
||||
self.imp
|
||||
.invoke_reducer_with_callback(AcceptQuestArgs { input }, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-15
@@ -2,12 +2,7 @@
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::quest_completion_ack_input_type::QuestCompletionAckInput;
|
||||
|
||||
@@ -19,10 +14,8 @@ pub(super) struct AcknowledgeQuestCompletionArgs {
|
||||
|
||||
impl From<AcknowledgeQuestCompletionArgs> for super::Reducer {
|
||||
fn from(args: AcknowledgeQuestCompletionArgs) -> Self {
|
||||
Self::AcknowledgeQuestCompletion {
|
||||
input: args.input,
|
||||
}
|
||||
}
|
||||
Self::AcknowledgeQuestCompletion { input: args.input }
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::InModule for AcknowledgeQuestCompletionArgs {
|
||||
@@ -40,9 +33,8 @@ pub trait acknowledge_quest_completion {
|
||||
/// The reducer will run asynchronously in the future,
|
||||
/// and this method provides no way to listen for its completion status.
|
||||
/// /// Use [`acknowledge_quest_completion:acknowledge_quest_completion_then`] to run a callback after the reducer completes.
|
||||
fn acknowledge_quest_completion(&self, input: QuestCompletionAckInput,
|
||||
) -> __sdk::Result<()> {
|
||||
self.acknowledge_quest_completion_then(input, |_, _| {})
|
||||
fn acknowledge_quest_completion(&self, input: QuestCompletionAckInput) -> __sdk::Result<()> {
|
||||
self.acknowledge_quest_completion_then(input, |_, _| {})
|
||||
}
|
||||
|
||||
/// Request that the remote module invoke the reducer `acknowledge_quest_completion` to run as soon as possible,
|
||||
@@ -70,7 +62,7 @@ impl acknowledge_quest_completion for super::RemoteReducers {
|
||||
+ Send
|
||||
+ 'static,
|
||||
) -> __sdk::Result<()> {
|
||||
self.imp.invoke_reducer_with_callback(AcknowledgeQuestCompletionArgs { input, }, callback)
|
||||
self.imp
|
||||
.invoke_reducer_with_callback(AcknowledgeQuestCompletionArgs { input }, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+20
-19
@@ -2,23 +2,17 @@
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::puzzle_run_next_level_input_type::PuzzleRunNextLevelInput;
|
||||
use super::puzzle_run_procedure_result_type::PuzzleRunProcedureResult;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
struct AdvancePuzzleNextLevelArgs {
|
||||
struct AdvancePuzzleNextLevelArgs {
|
||||
pub input: PuzzleRunNextLevelInput,
|
||||
}
|
||||
|
||||
|
||||
impl __sdk::InModule for AdvancePuzzleNextLevelArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
@@ -28,16 +22,19 @@ impl __sdk::InModule for AdvancePuzzleNextLevelArgs {
|
||||
///
|
||||
/// Implemented for [`super::RemoteProcedures`].
|
||||
pub trait advance_puzzle_next_level {
|
||||
fn advance_puzzle_next_level(&self, input: PuzzleRunNextLevelInput,
|
||||
) {
|
||||
self.advance_puzzle_next_level_then(input, |_, _| {});
|
||||
fn advance_puzzle_next_level(&self, input: PuzzleRunNextLevelInput) {
|
||||
self.advance_puzzle_next_level_then(input, |_, _| {});
|
||||
}
|
||||
|
||||
fn advance_puzzle_next_level_then(
|
||||
&self,
|
||||
input: PuzzleRunNextLevelInput,
|
||||
|
||||
__callback: impl FnOnce(&super::ProcedureEventContext, Result<PuzzleRunProcedureResult, __sdk::InternalError>) + Send + 'static,
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<PuzzleRunProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -46,13 +43,17 @@ impl advance_puzzle_next_level for super::RemoteProcedures {
|
||||
&self,
|
||||
input: PuzzleRunNextLevelInput,
|
||||
|
||||
__callback: impl FnOnce(&super::ProcedureEventContext, Result<PuzzleRunProcedureResult, __sdk::InternalError>) + Send + 'static,
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<PuzzleRunProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
) {
|
||||
self.imp.invoke_procedure_with_callback::<_, PuzzleRunProcedureResult>(
|
||||
"advance_puzzle_next_level",
|
||||
AdvancePuzzleNextLevelArgs { input, },
|
||||
__callback,
|
||||
);
|
||||
self.imp
|
||||
.invoke_procedure_with_callback::<_, PuzzleRunProcedureResult>(
|
||||
"advance_puzzle_next_level",
|
||||
AdvancePuzzleNextLevelArgs { input },
|
||||
__callback,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-9
@@ -2,12 +2,7 @@
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::ai_result_reference_kind_type::AiResultReferenceKind;
|
||||
|
||||
@@ -17,12 +12,10 @@ pub struct AiResultReferenceInput {
|
||||
pub task_id: String,
|
||||
pub reference_kind: AiResultReferenceKind,
|
||||
pub reference_id: String,
|
||||
pub label: Option::<String>,
|
||||
pub label: Option<String>,
|
||||
pub created_at_micros: i64,
|
||||
}
|
||||
|
||||
|
||||
impl __sdk::InModule for AiResultReferenceInput {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
|
||||
+1
-10
@@ -2,12 +2,7 @@
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
@@ -24,12 +19,8 @@ pub enum AiResultReferenceKind {
|
||||
RuntimeItemRecord,
|
||||
|
||||
AssetObject,
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
impl __sdk::InModule for AiResultReferenceKind {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
|
||||
+2
-9
@@ -2,12 +2,7 @@
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::ai_result_reference_kind_type::AiResultReferenceKind;
|
||||
|
||||
@@ -18,12 +13,10 @@ pub struct AiResultReferenceSnapshot {
|
||||
pub task_id: String,
|
||||
pub reference_kind: AiResultReferenceKind,
|
||||
pub reference_id: String,
|
||||
pub label: Option::<String>,
|
||||
pub label: Option<String>,
|
||||
pub created_at_micros: i64,
|
||||
}
|
||||
|
||||
|
||||
impl __sdk::InModule for AiResultReferenceSnapshot {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::ai_result_reference_kind_type::AiResultReferenceKind;
|
||||
|
||||
@@ -19,16 +14,14 @@ pub struct AiResultReference {
|
||||
pub task_id: String,
|
||||
pub reference_kind: AiResultReferenceKind,
|
||||
pub reference_id: String,
|
||||
pub label: Option::<String>,
|
||||
pub label: Option<String>,
|
||||
pub created_at: __sdk::Timestamp,
|
||||
}
|
||||
|
||||
|
||||
impl __sdk::InModule for AiResultReference {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
|
||||
/// Column accessor struct for the table `AiResultReference`.
|
||||
///
|
||||
/// Provides typed access to columns for query building.
|
||||
@@ -38,7 +31,7 @@ pub struct AiResultReferenceCols {
|
||||
pub task_id: __sdk::__query_builder::Col<AiResultReference, String>,
|
||||
pub reference_kind: __sdk::__query_builder::Col<AiResultReference, AiResultReferenceKind>,
|
||||
pub reference_id: __sdk::__query_builder::Col<AiResultReference, String>,
|
||||
pub label: __sdk::__query_builder::Col<AiResultReference, Option::<String>>,
|
||||
pub label: __sdk::__query_builder::Col<AiResultReference, Option<String>>,
|
||||
pub created_at: __sdk::__query_builder::Col<AiResultReference, __sdk::Timestamp>,
|
||||
}
|
||||
|
||||
@@ -46,14 +39,16 @@ impl __sdk::__query_builder::HasCols for AiResultReference {
|
||||
type Cols = AiResultReferenceCols;
|
||||
fn cols(table_name: &'static str) -> Self::Cols {
|
||||
AiResultReferenceCols {
|
||||
result_reference_row_id: __sdk::__query_builder::Col::new(table_name, "result_reference_row_id"),
|
||||
result_reference_row_id: __sdk::__query_builder::Col::new(
|
||||
table_name,
|
||||
"result_reference_row_id",
|
||||
),
|
||||
result_ref_id: __sdk::__query_builder::Col::new(table_name, "result_ref_id"),
|
||||
task_id: __sdk::__query_builder::Col::new(table_name, "task_id"),
|
||||
reference_kind: __sdk::__query_builder::Col::new(table_name, "reference_kind"),
|
||||
reference_id: __sdk::__query_builder::Col::new(table_name, "reference_id"),
|
||||
label: __sdk::__query_builder::Col::new(table_name, "label"),
|
||||
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,12 +65,13 @@ impl __sdk::__query_builder::HasIxCols for AiResultReference {
|
||||
type IxCols = AiResultReferenceIxCols;
|
||||
fn ix_cols(table_name: &'static str) -> Self::IxCols {
|
||||
AiResultReferenceIxCols {
|
||||
result_reference_row_id: __sdk::__query_builder::IxCol::new(table_name, "result_reference_row_id"),
|
||||
result_reference_row_id: __sdk::__query_builder::IxCol::new(
|
||||
table_name,
|
||||
"result_reference_row_id",
|
||||
),
|
||||
task_id: __sdk::__query_builder::IxCol::new(table_name, "task_id"),
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl __sdk::__query_builder::CanBeLookupTable for AiResultReference {}
|
||||
|
||||
|
||||
+4
-11
@@ -2,12 +2,7 @@
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::ai_task_stage_kind_type::AiTaskStageKind;
|
||||
|
||||
@@ -16,14 +11,12 @@ use super::ai_task_stage_kind_type::AiTaskStageKind;
|
||||
pub struct AiStageCompletionInput {
|
||||
pub task_id: String,
|
||||
pub stage_kind: AiTaskStageKind,
|
||||
pub text_output: Option::<String>,
|
||||
pub structured_payload_json: Option::<String>,
|
||||
pub warning_messages: Vec::<String>,
|
||||
pub text_output: Option<String>,
|
||||
pub structured_payload_json: Option<String>,
|
||||
pub warning_messages: Vec<String>,
|
||||
pub completed_at_micros: i64,
|
||||
}
|
||||
|
||||
|
||||
impl __sdk::InModule for AiStageCompletionInput {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,7 @@
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
@@ -17,8 +11,6 @@ pub struct AiTaskCancelInput {
|
||||
pub completed_at_micros: i64,
|
||||
}
|
||||
|
||||
|
||||
impl __sdk::InModule for AiTaskCancelInput {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::ai_task_kind_type::AiTaskKind;
|
||||
use super::ai_task_stage_blueprint_type::AiTaskStageBlueprint;
|
||||
@@ -20,14 +15,12 @@ pub struct AiTaskCreateInput {
|
||||
pub owner_user_id: String,
|
||||
pub request_label: String,
|
||||
pub source_module: String,
|
||||
pub source_entity_id: Option::<String>,
|
||||
pub request_payload_json: Option::<String>,
|
||||
pub stages: Vec::<AiTaskStageBlueprint>,
|
||||
pub source_entity_id: Option<String>,
|
||||
pub request_payload_json: Option<String>,
|
||||
pub stages: Vec<AiTaskStageBlueprint>,
|
||||
pub created_at_micros: i64,
|
||||
}
|
||||
|
||||
|
||||
impl __sdk::InModule for AiTaskCreateInput {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,7 @@
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
@@ -18,8 +12,6 @@ pub struct AiTaskFailureInput {
|
||||
pub completed_at_micros: i64,
|
||||
}
|
||||
|
||||
|
||||
impl __sdk::InModule for AiTaskFailureInput {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,7 @@
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
@@ -17,8 +11,6 @@ pub struct AiTaskFinishInput {
|
||||
pub completed_at_micros: i64,
|
||||
}
|
||||
|
||||
|
||||
impl __sdk::InModule for AiTaskFinishInput {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
@@ -24,12 +19,8 @@ pub enum AiTaskKind {
|
||||
QuestIntent,
|
||||
|
||||
RuntimeItemIntent,
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
impl __sdk::InModule for AiTaskKind {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
|
||||
+4
-11
@@ -2,12 +2,7 @@
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{
|
||||
self as __sdk,
|
||||
__lib,
|
||||
__sats,
|
||||
__ws,
|
||||
};
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::ai_task_snapshot_type::AiTaskSnapshot;
|
||||
use super::ai_text_chunk_snapshot_type::AiTextChunkSnapshot;
|
||||
@@ -16,13 +11,11 @@ use super::ai_text_chunk_snapshot_type::AiTextChunkSnapshot;
|
||||
#[sats(crate = __lib)]
|
||||
pub struct AiTaskProcedureResult {
|
||||
pub ok: bool,
|
||||
pub task: Option::<AiTaskSnapshot>,
|
||||
pub text_chunk: Option::<AiTextChunkSnapshot>,
|
||||
pub error_message: Option::<String>,
|
||||
pub task: Option<AiTaskSnapshot>,
|
||||
pub text_chunk: Option<AiTextChunkSnapshot>,
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
|
||||
impl __sdk::InModule for AiTaskProcedureResult {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user